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


PHP core_kernel_classes_Resource::getLabel方法代码示例

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


在下文中一共展示了core_kernel_classes_Resource::getLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:13,代码来源:class.KVDeliveryExecution.php

示例2: 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()));
     }
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:32,代码来源:class.Search.php

示例3: create

 /**
  * Creates a new delivery
  * 
  * @param core_kernel_classes_Class $deliveryClass
  * @param core_kernel_classes_Resource $test
  * @param array $properties Array of properties of delivery
  * @return common_report_Report
  */
 public static function create(\core_kernel_classes_Class $deliveryClass, \core_kernel_classes_Resource $test, $properties = array())
 {
     \common_Logger::i('Creating delivery with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel());
     $storage = new TrackedStorage();
     $testCompilerClass = \taoTests_models_classes_TestsService::singleton()->getCompilerClass($test);
     $compiler = new $testCompilerClass($test, $storage);
     $report = $compiler->compile();
     if ($report->getType() == \common_report_Report::TYPE_SUCCESS) {
         //$tz = new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone());
         $tz = new \DateTimeZone('UTC');
         if (!empty($properties[TAO_DELIVERY_START_PROP])) {
             $dt = new \DateTime($properties[TAO_DELIVERY_START_PROP], $tz);
             $properties[TAO_DELIVERY_START_PROP] = (string) $dt->getTimestamp();
         }
         if (!empty($properties[TAO_DELIVERY_END_PROP])) {
             $dt = new \DateTime($properties[TAO_DELIVERY_END_PROP], $tz);
             $properties[TAO_DELIVERY_END_PROP] = (string) $dt->getTimestamp();
         }
         $serviceCall = $report->getData();
         $properties[PROPERTY_COMPILEDDELIVERY_DIRECTORY] = $storage->getSpawnedDirectoryIds();
         $compilationInstance = DeliveryAssemblyService::singleton()->createAssemblyFromServiceCall($deliveryClass, $serviceCall, $properties);
         $report->setData($compilationInstance);
     }
     return $report;
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-schedule,代码行数:33,代码来源:DeliveryFactory.php

示例4: wizard

 /**
  * 
  * @author Lionel Lecaque, lionel@taotesting.com
  */
 public function wizard()
 {
     $this->defaultData();
     try {
         $formContainer = new \taoSimpleDelivery_actions_form_WizardForm(array('class' => $this->getCurrentClass()));
         $myForm = $formContainer->getForm();
         if ($myForm->isValid() && $myForm->isSubmited()) {
             $label = $myForm->getValue('label');
             $test = new core_kernel_classes_Resource($myForm->getValue('test'));
             $label = __("Delivery of %s", $test->getLabel());
             $deliveryClass = new core_kernel_classes_Class($myForm->getValue('classUri'));
             $report = taoSimpleDelivery_models_classes_SimpleDeliveryService::singleton()->create($deliveryClass, $test, $label);
             if ($report->getType() == common_report_Report::TYPE_SUCCESS) {
                 $assembly = $report->getdata();
                 $this->setData("selectNode", tao_helpers_Uri::encode($assembly->getUri()));
                 $this->setData('reload', true);
                 $this->setData('message', __('Delivery created'));
                 $this->setData('formTitle', __('Create a new delivery'));
                 $this->setView('form.tpl', 'tao');
             } else {
                 $this->setData('report', $report);
                 $this->setData('title', __('Error'));
                 $this->setView('report.tpl', 'tao');
             }
         } else {
             $this->setData('myForm', $myForm->render());
             $this->setData('formTitle', __('Create a new delivery'));
             $this->setView('form.tpl', 'tao');
         }
     } catch (taoSimpleDelivery_actions_form_NoTestsException $e) {
         $this->setView('wizard_error.tpl');
     }
 }
开发者ID:nagyist,项目名称:extension-tao-deliverysimple,代码行数:37,代码来源:class.Authoring.php

示例5: 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

示例6: commitResource

 /**
  * @requiresRight id WRITE
  */
 public function commitResource()
 {
     $resource = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
     // prevent escaping on input
     $message = isset($_POST['message']) ? $_POST['message'] : '';
     $revision = $this->getRevisionService()->commit($resource->getUri(), $message);
     $this->returnJson(array('success' => true, 'id' => $revision->getVersion(), 'modified' => \tao_helpers_Date::displayeDate($revision->getDateCreated()), 'author' => UserHelper::renderHtmlUser($revision->getAuthorId()), 'message' => $revision->getMessage(), 'commitMessage' => __('%s has been committed', $resource->getLabel())));
 }
开发者ID:oat-sa,项目名称:extension-tao-revision,代码行数:11,代码来源:History.php

示例7: spawn

 /**
  *
  * @param common_persistence_KeyValuePersistence $persistence
  * @param unknown $userId
  * @param core_kernel_classes_Resource $assembly
  * @return DeliveryExecution
  */
 public static function spawn(common_persistence_KeyValuePersistence $persistence, $userId, core_kernel_classes_Resource $assembly)
 {
     $identifier = self::DELIVERY_EXECUTION_PREFIX . common_Utils::getNewUri();
     $params = array(RDFS_LABEL => $assembly->getLabel(), PROPERTY_DELVIERYEXECUTION_DELIVERY => $assembly->getUri(), PROPERTY_DELVIERYEXECUTION_SUBJECT => $userId, PROPERTY_DELVIERYEXECUTION_START => microtime(), PROPERTY_DELVIERYEXECUTION_STATUS => InterfaceDeliveryExecution::STATE_ACTIVE);
     $kvDe = new static($persistence, $identifier, $params);
     $kvDe->save();
     $de = new DeliveryExecution($kvDe);
     return $de;
 }
开发者ID:Breakthrough-Technologies,项目名称:extension-tao-delivery,代码行数:16,代码来源:class.KVDeliveryExecution.php

示例8: create

 /**
  * Creates a new simple delivery
  * 
  * @param core_kernel_classes_Class $deliveryClass
  * @param core_kernel_classes_Resource $test
  * @param string $label
  * @return common_report_Report
  */
 public function create(core_kernel_classes_Class $deliveryClass, core_kernel_classes_Resource $test, $label)
 {
     common_Logger::i('Creating ' . $label . ' with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel());
     $contentClass = new core_kernel_classes_Class(CLASS_SIMPLE_DELIVERYCONTENT);
     $content = $contentClass->createInstanceWithProperties(array(PROPERTY_DELIVERYCONTENT_TEST => $test->getUri()));
     $report = TemplateAssemblyService::singleton()->createAssemblyByContent($deliveryClass, $content, array(RDFS_LABEL => $label));
     $content->delete();
     return $report;
 }
开发者ID:nagyist,项目名称:extension-tao-deliverysimple,代码行数:17,代码来源:class.SimpleDeliveryService.php

示例9: getAuthoring

 /**
  * @deprecated
  * @see taoTests_models_classes_TestModel::getAuthoring()
  */
 public function getAuthoring(core_kernel_classes_Resource $test)
 {
     $process = $test->getUniquePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById('taoWfAdvTest');
     $widget = new Renderer($ext->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
     $widget->setData('processUri', $process->getUri());
     $widget->setData('label', __('Authoring %s', $test->getLabel()));
     return $widget->render();
 }
开发者ID:oat-sa,项目名称:extension-tao-testwfauthoring,代码行数:13,代码来源:class.WfAdvTestModel.php

示例10: buildDiagramData

 /**
  * Builds a simple Diagram of the Process
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param  Resource process
  * @return string
  */
 public static function buildDiagramData(core_kernel_classes_Resource $process)
 {
     $returnValue = (string) '';
     common_Logger::i("Building diagram for " . $process->getLabel());
     $authoringService = wfAuthoring_models_classes_ProcessService::singleton();
     $activityService = wfEngine_models_classes_ActivityService::singleton();
     $connectorService = wfEngine_models_classes_ConnectorService::singleton();
     $activityCardinalityService = wfEngine_models_classes_ActivityCardinalityService::singleton();
     $activities = $authoringService->getActivitiesByProcess($process);
     $todo = array();
     foreach ($activities as $activity) {
         if ($activityService->isInitial($activity)) {
             $todo[] = $activity;
         }
     }
     $currentLevel = 0;
     $diagram = new wfAuthoring_models_classes_ProcessDiagram();
     $done = array();
     while (!empty($todo)) {
         $nextLevel = array();
         $posOnLevel = 0;
         foreach ($todo as $item) {
             $next = array();
             if ($activityService->isActivity($item)) {
                 // add this activity
                 $diagram->addActivity($item, 54 + 200 * $posOnLevel + 10 * $currentLevel, 35 + 80 * $currentLevel);
                 $next = array_merge($next, $activityService->getNextConnectors($item));
                 common_Logger::d('Activity added ' . $item->getUri());
             } elseif ($connectorService->isConnector($item)) {
                 // add this connector
                 $diagram->addConnector($item, 100 + 200 * $posOnLevel + 10 * $currentLevel, 40 + 80 * $currentLevel);
                 $next = array_merge($next, $connectorService->getNextActivities($item));
             } else {
                 common_Logger::w('unexpected ressource in process ' . $item->getUri());
             }
             //replace cardinalities
             foreach ($next as $key => $destination) {
                 if ($activityCardinalityService->isCardinality($destination)) {
                     // not represented on diagram
                     $next[$key] = $activityCardinalityService->getDestination($destination);
                 }
             }
             //add arrows
             foreach ($next as $destination) {
                 $diagram->addArrow($item, $destination);
             }
             $posOnLevel++;
             $nextLevel = array_merge($nextLevel, $next);
         }
         $done = array_merge($done, $todo);
         $todo = array_diff($nextLevel, $done);
         $currentLevel++;
     }
     $returnValue = $diagram->toJSON();
     return (string) $returnValue;
 }
开发者ID:oat-sa,项目名称:extension-tao-wfauthoring,代码行数:64,代码来源:class.ProcessDiagramFactory.php

示例11: getStrings

 public function getStrings($values)
 {
     $strings = array();
     foreach ($values as $valueUri) {
         if (!empty($valueUri)) {
             $value = new \core_kernel_classes_Resource($valueUri);
             $strings[] = $value->getLabel();
         }
     }
     return $strings;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:11,代码来源:Label.php

示例12: adminPermissions

 /**
  * Manage permissions
  * @requiresRight id GRANT
  */
 public function adminPermissions()
 {
     $resource = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
     $accessRights = AdminService::getUsersPermissions($resource->getUri());
     $this->setData('privileges', PermissionProvider::getRightLabels());
     $users = array();
     $roles = array();
     foreach ($accessRights as $uri => $privileges) {
         $identity = new \core_kernel_classes_Resource($uri);
         if ($identity->isInstanceOf(\tao_models_classes_RoleService::singleton()->getRoleClass())) {
             $roles[$uri] = array('label' => $identity->getLabel(), 'privileges' => $privileges);
         } else {
             $users[$uri] = array('label' => $identity->getLabel(), 'privileges' => $privileges);
         }
     }
     $this->setData('users', $users);
     $this->setData('roles', $roles);
     $this->setData('isClass', $resource->isClass());
     $this->setData('uri', $resource->getUri());
     $this->setData('label', _dh($resource->getLabel()));
     $this->setView('AdminAccessController/index.tpl');
 }
开发者ID:nagyist,项目名称:extension-tao-dac-simple,代码行数:26,代码来源:AdminAccessController.php

示例13: 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');
 }
开发者ID:kendaop,项目名称:extension-tao-revision,代码行数:16,代码来源:History.php

示例14: 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

示例15: defaultData

 /**
  * overwrite the parent defaultData, adding the item label to be sent to the view
  */
 protected function defaultData()
 {
     parent::defaultData();
     if ($this->hasRequestParameter('uri')) {
         $uri = $this->getRequestParameter('uri');
         $classUri = $this->getRequestParameter('classUri');
         if (!empty($uri)) {
             $item = new core_kernel_classes_Resource(tao_helpers_Uri::decode($uri));
             $this->setData('label', $item->getLabel());
             $this->setData('authoringUrl', _url('authoring', 'Items', 'taoItems', array('uri' => $uri, 'classUri' => $classUri)));
             $this->setData('previewUrl', $this->getClassService()->getPreviewUrl($item));
         }
     }
 }
开发者ID:nagyist,项目名称:tao-extension-tao-item,代码行数:17,代码来源:class.Items.php


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