/** * Short description of method remove * * @access public * @author Jehan Bihin, <*****@*****.**> * @param string $roleUri * @param string $accessUri * @return mixed */ public function remove($roleUri, $accessUri) { $module = new core_kernel_classes_Resource($accessUri); $role = new core_kernel_classes_Class($roleUri); $accessProperty = new core_kernel_classes_Property(funcAcl_models_classes_AccessService::PROPERTY_ACL_GRANTACCESS); // Retrieve the module ID. $uri = explode('#', $module->getUri()); list($type, $extId, $modId) = explode('_', $uri[1]); // access via extension? $extAccess = funcAcl_helpers_Cache::getExtensionAccess($extId); if (in_array($roleUri, $extAccess)) { // remove access to extension $extUri = $this->makeEMAUri($extId); funcAcl_models_classes_ExtensionAccessService::singleton()->remove($roleUri, $extUri); // add access to all other controllers foreach (funcAcl_helpers_Model::getModules($extId) as $eModule) { if (!$module->equals($eModule)) { $this->add($roleUri, $eModule->getUri()); $this->getEventManager()->trigger(new AccessRightRemovedEvent($roleUri, $eModule->getUri())); //$role->setPropertyValue($accessProperty, $eModule->getUri()); } } //funcAcl_helpers_Cache::flushExtensionAccess($extId); } // Remove the access to the module for this role. $role->removePropertyValue($accessProperty, $module->getUri()); $this->getEventManager()->trigger(new AccessRightRemovedEvent($roleUri, $accessUri)); funcAcl_helpers_Cache::cacheModule($module); // Remove the access to the actions corresponding to the module for this role. foreach (funcAcl_helpers_Model::getActions($module) as $actionResource) { funcAcl_models_classes_ActionAccessService::singleton()->remove($role->getUri(), $actionResource->getUri()); } funcAcl_helpers_Cache::cacheModule($module); }
/** * overriden * * @access public * @author Joel Bout, <*****@*****.**> * @return mixed */ public function initElements() { $testService = taoTests_models_classes_TestsService::singleton(); $testModel = new core_kernel_classes_Resource(INSTANCE_TEST_MODEL_QTI); $fileName = ''; $options = array(); if (isset($this->data['instance'])) { $test = $this->data['instance']; if ($test instanceof core_kernel_classes_Resource) { if ($testModel->equals($testService->getTestModel($test))) { $fileName = strtolower(tao_helpers_Display::textCleaner($test->getLabel())); $options[$test->getUri()] = $test->getLabel(); } } } else { if (isset($this->data['class'])) { $class = $this->data['class']; } else { $class = $itemService->getRootClass(); } if ($class instanceof core_kernel_classes_Class) { $fileName = strtolower(tao_helpers_Display::textCleaner($class->getLabel(), '*')); foreach ($class->getInstances() as $instance) { if ($testModel->equals($testService->getTestModel($instance))) { $options[$instance->getUri()] = $instance->getLabel(); } } } } $nameElt = tao_helpers_form_FormFactory::getElement('filename', 'Textbox'); $nameElt->setDescription(__('File name')); $nameElt->setValue($fileName); $nameElt->setUnit(".zip"); $nameElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty')); $this->form->addElement($nameElt); $instanceElt = tao_helpers_form_FormFactory::getElement('instances', 'Checkbox'); $instanceElt->setDescription(__('Test')); //$instanceElt->setAttribute('checkAll', true); $instanceElt->setOptions(tao_helpers_Uri::encodeArray($options, tao_helpers_Uri::ENCODE_ARRAY_KEYS)); foreach (array_keys($options) as $value) { $instanceElt->setValue($value); } $this->form->addElement($instanceElt); $this->form->createGroup('options', __('Export QTI 2.1 Test Package'), array('filename', 'instances')); }
public function getUserExecutions(core_kernel_classes_Resource $compiled, $userUri) { $activ = $this->getDeliveryExecutionsByStatus($userUri, InterfaceDeliveryExecution::STATE_ACTIVE); $finished = $this->getDeliveryExecutionsByStatus($userUri, InterfaceDeliveryExecution::STATE_FINISHIED); $returnValue = array(); foreach (array_merge($activ, $finished) as $de) { if ($compiled->equals($de->getDelivery())) { $returnValue[] = $de; } } return $returnValue; }