Beispiel #1
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();
 }