本文整理汇总了PHP中sortByColumn函数的典型用法代码示例。如果您正苦于以下问题:PHP sortByColumn函数的具体用法?PHP sortByColumn怎么用?PHP sortByColumn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sortByColumn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* @return array List of servers & their params
*/
public static function getList()
{
$result = array();
$shellAdapter = new ShellAdapter();
$execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/wrapper_ansible_conf -o json");
$serversData = $shellAdapter->getLastOutput();
if ($execRes) {
$arData = json_decode($serversData, true);
//mgmt server must be first
if (isset($arData["params"]) && is_array($arData["params"])) {
foreach ($arData["params"] as $hostname => $server) {
try {
$server["BX_ENV_VER"] = static::getBxEnvVer($hostname);
$bxInfo = static::getBxInfo($hostname);
if (isset($bxInfo["bx_last_password_change"])) {
$server["LAST_PASSWORD_CHANGE"] = $bxInfo["bx_last_password_change"];
}
if (!$server["BX_ENV_VER"] || !Helper::checkBxEnvVersion($server["BX_ENV_VER"])) {
$server["BX_ENV_NEED_UPDATE"] = true;
} else {
$server["BX_ENV_NEED_UPDATE"] = false;
}
} catch (ServerBxInfoException $e) {
$server["BX_INFO_ERROR"] = $e->getMessage();
}
$result[$hostname] = $server;
}
\sortByColumn($result, array("host_id" => array(SORT_NUMERIC, SORT_ASC)));
}
}
return $result;
}
示例2: PrintHtml
public static function PrintHtml($visCountParam = 3)
{
sortByColumn(self::$items, "SORT");
$itemsCount = 0;
$visibleCount = 0;
$div = '
<div class="adm-informer" id="admin-informer" style="display: none; top:48px; left:316px;" onclick="return BX.adminInformer.OnInnerClick(event);">
<div class="adm-informer-header">' . GetMessage("MAIN_AI_NEW_NOTIF") . '</div>';
foreach (self::$items as $key => $item) {
if ($itemsCount < $visCountParam || $item["ALERT"]) {
$bVisible = true;
$visibleCount++;
} else {
$bVisible = false;
}
$div .= self::PrintItemHtml($key, $bVisible);
$itemsCount++;
}
$div .= '
<a href="javascript:void(0);" class="adm-informer-footer adm-informer-footer-collapsed" hidefocus="true" id="adm-informer-footer" onclick="return BX.adminInformer.ToggleExtra();" ' . ($itemsCount <= $visibleCount ? ' style="display:none;"' : '') . '>' . GetMessage('MAIN_AI_ALL_NOTIF') . ' (' . $itemsCount . ') </a>
<span class="adm-informer-arrow"></span>
</div>
<script type="text/javascript">
BX.ready( function(){BX.adminInformer.Init(' . $visibleCount . '); } );
</script>';
return $div;
}
示例3: buildMenu
static public function buildMenu($arParams)
{
if (!empty(self::$arItems))
return self::$arItems;
if (isset($arParams["MENU_FILE"]))
{
$arMobileMenuItems = array();
require($_SERVER["DOCUMENT_ROOT"] . $arParams["MENU_FILE"]);
if (!empty($arMobileMenuItems))
foreach ($arMobileMenuItems as $arItem)
self::addItem($arItem);
}
if (isset($arParams["EVENT_NAME"]))
{
foreach (GetModuleEvents("mobileapp", $arParams["EVENT_NAME"], true) as $arHandler)
ExecuteModuleEventEx($arHandler);
}
CAdminMobilePush::OnAdminMobileGetPushSettings();
sortByColumn(self::$arItems, "sort");
return self::$arItems;
}
示例4: getConfigStructure
protected function getConfigStructure()
{
static $handlers = null;
$initedHandlers = self::getRegisteredHandlers("SID");
sortByColumn($initedHandlers, array(strtoupper("NAME") => SORT_ASC));
if ($handlers === null) {
$handlers = array("" => "");
foreach ($initedHandlers as $handler) {
$handlers[$handler["SID"]] = $handler["NAME"] . " [" . $handler["SID"] . "]";
}
}
if (strlen($this->handlerInitParams["SID"]) <= 0 || $this->id <= 0) {
$result = array("MAIN" => array("TITLE" => Loc::getMessage("SALE_DLVR_HANDL_AUT_HANDLER_SETTINGS"), "DESCRIPTION" => Loc::getMessage("SALE_DLVR_HANDL_AUT_HANDLER_SETTINGS_DSCR"), "ITEMS" => array("SID" => array("TYPE" => "ENUM", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_HANDLER_CHOOSE"), "OPTIONS" => $handlers, "ONCHANGE" => "top.BX.showWait(); if(this.form.elements['NAME'].value == '') this.form.elements['NAME'].value = this.selectedOptions[0].innerHTML.replace(/\\s*\\[.*\\]/g,''); this.form.submit();"))));
} else {
$handler = $this->handlerInitParams["SID"];
$result = array("MAIN" => array("TITLE" => Loc::getMessage("SALE_DLVR_HANDL_AUT_HANDLER_SETTINGS"), "DESCRIPTION" => Loc::getMessage("SALE_DLVR_HANDL_AUT_HANDLER_SETTINGS_DSCR"), "ITEMS" => array("SID" => array("TYPE" => "DELIVERY_READ_ONLY", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_HANDLER_CHOOSE"), "VALUE" => $handler, "VALUE_VIEW" => $handlers[$handler]), "DESCRIPTION_INNER" => array("TYPE" => "DELIVERY_READ_ONLY", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_DESCRIPTION_INNER"), "VALUE" => $this->handlerInitParams["DESCRIPTION_INNER"]))));
}
$serviceCurrency = $this->currency;
if (\Bitrix\Main\Loader::includeModule('currency')) {
$currencyList = CurrencyManager::getCurrencyList();
if (isset($currencyList[$this->currency])) {
$serviceCurrency = $currencyList[$this->currency];
}
unset($currencyList);
}
$marginTypes = array("%" => "%", "CURRENCY" => $serviceCurrency);
$result["MAIN"]["ITEMS"]["MARGIN_VALUE"] = array("TYPE" => "STRING", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_MARGIN_VALUE"), "DEFAULT" => 0);
$result["MAIN"]["ITEMS"]["MARGIN_TYPE"] = array("TYPE" => "ENUM", "NAME" => Loc::getMessage("SALE_DLVR_HANDL_AUT_MARGIN_TYPE"), "DEFAULT" => "%", "OPTIONS" => $marginTypes);
if (strlen($this->sid) > 0) {
$configProfileIds = array_keys($this->handlerInitParams["PROFILES"]);
} else {
$configProfileIds = array();
}
if (isset($this->oldConfig["CONFIG_GROUPS"])) {
$groupProfileIds = array_keys($this->oldConfig["CONFIG_GROUPS"]);
$intersect = array_intersect($groupProfileIds, $configProfileIds);
foreach ($intersect as $pid) {
unset($this->oldConfig["CONFIG_GROUPS"][$pid]);
}
}
$oldConfig = $this->convertOldConfigToNew($this->oldConfig);
if (!empty($oldConfig)) {
if (isset($oldConfig["CONFIG_GROUPS"]["MAIN"])) {
$oldConfig["CONFIG_GROUPS"]["MAIN_OLD"] = $oldConfig["CONFIG_GROUPS"]["MAIN"];
unset($oldConfig["CONFIG_GROUPS"]["MAIN"]);
}
$result = array_merge($result, $oldConfig);
}
return $result;
}
示例5: __construct
public function __construct($arParams = false)
{
$this->arParams = $arParams;
if (!is_array(self::$arAuthProviders)) {
self::$arAuthProviders = array();
foreach (GetModuleEvents("main", "OnAuthProvidersBuildList", true) as $arEvent) {
$res = ExecuteModuleEventEx($arEvent);
if (is_array($res)) {
if (!is_array($res[0])) {
$res = array($res);
}
foreach ($res as $provider) {
self::$arAuthProviders[$provider["ID"]] = $provider;
}
}
}
sortByColumn(self::$arAuthProviders, "SORT");
}
}
示例6: buildMenu
public function buildMenu($arParams)
{
if (!empty(self::$arItems)) {
return self::$arItems;
}
if (isset($arParams["MENU_FILE"])) {
$arMobileMenuItems = array();
require $_SERVER["DOCUMENT_ROOT"] . $arParams["MENU_FILE"];
if (!empty($arMobileMenuItems)) {
foreach ($arMobileMenuItems as $arItem) {
self::addItem($arItem);
}
}
}
if (isset($arParams["EVENT_NAME"])) {
foreach (GetModuleEvents("mobileapp", $arParams["EVENT_NAME"], true) as $arHandler) {
ExecuteModuleEventEx($arHandler);
}
}
sortByColumn(self::$arItems, "sort");
return self::$arItems;
}
示例7: getList
/**
* @return array List of servers & their params
*/
public static function getList()
{
$result = array();
$shellAdapter = new ShellAdapter();
$execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/wrapper_ansible_conf -o json");
$serversData = $shellAdapter->getLastOutput();
if ($execRes) {
$arData = json_decode($serversData, true);
//mgmt server must be first
if (isset($arData["params"]) && is_array($arData["params"])) {
foreach ($arData["params"] as $hostname => $server) {
$server["BX_ENV_VER"] = static::getBxEnvVer($hostname);
if (!$server["BX_ENV_VER"] || !Helper::checkBxEnvVersion($server["BX_ENV_VER"])) {
$server["BX_ENV_NEED_UPDATE"] = true;
} else {
$server["BX_ENV_NEED_UPDATE"] = false;
}
$result[$hostname] = $server;
}
\sortByColumn($result, array("host_id" => array(SORT_NUMERIC, SORT_ASC)));
}
}
return $result;
}
示例8: isset
}
$sumBrutto = $arResult['SUM_BRUTTO'] = isset($orderData['PRICE']) ? $orderData['PRICE'] : 0.0;
$taxSum = isset($orderData['TAX_VALUE']) ? $orderData['TAX_VALUE'] : 0.0;
$sumNetto = $arResult['SUM_NETTO'] = $sumBrutto - $taxSum;
if (isset($orderData['USE_VAT']) && $orderData['USE_VAT'] && $taxMode !== 'VAT') {
ShowError('ERROR: TAX MODES ARE ARE MISMATCHED');
return;
}
$taxList = isset($orderData['TAX_LIST']) && is_array($orderData['TAX_LIST']) ? $orderData['TAX_LIST'] : array();
$taxInfo = CCrmMobileHelper::PrepareInvoiceTaxInfo($taxList, false);
$arResult['TAX_INFOS'] = $taxInfo['ITEMS'];
$isVATMode = $taxMode === 'VAT';
$VATName = $isVATMode && isset($taxList[0]) && isset($taxList[0]['NAME']) ? $taxList[0]['NAME'] : '';
$cartItems = isset($orderData['BASKET_ITEMS']) && isset($orderData['BASKET_ITEMS']) ? $orderData['BASKET_ITEMS'] : array();
// Recover initial row's order
sortByColumn($cartItems, 'IDX');
foreach ($cartItems as &$cartItem) {
$productID = isset($cartItem['PRODUCT_ID']) ? intval($cartItem['PRODUCT_ID']) : 0;
if ($productID <= 0) {
continue;
}
$productName = isset($cartItem['NAME']) ? $cartItem['NAME'] : '';
if ($productName === '') {
$dbProduct = CCrmProduct::GetList(array(), array('ID' => $productID), array('NAME'));
$product = $dbProduct ? $dbProduct->Fetch() : null;
$productName = is_array($product) && isset($product['NAME']) ? $product['NAME'] : '';
}
if ($productName === '') {
continue;
}
$price = isset($cartItem['PRICE']) ? $cartItem['PRICE'] : 0.0;
示例9: GetPanelHtml
//.........这里部分代码省略.........
$toggleCaptionOff = '<span id="bx-panel-toggle-caption-mode-off">' . GetMessage("top_panel_off") . '</span>';
$toggleCaptions = $toggleMode ? $toggleCaptionOn . $toggleCaptionOff : $toggleCaptionOff . $toggleCaptionOn;
$toogle = '<a href="' . $toggleModeLink . '" id="bx-panel-toggle" class="bx-panel-toggle' . ($toggleMode ? '-on' : '-off') . '"' . ($toggleModeDynamic ? '' : ' ' . CTopPanel::AddAttrHint(GetMessage("top_panel_edit_mode_new_tooltip_title"), GetMessage('top_panel_toggle_tooltip') . $hkInstance->GetTitle("bx-panel-small-toggle", true))) . '><span id="bx-panel-switcher-gutter-left"></span><span id="bx-panel-toggle-indicator"><span id="bx-panel-toggle-icon"></span><span id="bx-panel-toggle-icon-overlay"></span></span><span class="bx-panel-break"></span><span id="bx-panel-toggle-caption">' . GetMessage("top_panel_edit_mode_new") . '</span><span class="bx-panel-break"></span><span id="bx-panel-toggle-caption-mode">' . $toggleCaptions . '</span><span id="bx-panel-switcher-gutter-right"></span></a>';
if ($aUserOpt["collapsed"] == "on") {
$result .= $toogle;
}
$result .= '<a href="" id="bx-panel-expander" ' . CTopPanel::AddAttrHint(GetMessage("top_panel_expand_tooltip_title"), GetMessage("top_panel_expand_tooltip") . $hkInstance->GetTitle("bx-panel-expander", true)) . '><span id="bx-panel-expander-text">' . GetMessage("top_panel_expand") . '</span><span id="bx-panel-expander-arrow"></span></a>';
if ($hkInstance->IsActive()) {
$result .= '<a id="bx-panel-hotkeys" href="javascript:void(0)" onclick="BXHotKeys.ShowSettings();" ' . CTopPanel::AddAttrHint(GetMessage("HK_PANEL_TITLE") . $hkInstance->GetTitle("bx-panel-hotkeys", true)) . '></a>';
}
$result .= '<a href="javascript:void(0)" id="bx-panel-pin"' . ($aUserOpt['fix'] == 'on' ? ' class="bx-panel-pin-fixed"' : '') . ' ' . CTopPanel::AddAttrHint(GetMessage('top_panel_pin_tooltip')) . '></a>';
$Execs = $hkInstance->GetCodeByClassName("bx-panel-logout", GetMessage('top_panel_logout_tooltip'));
$result .= $hkInstance->PrintJSExecs($Execs);
$Execs = $hkInstance->GetCodeByClassName("bx-panel-small-toggle", GetMessage("top_panel_edit_mode_new_tooltip_title"), 'location.href="' . $href . '?freetrix_include_areas=' . ($toggleMode ? 'N' : 'Y') . ($params != "" ? "&" . $params : "") . '";');
$result .= $hkInstance->PrintJSExecs($Execs);
$Execs = $hkInstance->GetCodeByClassName("bx-panel-expander", GetMessage("top_panel_expand_tooltip_title") . "/" . GetMessage("top_panel_collapse_tooltip_title"));
$result .= $hkInstance->PrintJSExecs($Execs);
$result .= '
</div>
</div>
';
/* BUTTONS */
$result .= '<div id="bx-panel-site-toolbar"><div id="bx-panel-buttons-gutter"></div><div id="bx-panel-switcher">';
if ($aUserOpt["collapsed"] != "on") {
$result .= $toogle;
}
$result .= '<a href="" id="bx-panel-hider" ' . CTopPanel::AddAttrHint(GetMessage("top_panel_collapse_tooltip_title"), GetMessage("top_panel_collapse_tooltip") . $hkInstance->GetTitle("bx-panel-expander", true)) . '>' . GetMessage("top_panel_collapse") . '<span id="bx-panel-hider-arrow"></span></a>';
$result .= '</div><div id="bx-panel-buttons"><div id="bx-panel-buttons-inner">';
$main_sort = "";
$last_btn_type = '';
$last_btn_small_cnt = 0;
$groupId = -1;
$result .= '<span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
sortByColumn($arPanelButtons, array("MAIN_SORT" => SORT_ASC, "SORT" => SORT_ASC));
foreach ($arPanelButtons as $key => $arButton) {
$result .= $hkInstance->PrintTPButton($arButton);
if ($main_sort != $arButton["MAIN_SORT"] && $main_sort != "") {
$result .= '</span><span class="bx-panel-button-separator"></span><span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
$last_btn_small_cnt = 0;
}
if (!isset($arButton['TYPE']) || $arButton['TYPE'] != 'BIG') {
$arButton['TYPE'] = 'SMALL';
}
//very old behaviour
if (is_set($arButton, "SRC_0")) {
$arButton["SRC"] = $arButton["SRC_0"];
}
$arButton['HREF'] = isset($arButton['HREF']) ? trim($arButton['HREF']) : '';
$bHasAction = $arButton['HREF'] != '';
if (array_key_exists("RESORT_MENU", $arButton) && $arButton["RESORT_MENU"] === true && is_array($arButton['MENU']) && !empty($arButton['MENU'])) {
sortByColumn($arButton['MENU'], "SORT", '', PHP_INT_MAX);
}
$bHasMenu = is_array($arButton['MENU']) && count($arButton['MENU']) > 0;
if ($bHasMenu && !$bHasAction) {
foreach ($arButton['MENU'] as $arItem) {
if (isset($arItem['DEFAULT']) && $arItem['DEFAULT']) {
$arButton['HREF'] = $arItem['HREF'];
$bHasAction = true;
}
}
}
if ($last_btn_type != '' && $arButton['TYPE'] != $last_btn_type && $main_sort == $arButton["MAIN_SORT"]) {
$result .= '</span><span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
$last_btn_small_cnt = 0;
}
if ($bHasAction && substr(strtolower($arButton['HREF']), 0, 11) == 'javascript:') {
示例10: foreach
foreach ($reportList as $firstReport) {
$engine->deleteForecastReport($firstReport["ForecastID"]);
break;
}
}
}
$phraseList = $_REQUEST['phrase'];
$geo = trim($_REQUEST['geo']);
if (is_array($phraseList)) {
$phraseList = array_values(array_unique($phraseList));
$geoList = strlen($geo) > 0 ? preg_split("/[^0-9\\-]+\\s*/", $geo) : array();
$phraseHash = md5(implode('|', $phraseList) . '|||' . $geo);
if (!isset($_SESSION["SEO_FORECASTS"])) {
$_SESSION["SEO_FORECASTS"] = array();
}
sortByColumn($_SESSION["SEO_FORECASTS"], "TS");
foreach ($_SESSION["SEO_FORECASTS"] as $k => $report) {
$lifeTime = time() - $report["TS"];
if ($lifeTime > Engine\YandexDirect::TTL_FORECAST_REPORT && $lifeTime < Engine\YandexDirect::TTL_FORECAST_REPORT_EXT || count($_SESSION["SEO_FORECASTS"]) >= Engine\YandexDirect::MAX_FORECAST_REPORTS) {
$reportId = $report["REPORT_ID"];
$engine->deleteForecastReport($reportId);
unset($_SESSION["SEO_FORECASTS"][$k]);
}
}
if (!isset($_SESSION["SEO_FORECASTS"][$phraseHash])) {
$reportId = $engine->createForecastReport($phraseList, $geoList);
$_SESSION["SEO_FORECASTS"][$phraseHash] = array("REPORT_ID" => intval($reportId), "PHRASE" => $phraseList, "GEO" => $geoList, "TS" => time());
$res = $_SESSION["SEO_FORECASTS"][$phraseHash];
} else {
$reportId = $_SESSION["SEO_FORECASTS"][$phraseHash]["REPORT_ID"];
$res = $engine->getForecastReport($reportId);
示例11: GetFileTemplates
function GetFileTemplates($lang = LANG, $arTemplates = array())
{
global $APPLICATION;
$arDirs = array("php_interface/" . $lang . "/templates", "templates/.default/page_templates", "php_interface/templates");
foreach ($arTemplates as $val) {
$arDirs[] = "templates/" . $val . "/page_templates";
}
$res = array();
foreach ($arDirs as $dir) {
$templDir = getLocalPath($dir, BX_PERSONAL_ROOT);
if ($templDir === false) {
continue;
}
$dirPath = $_SERVER["DOCUMENT_ROOT"] . $templDir;
if (file_exists($dirPath)) {
$sDescFile = $dirPath . "/.content.php";
$TEMPLATE = array();
if (file_exists($sDescFile)) {
include $sDescFile;
}
if ($handle = @opendir($dirPath)) {
while (($file = readdir($handle)) !== false) {
if (is_dir($dirPath . "/" . $file)) {
continue;
}
if (substr($file, 0, 1) == ".") {
continue;
}
$path = $templDir . "/" . $file;
if ($APPLICATION->GetFileAccessPermission($path) < "R") {
continue;
}
$restmp = array("name" => substr($file, 0, bxstrrpos($file, ".")), "file" => $file, "sort" => 150, "path" => $path);
if (array_key_exists($file, $TEMPLATE)) {
if (array_key_exists("name", $TEMPLATE[$file])) {
$restmp["name"] = $TEMPLATE[$file]["name"];
}
if (array_key_exists("sort", $TEMPLATE[$file])) {
$restmp["sort"] = $TEMPLATE[$file]["sort"];
}
}
$res[$file] = $restmp;
}
closedir($handle);
}
}
}
sortByColumn($res, "sort");
return array_values($res);
}
示例12: GetRecentList
//.........这里部分代码省略.........
if ($arRes['ITEM_TYPE'] == IM_MESSAGE_PRIVATE) {
$arUsers[] = $arRes['ITEM_ID'];
$arFileTmp = CFile::ResizeImageGet($arRes["PERSONAL_PHOTO"], array('width' => 58, 'height' => 58), BX_RESIZE_IMAGE_EXACT, false, false, true);
$item['USER'] = array('id' => $arRes['ITEM_ID'], 'name' => CUser::FormatName($nameTemplateSite, $arRes, true, false), 'nameList' => CUser::FormatName($nameTemplate, $arRes, true, false), 'workPosition' => $arRes['WORK_POSITION'], 'color' => self::GetUserColor($arRes["ID"], $arRes['PERSONAL_GENDER'] == 'M' ? 'M' : 'F'), 'avatar' => empty($arFileTmp['src']) ? '/bitrix/js/im/images/blank.gif' : $arFileTmp['src'], 'status' => 'offline', 'birthday' => $arRes['PERSONAL_BIRTHDAY'], 'gender' => $arRes['PERSONAL_GENDER'] == 'F' ? 'F' : 'M', 'extranet' => false, 'network' => $arRes['EXTERNAL_AUTH_ID'] == self::NETWORK_AUTH_ID, 'phoneDevice' => false, 'profile' => CIMContactList::GetUserPath($arRes["ITEM_ID"]));
} else {
$chatType = $arRes["ITEM_TYPE"] == IM_MESSAGE_OPEN ? 'open' : 'chat';
if ($arRes["C_ENTITY_TYPE"] == 'CALL') {
$chatType = 'call';
}
$itemId = 'chat' . $itemId;
$item['CHAT'] = array('id' => $arRes['ITEM_ID'], 'name' => $arRes["C_TITLE"], 'color' => $arRes["CHAT_COLOR"] == "" ? IM\Color::getColorByNumber($arRes['ITEM_ID']) : IM\Color::getColor($arRes['CHAT_COLOR']), 'avatar' => CIMChat::GetAvatarImage($arRes["C_AVATAR"]), 'extranet' => $arRes["CHAT_EXTRANET"] == "" ? "" : ($arRes["CHAT_EXTRANET"] == "Y" ? true : false), 'owner' => $arRes["C_OWNER_ID"], 'type' => $chatType, 'messageType' => $arRes['CHAT_TYPE'], 'call_number' => $arRes["C_CALL_NUMBER"]);
}
$arRecent[$itemId] = $item;
}
$params = CIMMessageParam::Get($arMessageId);
foreach ($arRecent as $key => $value) {
if (isset($params[$value['MESSAGE']['id']])) {
if (count($params[$value['MESSAGE']['id']]['FILE_ID']) > 0 && strlen(trim($arRecent[$key]['MESSAGE']['text'])) <= 0) {
$arRecent[$key]['MESSAGE']['text'] = "[" . GetMessage('IM_FILE') . "]";
}
$arRecent[$key]['MESSAGE']['params'] = $params[$value['MESSAGE']['id']];
}
}
if (!empty($toDelete)) {
if (isset($toDelete[IM_MESSAGE_PRIVATE])) {
self::DeleteRecent($toDelete[IM_MESSAGE_PRIVATE]);
}
if (isset($toDelete[IM_MESSAGE_CHAT])) {
self::DeleteRecent($toDelete[IM_MESSAGE_CHAT], true);
}
if (isset($toDelete[IM_MESSAGE_OPEN])) {
self::DeleteRecent($toDelete[IM_MESSAGE_OPEN], true);
}
}
$bExtranetEnable = IsModuleInstalled('extranet');
$bVoximplantEnable = IsModuleInstalled('voximplant');
if ($bExtranetEnable || $bVoximplantEnable) {
$arUserPhone = array();
$arUserDepartment = array();
$arSelectParams = array();
if ($bExtranetEnable) {
$arSelectParams[] = 'UF_DEPARTMENT';
}
if ($bVoximplantEnable) {
$arSelectParams[] = 'UF_VI_PHONE';
}
$dbUsers = CUser::GetList($sort_by = array('last_name' => 'asc'), $dummy = '', array('ID' => $userId . "|" . implode('|', $arUsers)), array('FIELDS' => array("ID"), 'SELECT' => $arSelectParams));
while ($arUser = $dbUsers->GetNext(true, false)) {
$arUserPhone[$arUser['ID']] = $arUser['UF_VI_PHONE'] == 'Y';
$arUserDepartment[$arUser['ID']] = self::IsExtranet($arUser);
}
foreach ($arRecent as $key => $value) {
if (isset($value['USER'])) {
$arRecent[$key]['USER']['extranet'] = $arUserDepartment[$value['USER']['id']];
$arRecent[$key]['USER']['phoneDevice'] = $arUserPhone[$value['USER']['id']];
}
}
}
if ($obCache->StartDataCache()) {
$obCache->EndDataCache(array('recent' => $arRecent, 'users' => $arUsers));
}
}
$arOnline = CIMStatus::GetList(array('ID' => array_values($arUsers), 'GET_OFFLINE' => 'Y'));
foreach ($arRecent as $key => $value) {
if ($value['TYPE'] != IM_MESSAGE_PRIVATE) {
continue;
}
$arRecent[$key]['USER']['birthday'] = $bIntranetEnable ? CIntranetUtils::IsToday($value['USER']['birthday']) : false;
$arRecent[$key]['USER']['status'] = isset($arOnline['users'][$value['USER']['id']]) ? $arOnline['users'][$value['USER']['id']]['status'] : 'offline';
$arRecent[$key]['USER']['idle'] = isset($arOnline['users'][$value['USER']['id']]) ? $arOnline['users'][$value['USER']['id']]['idle'] : 0;
$arRecent[$key]['USER']['mobileLastDate'] = isset($arOnline['users'][$value['USER']['id']]) ? $arOnline['users'][$value['USER']['id']]['mobileLastDate'] : 0;
if ($arOnline['users'][$value['USER']['id']]['color']) {
$arRecent[$key]['USER']['color'] = $arOnline['users'][$value['USER']['id']]['color'];
}
}
if ($bLoadUnreadMessage) {
$CIMMessage = new CIMMessage(false, array('HIDE_LINK' => 'Y'));
$ar = $CIMMessage->GetUnreadMessage(array('LOAD_DEPARTMENT' => 'N', 'ORDER' => 'ASC', 'GROUP_BY_CHAT' => 'Y', 'USE_TIME_ZONE' => $bTimeZone ? 'Y' : 'N', 'USE_SMILES' => $bSmiles ? 'Y' : 'N'));
foreach ($ar['message'] as $data) {
if (!isset($arRecent[$data['senderId']])) {
$arRecent[$data['senderId']] = array('TYPE' => IM_MESSAGE_PRIVATE, 'USER' => $ar['users'][$data['senderId']]);
}
$arRecent[$data['senderId']]['MESSAGE'] = array('id' => $data['id'], 'senderId' => $data['senderId'], 'date' => $data['date'], 'text' => preg_replace('#\\-{54}.+?\\-{54}#s', " [" . GetMessage('IM_QUOTE') . "] ", strip_tags(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), $data['text']), "<img>")));
$arRecent[$data['senderId']]['COUNTER'] = $data['counter'];
}
$CIMChat = new CIMChat(false, array('HIDE_LINK' => 'Y'));
$ar = $CIMChat->GetUnreadMessage(array('ORDER' => 'ASC', 'GROUP_BY_CHAT' => 'Y', 'USER_LOAD' => 'N', 'FILE_LOAD' => 'N', 'USE_SMILES' => $bSmiles ? 'Y' : 'N', 'USE_TIME_ZONE' => $bTimeZone ? 'Y' : 'N'));
foreach ($ar['message'] as $data) {
if (!isset($arRecent['chat' . $data['recipientId']])) {
$arRecent['chat' . $data['recipientId']] = array('TYPE' => $ar['messageType'] ? $ar['messageType'] : IM_MESSAGE_CHAT, 'CHAT' => $ar['chat']);
}
$arRecent['chat' . $data['recipientId']]['MESSAGE'] = array('id' => $data['id'], 'senderId' => $data['senderId'], 'date' => $data['date'], 'text' => $data['text']);
$arRecent['chat' . $data['recipientId']]['COUNTER'] = $data['counter'];
}
}
if (!empty($arRecent)) {
sortByColumn($arRecent, array('COUNTER' => array(SORT_NUMERIC, SORT_DESC), 'MESSAGE' => array(SORT_NUMERIC, SORT_DESC)), array('COUNTER' => array(__CLASS__, 'GetRecentListSortCounter'), 'MESSAGE' => array(__CLASS__, 'GetRecentListSortMessage')), null, true);
}
return $arRecent;
}
示例13: array
$arResult["SET_ITEMS"]["DEFAULT"][] = $arItem;
if ($arParams['CONVERT_CURRENCY'] == 'Y')
{
$arResult["SET_ITEMS"]["PRICE"] += $arItem["PRICE_DISCOUNT_VALUE"];
$arResult["SET_ITEMS"]["OLD_PRICE"] += $arItem["PRICE_VALUE"];
$arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"] += $arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"];
}
}
else
{
$arItem["SORT"] = $arSetItemsOtherID[$arItem["ID"]];
$arResult["SET_ITEMS"]["OTHER"][] = $arItem;
}
}
sortByColumn($arResult["SET_ITEMS"]["DEFAULT"], array('SORT' => SORT_ASC));
sortByColumn($arResult["SET_ITEMS"]["OTHER"], array('SORT' => SORT_ASC));
if ($arParams['CONVERT_CURRENCY'] == 'N')
{
//convert all prices to main element currency
foreach($arResult["SET_ITEMS"]["DEFAULT"] as $key=>$arItem)
{
$arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_DISCOUNT_VALUE"] = CCurrencyRates::ConvertCurrency($arItem['PRICE_DISCOUNT_VALUE'], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]);
$arResult["SET_ITEMS"]["PRICE"] += $arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_DISCOUNT_VALUE"];
$arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_VALUE"] = CCurrencyRates::ConvertCurrency($arItem["PRICE_VALUE"], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]);
$arResult["SET_ITEMS"]["OLD_PRICE"] += $arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_VALUE"];
$arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"] = CCurrencyRates::ConvertCurrency($arItem["PRICE_DISCOUNT_DIFFERENCE_VALUE"], $arItem["PRICE_CURRENCY"] , $arResult["ELEMENT"]["PRICE_CURRENCY"]);
$arResult["SET_ITEMS"]["PRICE_DISCOUNT_DIFFERENCE"] += $arResult["SET_ITEMS"]["DEFAULT"][$key]["PRICE_CONVERT_DISCOUNT_DIFFERENCE_VALUE"];
}
foreach($arResult["SET_ITEMS"]["OTHER"] as $key=>$arItem)
{
示例14: AddPagerSettings
public static function AddPagerSettings(&$arComponentParameters, $pager_title, $bDescNumbering=true, $bShowAllParam=false)
{
$arHiddenTemplates = array(
'js' => true
);
if (!isset($arComponentParameters['GROUPS']))
$arComponentParameters['GROUPS'] = array();
$arComponentParameters["GROUPS"]["PAGER_SETTINGS"] = array(
"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_SETTINGS"),
);
$arTemplateInfo = CComponentUtil::GetTemplatesList('freetrix:system.pagenavigation');
if (empty($arTemplateInfo))
{
$arComponentParameters["PARAMETERS"]["PAGER_TEMPLATE"] = Array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_TEMPLATE"),
"TYPE" => "STRING",
"DEFAULT" => "",
);
}
else
{
sortByColumn($arTemplateInfo, array('TEMPLATE' => SORT_ASC, 'NAME' => SORT_ASC));
$arTemplateList = array();
$arSiteTemplateList = array(
'.default' => GetMessage('T_IBLOCK_DESC_PAGER_TEMPLATE_SITE_DEFAULT')
);
$arTemplateID = array();
foreach ($arTemplateInfo as &$template)
{
if ('' != $template["TEMPLATE"] && '.default' != $template["TEMPLATE"])
$arTemplateID[] = $template["TEMPLATE"];
if (!isset($template['TITLE']))
$template['TITLE'] = $template['NAME'];
}
unset($template);
if (!empty($arTemplateID))
{
$rsSiteTemplates = CSiteTemplate::GetList(
array(),
array("ID"=>$arTemplateID),
array()
);
while ($arSitetemplate = $rsSiteTemplates->Fetch())
{
$arSiteTemplateList[$arSitetemplate['ID']] = $arSitetemplate['NAME'];
}
}
foreach ($arTemplateInfo as &$template)
{
if (isset($arHiddenTemplates[$template['NAME']]))
continue;
$strDescr = $template["TITLE"].' ('.('' != $template["TEMPLATE"] && '' != $arSiteTemplateList[$template["TEMPLATE"]] ? $arSiteTemplateList[$template["TEMPLATE"]] : GetMessage("T_IBLOCK_DESC_PAGER_TEMPLATE_SYSTEM")).')';
$arTemplateList[$template['NAME']] = $strDescr;
}
unset($template);
$arComponentParameters["PARAMETERS"]["PAGER_TEMPLATE"] = array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_TEMPLATE_EXT"),
"TYPE" => "LIST",
"VALUES" => $arTemplateList,
"DEFAULT" => ".default",
"ADDITIONAL_VALUES" => "Y"
);
}
$arComponentParameters["PARAMETERS"]["DISPLAY_TOP_PAGER"] = Array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_TOP_PAGER"),
"TYPE" => "CHECKBOX",
"DEFAULT" => "N",
);
$arComponentParameters["PARAMETERS"]["DISPLAY_BOTTOM_PAGER"] = Array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_BOTTOM_PAGER"),
"TYPE" => "CHECKBOX",
"DEFAULT" => "Y",
);
$arComponentParameters["PARAMETERS"]["PAGER_TITLE"] = Array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_TITLE"),
"TYPE" => "STRING",
"DEFAULT" => $pager_title,
);
$arComponentParameters["PARAMETERS"]["PAGER_SHOW_ALWAYS"] = Array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_SHOW_ALWAYS"),
"TYPE" => "CHECKBOX",
"DEFAULT" => "Y",
);
if($bDescNumbering)
{
$arComponentParameters["PARAMETERS"]["PAGER_DESC_NUMBERING"] = Array(
"PARENT" => "PAGER_SETTINGS",
"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_DESC_NUMBERING"),
"TYPE" => "CHECKBOX",
//.........这里部分代码省略.........
示例15: GetRecentList
//.........这里部分代码省略.........
{
if (isset($toDelete[IM_MESSAGE_PRIVATE]))
self::DeleteRecent($toDelete[IM_MESSAGE_PRIVATE]);
if (isset($toDelete[IM_MESSAGE_GROUP]))
self::DeleteRecent($toDelete[IM_MESSAGE_GROUP], true);
}
if($obCache->StartDataCache())
$obCache->EndDataCache(Array('recent' => $arRecent, 'users' => $arUsers));
}
$arOnline = self::GetStatus(Array('ID' => array_values($arUsers)));
foreach ($arRecent as $key => $value)
{
if ($value['TYPE'] != IM_MESSAGE_PRIVATE)
continue;
$arRecent[$key]['USER']['birthday'] = $bIntranetEnable? CIntranetUtils::IsToday($value['USER']['birthday']): false;
$arRecent[$key]['USER']['status'] = isset($arOnline['users'][$value['USER']['id']])? 'online': 'offline';
}
if ($bLoadUnreadMessage)
{
$CIMMessage = new CIMMessage(false, Array(
'hide_link' => true
));
$ar = $CIMMessage->GetUnreadMessage(Array(
'LOAD_DEPARTMENT' => 'N',
'ORDER' => 'ASC',
'GROUP_BY_CHAT' => 'Y',
'USE_TIME_ZONE' => $bTimeZone? 'Y': 'N',
'USE_SMILES' => $bSmiles? 'Y': 'N'
));
foreach ($ar['message'] as $data)
{
if (!isset($arRecent[$data['senderId']]))
{
$arRecent[$data['senderId']] = Array(
'TYPE' => IM_MESSAGE_PRIVATE,
'USER' => $ar['users'][$data['senderId']]
);
}
$arRecent[$data['senderId']]['MESSAGE'] = Array(
'id' => $data['id'],
'senderId' => $data['senderId'],
'date' => $data['date'],
'text' => preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [".GetMessage('IM_QUOTE')."] ", strip_tags(str_replace(array("<br>","<br/>","<br />", "#BR#"), Array(" ", " ", " ", " "), $data['text']), "<img>"))
);
$arRecent[$data['senderId']]['COUNTER'] = $data['counter'];
}
$CIMChat = new CIMChat(false, Array(
'hide_link' => true
));
$ar = $CIMChat->GetUnreadMessage(Array(
'ORDER' => 'ASC',
'GROUP_BY_CHAT' => 'Y',
'USER_LOAD' => 'N',
'USE_SMILES' => $bSmiles? 'Y': 'N',
'USE_TIME_ZONE' => $bTimeZone? 'Y': 'N'
));
foreach ($ar['message'] as $data)
{
if (!isset($arRecent['chat'.$data['recipientId']]))
{
$arRecent['chat'.$data['recipientId']] = Array(
'TYPE' => IM_MESSAGE_GROUP,
'CHAT' => $ar['chat']
);
}
$arRecent['chat'.$data['recipientId']]['MESSAGE'] = Array(
'id' => $data['id'],
'senderId' => $data['senderId'],
'date' => $data['date'],
'text' => $data['text']
);
$arRecent['chat'.$data['recipientId']]['COUNTER'] = $data['counter'];
}
}
if (!empty($arRecent))
{
sortByColumn(
$arRecent,
array(
'COUNTER' => array(SORT_NUMERIC, SORT_DESC),
'MESSAGE' => array(SORT_NUMERIC, SORT_DESC)
),
array(
'COUNTER' => function($counter){ return !is_null($counter); },
'MESSAGE' => function($recent){ return $recent['date']; }
),
null, true
);
}
return $arRecent;
}