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


PHP CList::getFields方法代码示例

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


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

示例1: export

 /**
  * @param int $iblockId This variable is the id iblock.
  * @return string
  * @throws Main\ArgumentNullException
  * @throws Main\ArgumentOutOfRangeException
  */
 public static function export($iblockId)
 {
     $iblockId = intval($iblockId);
     if ($iblockId <= 0) {
         throw new Main\ArgumentNullException("iblockId");
     }
     $db = \CIBlock::GetList(array(), array("ID" => $iblockId, "CHECK_PERMISSIONS" => "N"));
     $iblock = $db->Fetch();
     if (!$iblock) {
         throw new Main\ArgumentOutOfRangeException("iblockId");
     }
     if (!$iblock["CODE"]) {
         throw new Main\ArgumentException("Parameter 'CODE' is required.", "matches");
     }
     $list = new \CList($iblockId);
     $fields = $list->getFields();
     foreach ($fields as $fieldId => $field) {
         if ($field["TYPE"] == "NAME") {
             $iblock["~NAME_FIELD"] = array("NAME" => $field["NAME"], "SETTINGS" => $field["SETTINGS"], "DEFAULT_VALUE" => $field["DEFAULT_VALUE"], "SORT" => $field["SORT"]);
             break;
         }
     }
     $iblockUtf8 = Main\Text\Encoding::convertEncodingArray($iblock, LANG_CHARSET, "UTF-8");
     $iblockUtf8 = serialize($iblockUtf8);
     $iblockUtf8Length = Main\Text\String::getBinaryLength($iblockUtf8);
     $datum = str_pad($iblockUtf8Length, 10, "0", STR_PAD_LEFT) . $iblockUtf8;
     if (intval($iblock["PICTURE"]) > 0) {
         $picture = \CFile::MakeFileArray($iblock["PICTURE"]);
         if (isset($picture["tmp_name"]) && !empty($picture["tmp_name"])) {
             $f = fopen($picture["tmp_name"], "rb");
             $pictureData = fread($f, filesize($picture["tmp_name"]));
             fclose($f);
             $pictureTypeLength = Main\Text\String::getBinaryLength($picture["type"]);
             $pictureLength = Main\Text\String::getBinaryLength($pictureData);
             $datum .= "P" . str_pad($pictureTypeLength, 10, "0", STR_PAD_LEFT) . $picture["type"] . str_pad($pictureLength, 10, "0", STR_PAD_LEFT) . $pictureData;
         }
     }
     $documentType = self::getDocumentType($iblock["IBLOCK_TYPE_ID"], $iblockId);
     $templatesList = \CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $documentType), false, false, array("ID", "AUTO_EXECUTE", "NAME", "DESCRIPTION", "SYSTEM_CODE"));
     while ($templatesListItem = $templatesList->Fetch()) {
         $bpDescrUtf8 = Main\Text\Encoding::convertEncodingArray($templatesListItem, LANG_CHARSET, "UTF-8");
         $bpDescrUtf8 = serialize($bpDescrUtf8);
         $bpDescrUtf8Length = Main\Text\String::getBinaryLength($bpDescrUtf8);
         $datum .= "B" . str_pad($bpDescrUtf8Length, 10, "0", STR_PAD_LEFT) . $bpDescrUtf8;
         $bp = \CBPWorkflowTemplateLoader::ExportTemplate($templatesListItem["ID"], false);
         $bpLength = Main\Text\String::getBinaryLength($bp);
         $datum .= str_pad($bpLength, 10, "0", STR_PAD_LEFT) . $bp;
     }
     if (function_exists("gzcompress")) {
         $datum = "compressed" . gzcompress($datum, 9);
     }
     return $datum;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:importer.php

