Beispiel #1
0
 /**
  * Sets Router
  * 
  * @return void
  */
 public static function setRouter($oRouter)
 {
     self::$oRouter = $oRouter;
 }
Beispiel #2
0
 /**
  * Set up class properties etc.
  */
 private function Setup()
 {
     // place for additional sets
     // e.g. $this->aConfig[ section_key ][ value_key ] = value
     $sAppConfigIni = DOCROOT . $this->oConfig->getValue(sprintf('applications.%s.config_file', $this->oRouter->getApplicationName()));
     $this->oConfig->loadIniFile($sAppConfigIni);
     $this->sLogsDirectory = $this->getConfig('General.Logs_directory', DOCROOT . 'logs/');
     $this->sLogsDirectory .= date('Y-m-d') . '/';
     // set main framework path
     $this->addPath('Lithium');
     // set application path received from config file
     if ($sAppPath = $this->getConfig('General.App_path')) {
         $this->addPath($sAppPath);
         Loader::addPath(DOCROOT . $sAppPath);
     }
     // add path for external classes
     Loader::addPath(DOCROOT);
     // set language
     if ($sLanguage = $this->getConfig('Locale.Language')) {
         $this->sLanguage = $sLanguage;
     }
     Core_Model::setLithium($this);
     Core_Module::setLithium($this);
     Database_Driver::setLithium($this);
     // initialize router
     $this->oRouter->init();
     View::setRouter($this->oRouter);
     Module_Sorter::setRouter($this->oRouter);
     Module_Pagination::setRouter($this->oRouter);
 }
Beispiel #3
0
 public function coursesAction()
 {
     $this->mTemplate->sSectionTitle = $this->getLang('section_title_coursesadmin');
     $aList = array();
     // setup sorter
     $oSorter = new Module_Sorter(Model_Course::SORT_NAME);
     $oSorter->addSortOption(Model_Course::SORT_PRICE, Module_Sorter::SORT_DESC);
     $oSorter->addSortOption(Model_Course::SORT_TYPE);
     $oCourse = new Model_Course();
     $oCourse->setSorter($oSorter);
     $iItemsPerPage = 30;
     $oPagination = new Module_Pagination($iItemsPerPage, $oCourse->getRowsCount());
     $oPagination->setString(array('previous' => $this->getLang('catering.prev_f'), 'next' => $this->getLang('catering.next_f'), 'label' => $this->getLang('catering.page')));
     $aCourses = $oCourse->getCoursesForAccount($this->oCurrentUser->account_id, $oPagination->getOffset(), $iItemsPerPage);
     foreach ($aCourses as $aCourse) {
         $aList[] = array(array('sLink' => '/account/course/' . $aCourse['course_id'] . '/', 'sText' => $aCourse['name']), array('sText' => $aCourse['price']), array('sText' => $aCourse['type']));
     }
     $aData = array('aColumns' => array(array('text' => $this->getLang('course_name'), 'url' => $oSorter->getSortUrl(), 'img' => $oSorter->getSortDirectionImg()), array('text' => $this->getLang('course_price'), 'url' => $oSorter->getSortUrl(1), 'img' => $oSorter->getSortDirectionImg(1)), array('text' => $this->getLang('course_type'), 'url' => $oSorter->getSortUrl(2), 'img' => $oSorter->getSortDirectionImg(2))), 'aList' => $aList, 'mPagination' => View::factory('pagination', $oPagination->getViewData()));
     $this->mTemplate->content = View::factory('account/item_list', $aData)->render();
 }