本文整理汇总了PHP中Bitrix\Sale\Location\LocationTable::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationTable::getTableName方法的具体用法?PHP LocationTable::getTableName怎么用?PHP LocationTable::getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Location\LocationTable
的用法示例。
在下文中一共展示了LocationTable::getTableName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeData
public static function initializeData()
{
$locationTable = Location\LocationTable::getTableName();
$groupLocationTable = Location\GroupLocationTable::getTableName();
$siteLocationTable = Location\SiteLocationTable::getTableName();
// ORACLE: OK, MSSQL: OK
$sql = "\n\t\t\tinsert into " . static::getTableName() . " \n\t\t\t\t(LOCATION_ID, SITE_ID) \n\t\t\tselect LC.ID, LS.SITE_ID\n\t\t\t\tfrom " . $siteLocationTable . " LS\n\t\t\t\t\tinner join " . $locationTable . " L on LS.LOCATION_ID = L.ID and LS.LOCATION_TYPE = 'L'\n\t\t\t\t\tinner join " . $locationTable . " LC on LC.LEFT_MARGIN >= L.LEFT_MARGIN and LC.RIGHT_MARGIN <= L.RIGHT_MARGIN\n\t\t\tunion \n\t\t\tselect LC.ID, LS.SITE_ID\n\t\t\t\tfrom " . $siteLocationTable . " LS\n\t\t\t\t\tinner join " . $groupLocationTable . " LG on LS.LOCATION_ID = LG.LOCATION_GROUP_ID and LS.LOCATION_TYPE = 'G'\n\t\t\t\t\tinner join " . $locationTable . " L on LG.LOCATION_ID = L.ID\n\t\t\t\t\tinner join " . $locationTable . " LC on LC.LEFT_MARGIN >= L.LEFT_MARGIN and LC.RIGHT_MARGIN <= L.RIGHT_MARGIN\n\t\t";
Main\HttpApplication::getConnection()->query($sql);
}
示例2: checkNodeIsParent
private function checkNodeIsParent($id)
{
$locationTable = Location\LocationTable::getTableName();
$res = $this->dbConnection->query("select count(*) as CNT from {$locationTable} where PARENT_ID = " . ($id == 'root' ? '0' : intval($id)))->fetch();
return intval($res['CNT']);
}
示例3: 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;
//.........这里部分代码省略.........
示例4: DeleteAll
/**
* <p>Метод удаляет все местоположения из базы. Метод динамичный.</p> <br><br>
*
*
* @return mixed
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalelocation/csalelocation__deleteall.1cda6559.php
* @author Bitrix
*/
public static function DeleteAll()
{
global $DB;
foreach (GetModuleEvents("sale", "OnBeforeLocationDeleteAll", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent) === false) {
return false;
}
}
if (self::isLocationProMigrated()) {
//main
$DB->Query("DELETE FROM " . Location\LocationTable::getTableName());
$DB->Query("DELETE FROM " . Location\GroupTable::getTableName());
$DB->Query("DELETE FROM " . Location\TypeTable::getTableName());
//names
$DB->Query("DELETE FROM " . Location\Name\LocationTable::getTableName());
$DB->Query("DELETE FROM " . Location\Name\GroupTable::getTableName());
$DB->Query("DELETE FROM " . Location\Name\TypeTable::getTableName());
//links
$DB->Query("DELETE FROM " . Location\GroupLocationTable::getTableName());
$DB->Query("DELETE FROM " . Location\SiteLocationTable::getTableName());
$DB->Query("DELETE FROM " . Delivery\DeliveryLocationTable::getTableName());
//other
$DB->Query("DELETE FROM " . Location\DefaultSiteTable::getTableName());
$DB->Query("DELETE FROM " . Location\ExternalTable::getTableName());
$DB->Query("DELETE FROM " . Location\ExternalServiceTable::getTableName());
}
$DB->Query("DELETE FROM b_sale_location2location_group");
$DB->Query("DELETE FROM b_sale_location_group_lang");
$DB->Query("DELETE FROM b_sale_location_group");
$DB->Query("DELETE FROM b_sale_delivery2location");
$DB->Query("DELETE FROM b_sale_location");
$DB->Query("DELETE FROM b_sale_location_city_lang");
$DB->Query("DELETE FROM b_sale_location_city");
$DB->Query("DELETE FROM b_sale_location_country_lang");
$DB->Query("DELETE FROM b_sale_location_country");
$DB->Query("DELETE FROM b_sale_location_region_lang");
$DB->Query("DELETE FROM b_sale_location_region");
$DB->Query("DELETE FROM b_sale_location_zip");
foreach (GetModuleEvents("sale", "OnLocationDeleteAll", true) as $arEvent) {
ExecuteModuleEventEx($arEvent);
}
}
示例5: getListFast
/**
*
*
* @param
*
* @return
*/
public static function getListFast($parameters = array())
{
$dbConnection = Main\HttpApplication::getConnection();
$dbHelper = $dbConnection->getSqlHelper();
// we require autocomplete to answer ASAP, so say hello to direct query
// tables
$locationTable = LocationTable::getTableName();
$locationNameTable = Name\LocationTable::getTableName();
$locationGroupTable = GroupLocationTable::getTableName();
$locationSiteTable = SiteLocationTable::getTableName();
$locationTypeTable = TypeTable::getTableName();
//////////////////////////////////
// sql parameters prepare
//////////////////////////////////
if (strlen($parameters['filter']['SITE_ID'])) {
$filterSite = $dbHelper->forSql(substr($parameters['filter']['SITE_ID'], 0, 2));
$hasLocLinks = SiteLocationTable::checkLinkUsage($filterSite, 'L');
$hasGrpLinks = SiteLocationTable::checkLinkUsage($filterSite, 'G');
if ($hasLocLinks || $hasGrpLinks) {
$doFilterBySite = true;
}
}
if (strlen($parameters['filter']['NAME'])) {
$doFilterByMainParams = true;
$doFilterByName = true;
// user-typed '%' are not allowed in like expression - ddos risk
$filterName = ToUpper($dbHelper->forSql(str_replace('%', '', $parameters['filter']['NAME'])));
}
if (strlen($parameters['filter']['PRIMARY'])) {
$doFilterByMainParams = true;
$doFilterByPrimaryCode = true;
// user-typed '%' are not allowed in like expression - ddos risk
$filterPrimaryCode = ToLower($dbHelper->forSql(str_replace('%', '', $parameters['filter']['PRIMARY'])));
if (is_numeric($parameters['filter']['PRIMARY']) && $parameters['filter']['PRIMARY'] == intval($parameters['filter']['PRIMARY'])) {
$doFilterByPrimaryId = true;
$filterPrimaryId = intval($parameters['filter']['PRIMARY']);
}
}
if (intval($parameters['filter']['ID'])) {
$doFilterById = true;
$filterId = intval($parameters['filter']['ID']);
}
if (strlen($parameters['filter']['LANGUAGE_ID'])) {
$filterLang = $dbHelper->forSql(substr($parameters['filter']['LANGUAGE_ID'], 0, 2));
}
if (isset($parameters['filter']['PARENT_ID']) && intval($parameters['filter']['PARENT_ID']) >= 0) {
$doFilterByParent = true;
$filterParentId = intval($parameters['filter']['PARENT_ID']);
}
if (intval($parameters['filter']['TYPE_ID'])) {
$doFilterByType = true;
$filterTypeId = intval($parameters['filter']['TYPE_ID']);
}
if (intval($parameters['filter']['EXCLUDE_SUBTREE'])) {
$doFilterByExclude = true;
$filterExclude = intval($parameters['filter']['EXCLUDE_SUBTREE']);
$res = self::getById($filterExclude)->fetch();
if ($res) {
$excludeMarginLeft = $res['LEFT_MARGIN'];
$excludeMarginRight = $res['RIGHT_MARGIN'];
} else {
$doFilterByExclude = false;
}
}
// filter select fields
if (!is_array($parameters['select'])) {
$parameters['select'] = array();
}
$map = self::getMap();
foreach ($parameters['select'] as $k => $field) {
if ($field == 'CHILD_CNT') {
$doCountChildren = true;
}
if (in_array($field, array('ID', 'CODE', 'SORT', 'LEFT_MARGIN', 'RIGHT_MARGIN')) || !isset($map[$field]) || !in_array($map[$field]['data_type'], array('integer', 'string', 'float', 'boolean'))) {
unset($parameters['select'][$k]);
}
}
//////////////////////////////////
// sql query build
//////////////////////////////////
$fields = array('L.ID' => 'L.ID', 'L.CODE' => 'L.CODE', 'L.SORT' => 'L.SORT', 'LT.SORT' => 'LT_SORT', 'LN.NAME' => 'LN.NAME', 'L.LEFT_MARGIN' => 'L.LEFT_MARGIN', 'L.RIGHT_MARGIN' => 'L.RIGHT_MARGIN');
$groupFields = $fields;
// for select fields and group fields
foreach ($parameters['select'] as $fld) {
if ($fld == 'CHILD_CNT') {
$fields['COUNT(LC.ID)'] = 'CHILD_CNT';
} else {
$lFld = 'L.' . $fld;
if (isset($fields[$lFld])) {
continue;
}
$fields[$lFld] = $lFld;
$groupFields[$lFld] = $lFld;
//.........这里部分代码省略.........