コード例 #1
0
ファイル: class.php プロジェクト: ASDAFF/1C_Bitrix_info_site
 public static function getPropertyFieldSections($linkIblockId)
 {
     $linkIblockId = (int) $linkIblockId;
     if ($linkIblockId <= 0) {
         return false;
     }
     $ttl = 10000;
     $cache_id = 'catalog_store_sections';
     $cache_dir = '/bx/catalog_store_sections';
     $obCache = new CPHPCache();
     if ($obCache->InitCache($ttl, $cache_id, $cache_dir)) {
         $res = $obCache->GetVars();
     } else {
         $res = array();
     }
     if (!isset($res[$linkIblockId])) {
         $res[$linkIblockId] = array();
         $sections = \CIBlockSection::GetTreeList(array("IBLOCK_ID" => $linkIblockId));
         while ($row = $sections->Fetch()) {
             $res[$linkIblockId][] = $row;
         }
         if ($obCache->StartDataCache()) {
             $obCache->EndDataCache($res);
         }
     }
     return $res[$linkIblockId];
 }
コード例 #2
0
 function getMenu()
 {
     if (!is_array($this->arMenu)) {
         $menu = array();
         $arFilter = array("IBLOCK_ID" => (int) $GLOBALS['AQW_STORE']['IBLOCK_ID']);
         $GetTreeList = CIBlockSection::GetTreeList($arFilter);
         while ($item = $GetTreeList->GetNext()) {
             $menu[$item['ID']] = $item;
         }
         $this->arMenu = $menu;
     }
     return $this->arMenu;
 }
コード例 #3
0
ファイル: helper.php プロジェクト: mrdeadmouse/u136006
 public function getSubsections($catalogId, $sectionId)
 {
     $arSubsections = array();
     $resSection = CIBlockSection::GetList(array(), array('ID' => intval($sectionId)), false, array('ID', 'NAME', 'DEPTH_LEVEL', 'LEFT_MARGIN', 'RIGHT_MARGIN'));
     if ($resSection) {
         if ($arSection = $resSection->Fetch()) {
             $resElement = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $catalogId, '=SECTION_ID' => $arSection['ID'], '=DEPTH_LEVEL' => 1 + $arSection['DEPTH_LEVEL'], 'CHECK_PERMISSIONS' => 'N'), array('ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN'));
             while ($arElement = $resElement->Fetch()) {
                 $arSubsections[] = array('ID' => $arElement['ID'], 'NAME' => $arElement['NAME'], 'HAS_CHILDREN' => intval($arElement["RIGHT_MARGIN"]) - intval($arElement["LEFT_MARGIN"]) > 1 ? 'Y' : 'N', 'SELECTED' => 'N', 'CHILDREN' => array());
             }
         }
     }
     return $arSubsections;
 }
コード例 #4
0
 public function ImportSectionArray($arSectionName, $level = 0)
 {
     $sectionID = 0;
     $level = intval($level);
     if (is_array($arSectionName) && $this->iblockModuleIncluded) {
         $nSections = count($arSectionName);
         if ($nSections > 0 && $level < $nSections && $this->catalogID > 0) {
             $curSectionName = trim(strval($arSectionName[$level]));
             if ($curSectionName !== '') {
                 $curSectionHash = md5($curSectionName);
                 $parentSectionID = 0;
                 if ($level > 0) {
                     $parentSectionHash = md5(strval($arSectionName[$level - 1]));
                     if (is_array($this->sectionByNameCache[$level - 1]) && isset($this->sectionByNameCache[$level - 1][$parentSectionHash])) {
                         $parentSectionID = $this->sectionByNameCache[$level - 1][$parentSectionHash];
                     }
                 }
                 if ($parentSectionID > 0 || $level === 0) {
                     $curSectionID = 0;
                     if (is_array($this->sectionByNameCache[$level]) && isset($this->sectionByNameCache[$level][$curSectionHash])) {
                         $curSectionID = $this->sectionByNameCache[$level][$curSectionHash];
                     } else {
                         $dbRes = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $this->catalogID, '=SECTION_ID' => $parentSectionID, '=NAME' => $curSectionName, '=DEPTH_LEVEL' => $level + 1, 'CHECK_PERMISSIONS' => 'N'), array('ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN'));
                         if ($arRes = $dbRes->Fetch()) {
                             $curSectionID = $this->sectionByNameCache[$level][$curSectionHash] = intval($arRes['ID']);
                         }
                         unset($dbRes, $arRes);
                     }
                     if ($curSectionID === 0) {
                         $arSectionFields = array('CATALOG_ID' => $this->catalogID, 'SECTION_ID' => $parentSectionID, 'NAME' => $curSectionName);
                         $res = CCrmProductSection::Add($arSectionFields);
                         if ($res !== false) {
                             $curSectionID = $this->sectionByNameCache[$level][$curSectionHash] = intval($res);
                         }
                     }
                     if ($level === $nSections - 1) {
                         $sectionID = $curSectionID;
                     } else {
                         $sectionID = $this->ImportSectionArray($arSectionName, $level + 1);
                     }
                 }
             }
         }
     }
     return $sectionID;
 }
コード例 #5
0
ファイル: helper.php プロジェクト: mrdeadmouse/u136006
 public function getCrumbs($catalogId, $sectionId, $urlTemplate)
 {
     $arCrumbs = array();
     $arCrumb = array('ID' => 0, 'NAME' => GetMessage('CRM_PRODUCT_SECTION_ROOT_CRUMB_NAME'), 'LINK' => str_replace('#section_id#', '0', $urlTemplate), 'CHILDREN' => array());
     $resRootElements = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $catalogId, '=DEPTH_LEVEL' => 1, 'CHECK_PERMISSIONS' => 'N'), array('ID', 'NAME'));
     while ($arElement = $resRootElements->Fetch()) {
         $arCrumb['CHILDREN'][] = array('ID' => $arElement['ID'], 'NAME' => $arElement['NAME'], 'LINK' => str_replace('#section_id#', $arElement['ID'], $urlTemplate), 'CHILDREN' => array());
     }
     $arCrumbs[] = $arCrumb;
     $resElements = CIBlockSection::GetNavChain($catalogId, $sectionId, array('ID', 'NAME', 'DEPTH_LEVEL'));
     while ($arElement = $resElements->Fetch()) {
         $arCrumb = array('ID' => $arElement['ID'], 'NAME' => $arElement['NAME'], 'LINK' => str_replace('#section_id#', $arElement['ID'], $urlTemplate), 'CHILDREN' => array());
         $resElement = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $catalogId, '=SECTION_ID' => $arElement['ID'], '=DEPTH_LEVEL' => 1 + $arElement['DEPTH_LEVEL'], 'CHECK_PERMISSIONS' => 'N'), array('ID', 'NAME'));
         while ($arElement = $resElement->Fetch()) {
             $arCrumb['CHILDREN'][] = array('ID' => $arElement['ID'], 'NAME' => $arElement['NAME'], 'LINK' => str_replace('#section_id#', $arElement['ID'], $urlTemplate), 'CHILDREN' => array());
         }
         $arCrumbs[] = $arCrumb;
     }
     return $arCrumbs;
 }
