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


PHP core_kernel_classes_Resource::getPropertyValuesByLg方法代码示例

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


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

示例1: exists

 private function exists($subject, $property, $object, $lg)
 {
     $subject = new core_kernel_classes_Resource($subject->getUri());
     $values = $subject->getPropertyValuesByLg($property, $lg);
     $found = false;
     foreach ($values as $value) {
         $raw = (string) ($value instanceof core_kernel_classes_Resource ? $value->getUri() : $value);
         if ($raw == $object) {
             $found = true;
             break;
         }
     }
     return $found;
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:14,代码来源:class.UpdateOntologyModel.php

示例2: getItemFolder

 /**
  * Short description of method getItemFolder
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param  Resource item
  * @param  string lang
  * @return string
  */
 public function getItemFolder(core_kernel_classes_Resource $item, $lang = '')
 {
     $returnValue = (string) '';
     if ($lang === '') {
         $files = $item->getPropertyValues(new core_kernel_classes_Property(TAO_ITEM_CONTENT_PROPERTY));
     } else {
         $files = $item->getPropertyValuesByLg(new core_kernel_classes_Property(TAO_ITEM_CONTENT_PROPERTY), $lang)->toArray();
     }
     if (count($files) == 0) {
         // no content found assign default
         $returnValue = $this->getDefaultItemFolder($item, $lang);
     } else {
         if (count($files) > 1) {
             throw new common_Exception(__METHOD__ . ': Item ' . $item->getUri() . ' has multiple.');
         }
         $content = new core_kernel_file_File(current($files));
         $returnValue = dirname($content->getAbsolutePath()) . DIRECTORY_SEPARATOR;
     }
     return (string) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-extension-tao-item,代码行数:29,代码来源:class.ItemsService.php

示例3: getTranslatedProperties

 /**
  * get the properties of an instance for a specific language
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @param  Resource instance
  * @param  string lang
  * @return array
  */
 public function getTranslatedProperties(core_kernel_classes_Resource $instance, $lang)
 {
     $returnValue = array();
     try {
         foreach ($instance->getTypes() as $clazz) {
             foreach ($clazz->getProperties(true) as $property) {
                 if ($property->isLgDependent() || $property->getUri() == RDFS_LABEL) {
                     $collection = $instance->getPropertyValuesByLg($property, $lang);
                     if ($collection->count() > 0) {
                         if ($collection->count() == 1) {
                             $returnValue[$property->getUri()] = (string) $collection->get(0);
                         } else {
                             $propData = array();
                             foreach ($collection->getIterator() as $collectionItem) {
                                 $propData[] = (string) $collectionItem;
                             }
                             $returnValue[$property->getUri()] = $propData;
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         print $e;
     }
     return (array) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:36,代码来源:class.GenerisService.php

示例4: getItemDirectory

 /**
  * Returns the items flysystem directory
  *
  * @param core_kernel_classes_Resource $item
  * @param string $language
  * @return \oat\oatbox\filesystem\Directory
  * @throws Exception
  * @throws common_Exception
  * @throws core_kernel_persistence_Exception
  */
 public function getItemDirectory(core_kernel_classes_Resource $item, $language = '')
 {
     // Get file by language
     if ($language === '') {
         $files = $item->getPropertyValues($this->itemContentProperty);
     } else {
         $files = $item->getPropertyValuesByLg($this->itemContentProperty, $language)->toArray();
     }
     // If multiple files then throw exception
     if (count($files) > 1) {
         common_Logger::i(print_r($files, true));
         throw new common_Exception(__METHOD__ . ': Item ' . $item->getUri() . ' has multiple.');
     }
     // If there is one file then return directory
     if (count($files) == 1) {
         $file = reset($files);
         $file = is_object($file) && $file instanceof core_kernel_classes_Resource ? $file->getUri() : (string) $file;
         return $this->getFileReferenceSerializer()->unserializeDirectory($file);
     }
     // Otherwise there is no file, create one and return directory
     $model = $this->getItemModel($item);
     if (is_null($model)) {
         throw new common_Exception('Call to ' . __FUNCTION__ . ' for item without model');
     }
     // File does not exist, let's create it
     $actualLang = empty($language) ? $this->getSessionLg() : $language;
     $filePath = tao_helpers_Uri::getUniqueId($item->getUri()) . DIRECTORY_SEPARATOR . 'itemContent' . DIRECTORY_SEPARATOR . $actualLang;
     // Create item directory
     $itemDirectory = $this->getDefaultItemDirectory()->getDirectory($filePath);
     // Set uri file value as serial to item persistence
     $serial = $this->getFileReferenceSerializer()->serialize($itemDirectory);
     $item->setPropertyValueByLg($this->itemContentProperty, $serial, $actualLang);
     // Store file into persistence, purpose of serializer ?
     $dataFile = (string) $model->getOnePropertyValue($this->getProperty(TAO_ITEM_MODEL_DATAFILE_PROPERTY));
     $this->getFileReferenceSerializer()->serialize($itemDirectory->getFile($dataFile));
     return $itemDirectory;
 }
开发者ID:oat-sa,项目名称:extension-tao-item,代码行数:47,代码来源:class.ItemsService.php


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