示例2: getListData

 protected function getListData()
 {
     $list = new CList($this->iblockId);
     $this->lists['FIELDS'] = $list->getFields();
     $this->lists['SELECT'] = array('ID', 'IBLOCK_ID', 'NAME', 'IBLOCK_SECTION_ID', 'CREATED_BY', 'BP_PUBLISHED');
     $this->lists['DATA'] = array();
     $this->lists['DATA']['NAME'] = Loc::getMessage('LISTS_SEAC_FIELD_NAME_DEFAULT');
     $this->lists['DATA']['IBLOCK_SECTION_ID'] = '';
     foreach ($this->lists['FIELDS'] as $fieldId => $field) {
         $this->lists['FIELDS'][$fieldId]['NAME'] = htmlspecialcharsbx($this->lists['FIELDS'][$fieldId]['NAME']);
         if ($list->is_field($fieldId)) {
             if ($fieldId == 'ACTIVE_FROM' || $fieldId == 'PREVIEW_PICTURE' || $fieldId == 'DETAIL_PICTURE') {
                 if ($field['DEFAULT_VALUE'] === '=now') {
                     $this->lists['DATA'][$fieldId] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'FULL');
                 } elseif ($field['DEFAULT_VALUE'] === '=today') {
                     $this->lists['DATA'][$fieldId] = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT');
                 } else {
                     $this->lists['DATA'][$fieldId] = '';
                 }
             } else {
                 $this->lists['DATA'][$fieldId] = $field['DEFAULT_VALUE'];
             }
             $this->lists['SELECT'][] = $fieldId;
         } elseif (is_array($field['PROPERTY_USER_TYPE']) && array_key_exists('GetPublicEditHTML', $field['PROPERTY_USER_TYPE'])) {
             $this->lists['DATA'][$fieldId] = array('n0' => array('VALUE' => $field['DEFAULT_VALUE'], 'DESCRIPTION' => ''));
         } elseif ($field['PROPERTY_TYPE'] == 'L') {
             $this->lists['DATA'][$fieldId] = array();
             $propEnums = CIBlockProperty::getPropertyEnum($field['ID']);
             while ($enum = $propEnums->fetch()) {
                 if ($enum['DEF'] == 'Y') {
                     $this->lists['DATA'][$fieldId][] = $enum['ID'];
                 }
             }
         } elseif ($field['PROPERTY_TYPE'] == 'F') {
             $this->lists['DATA'][$fieldId] = array('n0' => array('VALUE' => $field['DEFAULT_VALUE'], 'DESCRIPTION' => ''));
         } elseif ($field['PROPERTY_TYPE'] == 'G' || $field['PROPERTY_TYPE'] == 'E') {
             $this->lists['DATA'][$fieldId] = array($field['DEFAULT_VALUE']);
         } else {
             $this->lists['DATA'][$fieldId] = array('n0' => array('VALUE' => $field['DEFAULT_VALUE'], 'DESCRIPTION' => ''));
             if ($field['MULTIPLE'] == 'Y') {
                 if (is_array($field['DEFAULT_VALUE']) || strlen($field['DEFAULT_VALUE'])) {
                     $this->lists['DATA'][$fieldId]['n1'] = array('VALUE' => '', 'DESCRIPTION' => '');
                 }
             }
         }
         if ($fieldId == 'CREATED_BY') {
             $this->lists['SELECT'][] = 'CREATED_USER_NAME';
         }
         if ($fieldId == 'MODIFIED_BY') {
             $this->lists['SELECT'][] = 'USER_NAME';
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:53,代码来源:ajax.php

示例3: GetDocumentFields

 public function GetDocumentFields($documentType)
 {
     $iblockId = intval(substr($documentType, strlen("iblock_")));
     if ($iblockId <= 0) {
         throw new CBPArgumentOutOfRangeException("documentType", $documentType);
     }
     $documentFieldTypes = self::getDocumentFieldTypes($documentType);
     $result = array("ID" => array("Name" => GetMessage("IBD_FIELD_ID"), "Type" => "int", "Filterable" => true, "Editable" => false, "Required" => false), "TIMESTAMP_X" => array("Name" => GetMessage("IBD_FIELD_TIMESTAMP_X"), "Type" => "datetime", "Filterable" => true, "Editable" => true, "Required" => false), "MODIFIED_BY" => array("Name" => GetMessage("IBD_FIELD_MODYFIED"), "Type" => "user", "Filterable" => true, "Editable" => true, "Required" => false), "MODIFIED_BY_PRINTABLE" => array("Name" => GetMessage("IBD_FIELD_MODIFIED_BY_USER_PRINTABLE"), "Type" => "string", "Filterable" => false, "Editable" => false, "Required" => false), "DATE_CREATE" => array("Name" => GetMessage("IBD_FIELD_DATE_CREATE"), "Type" => "datetime", "Filterable" => true, "Editable" => true, "Required" => false), "CREATED_BY" => array("Name" => GetMessage("IBD_FIELD_CREATED"), "Type" => "user", "Filterable" => true, "Editable" => false, "Required" => false), "CREATED_BY_PRINTABLE" => array("Name" => GetMessage("IBD_FIELD_CREATED_BY_USER_PRINTABLE"), "Type" => "string", "Filterable" => false, "Editable" => false, "Required" => false), "IBLOCK_ID" => array("Name" => GetMessage("IBD_FIELD_IBLOCK_ID"), "Type" => "int", "Filterable" => true, "Editable" => true, "Required" => false), "ACTIVE" => array("Name" => GetMessage("IBD_FIELD_ACTIVE"), "Type" => "bool", "Filterable" => true, "Editable" => true, "Required" => false), "BP_PUBLISHED" => array("Name" => GetMessage("IBD_FIELD_BP_PUBLISHED"), "Type" => "bool", "Filterable" => false, "Editable" => true, "Required" => false), "CODE" => array("Name" => GetMessage("IBD_FIELD_CODE"), "Type" => "string", "Filterable" => true, "Editable" => true, "Required" => false), "XML_ID" => array("Name" => GetMessage("IBD_FIELD_XML_ID"), "Type" => "string", "Filterable" => true, "Editable" => true, "Required" => false));
     $keys = array_keys($result);
     foreach ($keys as $key) {
         $result[$key]["Multiple"] = false;
     }
     $dbProperties = CIBlockProperty::getList(array("sort" => "asc", "name" => "asc"), array("IBLOCK_ID" => $iblockId, 'ACTIVE' => 'Y'));
     $ignoreProperty = array();
     while ($property = $dbProperties->fetch()) {
         if (strlen(trim($property["CODE"])) > 0) {
             $key = "PROPERTY_" . $property["CODE"];
             $ignoreProperty["PROPERTY_" . $property["ID"]] = "PROPERTY_" . $property["CODE"];
         } else {
             $key = "PROPERTY_" . $property["ID"];
             $ignoreProperty["PROPERTY_" . $property["ID"]] = 0;
         }
         $result[$key] = array("Name" => $property["NAME"], "Filterable" => $property["FILTRABLE"] == "Y", "Editable" => true, "Required" => $property["IS_REQUIRED"] == "Y", "Multiple" => $property["MULTIPLE"] == "Y", "TypeReal" => $property["PROPERTY_TYPE"]);
         if (strlen($property["USER_TYPE"]) > 0) {
             $result[$key]["TypeReal"] = $property["PROPERTY_TYPE"] . ":" . $property["USER_TYPE"];
             if ($property["USER_TYPE"] == "UserID" || $property["USER_TYPE"] == "employee" && COption::getOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
                 $result[$key]["Type"] = "user";
                 $result[$key . "_PRINTABLE"] = array("Name" => $property["NAME"] . GetMessage("IBD_FIELD_USERNAME_PROPERTY"), "Filterable" => false, "Editable" => false, "Required" => false, "Multiple" => $property["MULTIPLE"] == "Y", "Type" => "string");
                 $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
             } elseif ($property["USER_TYPE"] == "DateTime") {
                 $result[$key]["Type"] = "datetime";
                 $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
             } elseif ($property["USER_TYPE"] == "Date") {
                 $result[$key]["Type"] = "date";
                 $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
             } elseif ($property["USER_TYPE"] == "EList") {
                 $result[$key]["Type"] = "E:EList";
                 $result[$key]["Options"] = $property["LINK_IBLOCK_ID"];
             } elseif ($property["USER_TYPE"] == "HTML") {
                 $result[$key]["Type"] = "S:HTML";
                 $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
             } else {
                 $result[$key]["Type"] = "string";
                 $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
             }
         } elseif ($property["PROPERTY_TYPE"] == "L") {
             $result[$key]["Type"] = "select";
             $result[$key]["Options"] = array();
             $dbPropertyEnums = CIBlockProperty::getPropertyEnum($property["ID"]);
             while ($propertyEnum = $dbPropertyEnums->getNext()) {
                 $result[$key]["Options"][$propertyEnum["XML_ID"]] = $propertyEnum["VALUE"];
                 if ($propertyEnum["DEF"] == "Y") {
                     $result[$key]["DefaultValue"] = $propertyEnum["VALUE"];
                 }
             }
         } elseif ($property["PROPERTY_TYPE"] == "N") {
             $result[$key]["Type"] = "int";
             $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
         } elseif ($property["PROPERTY_TYPE"] == "F") {
             $result[$key]["Type"] = "file";
             $result[$key . "_printable"] = array("Name" => $property["NAME"] . GetMessage("IBD_FIELD_USERNAME_PROPERTY"), "Filterable" => false, "Editable" => false, "Required" => false, "Multiple" => $property["MULTIPLE"] == "Y", "Type" => "string");
         } elseif ($property["PROPERTY_TYPE"] == "S") {
             $result[$key]["Type"] = "string";
             $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
         } else {
             $result[$key]["Type"] = "string";
             $result[$key]["DefaultValue"] = $property["DEFAULT_VALUE"];
         }
     }
     $keys = array_keys($result);
     foreach ($keys as $k) {
         $result[$k]["BaseType"] = $documentFieldTypes[$result[$k]["Type"]]["BaseType"];
         $result[$k]["Complex"] = $documentFieldTypes[$result[$k]["Type"]]["Complex"];
     }
     $list = new CList($iblockId);
     $fields = $list->getFields();
     foreach ($fields as $fieldId => $field) {
         if (empty($field["SETTINGS"])) {
             $field["SETTINGS"] = array("SHOW_ADD_FORM" => 'Y', "SHOW_EDIT_FORM" => 'Y');
         }
         if (array_key_exists($fieldId, $ignoreProperty)) {
             $ignoreProperty[$fieldId] ? $key = $ignoreProperty[$fieldId] : ($key = $fieldId);
             $result[$key]["sort"] = $field["SORT"];
             $result[$key]["settings"] = $field["SETTINGS"];
             if ($field["ROW_COUNT"] && $field["COL_COUNT"]) {
                 $result[$key]["row_count"] = $field["ROW_COUNT"];
                 $result[$key]["col_count"] = $field["COL_COUNT"];
             }
         } else {
             if (!isset($result[$fieldId])) {
                 $result[$fieldId] = array('Name' => $field['NAME'], 'Filterable' => false, 'Editable' => true, 'Required' => $field['IS_REQUIRED'], 'Multiple' => $field['MULTIPLE'], 'Type' => $field['TYPE']);
             }
             $result[$fieldId]["sort"] = $field["SORT"];
             $result[$fieldId]["settings"] = $field["SETTINGS"];
             if ($field["ROW_COUNT"] && $field["COL_COUNT"]) {
                 $result[$fieldId]["row_count"] = $field["ROW_COUNT"];
                 $result[$fieldId]["col_count"] = $field["COL_COUNT"];
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:bizprocdocument.php

示例4: getElementFields

 protected function getElementFields($iblockId, $elementId)
 {
     $totalResult = array();
     $list = new CList($iblockId);
     $listFields = $list->getFields();
     foreach ($listFields as $fieldId => $field) {
         $totalResult[$fieldId] = $field;
     }
     $elementQuery = CIBlockElement::getList(array(), array("IBLOCK_ID" => $iblockId, "=ID" => $elementId), false, false, array('*'));
     $elementObject = $elementQuery->getNextElement();
     $elementNewData = $elementObject->getFields();
     if (is_array($elementNewData)) {
         foreach ($elementNewData as $fieldId => $fieldValue) {
             if (!$list->is_field($fieldId)) {
                 continue;
             }
             if (isset($totalResult[$fieldId]["NAME"])) {
                 $totalResult[$fieldId]["VALUE"] = $fieldValue;
             }
         }
     }
     $query = \CIblockElement::getPropertyValues($iblockId, array('ID' => $elementId));
     if ($propertyValues = $query->fetch()) {
         foreach ($propertyValues as $id => $values) {
             if ($id == "IBLOCK_ELEMENT_ID") {
                 continue;
             }
             $fieldId = "PROPERTY_" . $id;
             $totalResult[$fieldId]["VALUE"] = $values;
         }
     }
     return $totalResult;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:33,代码来源:class.php

示例5: getVisibleFieldsList

 private static function getVisibleFieldsList($iblockId)
 {
     $list = new CList($iblockId);
     $listFields = $list->getFields();
     $result = array();
     foreach ($listFields as $key => $field) {
         if (strpos($key, 'PROPERTY_') === 0) {
             if (!empty($field['CODE'])) {
                 $key = 'PROPERTY_' . $field['CODE'];
             }
         }
         $result[] = $key;
     }
     return $result;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:15,代码来源:createlistsdocumentactivity.php


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