コード例 #6
0
function _ShowGroupPropertyFieldList($name, $property_fields, $values)
{
    if (!is_array($values)) {
        $values = array();
    }
    $res = "";
    $result = "";
    $bWas = false;
    $sections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $property_fields["LINK_IBLOCK_ID"]));
    while ($ar = $sections->GetNext()) {
        $res .= '<option value="' . $ar["ID"] . '"';
        if (in_array($ar["ID"], $values)) {
            $bWas = true;
            $res .= ' selected';
        }
        $res .= '>' . str_repeat(" . ", $ar["DEPTH_LEVEL"]) . $ar["NAME"] . '</option>';
    }
    $result .= '<select name="' . $name . '[]" size="' . ($property_fields["MULTIPLE"] == "Y" ? "5" : "1") . '" ' . ($property_fields["MULTIPLE"] == "Y" ? "multiple" : "") . '>';
    $result .= '<option value=""' . (!$bWas ? ' selected' : '') . '>' . GetMessage("SPS_A_PROP_NOT_SET") . '</option>';
    $result .= $res;
    $result .= '</select>';
    return $result;
}
コード例 #7
0
    $arResult["ELEMENT"]["DETAIL_TEXT"] = htmlspecialcharsEx($_REQUEST["DESCRIPTION"]);
    $arResult["ELEMENT"]["TAGS"] = htmlspecialcharsEx($_REQUEST["TAGS"]);
    $arResult["ELEMENT"]["IBLOCK_SECTION_ID"] = htmlspecialcharsEx($_REQUEST["TO_SECTION_ID"]);
    $arResult["ELEMENT"]["DATE_CREATE"] = htmlspecialcharsEx($_REQUEST["DATE"]);
}
/********************************************************************
				Sections list
********************************************************************/
$arResult["SECTION_LIST"] = array();
$arFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"], "IBLOCK_ACTIVE" => "Y");
if ($arParams["BEHAVIOUR"] == "USER") {
    $arFilter["!ID"] = $arResult["GALLERY"]["ID"];
    $arFilter["RIGHT_MARGIN"] = $arResult["GALLERY"]["RIGHT_MARGIN"];
    $arFilter["LEFT_MARGIN"] = $arResult["GALLERY"]["LEFT_MARGIN"];
}
$rsIBlockSectionList = CIBlockSection::GetTreeList($arFilter);
while ($arSection = $rsIBlockSectionList->GetNext()) {
    $len = $arSection["DEPTH_LEVEL"] - 1;
    $arSection["NAME"] = ($len > 0 ? str_repeat(" . ", $len) : "") . $arSection["NAME"];
    $arResult["SECTION_LIST"][$arSection["ID"]] = $arSection["NAME"];
}
$arResult["I"] = array("PERMISSION" => $arParams["PERMISSION"], "ABS_PERMISSION" => $arParams["ABS_PERMISSION"]);
/********************************************************************
				/Data
********************************************************************/
$this->IncludeComponentTemplate();
/********************************************************************
				Standart
********************************************************************/
/************** Title **********************************************/
if ($arParams["SET_TITLE"] == "Y") {
コード例 #8
0
ファイル: .parameters.php プロジェクト: mrdeadmouse/u136006
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
CModule::IncludeModule('intranet');
$IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_structure', false);
$arSections = array(0 => '');
if ($IBLOCK_ID !== false) {
    $dbRes = CIBlockSection::GetTreeList(array('IBLOCK_ID' => $IBLOCK_ID, 'ACTIVE' => 'Y'));
    while ($arRes = $dbRes->Fetch()) {
        $arSections[$arRes['ID']] = trim(str_repeat('. ', $arRes['DEPTH_LEVEL'] - 1) . ' ' . $arRes['NAME']);
    }
}
$arComponentParameters = array('GROUPS' => array(), 'PARAMETERS' => array('AJAX_MODE' => array(), 'NUM_USERS' => array('TYPE' => 'STRING', 'MULTIPLE' => 'N', 'DEFAULT' => '10', 'NAME' => GetMessage('INTR_ISIN_PARAM_NUM_USERS'), 'PARENT' => 'BASE'), 'NAME_TEMPLATE' => array('TYPE' => 'LIST', 'NAME' => GetMessage('INTR_ISIN_PARAM_NAME_TEMPLATE'), 'VALUES' => CComponentUtil::GetDefaultNameTemplates(), 'MULTIPLE' => 'N', 'ADDITIONAL_VALUES' => 'Y', 'DEFAULT' => "", 'PARENT' => 'BASE'), "SHOW_LOGIN" => array("NAME" => GetMessage("INTR_ISIN_PARAM_SHOW_LOGIN"), "TYPE" => "CHECKBOX", "MULTIPLE" => "N", "VALUE" => "Y", "DEFAULT" => "Y", "PARENT" => "BASE"), "DEPARTMENT" => array("NAME" => GetMessage('INTR_PREDEF_DEPARTMENT'), "TYPE" => "LIST", 'VALUES' => $arSections, "DEFAULT" => ''), 'PM_URL' => array('TYPE' => 'STRING', 'DEFAULT' => '/company/personal/messages/chat/#USER_ID#/', 'NAME' => GetMessage('INTR_ISIN_PARAM_PM_URL'), 'PARENT' => 'BASE'), 'PATH_TO_CONPANY_DEPARTMENT' => array('TYPE' => 'STRING', 'DEFAULT' => '/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#', 'NAME' => GetMessage('INTR_ISIN_PARAM_PATH_TO_CONPANY_DEPARTMENT'), 'PARENT' => 'BASE'), "DATE_FORMAT" => CComponentUtil::GetDateFormatField(GetMessage("INTR_ISIN_PARAM_DATE_FORMAT"), 'ADDITIONAL_SETTINGS'), "DATE_TIME_FORMAT" => CComponentUtil::GetDateTimeFormatField(GetMessage("INTR_ISIN_PARAM_DATE_TIME_FORMAT"), 'ADDITIONAL_SETTINGS'), 'SHOW_YEAR' => array('TYPE' => 'LIST', 'MULTIPLE' => 'N', 'DEFAULT' => 'Y', 'VALUES' => array('Y' => GetMessage('INTR_ISIN_PARAM_SHOW_YEAR_VALUE_Y'), 'M' => GetMessage('INTR_ISIN_PARAM_SHOW_YEAR_VALUE_M'), 'N' => GetMessage('INTR_ISIN_PARAM_SHOW_YEAR_VALUE_N')), 'NAME' => GetMessage('INTR_ISIN_PARAM_SHOW_YEAR')), "CACHE_TIME" => array("DEFAULT" => 3600)));
コード例 #9
0
$lAdmin->AddHeaders($arHeader);
$arSelectedFields = $lAdmin->GetVisibleHeaderColumns();
$arSelectedProps = array();
foreach ($arProps as $i => $arProperty) {
    $k = array_search("PROPERTY_" . $arProperty['ID'], $arSelectedFields);
    if ($k !== false) {
        $arSelectedProps[] = $arProperty;
        if ($arProperty["PROPERTY_TYPE"] == "L") {
            $arSelect[$arProperty['ID']] = array();
            $rs = CIBlockProperty::GetPropertyEnum($arProperty['ID']);
            while ($ar = $rs->GetNext()) {
                $arSelect[$arProperty['ID']][$ar["ID"]] = $ar["VALUE"];
            }
        } elseif ($arProperty["PROPERTY_TYPE"] == "G") {
            $arSelect[$arProperty['ID']] = array();
            $rs = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $arProperty["LINK_IBLOCK_ID"]));
            while ($ar = $rs->GetNext()) {
                $arSelect[$arProperty['ID']][$ar["ID"]] = str_repeat(" . ", $ar["DEPTH_LEVEL"]) . $ar["NAME"];
            }
        }
        unset($arSelectedFields[$k]);
    }
}
if (!in_array("ID", $arSelectedFields)) {
    $arSelectedFields[] = "ID";
}
if (!in_array("CREATED_BY", $arSelectedFields)) {
    $arSelectedFields[] = "CREATED_BY";
}
$arSelectedFields[] = "LANG_DIR";
$arSelectedFields[] = "LID";
コード例 #10
0
							for(var j=0;j<oSelect.length;j++)
							{
								if(oSelect[j].value==a[i])
								{
									oSelect[j].selected=true;
									break;
								}
							}
						}
						change_selection(name_prefix, prop_id, a[i], i-1, id);
					}
				}
				var sectionListsFor0 = {id:0,name:'',children:Array()};

				<?
				$rsItems = CIBlockSection::GetTreeList(Array("IBLOCK_ID"=>$IBLOCK_ID));
				$depth = 0;
				$max_depth = 0;
				$arChain = array();
				while($arItem = $rsItems->GetNext())
				{
					if($max_depth < $arItem["DEPTH_LEVEL"])
					{
						$max_depth = $arItem["DEPTH_LEVEL"];
					}
					if($depth < $arItem["DEPTH_LEVEL"])
					{
						$arChain[]=$arItem["ID"];

					}
					while($depth > $arItem["DEPTH_LEVEL"])
コード例 #11
0
ファイル: component.php プロジェクト: webgksupport/alpina
                }
            } else {
                $data[$FIELD_ID]["n0"] = array("VALUE" => "", "DESCRIPTION" => "");
            }
        } else {
            $data[$FIELD_ID] = array("n0" => array("VALUE" => $arField["DEFAULT_VALUE"], "DESCRIPTION" => ""));
            if ($arField["MULTIPLE"] == "Y") {
                if (is_array($arField["DEFAULT_VALUE"]) || strlen($arField["DEFAULT_VALUE"])) {
                    $data[$FIELD_ID]["n1"] = array("VALUE" => "", "DESCRIPTION" => "");
                }
            }
        }
    }
}
$arResult["LIST_SECTIONS"] = array("" => GetMessage("CC_BLEE_UPPER_LEVEL"));
$rsSections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "CHECK_PERMISSIONS" => "N"));
while ($arSection = $rsSections->Fetch()) {
    $arResult["LIST_SECTIONS"][$arSection["ID"]] = str_repeat(" . ", $arSection["DEPTH_LEVEL"]) . $arSection["NAME"];
}
if ($arResult["IBLOCK"]["RIGHTS_MODE"] == 'E' && $arResult["CAN_EDIT_RIGHTS"]) {
    $arResult["RIGHTS"] = array();
    $arResult["SELECTED"] = array();
    if (IsModuleInstalled('bitrix24') && defined('BX24_HOST_NAME')) {
        if ($arParams["SOCNET_GROUP_ID"]) {
            $arResult["HIGHLIGHT"] = array("socnetgroup" => array("group_id" => $arParams["SOCNET_GROUP_ID"]), "groups" => array("disabled" => true));
        } else {
            $arResult["HIGHLIGHT"] = array("groups" => array("disabled" => true));
        }
    } else {
        if ($arParams["SOCNET_GROUP_ID"]) {
            $arResult["HIGHLIGHT"] = array("socnetgroup" => array("group_id" => $arParams["SOCNET_GROUP_ID"]));
コード例 #12
0
ファイル: ajax.php プロジェクト: webgksupport/alpina
 function EmployeeDrawStructure($arStructure, $arSections, $key, $win_id)
 {
     foreach ($arStructure[$key] as $ID) {
         $arRes = $arSections[$ID];
         echo '<div class="mts-section' . ($key == 0 ? '-first' : '') . '" style="padding-left: ' . ($arRes['DEPTH_LEVEL'] - 1) * 15 . 'px" onclick="document.getElementById(\'' . $win_id . '\').__object.LoadSection(\'' . $ID . '\')" id="mts_section_' . $ID . '">';
         echo '<div class="mts-section-name mts-closed">' . $arRes['NAME'] . '</div>';
         echo '</div>';
         echo '<div style="display: none" id="bx_children_' . $arRes['ID'] . '">';
         if (is_array($arStructure[$ID])) {
             EmployeeDrawStructure($arStructure, $arSections, $ID, $win_id);
         }
         echo '<div class="mts-list" id="mts_elements_' . $ID . '" style="margin-left: ' . $arRes['DEPTH_LEVEL'] * 15 . 'px"><i>' . GetMessage('CT_BMTS_WAIT') . '</i></div>';
         echo '</div>';
     }
 }
 $dbRes = CIBlockSection::GetTreeList(array('IBLOCK_ID' => $arIBlock["ID"], 'CHECK_PERMISSIONS' => $arParams['CAN_EDIT'] ? 'N' : 'Y'));
 $arStructure = array(0 => array());
 $arSections = array();
 while ($arRes = $dbRes->GetNext()) {
     if (!$arRes['IBLOCK_SECTION_ID']) {
         $arStructure[0][] = $arRes['ID'];
     } elseif (!is_array($arStructure[$arRes['IBLOCK_SECTION_ID']])) {
         $arStructure[$arRes['IBLOCK_SECTION_ID']] = array($arRes['ID']);
     } else {
         $arStructure[$arRes['IBLOCK_SECTION_ID']][] = $arRes['ID'];
     }
     $arSections[$arRes['ID']] = $arRes;
 }
 EmployeeDrawStructure($arStructure, $arSections, 0, $win_id);
 echo '<div style="display:none" id="mts_section_0">';
 echo '<div class="mts-section-name mts-closed"></div>';
コード例 #13
0
ファイル: template.php プロジェクト: mrdeadmouse/u136006
    $arTab1Fields[] = array("id" => "DEFAULT_VALUE[SCALE]", "name" => GetMessage("CT_BLFE_FIELD_PICTURE_SCALE"), "type" => "checkbox", "value" => isset($arResult["FORM_DATA"]["DEFAULT_VALUE"]["SCALE"]) ? $arResult["FORM_DATA"]["DEFAULT_VALUE"]["SCALE"] : '');
    $arTab1Fields[] = array("id" => "DEFAULT_VALUE[WIDTH]", "name" => GetMessage("CT_BLFE_FIELD_PICTURE_WIDTH"), "params" => array("size" => 7), "value" => isset($arResult["FORM_DATA"]["DEFAULT_VALUE"]["WIDTH"]) ? $arResult["FORM_DATA"]["DEFAULT_VALUE"]["WIDTH"] : '');
    $arTab1Fields[] = array("id" => "DEFAULT_VALUE[HEIGHT]", "name" => GetMessage("CT_BLFE_FIELD_PICTURE_HEIGHT"), "params" => array("size" => 7), "value" => isset($arResult["FORM_DATA"]["DEFAULT_VALUE"]["HEIGHT"]) ? $arResult["FORM_DATA"]["DEFAULT_VALUE"]["HEIGHT"] : '');
    $arTab1Fields[] = array("id" => "DEFAULT_VALUE[IGNORE_ERRORS]", "name" => GetMessage("CT_BLFE_FIELD_PICTURE_IGNORE_ERRORS"), "type" => "checkbox", "value" => isset($arResult["FORM_DATA"]["DEFAULT_VALUE"]["IGNORE_ERRORS"]) ? $arResult["FORM_DATA"]["DEFAULT_VALUE"]["IGNORE_ERRORS"] : '');
} elseif (preg_match("/^(L|L:)/", $arResult["FORM_DATA"]["TYPE"])) {
    //No default value input
} elseif (preg_match("/^(F|F:)/", $arResult["FORM_DATA"]["TYPE"])) {
    //No default value input
} elseif (preg_match("/^(G|G:)/", $arResult["FORM_DATA"]["TYPE"])) {
    $LINK = $arResult["FORM_DATA"]["LINK_IBLOCK_ID"];
    if ($LINK <= 0) {
        list($LINK, ) = each($arResult["LINK_IBLOCKS"]);
    }
    $items = array("" => GetMessage("CT_BLFE_NO_VALUE"));
    if ($LINK > 0) {
        $rsSections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $LINK));
        while ($ar = $rsSections->Fetch()) {
            $items[$ar["ID"]] = str_repeat(" . ", $ar["DEPTH_LEVEL"]) . $ar["NAME"];
        }
    }
    $arTab1Fields[] = array("id" => "DEFAULT_VALUE", "name" => GetMessage("CT_BLFE_FIELD_DEFAULT_VALUE"), "type" => "list", "items" => $items);
} elseif (preg_match("/^(E|E:)/", $arResult["FORM_DATA"]["TYPE"])) {
    //No default value input
} elseif (!is_array($arPropertyFields["HIDE"]) || !in_array("DEFAULT_VALUE", $arPropertyFields["HIDE"])) {
    //Show default property value input if it was not cancelled by property
    if (is_array($arUserType)) {
        if (array_key_exists("GetPublicEditHTML", $arUserType)) {
            $html = '';
            if ($arResult["FORM_DATA"]["TYPE"] == "S:HTML") {
                $params = array('width' => '100%', 'height' => '200px');
                if (is_array($arResult["FORM_DATA"]["~DEFAULT_VALUE"])) {
コード例 #14
0
				<select name="filter_section">
					<option value="">(<?php 
    echo GetMessage("SPS_ANY");
    ?>
)</option>
					<option value="0"<?php 
    if ($filter_section == "0") {
        echo " selected";
    }
    ?>
><?php 
    echo GetMessage("SPS_TOP_LEVEL");
    ?>
</option>
					<?php 
    $bsections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $IBLOCK_ID));
    while ($bsections->ExtractFields("s_")) {
        ?>
<option value="<?php 
        echo $s_ID;
        ?>
"<?php 
        if ($s_ID == $filter_section) {
            echo " selected";
        }
        ?>
><?php 
        echo str_repeat("&nbsp;.&nbsp;", $s_DEPTH_LEVEL);
        echo $s_NAME;
        ?>
</option><?php 
コード例 #15
0
ファイル: ldap_util.php プロジェクト: ASDAFF/bxApiDocs
 public static function getDepartmentListFromSystem($arFilter = array())
 {
     if (!IsModuleInstalled('intranet')) {
         return false;
     }
     $l = false;
     if (CModule::IncludeModule('iblock')) {
         $iblockId = COption::GetOptionInt("intranet", "iblock_structure", false, false);
         if ($iblockId) {
             $arFilter["IBLOCK_ID"] = $iblockId;
             $arFilter["CHECK_PERMISSIONS"] = "N";
             $l = CIBlockSection::GetTreeList($arFilter);
         }
     }
     return $l;
 }
コード例 #16
0
$arSelectedFields = $lAdmin->GetVisibleHeaderColumns();
$arSelectedProps = array();
$arSelect = array();
foreach ($arProps as $i => $arProperty) {
    $k = array_search("PROPERTY_" . $arProperty['ID'], $arSelectedFields);
    if ($k !== false) {
        $arSelectedProps[] = $arProperty;
        if ($arProperty["PROPERTY_TYPE"] == "L") {
            $arSelect[$arProperty['ID']] = array();
            $rs = CIBlockProperty::GetPropertyEnum($arProperty['ID']);
            while ($ar = $rs->GetNext()) {
                $arSelect[$arProperty['ID']][$ar["ID"]] = $ar["VALUE"];
            }
        } elseif ($arProperty["PROPERTY_TYPE"] == "G") {
            $arSelect[$arProperty['ID']] = array();
            $rs = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $arProperty["LINK_IBLOCK_ID"]), array("ID", "NAME", "DEPTH_LEVEL"));
            while ($ar = $rs->GetNext()) {
                $arSelect[$arProperty['ID']][$ar["ID"]] = str_repeat(" . ", $ar["DEPTH_LEVEL"]) . $ar["NAME"];
            }
        }
        unset($arSelectedFields[$k]);
    }
}
if (!in_array("ID", $arSelectedFields)) {
    $arSelectedFields[] = "ID";
}
if (!in_array("CREATED_BY", $arSelectedFields)) {
    $arSelectedFields[] = "CREATED_BY";
}
$arSelectedFields[] = "LANG_DIR";
$arSelectedFields[] = "LID";
コード例 #17
0
ファイル: index.php プロジェクト: akniyev/arteva.ru
        public static function buildIblockTree($code, $path, $priority)
        {
            echo 'path=';
            var_dump($path);
            $sections = [];
            $res = CIBlockSection::GetTreeList(
                ['IBLOCK_CODE' => $code],
                []
            );
            while ($section = $res->Fetch())
            {
                $sections[ $section['ID'] ] = [
                    'ID'     => $section['ID'],
                    'CODE'   => $section['CODE'],
                    'NAME'   => $section['NAME'],
                    'PARENT' => $section['IBLOCK_SECTION_ID'],
                ];
            }
            $res = CIBlockElement::GetList(
                [],
                [
                    'IBLOCK_CODE' => $code,
                    '!CODE'       => false
                ]
            );
            while ($element = $res->Fetch())
            {
                $sections[ $element['ID'] ] = [
                    'ID'     => $element['ID'],
                    'CODE'   => $element['CODE'],
                    'NAME'   => $element['NAME'],
                    'PARENT' => $element['IBLOCK_SECTION_ID'],
                ];
            }

            /* полное дерево папок инфоблока */

            return self::get_section_children(
                $sections,
                $path,
                $priority
            );
        }
コード例 #18
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arResult['USER_PROP'] = array();
TrimArr($arParams['USER_PROPERTY']);
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
if (!empty($arRes)) {
    foreach ($arRes as $key => $val) {
        $arResult['USER_PROP'][$val["FIELD_NAME"]] = strlen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
    }
}
$dbRes = CIBlockSection::GetTreeList(array('IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_structure')));
while ($arRes = $dbRes->Fetch()) {
    $arRes['USERS'] = array();
    $arResult['DEPARTMENTS'][$arRes['ID']] = $arRes;
}
foreach ($arResult['USERS'] as $arUser) {
    foreach ($arUser['UF_DEPARTMENT'] as $dept_id => $dept) {
        if (!is_array($arResult['FILTER_VALUES']['UF_DEPARTMENT']) || in_array($dept_id, $arResult['FILTER_VALUES']['UF_DEPARTMENT'])) {
            $arResult['DEPARTMENTS'][$dept_id]['USERS'][] = $arUser;
        }
    }
}
if (!CModule::IncludeModule('extranet') || !CExtranet::IsExtranetSite()) {
    if ($arResult['bAdmin']) {
        global $INTRANET_TOOLBAR;
        __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
        $current_dep = intval($_REQUEST['structure_UF_DEPARTMENT']) > 0 ? '&def_UF_DEPARTMENT=' . intval($_REQUEST['structure_UF_DEPARTMENT']) : '';
        $INTRANET_TOOLBAR->AddButton(array('ONCLICK' => $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/user_edit.php?lang=" . LANGUAGE_ID . "&bxpublic=Y&from_module=main" . $current_dep, 'PARAMS' => array('height' => 500, 'width' => 900, 'resize' => false))), "TEXT" => GetMessage('INTR_ABSC_TPL_ADD_ENTRY'), "ICON" => 'add', "SORT" => 1000));
コード例 #19
0
			</script>

			<?php 
$arIBlockCache = array();
$arIBlockTypeCache = array();
$maxLevel = 0;
$dbIBlockList = CIBlock::GetList(array("IBLOCK_TYPE" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y"));
while ($arIBlock = $dbIBlockList->Fetch()) {
    $arIBlockCache[] = $arIBlock;
    if (!array_key_exists($arIBlock["IBLOCK_TYPE_ID"], $arIBlockTypeCache)) {
        if ($arIBlockType = CIBlockType::GetByIDLang($arIBlock["IBLOCK_TYPE_ID"], LANG, true)) {
            $arIBlockTypeCache[$arIBlock["IBLOCK_TYPE_ID"]] = $arIBlockType["NAME"];
        }
    }
    $arSections = array();
    $dbSectionTree = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $arIBlock["ID"]));
    while ($arSectionTree = $dbSectionTree->Fetch()) {
        if ($maxLevel < $arSectionTree["DEPTH_LEVEL"]) {
            $maxLevel = $arSectionTree["DEPTH_LEVEL"];
        }
        $arSectionTree["IBLOCK_SECTION_ID"] = IntVal($arSectionTree["IBLOCK_SECTION_ID"]);
        if (!is_array($arSections[$arSectionTree["IBLOCK_SECTION_ID"]])) {
            $arSections[$arSectionTree["IBLOCK_SECTION_ID"]] = array();
        }
        $arSections[$arSectionTree["IBLOCK_SECTION_ID"]][] = array("ID" => $arSectionTree["ID"], "NAME" => $arSectionTree["NAME"]);
    }
    $str1 = "";
    $str2 = "";
    foreach ($arSections as $sectionID => $arSubSection) {
        $str1 .= "itm_id['" . $arIBlock["ID"] . "']['" . $sectionID . "'] = new Array(0";
        $str2 .= "itm_name['" . $arIBlock["ID"] . "']['" . $sectionID . "'] = new Array(''";
コード例 #20
0
ファイル: ajax.php プロジェクト: ASDAFF/open_bx
			echo '<div class="mts-section-name mts-closed">'.$arRes['NAME'].'</div>';
			echo '</div>';

			echo '<div style="display: none" id="bx_children_'.$arRes['ID'].'">';
			if (is_array($arStructure[$ID]))
			{
				EmployeeDrawStructure($arStructure, $arSections, $ID, $win_id);
			}
			echo '<div class="mts-list" id="mts_elements_'.$ID.'" style="margin-left: '.($arRes['DEPTH_LEVEL']*15).'px"><i>'.Loc::getMessage('CT_BMTS_WAIT').'</i></div>';
			echo '</div>';

		}
	}

	$dbRes = CIBlockSection::GetTreeList(array(
		'IBLOCK_ID' => $arIBlock["ID"],
		'CHECK_PERMISSIONS' => 'N',
	));
	$arStructure = array(0 => array());
	$arSections = array();
	while ($arRes = $dbRes->GetNext())
	{
		if (!$arRes['IBLOCK_SECTION_ID'])
			$arStructure[0][] = $arRes['ID'];
		elseif (!is_array($arStructure[$arRes['IBLOCK_SECTION_ID']]))
			$arStructure[$arRes['IBLOCK_SECTION_ID']] = array($arRes['ID']);
		else
			$arStructure[$arRes['IBLOCK_SECTION_ID']][] = $arRes['ID'];

		$arSections[$arRes['ID']] = $arRes;
	}
コード例 #21
0
/**
 * @param $name
 * @param $property_fields
 * @param $values
 * @return bool|string
 */
function _ShowGroupPropertyFieldList($name, $property_fields, $values)
{
    if (!is_array($values)) {
        $values = array();
    }
    static $linkIblockId;
    static $sections = null;
    $res = "";
    $result = "";
    $bWas = false;
    $ttl = 10000;
    $cache_id = 'catalog_store_sections';
    $obCache = new CPHPCache();
    $cache_dir = '/bx/catalog_store_sections';
    if (!$linkIblockId || $property_fields["LINK_IBLOCK_ID"] != $linkIblockId) {
        $linkIblockId = $property_fields["LINK_IBLOCK_ID"];
        if (intval($linkIblockId) <= 0) {
            return false;
        }
        $obCache->Clean($cache_id, $cache_dir);
    }
    if ($obCache->InitCache($ttl, $cache_id, $cache_dir)) {
        $res = $obCache->GetVars();
    } else {
        if ($sections === null) {
            $sections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $linkIblockId));
        }
        while ($ar = $sections->GetNext()) {
            $res .= '<option value="' . $ar["ID"] . '"';
            if (in_array($ar["ID"], $values)) {
                $bWas = true;
                $res .= ' selected';
            }
            $res .= '>' . str_repeat(" . ", $ar["DEPTH_LEVEL"]) . $ar["NAME"] . '</option>';
        }
        if ($obCache->StartDataCache()) {
            $obCache->EndDataCache($res);
        }
    }
    $result .= '<select name="' . $name . '[]" size="' . ($property_fields["MULTIPLE"] == "Y" ? "5" : "1") . '" ' . ($property_fields["MULTIPLE"] == "Y" ? "multiple" : "") . '>';
    $result .= '<option value=""' . (!$bWas ? ' selected' : '') . '>' . GetMessage("SPS_A_PROP_NOT_SET") . '</option>';
    $result .= $res;
    $result .= '</select>';
    return $result;
}
コード例 #22
0
ファイル: class.php プロジェクト: webgksupport/alpina
 protected function renderFieldByTypeG(array $field)
 {
     $items = array();
     $sections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $field["LINK_IBLOCK_ID"]));
     while ($section = $sections->GetNext()) {
         $items[$section["ID"]] = htmlspecialcharsbx(str_repeat(" . ", $section["DEPTH_LEVEL"]) . $section["~NAME"]);
     }
     if ($field['MULTIPLE'] == 'Y') {
         $results = array();
         foreach ($field['VALUE'] as $value) {
             $results[] = $items[$value];
         }
         $result = implode('<br>', $results);
     } else {
         $result = $items[$field['VALUE']];
     }
     return $result;
 }
コード例 #23
0
ファイル: result_modifier.php プロジェクト: romlg/bitrixcode
<?php

$arDescriptions = array();
$arSectionTree = array();
$rsTree = CIBlockSection::GetTreeList(array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'ACTIVE' => 'Y'));
while ($arTree = $rsTree->GetNext()) {
    $arResult['SectionTree'][$arTree['ID']] = array('ID' => $arTree['ID'], 'NAME' => $arTree['NAME'], 'SORT' => $arTree['SORT'], 'DESCRIPTION' => $arTree['DESCRIPTION'], 'IBLOCK_SECTION_ID' => $arTree['IBLOCK_SECTION_ID'], 'DEPTH_LEVEL' => $arTree['DEPTH_LEVEL'], 'SECTION_PAGE_URL' => $arTree['SECTION_PAGE_URL'], 'ITEMS' => array(), 'ITEMS_COUNT' => 0);
    if (!empty($arTree['DESCRIPTION'])) {
        if (!is_set($arResult['descriptions'][$arTree['DESCRIPTION']])) {
            $arResult['descriptions'][$arTree['DESCRIPTION']] = array('title' => $arTree['DESCRIPTION'], 'section_id' => array($arTree['ID']));
        } else {
            $arResult['descriptions'][$arTree['DESCRIPTION']]['section_id'][] = $arTree['ID'];
        }
    } else {
        $arResult['SectionTree'][$arTree['ID']]['DESCRIPTION'] = $arResult['SectionTree'][$arTree['IBLOCK_SECTION_ID']]['DESCRIPTION'];
    }
}
function IncItemsCount($id, &$tree)
{
    if (empty($id)) {
        return;
    }
    $tree[$id]['ITEMS_COUNT']++;
    if (intval($tree[$id]['IBLOCK_SECTION_ID']) > 0) {
        IncItemsCount($tree[$id]['IBLOCK_SECTION_ID'], $tree);
    }
}
if (!empty($arResult['ITEMS'])) {
    foreach ($arResult['ITEMS'] as $arItem) {
        $arResult['SectionTree'][$arItem['IBLOCK_SECTION_ID']]['ITEMS'][$arItem['ID']] = array('ID' => $arItem['ID'], 'NAME' => $arItem['NAME'], 'DETAIL_PAGE_URL' => $arItem['DETAIL_PAGE_URL'], 'MIN_PRICE' => $arItem['MIN_PRICE'], 'IBLOCK_SECTION_ID' => $arItem['IBLOCK_SECTION_ID'], 'DETAIL_URL' => $arItem["DETAIL_PAGE_URL"], 'DESCRIPTION' => $arResult['SectionTree'][$arItem['IBLOCK_SECTION_ID']]['DESCRIPTION']);
        IncItemsCount($arItem['IBLOCK_SECTION_ID'], $arResult['SectionTree']);
コード例 #24
0
function _ShowGroupPropertyField($name, $property_fields, $values)
{
	if(!is_array($values)) $values = array();

	$res = "";
	$bWas = false;
	$sections = CIBlockSection::GetTreeList(array("IBLOCK_ID"=>$property_fields["LINK_IBLOCK_ID"]), array("ID", "NAME", "DEPTH_LEVEL"));
	while($ar = $sections->GetNext())
	{
		$res .= '<option value="'.$ar["ID"].'"';
		if(in_array($ar["ID"], $values))
		{
			$bWas = true;
			$res .= ' selected';
		}
		$res .= '>'.str_repeat(" . ", $ar["DEPTH_LEVEL"]).$ar["NAME"].'</option>';
	}
	echo '<select name="'.$name.'[]">';
	echo '<option value=""'.(!$bWas?' selected':'').'>'.GetMessage("IBLOCK_ELSEARCH_NOT_SET").'</option>';
	echo $res;
	echo '</select>';
}
コード例 #25
0
 public static function init()
 {
     IncludeModuleLangFile(__FILE__);
     if (!self::$fInit) {
         self::$fInit = true;
         self::$siteCookieId = md5('SALE_REPORT_SITE_ID');
         // Initializing list of sites.
         $result = Bitrix\Main\SiteTable::getList(array('select' => array('LID', 'DEF', 'NAME')));
         $i = 0;
         while ($row = $result->fetch()) {
             self::$sitelist[$row['LID']] = $row['NAME'];
             if (++$i === 1) {
                 self::$defaultSiteId = $row['LID'];
             } else {
                 if ($row['DEF'] === 'Y') {
                     self::$defaultSiteId = $row['LID'];
                 }
             }
             self::$weightOptions[$row['LID']] = array('unit' => COption::GetOptionString('sale', 'weight_unit', null, $row['LID']), 'koef' => COption::GetOptionInt('sale', 'weight_koef', null, $row['LID']));
         }
         unset($i, $row, $result);
         // hack, add virtual ID field into StatusLang entity for filtering
         $statusEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\StatusLang');
         if ($statusEntity instanceof \Bitrix\Main\Entity\Base) {
             $statusEntity->addField(array('data_type' => 'string', 'expression' => array('%s', 'STATUS_ID')), 'ID');
         }
         unset($statusEntity);
         // hack, add virtual REPS_ORDER field into Shipment entity for filtering system records
         $shipmentEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\Shipment');
         if ($shipmentEntity instanceof \Bitrix\Main\Entity\Base) {
             $shipmentEntity->addField(array('data_type' => 'Order', 'reference' => array('=ref.ID' => 'this.ORDER_ID', '!=this.SYSTEM' => array('?', 'Y'))), 'REPS_ORDER');
         }
         unset($shipmentEntity);
         // Initializing list of statuses of orders.
         $result = Bitrix\Sale\Internals\StatusLangTable::getList(array('select' => array('STATUS_ID', 'NAME'), 'filter' => array('=LID' => LANGUAGE_ID)));
         while ($row = $result->fetch()) {
             self::$statuslist[$row['STATUS_ID']] = $row['NAME'];
         }
         unset($row, $result);
         self::$genders = array('M' => GetMessage('USER_MALE'), 'F' => GetMessage('USER_FEMALE'));
         // Initializing list of person types.
         $result = Bitrix\Sale\Internals\PersonTypeTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$personTypes[$row['ID']] = array('LID' => $row['LID'], 'NAME' => $row['NAME']);
         }
         unset($row, $result);
         // Initializing list of pay systems of orders.
         $result = Bitrix\Sale\PaySystemTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$paySystemList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => $row['LID']);
         }
         unset($row, $result);
         // Initializing list of services and methods of delivery.
         $result = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$deliveryList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => '');
         }
         unset($row, $result);
         // Obtaining table of correspondences of iblocks to sites.
         $result = Bitrix\Iblock\IblockSiteTable::getList();
         while ($row = $result->fetch()) {
             self::$iblockSite[$row['SITE_ID']][] = $row['IBLOCK_ID'];
         }
         unset($row, $result);
         // Obtaining the list of iblocks which are directories and filling
         // a property $catalogSections with sections of these units.
         $ent = new CCatalog();
         $result = $ent->GetList();
         while ($ibRow = $result->Fetch()) {
             // Obtaining list of sections of the catalog.
             self::$catalogs[] = $ibRow;
             $path = array();
             $curLevel = $prevLevel = 0;
             $sections = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $ibRow['IBLOCK_ID']));
             $row = null;
             while ($row = $sections->GetNext()) {
                 // Formation of an array of identifiers of current and parent sections.
                 $curLevel = $row['DEPTH_LEVEL'];
                 for ($i = 0; $i <= $prevLevel - $curLevel; $i++) {
                     array_pop($path);
                 }
                 array_push($path, $row['ID']);
                 $prevLevel = $curLevel;
                 self::$catalogSections[$row['ID']] = array('name' => ltrim(str_repeat(' . ', $curLevel) . $row['NAME']), 'path' => $path, 'catalog' => array('ID' => $ibRow['ID'], 'NAME' => $ibRow['NAME']));
             }
         }
         unset($ent, $ibRow, $row, $sections, $result);
         // Initialization of the list of warehouses.
         $result = Bitrix\Catalog\StoreTable::getList(array('select' => array('ID', 'TITLE')));
         while ($row = $result->fetch()) {
             self::$productStores[$row['ID']] = $row['TITLE'];
         }
         unset($row, $result);
         // Getting currencies
         $obj = new CCurrency();
         $by = '';
         $order = '';
         $result = $obj->GetList($by, $order, LANGUAGE_ID);
         while ($row = $result->Fetch()) {
             self::$currencies[$row['CURRENCY']] = array('name' => $row['FULL_NAME']);
         }
         unset($row, $result, $obj, $by, $order);
         // Getting types of prices
         $obj = new CCatalogGroup();
         $result = $obj->GetListEx(array('SORT'), array(), false, false, array('ID', 'NAME', 'BASE', 'NAME_LANG'));
         while ($row = $result->Fetch()) {
             self::$priceTypes[$row['ID']] = array('name' => empty($row['NAME_LANG']) ? $row['NAME'] : $row['NAME_LANG'], 'base' => $row['BASE'] === 'Y' ? true : false);
         }
         unset($row, $result, $obj);
         // Getting option, which means, it is necessary to display a fractional quantity of goods of no.
         self::$fDecimalQuant = COption::GetOptionString('sale', 'QUANTITY_FACTORIAL') == 'Y';
         self::initOwners();
     }
 }
