当前位置: 首页>>代码示例>>PHP>>正文


PHP core_kernel_classes_Resource::getPropertyValues方法代码示例

本文整理汇总了PHP中core_kernel_classes_Resource::getPropertyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::getPropertyValues方法的具体用法?PHP core_kernel_classes_Resource::getPropertyValues怎么用?PHP core_kernel_classes_Resource::getPropertyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_kernel_classes_Resource的用法示例。


在下文中一共展示了core_kernel_classes_Resource::getPropertyValues方法的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
 }
开发者ID:nagyist,项目名称:extension-tao-outcome,代码行数:36,代码来源:class.ResultServer.php

示例2: testLanguagesExistence

 /**
  * Test the existence of language definition resources in the knowledge base
  * regarding what we found in the tao/locales directory.
  * 
  * @author Jerome Bogaerts, <taosupport@tudor.lu>
  */
 public function testLanguagesExistence()
 {
     // Check for lang.rdf in /tao locales and query the KB to see if it exists or not.
     $languageClass = new core_kernel_classes_Class(CLASS_LANGUAGES);
     $taoLocalesDir = ROOT_PATH . '/tao/locales';
     $expectedUriPrefix = 'http://www.tao.lu/Ontologies/TAO.rdf#Lang';
     if (false !== ($locales = scandir($taoLocalesDir))) {
         foreach ($locales as $l) {
             $localePath = $taoLocalesDir . '/' . $l;
             if ($l[0] !== '.' && is_dir($localePath) && is_readable($localePath)) {
                 $langPath = $localePath . '/lang.rdf';
                 if (file_exists($langPath)) {
                     $lgResource = new core_kernel_classes_Resource($expectedUriPrefix . $l);
                     $this->assertTrue($lgResource->exists(), '$lgResource Resource does not exist (' . $expectedUriPrefix . $l . ').');
                     // Check for this language in Ontology.
                     $kbLangs = $lgResource->getPropertyValues(new core_kernel_classes_Property(RDF_VALUE));
                     if (is_array($kbLangs)) {
                         $this->assertEquals(count($kbLangs), 1, "Number of languages retrieved for language '{$l}' is '" . count($kbLangs) . "'.");
                         // Check if the language has the correct URI.
                         if ($kbLangs[0] instanceof core_kernel_classes_Resource) {
                             $this->assertTrue($kbLangs[0]->getUri() == $expectedUriPrefix . $l, "Malformed URI scheme for language resource '{$l}'.");
                         }
                     } else {
                         $this->fail('the $kbLangs variable should be an array. "' . gettype($kbLangs) . '" found instead.');
                     }
                 }
             }
         }
     }
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:36,代码来源:LanguagesTest.php

示例3: getStrings

 /**
  * Get tokens as string[] extracted from a QTI file
  * XML inside qti.xml is parsed and all text is tokenized
  *
  * @param \core_kernel_classes_Resource $resource
  * @return array
  */
 public function getStrings(\core_kernel_classes_Resource $resource)
 {
     try {
         $ontologyFiles = $resource->getPropertyValues($this->getProperty(TAO_ITEM_CONTENT_PROPERTY));
         if (empty($ontologyFiles)) {
             return [];
         }
     } catch (\core_kernel_classes_EmptyProperty $e) {
         return [];
     }
     $file = $this->getFileReferenceSerializer()->unserializeDirectory(reset($ontologyFiles))->getFile(Service::QTI_ITEM_FILE);
     if (!$file->exists()) {
         return [];
     }
     $content = $file->read();
     if (empty($content)) {
         return [];
     }
     $dom = new \DOMDocument();
     $dom->loadXML($content);
     $xpath = new \DOMXPath($dom);
     $textNodes = $xpath->query('//text()');
     unset($xpath);
     $contentStrings = array();
     foreach ($textNodes as $textNode) {
         if (ctype_space($textNode->wholeText) === false) {
             $contentStrings[] = trim($textNode->wholeText);
         }
     }
     return $contentStrings;
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:38,代码来源:QtiItemContentTokenizer.php

示例4: getNextSteps

 /**
  * Short description of method getNextSteps
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param  Resource step
  * @return array
  */
 public function getNextSteps(core_kernel_classes_Resource $step)
 {
     $returnValue = array();
     $nextStepProp = new core_kernel_classes_Property(PROPERTY_STEP_NEXT);
     foreach ($step->getPropertyValues($nextStepProp) as $stepUri) {
         $returnValue[] = new core_kernel_classes_Resource($stepUri);
     }
     return (array) $returnValue;
 }
开发者ID:nagyist,项目名称:extension-tao-wfengine,代码行数:17,代码来源:class.StepService.php

示例5: add

 /**
  * Short description of method add
  *
  * @access public
  * @author Jehan Bihin, <jehan.bihin@tudor.lu>
  * @param  string roleUri
  * @param  string accessUri
  * @return mixed
  */
 public function add($roleUri, $accessUri)
 {
     $module = new core_kernel_classes_Resource($accessUri);
     $role = new core_kernel_classes_Resource($roleUri);
     $moduleAccessProperty = new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS);
     $values = $role->getPropertyValues($moduleAccessProperty);
     if (!in_array($module->getUri(), $values)) {
         $role->setPropertyValue($moduleAccessProperty, $module->getUri());
         funcAcl_helpers_Cache::cacheModule($module);
     } else {
         common_Logger::w('Tried to add role ' . $role->getUri() . ' again to controller ' . $accessUri);
     }
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:22,代码来源:class.ModuleAccessService.php

示例6: buildTree

 /**
  * Generates a form to define the values of a specific property for a resource
  * 
  * @param core_kernel_classes_Resource $resource
  * @param core_kernel_classes_Property $property
  * @return tao_helpers_form_GenerisTreeForm
  */
 public static function buildTree(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property)
 {
     $tree = new self($resource, $property);
     $range = $property->getRange();
     $tree->setData('rootNode', $range->getUri());
     $tree->setData('dataUrl', _url('getData', 'GenerisTree', 'tao'));
     $tree->setData('saveUrl', _url('setValues', 'GenerisTree', 'tao'));
     $values = $resource->getPropertyValues($property);
     $tree->setData('values', $values);
     $openNodeUris = tao_models_classes_GenerisTreeFactory::getNodesToOpen($values, $range);
     $tree->setData('openNodes', $openNodeUris);
     return $tree;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:20,代码来源:class.GenerisTreeForm.php

示例7: update

 /**
  * 
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     //migrate from 2.6 to 2.6.1
     if ($currentVersion == '2.6') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_1.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $currentVersion = '2.6.1';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.6.1') {
         // double check
         $index = new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAOItem.rdf#ItemContentIndex');
         $default = $index->getPropertyValues(new core_kernel_classes_Property('http://www.tao.lu/Ontologies/TAO.rdf#IndexDefaultSearch'));
         if (count($default) == 0) {
             //no default search set, import
             $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_2.rdf';
             $adapter = new tao_helpers_data_GenerisAdapterRdf();
             if ($adapter->import($file)) {
                 $currentVersion = '2.6.2';
             } else {
                 common_Logger::w('Import failed for ' . $file);
             }
         } else {
             common_Logger::w('Defautl Search already set');
             $currentVersion = '2.6.2';
         }
     }
     if ($currentVersion == '2.6.2') {
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_1.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_2.rdf');
         $currentVersion = '2.6.3';
     }
     if ($currentVersion == '2.6.3') {
         // update user roles
         $class = new core_kernel_classes_Class(CLASS_TAO_USER);
         $itemManagers = $class->searchInstances(array(PROPERTY_USER_ROLES => 'http://www.tao.lu/Ontologies/TAOItem.rdf#ItemsManagerRole'), array('recursive' => true, 'like' => false));
         foreach ($itemManagers as $user) {
             $user->setPropertyValue(new core_kernel_classes_Property(PROPERTY_USER_ROLES), ItemAuthorRole::INSTANCE_URI);
         }
         $currentVersion = '2.6.4';
     }
     return $currentVersion;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:52,代码来源:class.Updater.php

示例8: add

 /**
  * Short description of method add
  *
  * @access public
  * @author Jehan Bihin, <jehan.bihin@tudor.lu>
  * @param  string roleUri
  * @param  string accessUri
  * @return mixed
  */
 public function add($roleUri, $accessUri)
 {
     $uri = explode('#', $accessUri);
     list($type, $ext, $mod, $act) = explode('_', $uri[1]);
     $role = new core_kernel_classes_Resource($roleUri);
     $module = new core_kernel_classes_Resource($this->makeEMAUri($ext, $mod));
     $actionAccessProperty = new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS);
     $moduleAccessProperty = new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS);
     $values = $role->getPropertyValues($actionAccessProperty);
     if (!in_array($accessUri, $values)) {
         $role->setPropertyValue($actionAccessProperty, $accessUri);
         $controllerClassName = funcAcl_helpers_Map::getControllerFromUri($module->getUri());
         funcAcl_helpers_Cache::flushControllerAccess($controllerClassName);
     } else {
         common_Logger::w('Tried to regrant access for role ' . $role->getUri() . ' to action ' . $accessUri);
     }
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:26,代码来源:class.ActionAccessService.php

示例9: getToolService

 public static function getToolService(core_kernel_classes_Resource $tool)
 {
     $services = $tool->getPropertyValues(new core_kernel_classes_Property(PROPERTY_LTITOOL_SERVICE));
     if (count($services) > 0) {
         if (count($services) > 1) {
             throw new common_exception_Error('Conflicting services for tool ' . $tool->getLabel());
         }
         $serviceName = (string) current($services);
         if (class_exists($serviceName) && is_subclass_of($serviceName, __CLASS__)) {
             return call_user_func(array($serviceName, 'singleton'));
         } else {
             throw new common_exception_Error('Tool service ' . $serviceName . ' not found, or not compatible for tool ' . $tool->getLabel());
         }
     } else {
         common_Logger::w('No implementation for ' . $tool->getLabel());
     }
 }
开发者ID:nagyist,项目名称:extension-tao-lti,代码行数:17,代码来源:class.LtiTool.php

示例10: getDeliveryTestTakers

 /**
  * Get test takers assigned to the delivery.
  * @param \core_kernel_classes_Resource $delivery
  * @return array list of assigned and excluded test takers.
  * Example:
  * <pre>
  * array(
  *   'ttassigned' => array(
  *     array(
  *       'uri' => 'http://sample/first.rdf#i14298035456775118',
  *       'label' => 'test taker 1',
  *       'firstname' => 'test',    
  *       'lastname' => 'taker'    
  *     ),
  *     ...   
  *   )
  *   'ttexcluded' => array(
  *     array(
  *       'uri' => 'http://sample/first.rdf#i14303206619279661',
  *       'label' => 'test taker 2',
  *       'firstname' => 'test',    
  *       'lastname' => 'taker'    
  *     ),
  *     ...   
  *   )
  * )
  * </pre>
  */
 public function getDeliveryTestTakers(\core_kernel_classes_Resource $delivery)
 {
     $result = array('ttexcluded' => array(), 'ttassigned' => array());
     // excluded test takers
     $excludedSubjProperty = new \core_kernel_classes_Property(TAO_DELIVERY_EXCLUDEDSUBJECTS_PROP);
     $excluded = $delivery->getPropertyValues($excludedSubjProperty);
     foreach ($excluded as $testTaker) {
         $result['ttexcluded'][] = $this->getTestTakerData(new \core_kernel_classes_Resource($testTaker));
     }
     // assigned test takers
     $users = ServiceManager::getServiceManager()->get(AssignmentService::CONFIG_ID)->getAssignedUsers($delivery->getUri());
     $assigned = array_values(array_diff(array_unique($users), $excluded));
     foreach ($assigned as $testTaker) {
         $result['ttassigned'][] = $this->getTestTakerData(new \core_kernel_classes_Resource($testTaker));
     }
     return $result;
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-schedule,代码行数:45,代码来源:DeliveryTestTakersService.php

示例11: testSetStatement

 public function testSetStatement()
 {
     $true = new core_kernel_classes_Resource(GENERIS_TRUE, __METHOD__);
     $predicate = RDFS_SEEALSO;
     $property = new core_kernel_classes_Property($predicate, __METHOD__);
     $this->assertTrue($this->object->setStatement($true->getUri(), $predicate, 'test', DEFAULT_LANG), "setStatement should be able to set a value.");
     $values = $true->getPropertyValues($property);
     $this->assertTrue(count($values) > 0);
     $tripleFound = false;
     foreach ($values as $value) {
         if (!common_Utils::isUri($value) && $value == 'test') {
             $tripleFound = true;
             break;
         }
     }
     $this->assertTrue($tripleFound, "A property value for property " . $property->getUri() . " should be found for resource " . $true->getUri());
     $this->object->removeStatement($true->getUri(), $predicate, 'test', DEFAULT_LANG);
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:18,代码来源:ApiModelTest.php

示例12: cloneInstance

 /**
  * Short description of method cloneInstance
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param
  *            Resource instance
  * @param
  *            Class clazz
  * @return core_kernel_classes_Resource
  */
 public function cloneInstance(core_kernel_classes_Resource $instance, core_kernel_classes_Class $clazz = null)
 {
     $returnValue = null;
     // call the parent create instance to prevent useless process test to be created:
     $label = $instance->getLabel();
     $cloneLabel = "{$label} bis";
     $clone = parent::createInstance($clazz, $cloneLabel);
     if (!is_null($clone)) {
         $noCloningProperties = array(TEST_TESTCONTENT_PROP, RDF_TYPE);
         foreach ($clazz->getProperties(true) as $property) {
             if (!in_array($property->getUri(), $noCloningProperties)) {
                 // allow clone of every property value but the deliverycontent, which is a process:
                 foreach ($instance->getPropertyValues($property) as $propertyValue) {
                     $clone->setPropertyValue($property, $propertyValue);
                 }
             }
         }
         // Fix label
         if (preg_match("/bis/", $label)) {
             $cloneNumber = (int) preg_replace("/^(.?)*bis/", "", $label);
             $cloneNumber++;
             $cloneLabel = preg_replace("/bis(.?)*\$/", "", $label) . "bis {$cloneNumber}";
         }
         $clone->setLabel($cloneLabel);
         // clone the process:
         $propInstanceContent = new core_kernel_classes_Property(TEST_TESTCONTENT_PROP);
         try {
             $process = $instance->getUniquePropertyValue($propInstanceContent);
         } catch (Exception $e) {
         }
         if (!is_null($process)) {
             $processCloner = new wfAuthoring_models_classes_ProcessCloner();
             $processClone = $processCloner->cloneProcess($process);
             $clone->editPropertyValues($propInstanceContent, $processClone->getUri());
         } else {
             throw new Exception("the test process cannot be found");
         }
         $this->onChangeTestLabel($clone);
         $returnValue = $clone;
     }
     return $returnValue;
 }
开发者ID:nagyist,项目名称:extension-tao-testwf,代码行数:53,代码来源:class.WfTestService.php

示例13: exportCompiledDelivery

 /**
  * export a compiled delivery into an archive
  * 
  * @param core_kernel_classes_Resource $compiledDelivery
  * @throws Exception
  * @return string
  */
 public static function exportCompiledDelivery(core_kernel_classes_Resource $compiledDelivery)
 {
     $fileName = tao_helpers_Display::textCleaner($compiledDelivery->getLabel()) . '.zip';
     $path = tao_helpers_File::concat(array(tao_helpers_Export::getExportPath(), $fileName));
     if (!tao_helpers_File::securityCheck($path, true)) {
         throw new Exception('Unauthorized file name');
     }
     $zipArchive = new ZipArchive();
     if ($zipArchive->open($path, ZipArchive::CREATE) !== true) {
         throw new Exception('Unable to create archive at ' . $path);
     }
     $taoDeliveryVersion = common_ext_ExtensionsManager::singleton()->getInstalledVersion('taoDelivery');
     $data = array('dir' => array(), 'label' => $compiledDelivery->getLabel(), 'version' => $taoDeliveryVersion);
     $directories = $compiledDelivery->getPropertyValues(new core_kernel_classes_Property(PROPERTY_COMPILEDDELIVERY_DIRECTORY));
     foreach ($directories as $id) {
         $directory = tao_models_classes_service_FileStorage::singleton()->getDirectoryById($id);
         tao_helpers_File::addFilesToZip($zipArchive, $directory->getPath(), $directory->getRelativePath());
         $data['dir'][$id] = $directory->getRelativePath();
     }
     $runtime = $compiledDelivery->getUniquePropertyValue(new core_kernel_classes_Property(PROPERTY_COMPILEDDELIVERY_RUNTIME));
     $serviceCall = tao_models_classes_service_ServiceCall::fromResource($runtime);
     $data['runtime'] = base64_encode($serviceCall->serializeToString());
     $rdfExporter = new tao_models_classes_export_RdfExporter();
     $rdfdata = $rdfExporter->getRdfString(array($compiledDelivery));
     if (!$zipArchive->addFromString('delivery.rdf', $rdfdata)) {
         throw common_Exception('Unable to add metadata to exported delivery assembly');
     }
     $data['meta'] = 'delivery.rdf';
     $content = json_encode($data);
     //'<?php return '.common_Utils::toPHPVariableString($data).";";
     if (!$zipArchive->addFromString(self::MANIFEST_FILE, $content)) {
         $zipArchive->close();
         unlink($path);
         throw common_Exception('Unable to add manifest to exported delivery assembly');
     }
     $zipArchive->close();
     return $path;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:45,代码来源:class.Assembler.php

示例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)
 {
     $uri = explode('#', $accessUri);
     list($type, $extId) = explode('_', $uri[1]);
     // Remove the access to the extension for this role.
     $extManager = common_ext_ExtensionsManager::singleton();
     $extension = $extManager->getExtensionById($extId);
     $role = new core_kernel_classes_Resource($roleUri);
     $role->removePropertyValues(new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS), array('pattern' => $accessUri));
     funcAcl_helpers_Cache::flushExtensionAccess($extId);
     // also remove access to all the controllers
     $moduleAccessProperty = new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS);
     $moduleAccessService = funcAcl_models_classes_ModuleAccessService::singleton();
     $grantedModules = $role->getPropertyValues($moduleAccessProperty);
     foreach ($grantedModules as $gM) {
         $gM = new core_kernel_classes_Resource($gM);
         $uri = explode('#', $gM->getUri());
         list($type, $ext) = explode('_', $uri[1]);
         if ($extId == $ext) {
             $moduleAccessService->remove($role->getUri(), $gM->getUri());
         }
     }
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:32,代码来源:class.ExtensionAccessService.php

示例15: getRelatedCampaigns

 /**
  * Short description of method getRelatedCampaigns
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param  Resource delivery
  * @return array
  */
 public function getRelatedCampaigns(core_kernel_classes_Resource $delivery)
 {
     $returnValue = array();
     $campaigns = $delivery->getPropertyValues(new core_kernel_classes_Property(TAO_DELIVERY_CAMPAIGN_PROP));
     if (count($campaigns) > 0) {
         $campaignSubClasses = array();
         foreach ($this->getRootClass()->getSubClasses(true) as $campaignSubClass) {
             $campaignSubClasses[] = $campaignSubClass->getUri();
         }
         foreach ($campaigns as $campaignUri) {
             $clazz = $this->getClass(new core_kernel_classes_Resource($campaignUri));
             if (!is_null($clazz)) {
                 if (in_array($clazz->getUri(), $campaignSubClasses)) {
                     $returnValue[] = $clazz->getUri();
                 }
             }
             $returnValue[] = $campaignUri;
         }
     }
     return (array) $returnValue;
 }
开发者ID:nagyist,项目名称:extension-tao-campaign,代码行数:29,代码来源:class.CampaignService.php


注:本文中的core_kernel_classes_Resource::getPropertyValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。