本文整理汇总了PHP中Bitrix\Sale\Location\LocationTable::getMap方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationTable::getMap方法的具体用法?PHP LocationTable::getMap怎么用?PHP LocationTable::getMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::getMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findNoIndex
/**
*
*
* @param
*
* @return
*/
protected static function findNoIndex($parameters)
{
$dbConnection = Main\HttpApplication::getConnection();
$dbHelper = $dbConnection->getSqlHelper();
// tables
$locationTable = Location\LocationTable::getTableName();
$locationNameTable = Location\Name\LocationTable::getTableName();
$locationGroupTable = Location\GroupLocationTable::getTableName();
$locationSiteTable = Location\SiteLocationTable::getTableName();
$locationTypeTable = Location\TypeTable::getTableName();
//////////////////////////////////
// sql parameters prepare
//////////////////////////////////
$filter = static::parseFilter($parameters['filter']);
if (strlen($filter['SITE_ID']['VALUE'])) {
$filterSite = $dbHelper->forSql(substr($filter['SITE_ID']['VALUE'], 0, 2));
$hasLocLinks = Location\SiteLocationTable::checkLinkUsage($filterSite, Location\SiteLocationTable::DB_LOCATION_FLAG);
$hasGrpLinks = Location\SiteLocationTable::checkLinkUsage($filterSite, Location\SiteLocationTable::DB_GROUP_FLAG);
$doFilterBySite = true;
}
if (strlen($filter['PHRASE']['VALUE'])) {
$doFilterByName = true;
$filterName = ToUpper($dbHelper->forSql($filter['PHRASE']['VALUE']));
}
if (intval($filter['ID']['VALUE'])) {
$doFilterById = true;
$filterId = intval($filter['ID']['VALUE']);
}
if (intval($filter['CODE']['VALUE'])) {
$doFilterByCode = true;
$filterCode = $dbHelper->forSql($filter['CODE']['VALUE']);
}
$doFilterByLang = true;
if (strlen($filter['NAME.LANGUAGE_ID']['VALUE'])) {
$filterLang = $dbHelper->forSql(substr($filter['NAME.LANGUAGE_ID']['VALUE'], 0, 2));
} else {
$filterLang = LANGUAGE_ID;
}
if (isset($filter['PARENT_ID']) && intval($filter['PARENT_ID']['VALUE']) >= 0) {
$doFilterByParent = true;
$filterParentId = intval($filter['PARENT_ID']['VALUE']);
}
if (intval($filter['TYPE_ID']['VALUE'])) {
$doFilterByType = true;
$filterTypeId = intval($filter['TYPE_ID']['VALUE']);
}
// filter select fields
if (!is_array($parameters['select'])) {
$parameters['select'] = array();
}
$map = Location\LocationTable::getMap();
$nameAlias = false;
foreach ($parameters['select'] as $alias => $field) {
if ($field == 'CHILD_CNT') {
$doCountChildren = true;
}
if ($field == 'NAME.NAME') {
$nameAlias = $alias;
}
if (!isset($map[$field]) || !in_array($map[$field]['data_type'], array('integer', 'string', 'float', 'boolean')) || isset($map[$field]['expression'])) {
unset($parameters['select'][$alias]);
}
}
//////////////////////////////////
// sql query build
//////////////////////////////////
// mandatory fields to be selected anyway
// alias => field
$fields = array('L.ID' => 'L.ID', 'L.CODE' => 'L.CODE', 'L.SORT' => 'L.SORT', 'LT_SORT' => 'LT.DISPLAY_SORT');
if ($nameAlias === false || !preg_match('#^[a-zA-Z0-9]+$#', $nameAlias)) {
$fields['NAME'] = 'LN.NAME';
} else {
$fields[$nameAlias] = 'LN.NAME';
}
$fields = array_merge($fields, array('L.LEFT_MARGIN' => 'L.LEFT_MARGIN', 'L.RIGHT_MARGIN' => 'L.RIGHT_MARGIN'));
$groupFields = $fields;
// additional fields to select
foreach ($parameters['select'] as $alias => $fld) {
$lFld = 'L.' . $fld;
// check if field is already selected
if ((string) $alias === (string) intval($alias)) {
// already selected
if (in_array($lFld, $fields)) {
continue;
}
$fields[$lFld] = $lFld;
//$groupFields[$lFld] = $lFld;
} else {
if (isset($fields[$alias])) {
continue;
}
$fields[$alias] = $lFld;
//$groupFields[$alias] = $lFld;
//.........这里部分代码省略.........