コード例 #26
0
							for(var j=0;j<oSelect.length;j++)
							{
								if(oSelect[j].value==a[i])
								{
									oSelect[j].selected=true;
									break;
								}
							}
						}
						change_selection(name_prefix, prop_id, a[i], i-1, id);
					}
				}
				var sectionListsFor0 = {id:0,name:'',children:Array()};

				<?
				$rsItems = CIBlockSection::GetTreeList(Array("IBLOCK_ID"=>$IBLOCK_ID), array("ID", "NAME", "DEPTH_LEVEL"));
				$depth = 0;
				$max_depth = 0;
				$arChain = array();
				while($arItem = $rsItems->GetNext())
				{
					if($max_depth < $arItem["DEPTH_LEVEL"])
					{
						$max_depth = $arItem["DEPTH_LEVEL"];
					}
					if($depth < $arItem["DEPTH_LEVEL"])
					{
						$arChain[]=$arItem["ID"];

					}
					while($depth > $arItem["DEPTH_LEVEL"])
コード例 #27
0
ファイル: .parameters.php プロジェクト: mrdeadmouse/u136006
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arComponentProps = CComponentUtil::GetComponentProps("bitrix:intranet.structure.informer.absent", $arCurrentValues);
$arParameters = array("PARAMETERS" => array("LIST_URL" => array("NAME" => GetMessage("GD_ABSENT_P_URL"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "/company/absence.php")), "USER_PARAMETERS" => array("NUM_USERS" => $arComponentProps["PARAMETERS"]["NUM_USERS"]));
$arParameters["USER_PARAMETERS"]["NUM_USERS"]["DEFAULT"] = 5;
$arDepartments = array();
$arUserFields = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields('USER', 0, LANGUAGE_ID);
if ($arUserFields["UF_DEPARTMENT"]["SETTINGS"]["IBLOCK_ID"] > 0) {
    $dbRes = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $arUserFields["UF_DEPARTMENT"]["SETTINGS"]["IBLOCK_ID"], "GLOBAL_ACTIVE" => "Y"));
    $arDepartments["-"] = GetMessage("GD_ABSENT_P_ALL");
    while ($arRes = $dbRes->GetNext()) {
        $arDepartments[$arRes["ID"]] = str_repeat(". ", $arRes["DEPTH_LEVEL"]) . $arRes["NAME"];
    }
    $arParameters["USER_PARAMETERS"]["DEPARTMENT"] = array("NAME" => GetMessage("GD_ABSENT_P_DEP"), "TYPE" => "LIST", "VALUES" => $arDepartments, "MULTIPLE" => "N", "DEFAULT" => "");
}
コード例 #28
0
ファイル: iblock.php プロジェクト: mrdeadmouse/u136006
 function GetSectionsTree($options = array())
 {
     static $dataType = 'SectionsTree';
     if (empty($options['prependPath'])) {
         $options['prependPath'] = '';
     }
     $dataCache = $options;
     $dataCache['IBLOCK_ID'] = $this->IBLOCK_ID;
     $dataCache['ROOT_SECTION_ID'] = empty($this->arRootSection['ID']) ? 0 : $this->arRootSection['ID'];
     $id = md5(serialize($dataCache));
     $sections = $this->_dataCache($dataType . $id);
     if ($sections === false) {
         $arElement = $this->GetObject($options, false, true);
         if ($arElement["not_found"]) {
             $sections = array();
         } else {
             $arFilter = array("IBLOCK_ID" => $this->IBLOCK_ID);
             if (isset($options['not_check_permissions'])) {
                 $arFilter['CHECK_PERMISSIONS'] = 'N';
             }
             $bRootFounded = empty($this->arRootSection) ? true : false;
             if ($arElement["item_id"] > 0 && !empty($arElement["dir_array"])) {
                 $arFilter["LEFT_MARGIN"] = intVal($arElement["dir_array"]["LEFT_MARGIN"]) + 1;
                 $arFilter["RIGHT_MARGIN"] = intVal($arElement["dir_array"]["RIGHT_MARGIN"]) - 1;
             } elseif (!empty($this->arRootSection)) {
                 $arFilter["LEFT_MARGIN"] = intVal($this->arRootSection["LEFT_MARGIN"]) + 1;
                 $arFilter["RIGHT_MARGIN"] = intVal($this->arRootSection["RIGHT_MARGIN"]) - 1;
             }
             if (!empty($arElement["is_dir"]) && $arElement["item_id"]) {
                 list($contextType, $contextEntityId) = $this->getContextData();
                 $sectionData = $this->getSectionDataForLinkAnalyze($arElement["item_id"], $arElement);
                 $iblockId = $sectionData['IBLOCK_ID'];
                 if (CWebDavSymlinkHelper::isLink($contextType, $contextEntityId, $sectionData)) {
                     $arFilter['IBLOCK_ID'] = $iblockId;
                     $symlinkSectionData = CWebDavSymlinkHelper::getLinkData($contextType, $contextEntityId, $sectionData);
                     if (!empty($symlinkSectionData[self::UF_LINK_SECTION_ID]) && $symlinkSectionData['ID'] == $arElement["item_id"]) {
                         $margins = CIBlockSection::GetList(array(), array('ID' => $symlinkSectionData[self::UF_LINK_SECTION_ID], 'IBLOCK_ID' => $symlinkSectionData[self::UF_LINK_IBLOCK_ID], 'CHECK_PERMISSIONS' => 'N'), false, array('LEFT_MARGIN', 'RIGHT_MARGIN', 'IBLOCK_ID'))->fetch();
                         if ($margins) {
                             $arFilter["LEFT_MARGIN"] = intVal($margins["LEFT_MARGIN"]) + 1;
                             $arFilter["RIGHT_MARGIN"] = intVal($margins["RIGHT_MARGIN"]) - 1;
                         }
                     }
                 }
             }
             $arResult = array();
             $db_res = CIBlockSection::GetTreeList($arFilter, array('ID', 'CREATED_BY', 'MODIFIED_BY', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'DEPTH_LEVEL', 'SOCNET_GROUP_ID', 'IBLOCK_CODE', 'TIMESTAMP_X'));
             // TODO: add e_rights check
             $trashID = $this->GetMetaID('TRASH');
             if ($db_res && ($res = $db_res->Fetch())) {
                 $deep = -1;
                 $arPath = array();
                 $arExclude = array();
                 do {
                     if ($this->MetaNames($res)) {
                         $res["DEPTH_LEVEL"] = intVal($res["DEPTH_LEVEL"]);
                         if (isset($arExclude[(int) $res["IBLOCK_SECTION_ID"]]) || $this->MetaSectionHide($res, !empty($options['NON_DROPPED_SECTION']))) {
                             $arExclude[(int) $res["ID"]] = true;
                         } else {
                             if ($res["DEPTH_LEVEL"] > $deep) {
                                 $deep = $res["DEPTH_LEVEL"];
                                 array_push($arPath, strtolower(htmlspecialcharsbx($res["NAME"])));
                             } elseif ($res["DEPTH_LEVEL"] == $deep) {
                                 array_pop($arPath);
                                 array_push($arPath, strtolower(htmlspecialcharsbx($res["NAME"])));
                             } else {
                                 while ($res["DEPTH_LEVEL"] < $deep) {
                                     array_pop($arPath);
                                     $deep--;
                                 }
                                 array_pop($arPath);
                                 array_push($arPath, strtolower(htmlspecialcharsbx($res["NAME"])));
                             }
                             $res["PATH"] = $options['prependPath'] . implode("/", $arPath);
                             $arResult[$res["ID"]] = $res;
                         }
                     } else {
                         $arExclude[(int) $res["ID"]] = true;
                     }
                 } while ($res = $db_res->Fetch());
             }
             $sections = $arResult;
         }
         $this->_dataCache($dataType . $id, $sections);
     }
     if (!empty($options['setERights'])) {
         $sectionIds = array();
         foreach ($sections as $section) {
             $sectionIds[] = $section['ID'];
         }
         unset($section);
         $sectionRights = $this->GetPermissions('SECTION', $sectionIds);
         foreach ($sections as &$section) {
             if (isset($sectionRights[$section['ID']])) {
                 $section['E_RIGHTS'] = $sectionRights[$section['ID']];
             }
         }
         unset($section);
     }
     global $USER;
     if (!empty($options['SET_IS_SHARED']) && $USER->getId()) {
         $querySelfSharedSections = \Bitrix\Webdav\FolderInviteTable::getList(array('filter' => array('USER_ID' => $USER->getId(), '!=INVITE_USER_ID' => $USER->getId()), 'select' => array('SECTION_ID', 'IBLOCK_ID')));
         while ($folderInvite = $querySelfSharedSections->fetch()) {
             $selfSharedSections[$folderInvite['SECTION_ID']] = $folderInvite;
         }
         unset($folderInvite);
         foreach ($sections as &$section) {
             if (isset($selfSharedSections[$section['ID']])) {
                 $section['IS_SHARED'] = true;
             }
         }
         unset($section);
     }
     return $sections;
 }
