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


PHP eZDataType::allowedTypes方法代码示例

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


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

示例1: array

//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
/*! \file
*/
require 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "eZ Publish datatype sql update\n\n" . "Script can be run as:\n" . "bin/php/ezimportdbafile.php --datatype=\n\n" . "Example: bin/php/ezimportdbafile.php --datatype=ezisbn", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions("[datatype:]", "", array('datatype' => "The name of the datatype where the database should be updated."));
$script->initialize();
$dataTypeName = $options['datatype'];
if ($dataTypeName === null) {
    $cli->output("Error: The option --datatype is required. Add --help for more information.");
}
$allowedDatatypes = eZDataType::allowedTypes();
if ($dataTypeName !== null and in_array($dataTypeName, $allowedDatatypes)) {
    // Inserting data from the dba-data files of the datatypes
    eZDataType::loadAndRegisterAllTypes();
    $registeredDataTypes = eZDataType::registeredDataTypes();
    if (isset($registeredDataTypes[$dataTypeName])) {
        $dataType = $registeredDataTypes[$dataTypeName];
        if ($dataType->importDBDataFromDBAFile()) {
            $cli->output("The database is updated for the datatype: " . $cli->style('emphasize') . $dataType->DataTypeString . $cli->style('emphasize-end') . "\n" . 'dba-data is imported from the file: ' . $cli->style('emphasize') . $dataType->getDBAFilePath() . $cli->style('emphasize-end'));
        } else {
            $activeExtensions = eZExtension::activeExtensions();
            $errorString = "Failed importing datatype related data into database: \n" . '  datatype - ' . $dataType->DataTypeString . ", \n" . '  checked dba-data file - ' . $dataType->getDBAFilePath(false);
            foreach ($activeExtensions as $activeExtension) {
                $fileName = eZExtension::baseDirectory() . '/' . $activeExtension . '/datatypes/' . $dataType->DataTypeString . '/' . $dataType->getDBAFileName();
                $errorString .= "\n" . str_repeat(' ', 23) . ' - ' . $fileName;
                if (file_exists($fileName)) {
开发者ID:runelangseid,项目名称:ezpublish,代码行数:31,代码来源:ezimportdbafile.php

示例2: loadAndRegisterAllTypes

 static function loadAndRegisterAllTypes()
 {
     $allowedTypes = eZDataType::allowedTypes();
     foreach ($allowedTypes as $type) {
         eZDataType::loadAndRegisterType($type);
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:7,代码来源:ezdatatype.php

示例3: addAttribute

 protected function addAttribute($originalAttribute)
 {
     $class = $this->currentClass;
     $localeAttributes = $class->fetchAttributes();
     $placement = count($localeAttributes);
     $allowedTypes = eZDataType::allowedTypes();
     if (!$class->fetchAttributeByIdentifier($originalAttribute->Identifier) && in_array($originalAttribute->DataTypeString, $allowedTypes)) {
         /** @var eZContentClassAttribute $localeAttribute */
         $localeAttribute = eZContentClassAttribute::create($class->attribute('id'), $originalAttribute->DataTypeString, array('version' => eZContentClass::VERSION_STATUS_TEMPORARY, 'identifier' => $originalAttribute->Identifier, 'serialized_name_list' => $originalAttribute->SerializedNameList, 'serialized_description_list' => $originalAttribute->SerializedDescriptionList, 'category' => $originalAttribute->Category, 'serialized_data_text' => $originalAttribute->SerializedDataText, 'is_required' => $originalAttribute->IsRequired, 'is_searchable' => $originalAttribute->IsSearchable, 'is_information_collector' => $originalAttribute->IsInformationCollector, 'can_translate' => $originalAttribute->CanTranslate, 'placement' => ++$placement), $this->EditLanguage);
         foreach ($this->fields as $localeIdentifier => $remoteProperty) {
             $localeAttribute->setAttribute($localeIdentifier, $originalAttribute->{$remoteProperty});
         }
         $localeAttribute->store();
         return $localeAttribute;
     }
     return false;
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:17,代码来源:occlasstools.php


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