/**
  * IndexAction for Permissions
  *
  * @return void
  */
 function indexAction()
 {
     //check if the user select a production
     $this->production = new Zend_Session_Namespace('production');
     if ($this->production->id == null) {
         return $this->_helper->_redirector->gotoSimple('index', 'production', 'production');
     }
     //get the page of the table
     $page = $this->_getParam('page', 1);
     //get the dates for the table
     $model = new Production_Model_Permissionproduction();
     $data = $model->fetchUserPermissionproductions();
     //paginator
     if ($data) {
         $paginator = Zend_Paginator::factory($data);
         $production = Zend_Registry::get('production');
         $paginator->setItemCountPerPage($production->paginator);
         $paginator->setCurrentPageNumber($page);
         $paginator->setPageRange($production->paginator);
         $this->view->paginator = $paginator;
     } else {
         $this->view->paginator = null;
     }
     //send information to the view
     $this->view->title = "Permissionproductions list";
 }
예제 #2
0
 function consultAction()
 {
     //get the page of the table
     $this->production = new Zend_Session_Namespace('production');
     if ($this->production->id == null) {
         return $this->_helper->_redirector->gotoSimple('index', 'production', 'production');
     }
     $page = $this->_getParam('page', 1);
     //get the dates for the table
     $model = new Production_Model_Production();
     $data = $model->fetchEntryProduction();
     $this->production->client_company = $data["client_companies_id"];
     $this->production->own_company = $data["companies_id"];
     $this->production->own_company_name = $data["own_company_name"];
     $this->production->client_company_name = $data["client_company_name"];
     $this->view->production = $data;
     //send information to the view
     $this->view->title = "Production Consult";
     //get the dates for the table Activity
     $model = new Production_Model_Activity();
     //        Zend_Debug::dump($_SESSION);
     //               die();
     //TODO cambiar hardcode por roles que pueden verse
     if ($_SESSION['gpms']['role'] == "Encargado Actividad" or $_SESSION['gpms']['role'] == "public") {
         $data_activities = $model->fetchOwnActivities();
     } else {
         $data_activities = $model->fetchActivities();
     }
     if ($data_activities) {
         $paginator = Zend_Paginator::factory($data_activities);
         $production = Zend_Registry::get('production');
         $paginator->setItemCountPerPage($production->paginator);
         $paginator->setCurrentPageNumber($page);
         $paginator->setPageRange($production->paginator);
         $this->view->paginator = $paginator;
     } else {
         $this->view->paginator = null;
     }
     //get the dates for permission
     $page = $this->_getParam('page', 1);
     //get the dates for the table
     $model_permission = new Production_Model_Permissionproduction();
     $data_permission = $model_permission->fetchUserPermissionproductions();
     //paginator
     if ($data) {
         $paginator2 = Zend_Paginator::factory($data_permission);
         $production = Zend_Registry::get('production');
         $paginator2->setItemCountPerPage($production->paginator);
         $paginator2->setCurrentPageNumber($page);
         $paginator2->setPageRange($production->paginator);
         $this->view->paginator2 = $paginator2;
     } else {
         $this->view->paginator = null;
     }
     //send information to the view
 }