Пример #1
0
 public function init()
 {
     $identity = Zend_Auth::getInstance()->getIdentity();
     $this->_helper->layout()->setLayout('layout_wep');
     $this->view->blockManager()->enable('partial/dashboard.phtml');
     if ($identity->role === 'superadmin') {
         $this->view->blockManager()->enable('partial/superadmin-menu.phtml');
     } else {
         $this->view->blockManager()->enable('partial/primarymenu.phtml');
         $this->view->blockManager()->enable('partial/add-activity-menu.phtml');
         $this->view->blockManager()->enable('partial/download-my-data.phtml');
         $this->view->blockManager()->enable('partial/usermgmtmenu.phtml');
         $this->view->blockManager()->enable('partial/published-list.phtml');
         $this->view->blockManager()->enable('partial/uploaded-docs.phtml');
         if (!Simplified_Model_Simplified::isSimplified()) {
             $this->view->blockManager()->enable('partial/organisation-data.phtml');
         } else {
             $this->view->blockManager()->enable('partial/simplified-info.phtml');
         }
     }
 }
Пример #2
0
 public function init()
 {
     $identity = Zend_Auth::getInstance()->getIdentity();
     $activityId = $this->_getParam('activity_id');
     // Check activity access
     if ($activityId) {
         $model = new Model_ActivityCollection();
         $access = $model->getActivityAccess($activityId, $identity->account_id);
         if (!$access) {
             $this->_helper->FlashMessenger->addMessage(array('error' => "Access denied."));
             $this->_redirect("/wep/dashboard");
         }
     }
     $this->_helper->layout()->setLayout('layout_wep');
     $this->view->blockManager()->enable('partial/dashboard.phtml');
     $this->view->blockManager()->enable('partial/primarymenu.phtml');
     $this->view->blockManager()->enable('partial/add-activity-menu.phtml');
     $this->view->blockManager()->enable('partial/published-list.phtml');
     $this->view->blockManager()->enable('partial/organisation-data.phtml');
     $this->view->blockManager()->enable('partial/download-my-data.phtml');
     // for role user check if the user has permission to add, publish ,if not disable menu.
     if ($identity->role == 'user') {
         $model = new Model_Wep();
         $userPermission = $model->getUserPermission($identity->user_id);
         $permission = $userPermission->hasPermission(Iati_WEP_PermissionConts::ADD_ACTIVITY);
         $publishPermission = $userPermission->hasPermission(Iati_WEP_PermissionConts::PUBLISH);
         if (!$permission) {
             $this->view->blockManager()->disable('partial/add-activity-menu.phtml');
         }
         if (!$publishPermission) {
             $this->view->blockManager()->disable('partial/published-list.phtml');
         }
     }
     $this->view->blockManager()->enable('partial/usermgmtmenu.phtml');
     if (!Simplified_Model_Simplified::isSimplified()) {
         $this->view->blockManager()->enable('partial/uploaded-docs.phtml');
     }
 }
Пример #3
0
 public function listPublishedFilesAction()
 {
     $identity = Zend_Auth::getInstance()->getIdentity();
     $orgId = $identity->account_id;
     // set publish permission to true so that we should only check permission for user.
     $publishPermission = 1;
     if ($identity->role == 'user') {
         $model = new Model_Wep();
         $userPermission = $model->getUserPermission($identity->user_id);
         $publishPermission = $userPermission->hasPermission(Iati_WEP_PermissionConts::PUBLISH);
     }
     $modelRegistryInfo = new Model_RegistryInfo();
     $registryInfo = $modelRegistryInfo->getOrgRegistryInfo($orgId);
     // Create Registry Form For Activities
     $formForActivities = new Form_Wep_PublishToRegistry();
     $formForActivities->setAction($this->view->baseUrl() . '/wep/publish-in-registry');
     if ($registryInfo->update_registry) {
         $formForActivities->push_to_registry->setAttrib('disabled', 'disabled');
     }
     $this->view->formForActivities = $formForActivities;
     // Create Registry Form For Organisation
     $formForOrganisation = new Form_Organisation_PublishToRegistry();
     $formForOrganisation->setAction($this->view->baseUrl() . '/organisation/publish-in-registry');
     if ($registryInfo->update_registry) {
         $formForOrganisation->push_to_registry_for_organisation->setAttrib('disabled', 'disabled');
     }
     $this->view->formForOrganisation = $formForOrganisation;
     // Fetch Publish Data For Activities
     $db = new Model_Published();
     $publishedFilesOfActivities = $db->getAllPublishedInfo($orgId);
     $this->view->published_files_activities = $publishedFilesOfActivities;
     // Fetch Publish Data For Organisation
     $organisationpublishedModel = new Model_OrganisationPublished();
     $publishedFilesOfOrganisation = $organisationpublishedModel->getAllPublishedInfo($orgId);
     $this->view->published_files_organisation = $publishedFilesOfOrganisation;
     $this->view->publish_permission = $publishPermission;
     if (Simplified_Model_Simplified::isSimplified()) {
         $this->view->blockManager()->disable('partial/organisation-data.phtml');
         $this->view->blockManager()->enable('partial/simplified-info.phtml');
     }
 }