本文整理汇总了PHP中CList::GetFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CList::GetFields方法的具体用法?PHP CList::GetFields怎么用?PHP CList::GetFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::GetFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LocalRedirect
$obList->UpdateField($ID, $arField);
}
//Clear components cache
$CACHE_MANAGER->ClearByTag("lists_list_" . $arResult["IBLOCK_ID"]);
}
if (!isset($_POST["AJAX_CALL"])) {
LocalRedirect($arResult["LIST_FIELDS_URL"]);
}
}
global $CACHE_MANAGER;
if ($this->StartResultCache(false)) {
$CACHE_MANAGER->StartTagCache($this->GetCachePath());
$CACHE_MANAGER->RegisterTag("lists_list_" . $arIBlock["ID"]);
$obList = new CList($arIBlock["ID"]);
$arResult["TYPES"] = $obList->GetAllTypes();
$arFields = $obList->GetFields();
$arResult["ROWS"] = array();
foreach ($arFields as $ID => $arField) {
$data = array();
foreach ($arField as $key => $value) {
$data["~" . $key] = $value;
if (is_array($value)) {
foreach ($value as $key1 => $value1) {
if (!is_array($value1)) {
$value[$key1] = htmlspecialcharsbx($value1);
}
}
$data[$key] = $value;
} else {
$data[$key] = htmlspecialcharsbx($value);
}
示例2: createDataExcel
protected function createDataExcel()
{
$obList = new CList($this->arIBlock["ID"]);
$gridOptions = new CGridOptions($this->arResult["GRID_ID"]);
$gridColumns = $gridOptions->GetVisibleColumns();
$gridSort = $gridOptions->GetSorting(array("sort" => array("name" => "asc")));
$this->arResult["ELEMENTS_HEADERS"] = array();
$arSelect = array("ID", "IBLOCK_ID");
$arProperties = array();
$this->arResult["FIELDS"] = $arListFields = $obList->GetFields();
foreach ($arListFields as $fieldId => $arField) {
if (!count($gridColumns) || in_array($fieldId, $gridColumns)) {
if (substr($fieldId, 0, 9) == "PROPERTY_") {
$arProperties[] = $fieldId;
} else {
$arSelect[] = $fieldId;
}
}
if ($fieldId == "CREATED_BY") {
$arSelect[] = "CREATED_USER_NAME";
}
if ($fieldId == "MODIFIED_BY") {
$arSelect[] = "USER_NAME";
}
$this->arResult["ELEMENTS_HEADERS"][$fieldId] = array("name" => htmlspecialcharsex($arField["NAME"]), "default" => true, "sort" => $arField["MULTIPLE"] == "Y" ? "" : $fieldId);
}
if (!count($gridColumns) || in_array("IBLOCK_SECTION_ID", $gridColumns)) {
$arSelect[] = "IBLOCK_SECTION_ID";
}
$this->arResult["ELEMENTS_HEADERS"]["IBLOCK_SECTION_ID"] = array("name" => Loc::getMessage("CC_BLL_COLUMN_SECTION"), "default" => true, "sort" => false);
/* FILTER */
$sections = array();
foreach ($this->arResult["LIST_SECTIONS"] as $id => $name) {
$sections[$id] = $name;
}
$this->arResult["FILTER"] = array(array("id" => "list_section_id", "type" => "list", "items" => $sections, "filtered" => $this->arResult["SECTION_ID"] !== false, "filter_value" => $this->arResult["SECTION_ID"], "value" => $this->arResult["SECTION_ID"]));
$i = 1;
$arFilterable = array();
$arDateFilter = array();
foreach ($arListFields as $fieldId => $arField) {
if ($arField["TYPE"] == "ACTIVE_FROM" || $arField["TYPE"] == "ACTIVE_TO") {
$this->arResult["FILTER"][$i] = array("id" => "DATE_" . $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
$arFilterable["DATE_" . $fieldId] = "";
$arDateFilter["DATE_" . $fieldId] = true;
} elseif ($arField["TYPE"] == "DATE_CREATE" || $arField["TYPE"] == "TIMESTAMP_X") {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
$arFilterable[$fieldId] = "";
$arDateFilter[$fieldId] = true;
} elseif (is_array($arField["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicFilterHTML", $arField["PROPERTY_USER_TYPE"])) {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "custom", "enable_settings" => false, "value" => call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicFilterHTML"], array($arField, array("VALUE" => $fieldId, "FORM_NAME" => "filter_" . $this->arResult["GRID_ID"], "GRID_ID" => $this->arResult["GRID_ID"]))));
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "SORT" || $arField["TYPE"] == "N") {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "number");
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "G") {
$items = array();
$prop_secs = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arField["LINK_IBLOCK_ID"]));
while ($ar_sec = $prop_secs->Fetch()) {
$items[$ar_sec["ID"]] = str_repeat(". ", $ar_sec["DEPTH_LEVEL"] - 1) . $ar_sec["NAME"];
}
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "E") {
//Should be handled in template
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "E", "value" => $arField);
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "L") {
$items = array();
$propEnums = CIBlockProperty::GetPropertyEnum($arField["ID"]);
while ($arEnum = $propEnums->Fetch()) {
$items[$arEnum["ID"]] = $arEnum["VALUE"];
}
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
$arFilterable[$fieldId] = "";
} elseif (in_array($arField["TYPE"], array("S", "S:HTML", "NAME", "DETAIL_TEXT", "PREVIEW_TEXT"))) {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
$arFilterable[$fieldId] = "?";
} else {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
$arFilterable[$fieldId] = "";
}
$i++;
}
$arFilter = array();
$gridFilter = $gridOptions->GetFilter($this->arResult["FILTER"]);
foreach ($gridFilter as $key => $value) {
if (substr($key, -5) == "_from") {
$op = ">=";
$newKey = substr($key, 0, -5);
} elseif (substr($key, -3) == "_to") {
$op = "<=";
$newKey = substr($key, 0, -3);
if (array_key_exists($newKey, $arDateFilter)) {
if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
$value .= " 23:59:59";
}
}
} else {
$op = "";
$newKey = $key;
//.........这里部分代码省略.........
示例3: CGridOptions
}
$grid_options = new CGridOptions($arResult["GRID_ID"]);
$grid_columns = $grid_options->GetVisibleColumns();
$grid_sort = $grid_options->GetSorting(array("sort" => array("name" => "asc")));
if ($arResult["IBLOCK"]["BIZPROC"] == "Y" && CModule::IncludeModule('bizproc')) {
$arDocumentTemplates = CBPDocument::GetWorkflowTemplatesForDocumentType(BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]));
$arResult["BIZPROC"] = "Y";
} else {
$arDocumentTemplates = array();
$arResult["BIZPROC"] = "N";
}
/* FIELDS */
$arResult["ELEMENTS_HEADERS"] = array();
$arSelect = array("ID", "IBLOCK_ID");
$arProperties = array();
$arResult["FIELDS"] = $arListFields = $obList->GetFields();
foreach ($arListFields as $FIELD_ID => $arField) {
if (!count($grid_columns) || in_array($FIELD_ID, $grid_columns)) {
if (substr($FIELD_ID, 0, 9) == "PROPERTY_") {
$arProperties[] = $FIELD_ID;
} else {
$arSelect[] = $FIELD_ID;
}
}
if ($FIELD_ID == "CREATED_BY") {
$arSelect[] = "CREATED_USER_NAME";
}
if ($FIELD_ID == "MODIFIED_BY") {
$arSelect[] = "USER_NAME";
}
$arResult["ELEMENTS_HEADERS"][] = array("id" => $FIELD_ID, "name" => htmlspecialcharsex($arField["NAME"]), "default" => true, "sort" => $arField["MULTIPLE"] == "Y" ? "" : $FIELD_ID);
示例4: createDataExcel
protected function createDataExcel()
{
$obList = new CList($this->arIBlock["ID"]);
$gridOptions = new CGridOptions($this->arResult["GRID_ID"]);
$gridColumns = $gridOptions->GetVisibleColumns();
$gridSort = $gridOptions->GetSorting(array("sort" => array("name" => "asc")));
$this->arResult["ELEMENTS_HEADERS"] = array();
$arSelect = array("ID", "IBLOCK_ID");
$arProperties = array();
$this->arResult["FIELDS"] = $arListFields = $obList->GetFields();
foreach ($arListFields as $fieldId => $arField) {
if (!count($gridColumns) || in_array($fieldId, $gridColumns)) {
if (substr($fieldId, 0, 9) == "PROPERTY_") {
$arProperties[] = $fieldId;
} else {
$arSelect[] = $fieldId;
}
}
if ($fieldId == "CREATED_BY") {
$arSelect[] = "CREATED_USER_NAME";
}
if ($fieldId == "MODIFIED_BY") {
$arSelect[] = "USER_NAME";
}
$this->arResult["ELEMENTS_HEADERS"][$fieldId] = $arField["NAME"];
}
if (!count($gridColumns) || in_array("IBLOCK_SECTION_ID", $gridColumns)) {
$arSelect[] = "IBLOCK_SECTION_ID";
}
$this->arResult["ELEMENTS_HEADERS"]["IBLOCK_SECTION_ID"] = Loc::getMessage("CC_BLL_COLUMN_SECTION");
/* FILTER */
$sections = array();
foreach ($this->arResult["LIST_SECTIONS"] as $id => $name) {
$sections[$id] = $name;
}
$this->arResult["FILTER"] = array(array("id" => "list_section_id", "type" => "list", "items" => $sections, "filtered" => $this->arResult["SECTION_ID"] !== false, "filter_value" => $this->arResult["SECTION_ID"], "value" => $this->arResult["SECTION_ID"]));
$i = 1;
$arFilterable = array();
$arCustomFilter = array();
$arDateFilter = array();
foreach ($arListFields as $fieldId => $arField) {
if ($arField["TYPE"] == "ACTIVE_FROM" || $arField["TYPE"] == "ACTIVE_TO") {
$this->arResult["FILTER"][$i] = array("id" => "DATE_" . $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
$arFilterable["DATE_" . $fieldId] = "";
$arDateFilter["DATE_" . $fieldId] = true;
} elseif ($arField["TYPE"] == "DATE_CREATE" || $arField["TYPE"] == "TIMESTAMP_X") {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
$arFilterable[$fieldId] = "";
$arDateFilter[$fieldId] = true;
} elseif (is_array($arField["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicFilterHTML", $arField["PROPERTY_USER_TYPE"])) {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "custom", "fieldsType" => $arField["TYPE"], "enable_settings" => false, "value" => call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicFilterHTML"], array($arField, array("VALUE" => $fieldId, "FORM_NAME" => "filter_" . $this->arResult["GRID_ID"], "GRID_ID" => $this->arResult["GRID_ID"]))));
$arFilterable[$fieldId] = "";
if (array_key_exists("AddFilterFields", $arField["PROPERTY_USER_TYPE"])) {
$arCustomFilter[$fieldId] = array("callback" => $arField["PROPERTY_USER_TYPE"]["AddFilterFields"], "filter" => &$this->arResult["FILTER"][$i]);
}
} elseif ($arField["TYPE"] == "SORT" || $arField["TYPE"] == "N") {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "number");
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "G") {
$items = array();
$prop_secs = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arField["LINK_IBLOCK_ID"]));
while ($ar_sec = $prop_secs->Fetch()) {
$items[$ar_sec["ID"]] = str_repeat(". ", $ar_sec["DEPTH_LEVEL"] - 1) . $ar_sec["NAME"];
}
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "E") {
//Should be handled in template
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "E", "value" => $arField);
$arFilterable[$fieldId] = "";
} elseif ($arField["TYPE"] == "L") {
$items = array();
$propEnums = CIBlockProperty::GetPropertyEnum($arField["ID"]);
while ($arEnum = $propEnums->Fetch()) {
$items[$arEnum["ID"]] = $arEnum["VALUE"];
}
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
$arFilterable[$fieldId] = "";
} elseif (in_array($arField["TYPE"], array("S", "S:HTML", "NAME", "DETAIL_TEXT", "PREVIEW_TEXT"))) {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
$arFilterable[$fieldId] = "?";
} else {
$this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "fieldsType" => $arField["TYPE"]);
$arFilterable[$fieldId] = "";
}
$i++;
}
$arFilter = array();
$gridFilter = $gridOptions->GetFilter($this->arResult["FILTER"]);
foreach ($gridFilter as $key => $value) {
if (substr($key, -5) == "_from") {
$op = ">=";
$newKey = substr($key, 0, -5);
} elseif (substr($key, -3) == "_to") {
$op = "<=";
$newKey = substr($key, 0, -3);
if (array_key_exists($newKey, $arDateFilter)) {
if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
$value .= " 23:59:59";
}
//.........这里部分代码省略.........