當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。