예제 #1
0
 public function indexAction()
 {
     $viewer = Engine_Api::_()->user()->getViewer();
     // Make form
     $this->view->form = $form = new Video_Form_Search();
     // Process form
     $p = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     if ($form->isValid($p)) {
         $values = $form->getValues();
     } else {
         $values = array();
     }
     $this->view->formValues = $values;
     $values['status'] = 1;
     $values['search'] = 1;
     $this->view->category = $values['category'];
     if (!empty($values['tag'])) {
         $this->view->tag = Engine_Api::_()->getItem('core_tag', $values['tag'])->text;
     }
     // check to see if request is for specific user's listings
     $user_id = $this->_getParam('user');
     if ($user_id) {
         $values['user_id'] = $user_id;
     }
 }
예제 #2
0
 public function manageAction()
 {
     $viewer = Engine_Api::_()->user()->getViewer();
     if (!$this->_helper->requireUser()->isValid()) {
         return;
     }
     $this->view->can_create = $this->_helper->requireAuth()->setAuthParams('video', null, 'create')->checkRequire();
     // Render
     $this->_helper->content->setEnabled();
     // prepare categories
     $this->view->form = $form = new Video_Form_Search();
     // Populate form
     $this->view->categories = $categories = Engine_Api::_()->video()->getCategories();
     foreach ($categories as $category) {
         $form->category->addMultiOption($category->category_id, $category->category_name);
     }
     // Process form
     $form->isValid($this->_getAllParams());
     $values = $form->getValues();
     $values['user_id'] = $viewer->getIdentity();
     $this->view->category = $values['category'];
     $this->view->paginator = $paginator = Engine_Api::_()->getApi('core', 'video')->getVideosPaginator($values);
     $items_count = (int) Engine_Api::_()->getApi('settings', 'core')->getSetting('video.page', 10);
     $this->view->paginator->setItemCountPerPage($items_count);
     $this->view->paginator->setCurrentPageNumber($this->_getParam('page', 1));
     // maximum allowed videos
     $this->view->quota = $quota = (int) Engine_Api::_()->authorization()->getPermission($viewer->level_id, 'video', 'max');
     $this->view->current_count = $paginator->getTotalItemCount();
 }