コード例 #29
0
ファイル: ajax.php プロジェクト: mrdeadmouse/u136006
    protected function createPreparedFields()
    {
        $this->lists['PREPARED_FIELDS'] = array();
        $this->lists['ELEMENT_ID'] = 0;
        $this->createFormData();
        $this->getElementFields();
        foreach ($this->lists['FIELDS'] as $fieldId => $field) {
            if ($fieldId == 'ACTIVE_FROM' || $fieldId == 'ACTIVE_TO') {
                $this->lists['PREPARED_FIELDS'][$fieldId] = array('id' => $fieldId . '[' . $this->iblockId . ']', 'name' => $field['NAME'], 'required' => $field['IS_REQUIRED'] == 'Y' ? true : false, 'type' => 'date', 'value' => $this->lists['FORM_DATA'][$fieldId]);
            } elseif ($fieldId == 'PREVIEW_PICTURE' || $fieldId == 'DETAIL_PICTURE') {
                $this->lists['PREPARED_FIELDS'][$fieldId] = array('id' => $fieldId, 'name' => $field['NAME'], 'required' => $field['IS_REQUIRED'] == 'Y' ? true : false, 'type' => 'file');
            } elseif ($fieldId == 'PREVIEW_TEXT' || $fieldId == 'DETAIL_TEXT') {
                if ($field['SETTINGS']['USE_EDITOR'] == 'Y') {
                    $params = array('width' => '100%', 'height' => '200px', 'iblockId' => $this->iblockId);
                    $match = array();
                    if (preg_match('/\\s*(\\d+)\\s*(px|%|)/', $field['SETTINGS']['WIDTH'], $match) && $match[1] > 0) {
                        $params['width'] = $match[1] . $match[2];
                    }
                    if (preg_match('/\\s*(\\d+)\\s*(px|%|)/', $field['SETTINGS']['HEIGHT'], $match) && $match[1] > 0) {
                        $params['height'] = $match[1] . $match[2];
                    }
                    $html = $this->connectionHtmlEditor($fieldId, $fieldId, $params, $this->lists['FORM_DATA'][$fieldId]);
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array('id' => $fieldId, 'name' => $field['NAME'], 'required' => $field['IS_REQUIRED'] == 'Y' ? true : false, 'type' => 'custom', 'value' => $html);
                } else {
                    $params = array('style' => '');
                    if (preg_match('/\\s*(\\d+)\\s*(px|%|)/', $field['SETTINGS']['WIDTH'], $match) && $match[1] > 0) {
                        if ($match[2] == '') {
                            $params['cols'] = $match[1];
                        } else {
                            $params['style'] .= 'width:' . $match[1] . $match[2] . ';';
                        }
                    }
                    if (preg_match('/\\s*(\\d+)\\s*(px|%|)/', $field['SETTINGS']['HEIGHT'], $match) && $match[1] > 0) {
                        if ($match[2] == "") {
                            $params['rows'] = $match[1];
                        } else {
                            $params['style'] .= 'height:' . $match[1] . $match[2] . ';';
                        }
                    }
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array('id' => $fieldId, 'name' => $field['NAME'], 'required' => $field['IS_REQUIRED'] == 'Y' ? true : false, 'type' => 'textarea', 'params' => $params);
                }
            } elseif ($fieldId == "DATE_CREATE" || $fieldId == "TIMESTAMP_X") {
                if ($this->lists['ELEMENT_FIELDS'][$fieldId]) {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $this->lists['ELEMENT_FIELDS'][$fieldId]);
                }
            } elseif ($fieldId == "CREATED_BY") {
                if ($this->lists['ELEMENT_FIELDS']["CREATED_BY"]) {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => "[" . $this->lists['ELEMENT_FIELDS']["CREATED_BY"] . "] " . $this->lists['ELEMENT_FIELDS']["CREATED_USER_NAME"]);
                }
            } elseif ($fieldId == "MODIFIED_BY") {
                if ($this->lists['ELEMENT_FIELDS']["MODIFIED_BY"]) {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => "[" . $this->lists['ELEMENT_FIELDS']["MODIFIED_BY"] . "] " . $this->lists['ELEMENT_FIELDS']["USER_NAME"]);
                }
            } elseif (is_array($field["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicEditHTMLMulty", $field["PROPERTY_USER_TYPE"]) && $field["MULTIPLE"] == "Y" && $field["PROPERTY_TYPE"] != "E") {
                $html = call_user_func_array($field["PROPERTY_USER_TYPE"]["GetPublicEditHTMLMulty"], array($field, $this->lists['FORM_DATA'][$fieldId], array("VALUE" => $fieldId, "DESCRIPTION" => '', "FORM_NAME" => $this->formId, "MODE" => "FORM_FILL")));
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html);
            } elseif (is_array($field["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicEditHTML", $field["PROPERTY_USER_TYPE"])) {
                $params = array('width' => '100%', 'height' => '200px', 'iblockId' => '');
                if ($field["MULTIPLE"] == "Y") {
                    $checkHtml = false;
                    $html = '<table id="tbl' . $fieldId . '">';
                    foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                        if ($field["TYPE"] == "S:HTML") {
                            $checkHtml = true;
                            $fieldIdForHtml = 'id_' . $fieldId . '__' . $key . '_';
                            $fieldNameForHtml = $fieldId . "[" . $key . "][VALUE]";
                            $html .= '<tr><td>' . $this->connectionHtmlEditor($fieldIdForHtml, $fieldNameForHtml, $params, is_array($value['VALUE']) ? $value['VALUE']['TEXT'] : '') . '</td></tr>';
                        } elseif ($field['TYPE'] == 'S:DateTime') {
                            $html .= '<tr><td>
								<input class="bx-lists-input-calendar" type="text" name="' . $fieldId . '[' . $key . '][VALUE]" onclick="BX.calendar({node: this.parentNode, field: this, bTime: true, bHideTime: false});" value="' . $value['VALUE'] . '">
								<span class="bx-lists-calendar-icon" onclick="BX.calendar({node:this, field:\'' . $fieldId . '[' . $key . '][VALUE]\', form: \'\', bTime: true, bHideTime: false});"
									  onmouseover="BX.addClass(this, \'calendar-icon-hover\');" onmouseout="BX.removeClass(this, \'calendar-icon-hover\');" border="0"></span>
							</td></tr>';
                        } elseif ($field['TYPE'] == 'S:Date') {
                            $html .= '<tr><td>
								<input class="bx-lists-input-calendar" type="text" name="' . $fieldId . '[' . $key . '][VALUE]" onclick="BX.calendar({node: this.parentNode, field: this, bTime: false, bHideTime: false});" value="' . $value['VALUE'] . '">
								<span class="bx-lists-calendar-icon" onclick="BX.calendar({node:this, field:\'' . $fieldId . '[' . $key . '][VALUE]\', form: \'\', bTime: false, bHideTime: false});"
									  onmouseover="BX.addClass(this, \'calendar-icon-hover\');" onmouseout="BX.removeClass(this, \'calendar-icon-hover\');" border="0"></span>
							</td></tr>';
                        } else {
                            $html .= '<tr><td>' . call_user_func_array($field["PROPERTY_USER_TYPE"]["GetPublicEditHTML"], array($field, $value, array("VALUE" => $fieldId . "[" . $key . "][VALUE]", "DESCRIPTION" => '', "FORM_NAME" => $this->formId, "MODE" => "FORM_FILL", "COPY" => false))) . '</td></tr>';
                        }
                    }
                    $html .= '</table>';
                    if ($checkHtml) {
                        $html .= '<span class="bx-lists-input-add-button"><input type="button" onclick="javascript:BX[\'LiveFeedClass_' . $this->randomString . '\'].createAdditionalHtmlEditor(\'tbl' . $fieldId . '\', \'' . $fieldId . '\', \'' . $this->formId . '\');" value="' . Loc::getMessage("LISTS_SEAC_ADD_BUTTON") . '"></span>';
                    } else {
                        $html .= '<span class="bx-lists-input-add-button"><input type="button" onclick="javascript:BX[\'LiveFeedClass_' . $this->randomString . '\'].addNewTableRow(\'tbl' . $fieldId . '\', 1, /' . $fieldId . '\\[(n)([0-9]*)\\]/g, 2)" value="' . Loc::getMessage("LISTS_SEAC_ADD_BUTTON") . '"></span>';
                    }
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html);
                } else {
                    $html = '';
                    foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                        if ($field["TYPE"] == "S:HTML") {
                            $html = $this->connectionHtmlEditor($fieldId, $fieldId, $params, is_array($value['VALUE']) ? $value['VALUE']['TEXT'] : '');
                        } elseif ($field['TYPE'] == 'S:DateTime') {
                            $html = '
								<input class="bx-lists-input-calendar" type="text" name="' . $fieldId . '[n0][VALUE]" onclick="BX.calendar({node: this.parentNode, field: this, bTime: true, bHideTime: false});" value="' . $value['VALUE'] . '">
								<span class="bx-lists-calendar-icon" onclick="BX.calendar({node:this, field:\'' . $fieldId . '[n0][VALUE]\', form: \'\', bTime: true, bHideTime: false});"
									  onmouseover="BX.addClass(this, \'calendar-icon-hover\');" onmouseout="BX.removeClass(this, \'calendar-icon-hover\');" border="0"></span>
							';
                        } elseif ($field['TYPE'] == 'S:Date') {
                            $html = '
								<input class="bx-lists-input-calendar" type="text" name="' . $fieldId . '[n0][VALUE]" onclick="BX.calendar({node: this.parentNode, field: this, bTime: false, bHideTime: false});" value="' . $value['VALUE'] . '">
								<span class="bx-lists-calendar-icon" onclick="BX.calendar({node:this, field:\'' . $fieldId . '[n0][VALUE]\', form: \'\', bTime: false, bHideTime: false});"
									  onmouseover="BX.addClass(this, \'calendar-icon-hover\');" onmouseout="BX.removeClass(this, \'calendar-icon-hover\');" border="0"></span>
							';
                        } else {
                            $html = call_user_func_array($field['PROPERTY_USER_TYPE']['GetPublicEditHTML'], array($field, $value, array('VALUE' => $fieldId . '[' . $key . '][VALUE]', 'DESCRIPTION' => '', 'FORM_NAME' => $this->formId, 'MODE' => 'FORM_FILL', 'COPY' => false)));
                        }
                        break;
                    }
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array('id' => $fieldId, 'name' => $field['NAME'], 'required' => $field['IS_REQUIRED'] == 'Y' ? true : false, 'type' => 'custom', 'value' => $html);
                }
            } elseif ($field["PROPERTY_TYPE"] == "N") {
                $html = '';
                if ($field["MULTIPLE"] == "Y") {
                    $html = '<table id="tbl' . $fieldId . '">';
                    foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                        $html .= '<tr><td><input type="text" name="' . $fieldId . '[' . $key . '][VALUE]" value="' . $value["VALUE"] . '"></td></tr>';
                    }
                    $html .= '</table>';
                    $html .= '<span class="bx-lists-input-add-button"><input type="button" onclick="javascript:BX[\'LiveFeedClass_' . $this->randomString . '\'].addNewTableRow(\'tbl' . $fieldId . '\', 1, /' . $fieldId . '\\[(n)([0-9]*)\\]/g, 2)" value="' . Loc::getMessage("LISTS_SEAC_ADD_BUTTON") . '"></span>';
                } else {
                    foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                        $html = '<input type="text" name="' . $fieldId . '[' . $key . '][VALUE]" value="' . $value["VALUE"] . '">';
                    }
                }
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html);
            } elseif ($field["PROPERTY_TYPE"] == "S") {
                $html = '';
                if ($field["MULTIPLE"] == "Y") {
                    $html = '<table id="tbl' . $fieldId . '">';
                    if ($field["ROW_COUNT"] > 1) {
                        foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                            $html .= '<tr><td><textarea name="' . $fieldId . '[' . $key . '][VALUE]" rows="' . intval($field["ROW_COUNT"]) . '" cols="' . intval($field["COL_COUNT"]) . '">' . $value["VALUE"] . '</textarea></td></tr>';
                        }
                    } else {
                        foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                            $html .= '<tr><td><input type="text" name="' . $fieldId . '[' . $key . '][VALUE]" value="' . $value["VALUE"] . '"></td></tr>';
                        }
                    }
                    $html .= '</table>';
                    $html .= '<span class="bx-lists-input-add-button"><input type="button" onclick="javascript:BX[\'LiveFeedClass_' . $this->randomString . '\'].addNewTableRow(\'tbl' . $fieldId . '\', 1, /' . $fieldId . '\\[(n)([0-9]*)\\]/g, 2)" value="' . Loc::getMessage("LISTS_SEAC_ADD_BUTTON") . '"></span>';
                } else {
                    if ($field["ROW_COUNT"] > 1) {
                        foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                            $html = '<textarea name="' . $fieldId . '[' . $key . '][VALUE]" rows="' . intval($field["ROW_COUNT"]) . '" cols="' . intval($field["COL_COUNT"]) . '">' . $value["VALUE"] . '</textarea>';
                        }
                    } else {
                        foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                            $html = '<input type="text" name="' . $fieldId . '[' . $key . '][VALUE]" value="' . $value["VALUE"] . '" size="' . intval($field["COL_COUNT"]) . '">';
                        }
                    }
                }
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html);
            } elseif ($field["PROPERTY_TYPE"] == "L") {
                $items = array("" => Loc::getMessage("LISTS_SEAC_NO_VALUE"));
                $propEnums = CIBlockProperty::getPropertyEnum($field["ID"]);
                while ($enum = $propEnums->fetch()) {
                    $items[$enum["ID"]] = $enum["VALUE"];
                }
                if ($field["MULTIPLE"] == "Y") {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId . '[]', "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => 'list', "items" => $items, "value" => $this->lists['FORM_DATA'][$fieldId], "params" => array("size" => 5, "multiple" => "multiple"));
                } else {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => 'list', "items" => $items, "value" => $this->lists['FORM_DATA'][$fieldId]);
                }
            } elseif ($field['PROPERTY_TYPE'] == 'F') {
                $html = '
					<script>
						var wrappers = document.getElementsByClassName("bx-lists-input-file");
						for (var i = 0; i < wrappers.length; i++)
						{
							var inputs = wrappers[i].getElementsByTagName("input");
							for (var j = 0; j < inputs.length; j++)
							{
								inputs[j].onchange = getName;
							}
						}
						function getName ()
						{
							var str = this.value, i;
							if (str.lastIndexOf("\\\\"))
							{
								i = str.lastIndexOf("\\\\")+1;
							}
							else
							{
								i = str.lastIndexOf("\\\\")+1;
							}
							str = str.slice(i);
							var uploaded = this.parentNode.parentNode.getElementsByClassName("fileformlabel")[0];
							uploaded.innerHTML = str;
						}
					</script>
				';
                if ($field['MULTIPLE'] == 'Y') {
                    $html .= '<table id="tbl' . $fieldId . '">';
                    foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                        $html .= '<tr><td><span class="file-wrapper"><span class="bx-lists-input-file">
								<span class="webform-small-button bx-lists-small-button">' . Loc::getMessage('LISTS_SEAC_FILE_ADD') . '</span>';
                        $html .= $this->connectionFile($fieldId, $key, $value, $field['PROPERTY_TYPE']);
                        $html .= '</span><span class="fileformlabel bx-lists-input-file-name"></span></span></td></tr>';
                    }
                    $html .= '</table>';
                    $html .= '
						<span class="bx-lists-input-add-button">
							<input type="button" onclick="javascript:BX[\'LiveFeedClass_' . $this->randomString . '\'].addNewTableRow(\'tbl' . $fieldId . '\', 1, /' . $fieldId . '\\[(n)([0-9]*)\\]/g, 2);
							BX[\'LiveFeedClass_' . $this->randomString . '\'].getNameInputFile();" value="' . Loc::getMessage("LISTS_SEAC_ADD_BUTTON") . '">
						</span>';
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html);
                } else {
                    foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                        $html .= '<span class="file-wrapper"><span class="bx-lists-input-file">
								<span class="webform-small-button bx-lists-small-button">' . Loc::getMessage('LISTS_SEAC_FILE_ADD') . '</span>';
                        $html .= $this->connectionFile($fieldId, $key, $value, $field['PROPERTY_TYPE']);
                        $html .= '</span><span class="fileformlabel bx-lists-input-file-name"></span></span>';
                        $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId . '[' . $key . '][VALUE]', "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "file", "value" => $html);
                    }
                }
            } elseif ($field["PROPERTY_TYPE"] == "G") {
                if ($field["IS_REQUIRED"] == "Y") {
                    $items = array();
                } else {
                    $items = array("" => Loc::getMessage("LISTS_SEAC_NO_VALUE"));
                }
                $rsSections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $field["LINK_IBLOCK_ID"]));
                while ($res = $rsSections->GetNext()) {
                    $items[$res["ID"]] = str_repeat(" . ", $res["DEPTH_LEVEL"]) . $res["NAME"];
                }
                if ($field["MULTIPLE"] == "Y") {
                    $params = array("size" => 4, "multiple" => "multiple");
                } else {
                    $params = array();
                }
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId . '[]', "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => 'list', "items" => $items, "value" => $this->lists['FORM_DATA'][$fieldId], "params" => $params);
            } elseif ($field["PROPERTY_TYPE"] == "E") {
                if ($field["IS_REQUIRED"] == "Y") {
                    $items = array();
                } else {
                    $items = array("" => Loc::getMessage("LISTS_SEAC_NO_VALUE"));
                }
                $elements = CIBlockElement::getList(array("NAME" => "ASC"), array("IBLOCK_ID" => $field["LINK_IBLOCK_ID"]), false, false, array("ID", "NAME"));
                while ($res = $elements->fetch()) {
                    $items[$res["ID"]] = $res["NAME"];
                }
                if ($field["MULTIPLE"] == "Y") {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId . '[]', "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => 'list', "items" => $items, "value" => $this->lists['FORM_DATA'][$fieldId], "params" => array("size" => 5, "multiple" => "multiple"));
                } else {
                    $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => 'list', "items" => $items, "value" => $this->lists['FORM_DATA'][$fieldId]);
                }
            } elseif ($field["MULTIPLE"] == "Y") {
                $html = '<table id="tbl' . $fieldId . '"><tr><td>';
                foreach ($this->lists['FORM_DATA'][$fieldId] as $key => $value) {
                    $html .= '<tr><td><input type="text" name="' . $fieldId . '[' . $key . '][VALUE]" value="' . $value["VALUE"] . '"></td></tr>';
                }
                $html .= '</td></tr></table>';
                $html .= '
				<span class="bx-lists-input-add-button">
					<input type="button" onclick="javascript:BX[\'LiveFeedClass_' . $this->randomString . '\'].addNewTableRow(\'tbl' . $fieldId . '\', 1, /' . $fieldId . '\\[(n)([0-9]*)\\]/g, 2)" value="' . Loc::getMessage("LISTS_SEAC_ADD_BUTTON") . '">
				</span>';
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html);
            } elseif (is_array($this->lists['FORM_DATA'][$fieldId]) && array_key_exists("VALUE", $this->lists['FORM_DATA'][$fieldId])) {
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId . '[VALUE]', "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "text", "value" => $this->lists['FORM_DATA'][$fieldId]["VALUE"]);
            } else {
                $this->lists['PREPARED_FIELDS'][$fieldId] = array("id" => $fieldId, "name" => $field["NAME"], "required" => $field["IS_REQUIRED"] == "Y" ? true : false, "type" => "text");
            }
            if (!($fieldId == 'DATE_CREATE' || $fieldId == 'TIMESTAMP_X' || $fieldId == 'CREATED_BY' || $fieldId == 'MODIFIED_BY')) {
                if (isset($field['SETTINGS']['SHOW_ADD_FORM'])) {
                    $this->lists['PREPARED_FIELDS'][$fieldId]['show'] = $field['SETTINGS']['SHOW_ADD_FORM'] == 'Y' ? 'Y' : 'N';
                } else {
                    $this->lists['PREPARED_FIELDS'][$fieldId]['show'] = 'Y';
                }
            }
        }
    }
