/**
  * Admin, moderate blocks (action)
  */
 public function adminAction()
 {
     // pre-action
     $this->_getHomeParams();
     // pre-data
     $page = $this->_getParam('page');
     $order = $this->_getParam('order');
     $type = $this->_getParam('type') == 'desc' ? 'DESC' : 'ASC';
     $blocks = $this->_getModel()->findAllForAdminByHomeId($this->getHomeId());
     // order
     switch ($order) {
         case "arrival":
             $blocks->orderBy('hm_date_arrival_id ' . $type);
             break;
         case "departure":
             $blocks->orderBy('hm_date_departure_id ' . $type);
             break;
         case "created":
             $blocks->orderBy('created_at ' . $type);
             break;
     }
     // pagination
     $blocks = new ZendX_Doctrine_Paginator($blocks);
     $blocks->setItemCountPerPage(20)->setPageRange(11)->setCurrentPageNumber($page);
     // view
     $this->view->blocks = $blocks;
     $this->view->layout()->setLayout('submenu');
 }
 public function adminAction()
 {
     $page = $this->_getParam('page');
     $order = $this->_getParam('order');
     $q = $this->_getModel()->findAllForAdmin();
     $type = $this->_getParam('type') == 'asc' ? 'asc' : 'desc';
     if ($order) {
         switch ($order) {
             case 'id':
                 $q->orderBy('u.id ' . $type);
                 break;
             case 'name':
                 $q->orderBy('u.surname ' . $type . ', u.initials ' . $type . ', u.insertion ' . $type);
                 break;
             case 'email':
                 $q->orderBy('u.email ' . $type);
                 break;
             case 'registration':
                 $q->orderBy('u.created_at ' . $type);
                 break;
             case 'username':
                 $q->orderBy('u.username ' . $type);
                 break;
         }
     }
     $users = new ZendX_Doctrine_Paginator($q);
     $users->setItemCountPerPage(20)->setPageRange(11)->setCurrentPageNumber($page);
     $this->_helper->layout()->setLayout('submenu');
     $this->view->users = $users;
 }
 public function adminAction()
 {
     $type = $this->_getParam('type') == 'asc' ? 'asc' : 'desc';
     $order = $this->_getParam('order');
     $page = $this->_getParam('page');
     $q = $this->_getModel()->findAllForAdmin();
     if ($order) {
         switch ($order) {
             case 'name':
                 $q->orderBy('c.name ' . $type);
                 break;
             case 'code':
                 $q->orderBy('c.numcode ' . $type);
                 break;
             case 'iso2':
                 $q->orderBy('c.iso2 ' . $type);
                 break;
             case 'iso3':
                 $q->orderBy('c.iso3 ' . $type);
                 break;
         }
     }
     $countries = new ZendX_Doctrine_Paginator($q);
     $countries->setItemCountPerPage(20)->setPageRange(11)->setCurrentPageNumber($page);
     $this->_helper->layout()->setLayout('submenu');
     $this->view->countries = $countries;
 }
 public function adminAction()
 {
     $holidayHomes = $this->_getModel()->findAllForCalendar();
     // data
     $page = $this->_getParam('page');
     $order = $this->_getParam('order');
     $type = $this->_getParam('type') == 'asc' ? 'asc' : 'desc';
     // ordering
     switch ($order) {
         case "name":
             $holidayHomes->orderBy('name ' . $type);
             break;
     }
     // Homes & Pagination
     $paginator = new ZendX_Doctrine_Paginator($holidayHomes);
     $paginator->setItemCountPerPage(20)->setPageRange(11)->setCurrentPageNumber($page);
     // view
     $this->view->holidayHomes = $paginator;
     $this->view->layout()->setLayout('submenu');
 }
 public function financialAction()
 {
     $page = $this->_getParam('page');
     $sort = $this->_getParam('order');
     $type = $this->_getParam('type') == 'asc' ? 'asc' : 'desc';
     $holidayHomes = Model_Hm_Home::adminIndex();
     $this->_helper->layout()->setLayout('submenu');
     if ($sort) {
         switch ($sort) {
             case 'name':
                 $holidayHomes->orderBy('hm.name ' . $type);
                 break;
             case 'price':
                 $holidayHomes->orderBy('hm.price ' . $type);
                 break;
         }
     }
     $holidayHomes = new ZendX_Doctrine_Paginator($holidayHomes);
     $holidayHomes->setItemCountPerPage(20)->setPageRange(11)->setCurrentPageNumber($page);
     $this->view->holidayHomes = $holidayHomes;
 }