本文整理汇总了PHP中core_kernel_classes_Resource::equals方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::equals方法的具体用法?PHP core_kernel_classes_Resource::equals怎么用?PHP core_kernel_classes_Resource::equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_kernel_classes_Resource
的用法示例。
在下文中一共展示了core_kernel_classes_Resource::equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* Short description of method remove
*
* @access public
* @author Jehan Bihin, <jehan.bihin@tudor.lu>
* @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);
}
示例2: initElements
/**
* overriden
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @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'));
}
示例3: getUserExecutions
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;
}