コード例 #30
0
ファイル: template.php プロジェクト: Satariall/izurit
     } else {
         foreach ($arResult["FORM_DATA"][$FIELD_ID] as $key => $value) {
             $obFile = new CListFile($arResult["IBLOCK_ID"], $arResult["ELEMENT_FIELDS"]["IBLOCK_SECTION_ID"], $arResult["ELEMENT_ID"], $FIELD_ID, $value["VALUE"]);
             $obFile->SetSocnetGroup($arParams["SOCNET_GROUP_ID"]);
             $obFileControl = new CListFileControl($obFile, $FIELD_ID . '[' . $key . '][VALUE]');
             $html = $obFileControl->GetHTML(array('max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams["~LIST_FILE_URL"], 'a_title' => GetMessage("CT_BLEE_ENLARGE"), 'download_text' => GetMessage("CT_BLEE_DOWNLOAD")));
             $arTabElement[] = array("id" => $FIELD_ID . '[' . $key . '][VALUE]', "name" => $arField["~NAME"], "required" => $arField["IS_REQUIRED"] == "Y" ? true : false, "type" => "custom", "value" => $html, "show" => $show);
         }
     }
 } elseif ($arField["PROPERTY_TYPE"] == "G") {
     if ($arField["IS_REQUIRED"] == "Y") {
         $items = array();
     } else {
         $items = array("" => GetMessage("CT_BLEE_NO_VALUE"));
     }
     $rsSections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $arField["LINK_IBLOCK_ID"]));
     while ($ar = $rsSections->GetNext()) {
         $items[$ar["ID"]] = str_repeat(" . ", $ar["DEPTH_LEVEL"]) . $ar["~NAME"];
     }
     if ($arField["MULTIPLE"] == "Y") {
         $params = array("size" => 5, "multiple" => "multiple");
     } else {
         $params = array();
     }
     $arTabElement[] = array("id" => $FIELD_ID . '[]', "name" => $arField["~NAME"], "required" => $arField["IS_REQUIRED"] == "Y" ? true : false, "type" => 'list', "items" => $items, "value" => $arResult["FORM_DATA"][$FIELD_ID], "params" => $params, "show" => $show);
 } elseif ($arField["PROPERTY_TYPE"] == "E") {
     if ($arField["IS_REQUIRED"] == "Y") {
         $items = array();
     } else {
         $items = array("" => GetMessage("CT_BLEE_NO_VALUE"));
     }