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


PHP core_kernel_classes_Class::getLabel方法代码示例

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


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

示例1: getDirectory

 /**
  * (non-PHPdoc)
  *
  * @see \oat\tao\model\media\MediaBrowser::getDirectory
  */
 public function getDirectory($parentLink = '', $acceptableMime = array(), $depth = 1)
 {
     if ($parentLink == '') {
         $class = new \core_kernel_classes_Class($this->rootClassUri);
     } else {
         $class = new \core_kernel_classes_Class(\tao_helpers_Uri::decode($parentLink));
     }
     $data = array('path' => 'taomedia://mediamanager/' . \tao_helpers_Uri::encode($class->getUri()), 'label' => $class->getLabel());
     if ($depth > 0) {
         $children = array();
         foreach ($class->getSubClasses() as $subclass) {
             $children[] = $this->getDirectory($subclass->getUri(), $acceptableMime, $depth - 1);
         }
         // add a filter for example on language (not for now)
         $filter = array();
         foreach ($class->searchInstances($filter) as $instance) {
             try {
                 $file = $this->getFileInfo($instance->getUri());
                 if (count($acceptableMime) == 0 || in_array($file['mime'], $acceptableMime)) {
                     $children[] = $file;
                 }
             } catch (\tao_models_classes_FileNotFoundException $e) {
                 \common_Logger::e($e->getMessage());
             }
         }
         $data['children'] = $children;
     } else {
         $data['parent'] = $parentLink;
     }
     return $data;
 }
开发者ID:oat-sa,项目名称:extension-tao-mediamanager,代码行数:36,代码来源:MediaSource.php

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

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

