本文整理汇总了PHP中Bitrix\Main\Type\Collection::sortByColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::sortByColumn方法的具体用法?PHP Collection::sortByColumn怎么用?PHP Collection::sortByColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Type\Collection
的用法示例。
在下文中一共展示了Collection::sortByColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processActionShowSubFolders
protected function processActionShowSubFolders()
{
if (!$this->checkRequiredPostParams(array('objectId'))) {
$this->sendJsonErrorResponse();
}
$showOnlyDeleted = (bool) $this->request->getPost('showOnlyDeleted');
$isRoot = (bool) $this->request->getPost('isRoot');
/** @var Folder $folder */
$folder = Folder::loadById((int) $this->request->getPost('objectId'), array('STORAGE'));
if (!$folder) {
$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_BREADCRUMBS_ERROR_COULD_NOT_FIND_FOLDER'), self::ERROR_COULD_NOT_FIND_FOLDER)));
$this->sendJsonErrorResponse();
}
$securityContext = $folder->getStorage()->getCurrentUserSecurityContext();
$subFolders = array();
$filter = array('TYPE' => ObjectTable::TYPE_FOLDER);
if ($showOnlyDeleted) {
$filter['!=DELETED_TYPE'] = ObjectTable::DELETED_TYPE_NONE;
}
if ($showOnlyDeleted && $isRoot) {
$filter['DELETED_TYPE'] = ObjectTable::DELETED_TYPE_ROOT;
$children = $folder->getDescendants($securityContext, array('filter' => $filter));
} else {
$children = $folder->getChildren($securityContext, array('filter' => $filter));
}
foreach ($children as $subFolder) {
/** @var Folder $subFolder */
$subFolders[] = array('id' => $subFolder->getId(), 'name' => $subFolder->getName(), 'isLink' => $subFolder->isLink());
}
unset($subFolder);
\Bitrix\Main\Type\Collection::sortByColumn($subFolders, 'name');
$this->sendJsonSuccessResponse(array('items' => $subFolders));
}
示例2: getGridData
private function getGridData($gridId)
{
$grid = array('ID' => $gridId);
$securityContext = $this->storage->getCurrentUserSecurityContext();
$parameters = array('with' => array('FILE', 'CREATE_USER'), 'filter' => array('IS_EXPIRED' => false, 'OBJECT.STORAGE_ID' => $this->storage->getId(), 'CREATED_BY' => $this->getUser()->getId()));
$parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('OBJECT_ID', 'OBJECT.CREATED_BY'));
$items = ExternalLink::getModelList($parameters);
Collection::sortByColumn($items, array('CREATE_TIME' => array(SORT_NUMERIC, SORT_ASC)));
$urlManager = Driver::getInstance()->getUrlManager();
$rows = array();
foreach ($items as $externalLink) {
/** @var ExternalLink $externalLink */
$exportData = $externalLink->toArray();
$nameSpecialChars = htmlspecialcharsbx($externalLink->getFile()->getName());
$createDateText = htmlspecialcharsbx((string) $externalLink->getCreateTime());
$columnName = "\n\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$externalLink->getId()}\" class=\"draggable bx-file-icon-container-small bx-disk-file-icon\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$externalLink->getId()}\" href=\"\" data-bx-dateModify=\"{$createDateText}\">{$nameSpecialChars}</a></td>\n\t\t\t\t</tr></table>\n\t\t\t";
$createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $externalLink->getCreatedBy()));
$rows[] = array('data' => $exportData, 'columns' => array('CREATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'UPDATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'NAME' => $columnName, 'FORMATTED_SIZE' => CFile::formatSize($externalLink->getFile()->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($externalLink->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t"), 'actions' => array(array("PSEUDO_NAME" => "download", "DEFAULT" => true, "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($externalLink->getFile()) . "')"), array("PSEUDO_NAME" => "disable_external_link", "ICONCLASS" => "disable_external_link", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK'), "SHORT_TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK_SHORT'), "ONCLICK" => "BX.Disk['ExternalLinkListClass_{$this->getComponentId()}'].disableExternalLink({$externalLink->getId()}, {$externalLink->getObjectId()})")));
}
unset($externalLink);
$grid['MODE'] = 'list';
$grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_TIME'), 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_USER'), 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_FORMATTED_SIZE'), 'default' => true));
$grid['ROWS'] = $rows;
$grid['ROWS_COUNT'] = count($rows);
$grid['FOOTER'] = array();
return $grid;
}
示例3: AppyUserSettings
protected static function AppyUserSettings($suffix)
{
$arAuthServices = self::$arAuthServices;
//user settings: sorting, active
$arServices = unserialize(COption::GetOptionString("socialservices", "auth_services" . $suffix, ""));
if (is_array($arServices)) {
$i = 0;
foreach ($arServices as $serv => $active) {
if (isset($arAuthServices[$serv])) {
$arAuthServices[$serv]["__sort"] = $i++;
$arAuthServices[$serv]["__active"] = $active == "Y";
}
}
\Bitrix\Main\Type\Collection::sortByColumn($arAuthServices, "__sort");
}
return $arAuthServices;
}
示例4: __construct
protected function __construct()
{
$event = new Main\Event("main", "OnApplicationsBuildList");
$event->send();
foreach ($event->getResults() as $eventResult) {
$result = $eventResult->getParameters();
if (is_array($result)) {
if (!is_array($result[0])) {
$result = array($result);
}
foreach ($result as $app) {
$this->applications[$app["ID"]] = $app;
}
}
}
Main\Type\Collection::sortByColumn($this->applications, "SORT");
}
示例5: processActionGetListStorage
protected function processActionGetListStorage()
{
$this->checkRequiredPostParams(array('proxyType'));
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$proxyTypePost = $this->request->getPost('proxyType');
$diskSecurityContext = $this->getSecurityContextByUser($this->getUser());
$siteId = null;
$siteDir = null;
if ($this->request->getPost('siteId')) {
$siteId = $this->request->getPost('siteId');
}
if ($this->request->getPost('siteDir')) {
$siteDir = rtrim($this->request->getPost('siteDir'), '/');
}
$result = array();
$filterReadableList = array();
$checkSiteId = false;
if ($proxyTypePost == 'user') {
$result['TITLE'] = Loc::getMessage('DISK_AGGREGATOR_USER_TITLE');
$filterReadableList = array('STORAGE.ENTITY_TYPE' => ProxyType\User::className());
} elseif ($proxyTypePost == 'group') {
$checkSiteId = true;
$result['TITLE'] = Loc::getMessage('DISK_AGGREGATOR_GROUP_TITLE');
$filterReadableList = array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className());
}
foreach (Storage::getReadableList($diskSecurityContext, array('filter' => $filterReadableList)) as $storage) {
if ($checkSiteId) {
$groupObject = CSocNetGroup::getList(array(), array('ID' => $storage->getEntityId()), false, false, array('SITE_ID'));
$group = $groupObject->fetch();
if (!empty($group) && $group['SITE_ID'] != $siteId) {
continue;
}
}
$proxyType = $storage->getProxyType();
$result['DATA'][] = array("TITLE" => $proxyType->getEntityTitle(), "URL" => $siteDir . $proxyType->getBaseUrlFolderList(), "ICON" => $proxyType->getEntityImageSrc(64, 64));
}
if (!empty($result['DATA'])) {
Collection::sortByColumn($result['DATA'], array('TITLE' => SORT_ASC));
$this->sendJsonSuccessResponse(array('listStorage' => $result['DATA'], 'title' => $result['TITLE']));
} else {
$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_AGGREGATOR_ERROR_COULD_NOT_FIND_DATA'))));
$this->sendJsonErrorResponse();
}
}
示例6: fixColdStart
/**
* Fixes cold start, when we don't have any data in RecentlyUsedTable.
* @param mixed|int|User|\CAllUser $user User.
* @return bool
* @throws \Bitrix\Main\ArgumentException
*/
private function fixColdStart($user)
{
$userId = User::resolveUserId($user);
if (!$userId) {
$this->errorCollection->addOne(new Error('Could not get user id.'));
return false;
}
$storage = Driver::getInstance()->getStorageByUserId($userId);
if (!$storage) {
$this->errorCollection->addOne(new Error('Could not get storage by user id.'));
return false;
}
$fromDate = DateTime::createFromTimestamp(time() - 14 * 24 * 3600);
$objects = array();
$query = FileTable::getList(array('select' => array('ID', 'UPDATE_TIME'), 'filter' => array('STORAGE_ID' => $storage->getId(), 'TYPE' => ObjectTable::TYPE_FILE, 'DELETED_TYPE' => ObjectTable::DELETED_TYPE_NONE, '>UPDATE_TIME' => $fromDate, array('LOGIC' => 'OR', array('CREATED_BY' => $userId), array('UPDATED_BY' => $userId))), 'order' => array('UPDATE_TIME' => 'DESC'), 'limit' => RecentlyUsedTable::MAX_COUNT_FOR_USER));
while ($row = $query->fetch()) {
$objects[] = array('USER_ID' => $userId, 'OBJECT_ID' => $row['ID'], 'CREATE_TIME' => $row['UPDATE_TIME']);
}
unset($row, $query, $fromDate);
Collection::sortByColumn($objects, array('CREATE_TIME' => SORT_ASC));
RecentlyUsedTable::insertBatch($objects);
return true;
}
示例7: GetArray
public static function GetArray($IBLOCK_ID, $SECTION_ID = 0, $bNewSection = false)
{
global $DB;
$IBLOCK_ID = intval($IBLOCK_ID);
$SECTION_ID = intval($SECTION_ID);
$result = array();
if ($SECTION_ID > 0) {
$rs = $DB->Query($s = "\n\t\t\t\tSELECT\n\t\t\t\t\tB.SECTION_PROPERTY,\n\t\t\t\t\tBP.ID PROPERTY_ID,\n\t\t\t\t\tBSP.SECTION_ID LINK_ID,\n\t\t\t\t\tBSP.SMART_FILTER,\n\t\t\t\t\tBP.SORT,\n\t\t\t\t\tBS.LEFT_MARGIN,\n\t\t\t\t\tBS.NAME LINK_TITLE\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock B\n\t\t\t\t\tINNER JOIN b_iblock_property BP ON BP.IBLOCK_ID = B.ID\n\t\t\t\t\tINNER JOIN b_iblock_section M ON M.ID = " . $SECTION_ID . "\n\t\t\t\t\tINNER JOIN b_iblock_section BS ON BS.IBLOCK_ID = M.IBLOCK_ID\n\t\t\t\t\t\tAND M.LEFT_MARGIN >= BS.LEFT_MARGIN\n\t\t\t\t\t\tAND M.RIGHT_MARGIN <= BS.RIGHT_MARGIN\n\t\t\t\t\tINNER JOIN b_iblock_section_property BSP ON BSP.IBLOCK_ID = BS.IBLOCK_ID AND BSP.SECTION_ID = BS.ID AND BSP.PROPERTY_ID = BP.ID\n\t\t\t\tWHERE\n\t\t\t\t\tB.ID = " . $IBLOCK_ID . "\n\t\t\t\tORDER BY\n\t\t\t\t\tBP.SORT ASC, BP.ID ASC, BS.LEFT_MARGIN DESC\n\t\t\t");
while ($ar = $rs->Fetch()) {
$result[$ar["PROPERTY_ID"]] = array("PROPERTY_ID" => $ar["PROPERTY_ID"], "SMART_FILTER" => $ar["SMART_FILTER"], "INHERITED" => $SECTION_ID == $ar["LINK_ID"] ? "N" : "Y", "INHERITED_FROM" => $ar["LINK_ID"], "SORT" => $ar["SORT"], "LEFT_MARGIN" => $ar["LEFT_MARGIN"], "LINK_TITLE" => $ar["LINK_TITLE"]);
}
}
if ($SECTION_ID >= 0) {
$rs = $DB->Query("\n\t\t\t\tSELECT\n\t\t\t\t\tB.SECTION_PROPERTY,\n\t\t\t\t\tBP.ID PROPERTY_ID,\n\t\t\t\t\tBSP.SECTION_ID LINK_ID,\n\t\t\t\t\tBSP.SMART_FILTER,\n\t\t\t\t\tBP.SORT,\n\t\t\t\t\t0 LEFT_MARGIN,\n\t\t\t\t\tB.NAME LINK_TITLE\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock B\n\t\t\t\t\tINNER JOIN b_iblock_property BP ON BP.IBLOCK_ID = B.ID\n\t\t\t\t\tLEFT JOIN b_iblock_section_property BSP ON BSP.SECTION_ID = 0 AND BSP.PROPERTY_ID = BP.ID\n\t\t\t\tWHERE\n\t\t\t\t\tB.ID = " . $IBLOCK_ID . "\n\t\t\t\tORDER BY\n\t\t\t\t\tBP.SORT ASC, BP.ID ASC\n\t\t\t");
while ($ar = $rs->Fetch()) {
if ($ar["SECTION_PROPERTY"] === "Y") {
if (strlen($ar["LINK_ID"])) {
$result[$ar["PROPERTY_ID"]] = array("PROPERTY_ID" => $ar["PROPERTY_ID"], "SMART_FILTER" => $ar["SMART_FILTER"], "INHERITED" => $SECTION_ID == 0 && !$bNewSection ? "N" : "Y", "INHERITED_FROM" => 0, "SORT" => $ar["SORT"], "LEFT_MARGIN" => $ar["LEFT_MARGIN"], "LINK_TITLE" => $ar["LINK_TITLE"]);
}
} else {
$result[$ar["PROPERTY_ID"]] = array("PROPERTY_ID" => $ar["PROPERTY_ID"], "SMART_FILTER" => "N", "INHERITED" => $SECTION_ID == 0 && !$bNewSection ? "N" : "Y", "INHERITED_FROM" => 0, "SORT" => $ar["SORT"], "LEFT_MARGIN" => $ar["LEFT_MARGIN"], "LINK_TITLE" => $ar["LINK_TITLE"]);
}
}
if (!empty($result)) {
\Bitrix\Main\Type\Collection::sortByColumn($result, array("SORT" => SORT_ASC, "PROPERTY_ID" => SORT_ASC), '', null, true);
}
}
return $result;
}
示例8: getParentRights
private function getParentRights()
{
if ($this->parentRights !== null) {
return $this->parentRights;
}
$this->parentRights = Driver::getInstance()->getRightsManager()->getParentsRights($this->object->getId());
Collection::sortByColumn($this->parentRights, array('DEPTH_LEVEL' => SORT_DESC));
return $this->parentRights;
}
示例9: foreach
foreach ($arMatrix as $keyOffer => $arRow) {
if ($boolExist) {
if (!isset($arItem['OFFERS'][$keyOffer]['TREE'])) {
$arItem['OFFERS'][$keyOffer]['TREE'] = array();
}
$arItem['OFFERS'][$keyOffer]['TREE']['PROP_' . $arSKUPropList[$strOneCode]['ID']] = $arMatrix[$keyOffer][$strOneCode]['VALUE'];
$arItem['OFFERS'][$keyOffer]['SKU_SORT_' . $strOneCode] = $arMatrix[$keyOffer][$strOneCode]['SORT'];
$arUsedFields[$strOneCode] = true;
$arSortFields['SKU_SORT_' . $strOneCode] = SORT_NUMERIC;
} else {
unset($arMatrix[$keyOffer][$strOneCode]);
}
}
}
$arItem['OFFERS_PROP'] = $arUsedFields;
\Bitrix\Main\Type\Collection::sortByColumn($arItem['OFFERS'], $arSortFields);
// Find Selected offer
foreach ($arItem['OFFERS'] as $ind => $offer) {
if ($offer['SELECTED']) {
$arItem['OFFERS_SELECTED'] = $ind;
break;
}
}
$arMatrix = array();
$intSelected = -1;
$arItem['MIN_PRICE'] = false;
/*foreach ($arItem['OFFERS'] as $keyOffer => $arOffer)
{
if (empty($arItem['MIN_PRICE']) && $arOffer['CAN_BUY'])
{
$intSelected = $keyOffer;
示例10: ImportTemplate
public static function ImportTemplate($id, $documentType, $autoExecute, $name, $description, $datum, $systemCode = null, $systemImport = false)
{
$id = intval($id);
if ($id <= 0) {
$id = 0;
}
$datumTmp = CheckSerializedData($datum) ? @unserialize($datum) : null;
if (!is_array($datumTmp) || is_array($datumTmp) && !array_key_exists("TEMPLATE", $datumTmp)) {
if (function_exists("gzcompress")) {
$datumTmp = @gzuncompress($datum);
$datumTmp = CheckSerializedData($datumTmp) ? @unserialize($datumTmp) : null;
}
}
if (!is_array($datumTmp) || is_array($datumTmp) && !array_key_exists("TEMPLATE", $datumTmp)) {
throw new Exception(GetMessage("BPCGWTL_WRONG_TEMPLATE"));
}
if (array_key_exists("VERSION", $datumTmp) && $datumTmp["VERSION"] == 2) {
$datumTmp["TEMPLATE"] = self::ConvertArrayCharset($datumTmp["TEMPLATE"], BP_EI_DIRECTION_IMPORT);
$datumTmp["PARAMETERS"] = self::ConvertArrayCharset($datumTmp["PARAMETERS"], BP_EI_DIRECTION_IMPORT);
$datumTmp["VARIABLES"] = self::ConvertArrayCharset($datumTmp["VARIABLES"], BP_EI_DIRECTION_IMPORT);
$datumTmp["CONSTANTS"] = isset($datumTmp["CONSTANTS"]) ? self::ConvertArrayCharset($datumTmp["CONSTANTS"], BP_EI_DIRECTION_IMPORT) : array();
$datumTmp["DOCUMENT_FIELDS"] = self::ConvertArrayCharset($datumTmp["DOCUMENT_FIELDS"], BP_EI_DIRECTION_IMPORT);
}
if (!$systemImport) {
if (!self::WalkThroughWorkflowTemplate($datumTmp["TEMPLATE"], array("CBPWorkflowTemplateLoader", "ImportTemplateChecker"), new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser))) {
return false;
}
} elseif ($id > 0 && !empty($datumTmp["CONSTANTS"])) {
$userConstants = self::getTemplateConstants($id);
if (!empty($userConstants)) {
foreach ($userConstants as $constantName => $constantData) {
if (isset($datumTmp["CONSTANTS"][$constantName])) {
$datumTmp["CONSTANTS"][$constantName]['Default'] = $constantData['Default'];
}
}
}
}
$templateData = array("DOCUMENT_TYPE" => $documentType, "AUTO_EXECUTE" => $autoExecute, "NAME" => $name, "DESCRIPTION" => $description, "TEMPLATE" => $datumTmp["TEMPLATE"], "PARAMETERS" => $datumTmp["PARAMETERS"], "VARIABLES" => $datumTmp["VARIABLES"], "CONSTANTS" => $datumTmp["CONSTANTS"], "USER_ID" => $systemImport ? 1 : $GLOBALS["USER"]->GetID(), "MODIFIER_USER" => new CBPWorkflowTemplateUser($systemImport ? 1 : CBPWorkflowTemplateUser::CurrentUser));
if (!is_null($systemCode)) {
$templateData["SYSTEM_CODE"] = $systemCode;
}
if ($id <= 0) {
$templateData['ACTIVE'] = 'Y';
}
if ($id > 0) {
self::Update($id, $templateData, $systemImport);
} else {
$id = self::Add($templateData, $systemImport);
}
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
$arDocumentFields = $documentService->GetDocumentFields($documentType);
if (is_array($datumTmp["DOCUMENT_FIELDS"])) {
$len = strlen("_PRINTABLE");
$arFieldsTmp = array();
foreach ($datumTmp["DOCUMENT_FIELDS"] as $code => $field) {
if (!array_key_exists($code, $arDocumentFields) && strtoupper(substr($code, -$len)) != "_PRINTABLE") {
$arFieldsTmp[$code] = array("name" => $field["Name"], "code" => $code, "type" => $field["Type"], "multiple" => $field["Multiple"], "required" => $field["Required"]);
if (is_array($field["Options"]) && count($field["Options"]) > 0) {
foreach ($field["Options"] as $k => $v) {
$arFieldsTmp[$code]["options"] .= "[" . $k . "]" . $v . "\n";
}
}
unset($field["Name"], $field["Type"], $field["Multiple"], $field["Required"], $field["Options"]);
$arFieldsTmp[$code] = array_merge($arFieldsTmp[$code], $field);
}
}
if (!empty($arFieldsTmp)) {
\Bitrix\Main\Type\Collection::sortByColumn($arFieldsTmp, "sort");
foreach ($arFieldsTmp as $fieldTmp) {
$documentService->AddDocumentField($documentType, $fieldTmp);
}
}
}
return $id;
}
示例11: GetMessage
if ($arPriceBoundaries[$i]["FROM"] < $arPrice["QUANTITY_FROM"] && $arPriceBoundaries[$i]["TO"] >= $arPrice["QUANTITY_TO"] && $arPrice["QUANTITY_TO"] != 0) {
$arPriceBoundariesError[] = str_replace("#TYPE#", $arPrice["CATALOG_GROUP_NAME"], str_replace("#RIGHT#", $arPrice["QUANTITY_TO"], str_replace("#LEFT#", $arPrice["QUANTITY_FROM"], GetMessage("C2IT_BOUND_DIAP"))));
$bNewSegment = false;
break;
}
}
}
if ($bNewSegment) {
$arPriceBoundaries[] = array("FROM" => $arPrice["QUANTITY_FROM"], "TO" => $arPrice["QUANTITY_TO"]);
}
}
}
}
if (!empty($arPriceBoundaries)) {
if (count($arPriceBoundaries) > 1) {
Main\Type\Collection::sortByColumn($arPriceBoundaries, array('FROM' => SORT_ASC));
} else {
$arPriceBoundaries[0]['FROM'] = false;
$arPriceBoundaries[0]['TO'] = false;
}
}
// prices tab
$tabControl1->BeginNextTab();
$arCatPricesExist = array();
// attr for exist prices for range
$bUseExtendedPrice = $bVarsFromForm ? $price_useextform == 'Y' : count($arPriceBoundaries) > 1;
$str_CAT_VAT_ID = $bVarsFromForm ? $CAT_VAT_ID : ($arBaseProduct['VAT_ID'] == 0 ? $arMainCatalog['VAT_ID'] : $arBaseProduct['VAT_ID']);
$str_CAT_VAT_INCLUDED = $bVarsFromForm ? $CAT_VAT_INCLUDED : $arBaseProduct['VAT_INCLUDED'];
?>
<input type="hidden" name="price_useextform" id="price_useextform_N" value="N" />
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="edit-table" id="catalog_vat_table">
示例12: array
$arItem['OFFERS'][$keyOffer]['TREE'] = array();
$arItem['OFFERS'][$keyOffer]['TREE']['PROP_'.$arSKUPropList[$strOneCode]['ID']] = $arMatrix[$keyOffer][$strOneCode]['VALUE'];
$arItem['OFFERS'][$keyOffer]['SKU_SORT_'.$strOneCode] = $arMatrix[$keyOffer][$strOneCode]['SORT'];
$arUsedFields[$strOneCode] = true;
$arSortFields['SKU_SORT_'.$strOneCode] = SORT_NUMERIC;
}
else
{
unset($arMatrix[$keyOffer][$strOneCode]);
}
}
}
$arItem['OFFERS_PROP'] = $arUsedFields;
$arItem['OFFERS_PROP_CODES'] = (!empty($arUsedFields) ? base64_encode(serialize(array_keys($arUsedFields))) : '');
Collection::sortByColumn($arItem['OFFERS'], $arSortFields);
$arMatrix = array();
$intSelected = -1;
$arItem['MIN_PRICE'] = false;
$arItem['MIN_BASIS_PRICE'] = false;
foreach ($arItem['OFFERS'] as $keyOffer => $arOffer)
{
if (empty($arItem['MIN_PRICE']) && $arOffer['CAN_BUY'])
{
$intSelected = $keyOffer;
$arItem['MIN_PRICE'] = (isset($arOffer['RATIO_PRICE']) ? $arOffer['RATIO_PRICE'] : $arOffer['MIN_PRICE']);
$arItem['MIN_BASIS_PRICE'] = $arOffer['MIN_PRICE'];
}
$arSKUProps = false;
if (!empty($arOffer['DISPLAY_PROPERTIES']))
示例13: unset
} else {
if (!$setItem['ITEM_DATA']['CAN_BUY']) {
$resort = true;
}
$arResult['SET_ITEMS']['OTHER'][] = $setItem['ITEM_DATA'];
}
$found = true;
}
unset($setItem, $currentSet);
if (!$found || empty($arResult['SET_ITEMS']['DEFAULT'])) {
$this->AbortResultCache();
return;
}
unset($found);
if ($resort) {
Main\Type\Collection::sortByColumn($arResult['SET_ITEMS']['OTHER'], array('CAN_BUY' => SORT_DESC, 'SET_SORT' => SORT_ASC));
}
unset($resort);
if (defined('BX_COMP_MANAGED_CACHE') && (!empty($tagIblockList) || !empty($tagCurrencyList))) {
$taggedCache = Application::getInstance()->getTaggedCache();
if (!empty($tagIblockList)) {
foreach ($tagIblockList as &$iblock) {
$taggedCache->registerTag('iblock_id_' . $iblock);
}
unset($iblock);
}
if (!empty($tagCurrencyList)) {
foreach ($tagCurrencyList as &$currency) {
$taggedCache->registerTag('currency_id_' . $currency);
}
unset($currency);
示例14: workWithNegativeNodes
/**
* Works with nodes which have negative rights.
*
* We have to get all negative nodes in subtree and order by DEPTH_LEVEL ASC.
* Then we go from each negative node up and calculate opportunity to read this object by ACCESS_CODE.
* If we have positive right on different TASK_ID in subtree, then we can't delete simple rights from subtree.
* If we don't have positive right on different TASK_ID in subtree, then we delete simple rights from subtree
* before we find another positive rights with same ACCESS_CODE.
*
* @return $this
* @throws \Bitrix\Main\ArgumentOutOfRangeException
*/
private function workWithNegativeNodes()
{
$negativeNodes = $this->connection->query("\n\t\t\tSELECT\n\t\t\t\tr.ACCESS_CODE, r.TASK_ID,\n\t\t\t\tr.OBJECT_ID, p.DEPTH_LEVEL\n\t\t\tFROM b_disk_right r\n\t\t\t\tINNER JOIN b_disk_object_path p ON p.OBJECT_ID = r.OBJECT_ID\n\t\t\tWHERE\n\t\t\t\tp.PARENT_ID = {$this->objectId} AND r.NEGATIVE = 1\n\t\t")->fetchAll();
$rightsManager = Driver::getInstance()->getRightsManager();
Collection::sortByColumn($negativeNodes, array('DEPTH_LEVEL' => SORT_ASC));
foreach ($negativeNodes as $negativeNode) {
$nodeObject = BaseObject::buildFromArray(array('ID' => $negativeNode['OBJECT_ID'], 'TYPE' => ObjectTable::TYPE_FOLDER));
$runClean = true;
foreach ($rightsManager->getAllListNormalizeRights($nodeObject) as $right) {
if ($right['ACCESS_CODE'] !== $negativeNode['ACCESS_CODE']) {
continue;
}
//the right goes from parent
if (!empty($right['NEGATIVE']) && $right['OBJECT_ID'] != $negativeNode['OBJECT_ID'] && $right['TASK_ID'] == $negativeNode['TASK_ID']) {
$runClean = false;
break;
}
if (!empty($right['NEGATIVE'])) {
continue;
}
if ($rightsManager->containsOperationInTask($rightsManager::OP_READ, $right['TASK_ID'])) {
$runClean = false;
break;
}
}
unset($right);
if (!$runClean) {
//the node and all sub-elements inherit OP_READ from another positive right.
continue;
}
$this->deleteSimpleRightFromSubTree($negativeNode['OBJECT_ID'], $negativeNode['ACCESS_CODE']);
}
unset($negativeNode);
return $this;
}
示例15: sortByColumn
/**
* Sorting array by column.
* You can use short mode: Collection::sortByColumn($arr, 'value'); This is equal Collection::sortByColumn($arr, array('value' => SORT_ASC))
*
* More example:
* Collection::sortByColumn($arr, array('value' => array(SORT_NUMERIC, SORT_ASC), 'attr' => SORT_DESC), array('attr' => 'strlen'), 'www');
*
* @param array $array
* @param string|array $columns
* @param string|array $callbacks
* @param bool $preserveKeys If false numeric keys will be re-indexed. If true - preserve.
* @param null $defaultValueIfNotSetValue If value not set - use $defaultValueIfNotSetValue (any cols)
*/
function sortByColumn(array &$array, $columns, $callbacks = '', $defaultValueIfNotSetValue = null, $preserveKeys = false)
{
\Bitrix\Main\Type\Collection::sortByColumn($array, $columns, $callbacks, $defaultValueIfNotSetValue, $preserveKeys);
}