File indexing completed on 2024-05-05 05:59:21

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 class Statistics_Bootstrap extends Zend_Application_Module_Bootstrap
0023 {
0024 
0025     protected function _initAutoloader()
0026     {
0027         $autoloader = new Zend_Application_Module_Autoloader(array(
0028             'namespace' => 'Statistics',
0029             'basePath' => realpath(dirname(__FILE__)),
0030         ));
0031         $autoloader->addResourceType('Ranking', 'library/statistics/ranking', 'Ranking');
0032         return $autoloader;
0033     }
0034 
0035     protected function _initRouter()
0036     {
0037         $frontController = Zend_Controller_Front::getInstance();
0038         /** @var $router Zend_Controller_Router_Rewrite */
0039         $router = $frontController->getRouter();
0040 
0041 //        $dir = $router->getFrontController()->getControllerDirectory();
0042 
0043         $router->addRoute(
0044             'statistics_daily_ajax',
0045             new Zend_Controller_Router_Route(
0046                 '/statistics/daily/ajax/:project_id/:year/:month/:day/',
0047                 array(
0048                     'module' => 'statistics',
0049                     'controller' => 'daily',
0050                     'action' => 'ajax',
0051                     'project_id' => null,
0052                     'year' => null,
0053                     'month' => null,
0054                     'day' => null
0055                 )
0056             )
0057         );
0058 
0059         $router->addRoute(
0060             'statistics_monthly_ajax',
0061             new Zend_Controller_Router_Route(
0062                 '/statistics/monthly/ajax/:project_id/:year/:month/',
0063                 array(
0064                     'module' => 'statistics',
0065                     'controller' => 'monthly',
0066                     'action' => 'ajax',
0067                     'project_id' => null,
0068                     'year' => null,
0069                     'month' => null
0070                 )
0071             )
0072         );
0073 
0074         $router->addRoute(
0075             'statistics_weekly_ajax',
0076             new Zend_Controller_Router_Route(
0077                 '/statistics/weekly/ajax/:project_id/:yearweek/',
0078                 array(
0079                     'module' => 'statistics',
0080                     'controller' => 'weekly',
0081                     'action' => 'ajax',
0082                     'project_id' => null,
0083                     'yearweek' => null
0084                 )
0085             )
0086         );
0087 
0088         return $router;
0089     }
0090 
0091     protected function _initIncludePath () {
0092         set_include_path(implode(PATH_SEPARATOR, array(
0093             dirname(__FILE__) . '/library',
0094             get_include_path(),
0095         )));
0096     }
0097 
0098 }
0099