コード例 #1
0
 private function _changeState($document, $targetState, $form = null)
 {
     try {
         $this->_workflowHelper->changeState($document, $targetState);
         if ($targetState == 'published') {
             $this->_sendNotification($document, $form);
         }
     } catch (Exception $e) {
         return $this->_redirectTo('index', array('failure' => $e->getMessage()), 'documents', 'admin');
     }
     $key = 'admin_workflow_' . $targetState . '_success';
     if (!$this->view->translate()->getTranslator()->isTranslated($key)) {
         $key = 'admin_workflow_success';
     }
     $message = $this->view->translate($key, $document->getId(), $targetState);
     if ($targetState === 'removed') {
         return $this->_redirectTo('index', $message, 'documents', 'admin');
     }
     return $this->_redirectTo('index', $message, 'document', 'admin', array('id' => $document->getId()));
 }
コード例 #2
0
 /**
  * Action for showing list of modules and permissions.
  *
  * @throws Exception
  */
 public function listmoduleAction()
 {
     $id = $this->getRequest()->getParam('roleid');
     if ($id == null) {
         throw new Exception('Role ID missing');
     }
     $role = new Opus_UserRole($id);
     $roleModules = $role->listAccessModules();
     if ($role->getName() !== 'guest') {
         $guest = Opus_UserRole::fetchByName('guest');
         $guestModules = $guest->listAccessModules();
         // Role 'guest' has always access to 'default' module
         if (!in_array('default', $guestModules)) {
             $guestModules[] = 'default';
         }
         $this->view->guestModules = $guestModules;
     } else {
         // Role 'guest' has alreays access to 'default' module
         if (!in_array('default', $roleModules)) {
             $roleModules[] = 'default';
         }
     }
     $moduleDirectory = dirname($this->getFrontController()->getModuleDirectory());
     $modulesModel = new Application_Util_Modules($moduleDirectory);
     $transitions = Application_Controller_Action_Helper_Workflow::getWorkflowResources();
     $this->view->loginNames = $role->getAllAccountNames();
     $this->view->roleId = $role->getId();
     $this->view->roleName = $role->getName();
     $this->view->modules = $roleModules;
     $this->view->allModules = $modulesModel->getAll();
     $this->view->allResources = $this->getAllResources();
     $this->view->allWorkflow = $transitions;
 }
コード例 #3
0
 public function testWorkflowTranslationsForStates()
 {
     $states = Application_Controller_Action_Helper_Workflow::getAllStates();
     Zend_Registry::get('Zend_Translate')->loadModule('admin');
     $translate = Zend_Registry::get('Zend_Translate');
     foreach ($states as $state) {
         $key = 'admin_workflow_' . $state;
         $this->assertTrue($translate->isTranslated($key), 'Translation key \'' . $key . '\' is missing.');
     }
 }
コード例 #4
0
 public function loadWorkflowResources($acl)
 {
     $resources = Application_Controller_Action_Helper_Workflow::getWorkflowResources();
     $acl->addResource(new Zend_Acl_Resource('workflow'));
     foreach ($resources as $resource) {
         $acl->addResource(new Zend_Acl_Resource($resource), 'workflow');
     }
 }
コード例 #5
0
ファイル: Workflow.php プロジェクト: belapp/opus4-application
 /**
  * Returns configuration for basic workflow model.
  * @return Zend_Config_Ini
  */
 public static function getWorkflowConfig()
 {
     if (empty(Application_Controller_Action_Helper_Workflow::$_workflowConfig)) {
         Application_Controller_Action_Helper_Workflow::$_workflowConfig = new Zend_Config_Ini(APPLICATION_PATH . '/modules/admin/models/workflow.ini');
     }
     return Application_Controller_Action_Helper_Workflow::$_workflowConfig;
 }