本文整理汇总了PHP中core_kernel_classes_Resource::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::getUri方法的具体用法?PHP core_kernel_classes_Resource::getUri怎么用?PHP core_kernel_classes_Resource::getUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_kernel_classes_Resource
的用法示例。
在下文中一共展示了core_kernel_classes_Resource::getUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
*
* @param array callOptions an array of parameters sent to the results storage configuration
* @param mixed $resultServer
* @param string uri or resource
*/
public function __construct($resultServer, $additionalStorages = array())
{
$this->implementations = array();
if (is_object($resultServer) and get_class($resultServer) == 'core_kernel_classes_Resource') {
$this->resultServer = $resultServer;
} else {
if (common_Utils::isUri($resultServer)) {
$this->resultServer = new core_kernel_classes_Resource($resultServer);
}
}
// the static storages
if ($this->resultServer->getUri() != TAO_VOID_RESULT_SERVER) {
$resultServerModels = $this->resultServer->getPropertyValues(new core_kernel_classes_Property(TAO_RESULTSERVER_MODEL_PROP));
if (!isset($resultServerModels) or count($resultServerModels) == 0) {
throw new common_Exception("The result server is not correctly configured (Resource definition)");
}
foreach ($resultServerModels as $resultServerModelUri) {
$resultServerModel = new core_kernel_classes_Resource($resultServerModelUri);
$this->addImplementation($resultServerModel->getUniquePropertyValue(new core_kernel_classes_Property(TAO_RESULTSERVER_MODEL_IMPL_PROP))->literal);
}
}
if (!is_null($additionalStorages)) {
// the dynamic storages
foreach ($additionalStorages as $additionalStorage) {
$this->addImplementation($additionalStorage["implementation"], $additionalStorage["parameters"]);
}
}
common_Logger::i("Result Server Initialized using defintion:" . $this->resultServer->getUri());
// sets the details required depending on the type of storage
}
示例2: 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)
{
$uri = explode('#', $accessUri);
list($type, $ext, $mod, $act) = explode('_', $uri[1]);
$role = new core_kernel_classes_Class($roleUri);
$actionAccessProperty = new core_kernel_classes_Property(funcAcl_models_classes_AccessService::PROPERTY_ACL_GRANTACCESS);
$module = new core_kernel_classes_Resource($this->makeEMAUri($ext, $mod));
$controllerClassName = funcAcl_helpers_Map::getControllerFromUri($module->getUri());
// access via controller?
$controllerAccess = funcAcl_helpers_Cache::getControllerAccess($controllerClassName);
if (in_array($roleUri, $controllerAccess['module'])) {
// remove access to controller
funcAcl_models_classes_ModuleAccessService::singleton()->remove($roleUri, $module->getUri());
// add access to all other actions
foreach (funcAcl_helpers_Model::getActions($module) as $action) {
if ($action->getUri() != $accessUri) {
$this->add($roleUri, $action->getUri());
$this->getEventManager()->trigger(new AccessRightAddedEvent($roleUri, $action->getUri()));
}
}
} elseif (isset($controllerAccess['actions'][$act]) && in_array($roleUri, $controllerAccess['actions'][$act])) {
// remove action only
$role->removePropertyValues($actionAccessProperty, array('pattern' => $accessUri));
$this->getEventManager()->trigger(new AccessRightRemovedEvent($roleUri, $accessUri));
funcAcl_helpers_Cache::flushControllerAccess($controllerClassName);
}
}
示例3: testCompile
public function testCompile()
{
//test with items
$config = array('previous' => true);
$items = array($this->item->getUri());
$this->testModel->save($this->test, array('itemUris' => $items, 'config' => $config));
$waitingReport = new \common_report_Report(\common_report_Report::TYPE_SUCCESS);
$serviceCall = $this->getMockBuilder('tao_models_classes_service_ServiceCall')->disableOriginalConstructor()->setMethods(array('serializeToString'))->getMock();
$serviceCall->expects($this->once())->method('serializeToString')->willReturn('greatString');
$waitingReport->setData($serviceCall);
$testCompiler = $this->getMockBuilder('oat\\taoTestLinear\\model\\TestCompiler')->setConstructorArgs(array($this->test, $this->storage))->setMethods(array('subCompile', 'spawnPrivateDirectory'))->getMock();
$testCompiler->expects($this->once())->method('subCompile')->willReturn($waitingReport);
//will spawn a new directory and store the content file
$directoryMock = $this->getMockBuilder('tao_models_classes_service_StorageDirectory')->disableOriginalConstructor()->setMethods(array('getPath'))->getMock();
if (!file_exists(sys_get_temp_dir() . '/sample/compile/')) {
mkdir(sys_get_temp_dir() . '/sample/compile/', 0777, true);
}
$directoryMock->expects($this->once())->method('getPath')->willReturn(sys_get_temp_dir() . '/sample/compile/');
$testCompiler->expects($this->once())->method('spawnPrivateDirectory')->willReturn($directoryMock);
$report = $testCompiler->compile();
$this->assertEquals(__('Test Compilation'), $report->getMessage(), __('Compilation should work'));
$this->assertFileExists(sys_get_temp_dir() . '/sample/compile/data.json', __('Compilation file not created'));
$compile = '{"items":{"http:\\/\\/myFancyDomain.com\\/myGreatResourceUriForItem":"greatString"},"previous":true}';
$this->assertEquals($compile, file_get_contents(sys_get_temp_dir() . '/sample/compile/data.json', __('File content error')));
}
示例4: __construct
/**
* Initialise the form for the given importHandlers
*
* @param tao_models_classes_import_ImportHandler $importHandler
* @param array $availableHandlers
* @param core_kernel_classes_Resource $class
* @internal param array $importHandlers
* @internal param tao_helpers_form_Form $subForm
*/
public function __construct($importHandler, $availableHandlers, $class)
{
$this->importHandlers = $availableHandlers;
if (!is_null($importHandler)) {
$this->subForm = $importHandler->getForm();
}
parent::__construct(array('importHandler' => get_class($importHandler), 'classUri' => $class->getUri(), 'id' => $class->getUri()));
}
示例5: getWidgetDefinition
public static function getWidgetDefinition(\core_kernel_classes_Resource $widget)
{
$widgets = self::getWidgetDefinitions();
if (isset($widgets[$widget->getUri()])) {
return $widgets[$widget->getUri()];
} else {
common_Logger::w('Widget "' . $widget->getUri() . '" not found');
return null;
}
}
示例6: index
/**
* @requiresRight id WRITE
*/
public function index()
{
$resource = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
$revisions = RepositoryProxy::getRevisions($resource->getUri());
$returnRevision = array();
foreach ($revisions as $revision) {
$returnRevision[] = array('id' => $revision->getVersion(), 'modified' => \tao_helpers_Date::displayeDate($revision->getDateCreated()), 'author' => UserHelper::renderHtmlUser($revision->getAuthorId()), 'message' => _dh($revision->getMessage()));
}
$this->setData('resourceLabel', _dh($resource->getLabel()));
$this->setData('id', $resource->getUri());
$this->setData('revisions', $returnRevision);
$this->setView('History/index.tpl');
}
示例7: createSPX
/**
* Short description of method createSPX
*
* @access public
* @author firstname and lastname of author, <author@example.org>
* @param Resource $subject
* @param Property $predicate
* @return core_kernel_rules_Term
*/
public static function createSPX(core_kernel_classes_Resource $subject, core_kernel_classes_Property $predicate)
{
$returnValue = null;
$termSPXClass = new core_kernel_classes_Class(CLASS_TERM_SUJET_PREDICATE_X, __METHOD__);
$label = 'Def Term SPX Label : ' . $subject->getLabel() . ' - ' . $predicate->getLabel();
$comment = 'Def Term SPX Label : ' . $subject->getUri() . ' ' . $predicate->getUri();
$SPXResource = core_kernel_classes_ResourceFactory::create($termSPXClass, $label, $comment);
$returnValue = new core_kernel_rules_Term($SPXResource->getUri());
$subjectProperty = new core_kernel_classes_Property(PROPERTY_TERM_SPX_SUBJET, __METHOD__);
$predicateProperty = new core_kernel_classes_Property(PROPERTY_TERM_SPX_PREDICATE, __METHOD__);
$returnValue->setPropertyValue($subjectProperty, $subject->getUri());
$returnValue->setPropertyValue($predicateProperty, $predicate->getUri());
return $returnValue;
}
示例8: onResourceCreated
/**
* (non-PHPdoc)
* @see \oat\generis\model\data\PermissionInterface::onResourceCreated()
*/
public function onResourceCreated(\core_kernel_classes_Resource $resource)
{
$dbAccess = new DataBaseAccess();
// verify resource is created
$permissions = $dbAccess->getResourcePermissions($resource->getUri());
if (empty($permissions)) {
// treat resources as classes without parent classes
$class = new \core_kernel_classes_Class($resource);
foreach (array_merge($resource->getTypes(), $class->getParentClasses()) as $parent) {
foreach (AdminService::getUsersPermissions($parent->getUri()) as $userUri => $rights) {
$dbAccess->addPermissions($userUri, $resource->getUri(), $rights);
}
}
}
}
示例9: buildStatusImageURI
/**
* Short description of method buildStatusImageURI
*
* @access public
* @author Somsack Sipasseuth, <somsack.sipasseuth@tudor.lu>
* @param Resource status
* @return string
*/
public static function buildStatusImageURI(core_kernel_classes_Resource $status)
{
$returnValue = (string) '';
$baseURI = 'img/status_';
$statusName = '';
switch ($status->getUri()) {
case INSTANCE_PROCESSSTATUS_PAUSED:
$statusName = 'paused';
break;
case INSTANCE_PROCESSSTATUS_RESUMED:
$statusName = 'resumed';
break;
case INSTANCE_PROCESSSTATUS_FINISHED:
$statusName = 'finished';
break;
case INSTANCE_PROCESSSTATUS_STARTED:
$statusName = 'started';
break;
case INSTANCE_PROCESSSTATUS_CLOSED:
$statusName = 'closed';
break;
case INSTANCE_PROCESSSTATUS_STOPPED:
$statusName = 'stopped';
break;
}
$returnValue = $baseURI . $statusName . '.png';
return (string) $returnValue;
}
示例10: search
/**
* Search results
* The search is paginated and initiated by the datatable component.
*/
public function search()
{
$params = $this->getRequestParameter('params');
$query = $params['query'];
$class = new core_kernel_classes_Class($params['rootNode']);
$rows = $this->hasRequestParameter('rows') ? (int) $this->getRequestParameter('rows') : null;
$page = $this->hasRequestParameter('page') ? (int) $this->getRequestParameter('page') : 1;
$startRow = is_null($rows) ? 0 : $rows * ($page - 1);
try {
$results = SearchService::getSearchImplementation()->query($query, $class, $startRow, $rows);
$totalPages = is_null($rows) ? 1 : ceil($results->getTotalCount() / $rows);
$response = new StdClass();
if (count($results) > 0) {
foreach ($results as $uri) {
$instance = new core_kernel_classes_Resource($uri);
$instanceProperties = array('id' => $instance->getUri(), RDFS_LABEL => $instance->getLabel());
$response->data[] = $instanceProperties;
}
}
$response->success = true;
$response->page = empty($response->data) ? 0 : $page;
$response->total = $totalPages;
$response->records = count($results);
$this->returnJson($response, 200);
} catch (SyntaxException $e) {
$this->returnJson(array('success' => false, 'msg' => $e->getUserMessage()));
}
}
示例11: properties
/**
* Action dedicated to change the settings of the user (language, ...)
*/
public function properties()
{
$myFormContainer = new tao_actions_form_UserSettings($this->getUserSettings());
$myForm = $myFormContainer->getForm();
if ($myForm->isSubmited()) {
if ($myForm->isValid()) {
$currentUser = $this->userService->getCurrentUser();
$userSettings = array(PROPERTY_USER_UILG => $myForm->getValue('ui_lang'), PROPERTY_USER_DEFLG => $myForm->getValue('data_lang'), PROPERTY_USER_TIMEZONE => $myForm->getValue('timezone'));
$uiLang = new core_kernel_classes_Resource($myForm->getValue('ui_lang'));
$dataLang = new core_kernel_classes_Resource($myForm->getValue('data_lang'));
$userSettings[PROPERTY_USER_UILG] = $uiLang->getUri();
$userSettings[PROPERTY_USER_DEFLG] = $dataLang->getUri();
$binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($currentUser);
if ($binder->bind($userSettings)) {
\common_session_SessionManager::getSession()->refresh();
$uiLangCode = tao_models_classes_LanguageService::singleton()->getCode($uiLang);
$extension = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
tao_helpers_I18n::init($extension, $uiLangCode);
$this->setData('message', __('Settings updated'));
$this->setData('reload', true);
}
}
}
$userLabel = $this->userService->getCurrentUser()->getLabel();
$this->setData('formTitle', sprintf(__("My settings (%s)"), __($userLabel)));
$this->setData('myForm', $myForm->render());
//$this->setView('form.tpl');
$this->setView('form/settings_user.tpl');
}
示例12: adminPermissions
/**
* Manage permissions
*/
protected function adminPermissions()
{
$resource = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
$accessRights = AdminService::getUsersPermissions($resource->getUri());
$userList = $this->getUserList();
$roleList = $this->getRoleList();
$this->setData('privileges', PermissionProvider::getRightLabels());
$userData = array();
foreach (array_keys($accessRights) as $uri) {
if (isset($userList[$uri])) {
$userData[$uri] = array('label' => $userList[$uri], 'isRole' => false);
unset($userList[$uri]);
} elseif (isset($roleList[$uri])) {
$userData[$uri] = array('label' => $roleList[$uri], 'isRole' => true);
unset($roleList[$uri]);
} else {
\common_Logger::d('unknown user ' . $uri);
}
}
$this->setData('users', $userList);
$this->setData('roles', $roleList);
$this->setData('userPrivileges', $accessRights);
$this->setData('userData', $userData);
$this->setData('uri', $resource->getUri());
$this->setData('label', _dh($resource->getLabel()));
$this->setView('AdminAccessController/index.tpl');
}
示例13: spawn
/**
*
* @param unknown $userId
* @param core_kernel_classes_Resource $assembly
* @return taoDelivery_models_classes_execution_KVDeliveryExecution
*/
public static function spawn(common_persistence_KeyValuePersistence $persistence, $userId, core_kernel_classes_Resource $assembly)
{
$identifier = self::DELIVERY_EXECUTION_PREFIX . common_Utils::getNewUri();
$de = new self($persistence, $identifier, array(RDFS_LABEL => $assembly->getLabel(), PROPERTY_DELVIERYEXECUTION_DELIVERY => $assembly->getUri(), PROPERTY_DELVIERYEXECUTION_SUBJECT => $userId, PROPERTY_DELVIERYEXECUTION_START => time(), PROPERTY_DELVIERYEXECUTION_STATUS => INSTANCE_DELIVERYEXEC_ACTIVE));
$de->save();
return $de;
}
示例14: 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);
}
示例15: getResourceDescription
public function getResourceDescription(core_kernel_classes_Resource $resource, $fromDefinition = true)
{
$returnValue = new stdClass();
$properties = array();
if ($fromDefinition) {
$types = $resource->getTypes();
foreach ($types as $type) {
foreach ($type->getProperties(true) as $property) {
//$this->$$property->getUri() = array($property->getLabel(),$this->getPropertyValues());
$properties[$property->getUri()] = $property;
}
}
//var_dump($properties);
$properties = array_unique($properties);
$propertiesValues = $resource->getPropertiesValues($properties);
if (count($propertiesValues) == 0) {
throw new common_exception_NoContent();
}
$propertiesValuesStdClasses = $this->propertiesValuestoStdClasses($propertiesValues);
} else {
$triples = $resource->getRdfTriples();
if (count($triples) == 0) {
throw new common_exception_NoContent();
}
foreach ($triples as $triple) {
$properties[$triple->predicate][] = common_Utils::isUri($triple->object) ? new core_kernel_classes_Resource($triple->object) : new core_kernel_classes_Literal($triple->object);
}
$propertiesValuesStdClasses = $this->propertiesValuestoStdClasses($properties);
}
$returnValue->uri = $resource->getUri();
$returnValue->properties = $propertiesValuesStdClasses;
return $returnValue;
}