示例4: 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 static function create(core_kernel_classes_Class $deliveryClass, core_kernel_classes_Resource $test, $label)
 {
     common_Logger::i('Creating ' . $label . ' with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel());
     $storage = new taoDelivery_models_classes_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) {
         $serviceCall = $report->getData();
         $properties = array(RDFS_LABEL => $label, PROPERTY_COMPILEDDELIVERY_DIRECTORY => $storage->getSpawnedDirectoryIds());
         $compilationInstance = taoDelivery_models_classes_DeliveryAssemblyService::singleton()->createAssemblyFromServiceCall($deliveryClass, $serviceCall, $properties);
         $report->setData($compilationInstance);
     }
     return $report;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:23,代码来源:class.SimpleDeliveryFactory.php

示例5: rangeToTree

 /**
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @param  core_kernel_classes_Class $range
  * @param  boolean $recursive
  * @return array
  */
 public function rangeToTree(core_kernel_classes_Class $range, $recursive = false)
 {
     $data = array();
     foreach ($range->getSubClasses(false) as $rangeClass) {
         $classData = array('data' => $rangeClass->getLabel(), 'attributes' => array('id' => tao_helpers_Uri::encode($rangeClass->getUri()), 'class' => 'node-instance'));
         $children = $this->rangeToTree($rangeClass, true);
         if (count($children) > 0) {
             $classData['state'] = 'closed';
             $classData['children'] = $children;
         }
         $data[] = $classData;
     }
     if (!$recursive) {
         $returnValue = array('data' => $range->getLabel(), 'attributes' => array('id' => tao_helpers_Uri::encode($range->getUri()), 'class' => 'node-class'), 'children' => $data);
     } else {
         $returnValue = $data;
     }
     return $returnValue;
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:25,代码来源:class.Treeview.php

示例6: __invoke

 /**
  * (non-PHPdoc)
  * @see \oat\oatbox\action\Action::__invoke()
  */
 public function __invoke($params)
 {
     \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
     if (count($params) != 2) {
         return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Usage: %s DELIVERY_CLASS_URI OUTPUT_DIRECTORY', __CLASS__));
     }
     $deliveryClassUri = array_shift($params);
     $deliveryClass = new \core_kernel_classes_Class($deliveryClassUri);
     $dir = array_shift($params);
     if (!file_exists($dir) && !mkdir($dir)) {
         return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Directory %s doesn\'t exist', $dir));
     }
     $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     $report = new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Exporting %s', $deliveryClass->getLabel()));
     foreach ($deliveryClass->getInstances(true) as $delivery) {
         $destFile = $dir . \tao_helpers_File::getSafeFileName($delivery->getLabel()) . '.zip';
         $tmpFile = Assembler::exportCompiledDelivery($delivery);
         \tao_helpers_File::move($tmpFile, $destFile);
         $report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Exported %1$s to %2$s', $delivery->getLabel(), $destFile)));
     }
     return $report;
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-rdf,代码行数:26,代码来源:ExportAssemblyClass.php

示例7: indexTypes

 /**
  * @param Document $document
  */
 protected function indexTypes(Document $document)
 {
     $toDo = array();
     foreach ($this->resource->getTypes() as $class) {
         $toDo[] = $class->getUri();
         $document->addField(Document\Field::Text('class', $class->getLabel()));
     }
     $done = array(RDFS_CLASS, TAO_OBJECT_CLASS);
     $toDo = array_diff($toDo, $done);
     $classLabels = array();
     while (!empty($toDo)) {
         $class = new \core_kernel_classes_Class(array_pop($toDo));
         $classLabels[] = $class->getLabel();
         foreach ($class->getParentClasses() as $parent) {
             if (!in_array($parent->getUri(), $done)) {
                 $toDo[] = $parent->getUri();
             }
         }
         $done[] = $class->getUri();
     }
     $field = Document\Field::Keyword('class_r', $classLabels);
     $field->isStored = false;
     $document->addField($field);
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:27,代码来源:ZendIndexer.php

示例8: buildClassNode

 /**
  * generis tree representation of a class node
  * without it's content
  * 
  * @param core_kernel_classes_Class $class
  * @return array
  */
 public function buildClassNode(core_kernel_classes_Class $class, core_kernel_classes_Class $parent = null)
 {
     $label = $class->getLabel();
     $label = empty($label) ? __('no label') : $label;
     return array('data' => _dh($label), 'type' => 'class', '_data' => array('uri' => $class->getUri(), 'classUri' => is_null($parent) ? null : $parent->getUri()), 'attributes' => array('id' => tao_helpers_Uri::encode($class->getUri()), 'class' => 'node-class', 'data-uri' => $class->getUri()));
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:13,代码来源:class.GenerisTreeFactory.php

示例9: importProperties

 /**
  * Import the properties of the resource
  * 
  * @param core_kernel_classes_Resource $resource
  * @param array $propertiesValues
  * @param array $map
  * @param core_kernel_classes_Class $class
  * @return common_report_Report
  */
 private function importProperties(core_kernel_classes_Resource $resource, $propertiesValues, $map, $class)
 {
     if (isset($propertiesValues[RDF_TYPE])) {
         // assuming single Type
         if (count($propertiesValues[RDF_TYPE]) > 1) {
             return new common_report_Report(common_report_Report::TYPE_ERROR, __('Resource not imported due to multiple types'));
         } else {
             foreach ($propertiesValues[RDF_TYPE] as $k => $v) {
                 $classType = isset($map[$v['value']]) ? new core_kernel_classes_Class($map[$v['value']]) : $class;
                 //$resource->setType($classType);
                 $classType->createInstance(null, null, $resource->getUri());
             }
         }
         unset($propertiesValues[RDF_TYPE]);
     }
     if (isset($propertiesValues[RDFS_SUBCLASSOF])) {
         $resource = new core_kernel_classes_Class($resource);
         // assuming single subclass
         if (isset($propertiesValues[RDF_TYPE]) && count($propertiesValues[RDF_TYPE]) > 1) {
             return new common_report_Report(common_report_Report::TYPE_ERROR, __('Resource not imported due to multiple super classes'));
         }
         foreach ($propertiesValues[RDFS_SUBCLASSOF] as $k => $v) {
             $classSup = isset($map[$v['value']]) ? new core_kernel_classes_Class($map[$v['value']]) : $class;
             $resource->setSubClassOf($classSup);
         }
         unset($propertiesValues[RDFS_SUBCLASSOF]);
     }
     foreach ($propertiesValues as $prop => $values) {
         $property = new core_kernel_classes_Property(isset($map[$prop]) ? $map[$prop] : $prop);
         foreach ($values as $k => $v) {
             $value = isset($map[$v['value']]) ? $map[$v['value']] : $v['value'];
             if (isset($v['lang'])) {
                 $resource->setPropertyValueByLg($property, $value, $v['lang']);
             } else {
                 $resource->setPropertyValue($property, $value);
             }
         }
     }
     $msg = $resource instanceof core_kernel_classes_Class ? __('Successfully imported class "%s"', $resource->getLabel()) : __('Successfully imported "%s"', $resource->getLabel());
     return new common_report_Report(common_report_Report::TYPE_SUCCESS, $msg, $resource);
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:50,代码来源:class.RdfImporter.php

示例10: createUniqueLabel

 /**
  * Short description of method createUniqueLabel
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @param  Class clazz
  * @param  boolean subClassing
  * @return string
  */
 public function createUniqueLabel(core_kernel_classes_Class $clazz, $subClassing = false)
 {
     $returnValue = (string) '';
     if ($subClassing) {
         $labelBase = $clazz->getLabel() . '_';
         $count = count($clazz->getSubClasses()) + 1;
     } else {
         $labelBase = $clazz->getLabel() . ' ';
         $count = count($clazz->getInstances()) + 1;
     }
     $options = array('lang' => \common_session_SessionManager::getSession()->getDataLanguage(), 'like' => false, 'recursive' => false);
     do {
         $exist = false;
         $label = $labelBase . $count;
         $result = $clazz->searchInstances(array(RDFS_LABEL => $label), $options);
         if (count($result) > 0) {
             $exist = true;
             $count++;
         }
     } while ($exist);
     $returnValue = $label;
     return (string) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:32,代码来源:class.GenerisService.php

示例11: addInstanceForm

 public function addInstanceForm()
 {
     if (!tao_helpers_Request::isAjax()) {
         throw new Exception("wrong request mode");
     }
     $clazz = new core_kernel_classes_Class(CLASS_TAO_USER);
     $formContainer = new tao_actions_form_CreateInstance(array($clazz), array());
     $myForm = $formContainer->getForm();
     if ($myForm->isSubmited()) {
         if ($myForm->isValid()) {
             $properties = $myForm->getValues();
             $instance = $this->createInstance(array($clazz), $properties);
             $this->setData('message', __($instance->getLabel() . ' created'));
             //$this->setData('reload', true);
             $this->setData('selectTreeNode', $instance->getUri());
         }
     }
     $this->setData('formTitle', __('Create instance of ') . $clazz->getLabel());
     $this->setData('myForm', $myForm->render());
     $this->setView('form.tpl', 'tao');
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:21,代码来源:class.Users.php

示例12: hardify

 /**
  * Calling this method will transfer all instances of $class from the statements table
  * to specific optimized relational tables.
  * 
  * During optimization, the current user has all privileges on the persistent memory. At
  * the end of the process, the old privileges will be set back.
  * 
  * The $options array can contain the following key => values (all booleans):
  * 
  * - recursive: compile the target class and its subclasses (default: false).
  * - append: append data to the existing optimized table if it already exists (default: false).
  * - rmSources: remove the triples in the statement table after transfer (default: true).
  *
  * @access public
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @param  \core_kernel_classes_Class class
  * @param  array options
  * @return boolean Will return true if it succeeds, false otherwise.
  */
 public function hardify(\core_kernel_classes_Class $class, $options = array())
 {
     $returnValue = (bool) false;
     $oldUpdatableModels = core_kernel_persistence_smoothsql_SmoothModel::getUpdatableModelIds();
     try {
         // Give access to all models during hardification.
         core_kernel_persistence_smoothsql_SmoothModel::forceUpdatableModelIds(self::getAllModelIds());
         $classLabel = $class->getLabel();
         \common_Logger::i("Hardifying class {$classLabel}", array("GENERIS"));
         if (defined("DEBUG_PERSISTENCE") && DEBUG_PERSISTENCE) {
             if (in_array($class->getUri(), self::$debug_tables)) {
                 return;
             }
             \common_Logger::d('hardify ' . $class->getUri());
             self::$debug_tables[] = $class->getUri();
             $countStatement = $this->countStatements();
         }
         if (in_array($class->getUri(), self::$blackList)) {
             return $returnValue;
         }
         // ENTER IN SMOOTH SQL MODE
         PersistenceProxy::forceMode(PERSISTENCE_SMOOTH);
         //recursive will hardify the class and it's subclasses in the same table!
         isset($options['recursive']) ? $recursive = $options['recursive'] : ($recursive = false);
         //createForeigns will hardify the class that are range of the properties
         isset($options['createForeigns']) ? $createForeigns = $options['createForeigns'] : ($createForeigns = false);
         //check if we append the data in case the hard table exists or truncate the table and add the new rows
         isset($options['append']) ? $append = $options['append'] : ($append = false);
         //if true, the instances of the class will  be removed from the statements table!
         isset($options['rmSources']) ? $rmSources = (bool) $options['rmSources'] : ($rmSources = false);
         //if defined, we took all the properties of the class and it's parents till the topclass
         isset($options['topclass']) ? $topclass = $options['topclass'] : ($topclass = new \core_kernel_classes_Class(RDFS_RESOURCE));
         //if defined, compile the additional properties
         isset($options['additionalProperties']) ? $additionalProperties = $options['additionalProperties'] : ($additionalProperties = array());
         //if defined, reference the additional class to the table
         isset($options['referencesAllTypes']) ? $referencesAllTypes = $options['referencesAllTypes'] : ($referencesAllTypes = false);
         $tableName = '_' . Utils::getShortName($class);
         $myTableMgr = new TableManager($tableName);
         $referencer = ResourceReferencer::singleton();
         //get the table columns from the class properties
         $columns = array();
         $ps = new PropertySwitcher($class);
         $properties = $ps->getProperties($additionalProperties);
         $columns = $ps->getTableColumns($additionalProperties, self::$blackList);
         //init the count value in hardened classes:
         if (isset($this->hardenedClasses[$class->getUri()])) {
             PersistenceProxy::restoreImplementation();
             return true;
             //already being compiled
         } else {
             $this->hardenedClasses[$class->getUri()] = 0;
         }
         if (!$append || $append && !$myTableMgr->exists()) {
             //create the table
             if ($myTableMgr->exists()) {
                 $myTableMgr->remove();
             }
             $myTableMgr->create($columns);
             //reference the class
             $referencer->referenceClass($class, array("topclass" => $topclass, "additionalProperties" => $additionalProperties));
             if ($referencesAllTypes) {
                 $referencer->referenceInstanceTypes($class);
             }
         }
         //insert the resources
         $startIndex = 0;
         $instancePackSize = 100;
         $instances = $class->getInstances(false, array('offset' => $startIndex, 'limit' => $instancePackSize));
         $count = count($instances);
         $notDeletedInstances = array();
         do {
             //reset timeout:
             //set_time_limit(30);
             \helpers_TimeOutHelper::setTimeOutLimit(\helpers_TimeOutHelper::MEDIUM);
             $rows = array();
             foreach ($instances as $index => $resource) {
                 if ($referencer->isResourceReferenced($resource)) {
                     PersistenceProxy::forceMode(PERSISTENCE_HARD);
                     $resource->delete();
                     PersistenceProxy::restoreImplementation();
                 }
//.........这里部分代码省略.........
开发者ID:nagyist,项目名称:extension-generis-hard,代码行数:101,代码来源:Switcher.php

示例13: decompileClass

 /**
  * Decompile a specific class with the decompilation options found in the data returned
  * by the decompileClass method.
  *
  * This method returns an associative array containing the following informations:
  *
  * array(
  *    "success" => true/false,
  *    "count" => integer // the class instances that were unoptimized
  *    "relatedClasses" => array("class1", "class2", ...) // the classes that were impacted by the unoptimization
  *                                                // depending on the unoptimization options
  * )
  *
  * @see Optimization::decompileClass()
  * @param \core_kernel_classes_Class class The class you would like to compile.
  */
 public static function decompileClass(\core_kernel_classes_Class $class)
 {
     $result = array('success' => false);
     $optimizableClasses = self::getOptimizableClasses();
     if (isset($optimizableClasses[$class->getUri()]) && isset($optimizableClasses[$class->getUri()]['decompile'])) {
         //build the option array and launch the compilation:
         $userDefinedOptions = array();
         $options = array_merge($optimizableClasses[$class->getUri()]['decompile'], $userDefinedOptions);
         $switcher = new Switcher();
         $switcher->unhardify($class, $options);
         //prepare return value
         $decompiledClass = $switcher->getDecompiledClasses();
         $count = isset($decompiledClass[$class->getUri()]) ? $decompiledClass[$class->getUri()] : 0;
         $relatedClasses = array();
         foreach ($decompiledClass as $relatedClassUri => $nb) {
             if ($relatedClassUri != $class->getUri()) {
                 $relatedClass = new \core_kernel_classes_Class($relatedClassUri);
                 $relatedClasses[$relatedClass->getLabel()] = $nb;
             }
         }
         $result = array('success' => true, 'count' => $count, 'relatedClasses' => $relatedClasses);
         unset($switcher);
     }
     return $result;
 }
开发者ID:nagyist,项目名称:extension-generis-hard,代码行数:41,代码来源:Optimization.php


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