当前位置: 首页>>代码示例>>PHP>>正文


PHP CArrayHelper::sort方法代码示例

本文整理汇总了PHP中CArrayHelper::sort方法的典型用法代码示例。如果您正苦于以下问题:PHP CArrayHelper::sort方法的具体用法?PHP CArrayHelper::sort怎么用?PHP CArrayHelper::sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CArrayHelper的用法示例。


在下文中一共展示了CArrayHelper::sort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

$items = API::Item()->get(['output' => ['itemid', 'name'], 'selectHosts' => ['name'], 'itemids' => $itemIds, 'webitems' => true, 'preservekeys' => true]);
foreach ($itemIds as $itemId) {
    if (!isset($items[$itemId])) {
        access_deny();
    }
}
$hostNames = [];
foreach ($items as &$item) {
    $item['hostname'] = $item['hosts'][0]['name'];
    if (!in_array($item['hostname'], $hostNames)) {
        $hostNames[] = $item['hostname'];
    }
}
unset($item);
// sort items
CArrayHelper::sort($items, ['name', 'hostname', 'itemid']);
/*
 * Display
 */
$timeline = CScreenBase::calculateTime(['profileIdx' => getRequest('profileIdx', 'web.screens'), 'profileIdx2' => getRequest('profileIdx2'), 'updateProfile' => getRequest('updateProfile', true), 'period' => getRequest('period'), 'stime' => getRequest('stime')]);
$graph = new CLineGraphDraw(getRequest('type'));
$graph->setPeriod($timeline['period']);
$graph->setSTime($timeline['stime']);
// change how the graph will be displayed if more than one item is selected
if (getRequest('batch')) {
    // set a default header
    if (count($hostNames) == 1) {
        $graph->setHeader($hostNames[0] . NAME_DELIMITER . _('Item values'));
    } else {
        $graph->setHeader(_('Item values'));
    }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:chart.php

示例2: get_accessible_groups_by_rights

function get_accessible_groups_by_rights(&$rights, $user_type, $perm)
{
    $result = [];
    $group_perm = [];
    foreach ($rights as $right) {
        $group_perm[$right['id']] = $right['permission'];
    }
    $dbHostGroups = DBselect('SELECT g.*,' . PERM_DENY . ' AS permission FROM groups g');
    while ($dbHostGroup = DBfetch($dbHostGroups)) {
        if ($user_type == USER_TYPE_SUPER_ADMIN) {
            $dbHostGroup['permission'] = PERM_READ_WRITE;
        } elseif (isset($group_perm[$dbHostGroup['groupid']])) {
            $dbHostGroup['permission'] = $group_perm[$dbHostGroup['groupid']];
        } else {
            $dbHostGroup['permission'] = PERM_DENY;
        }
        if ($dbHostGroup['permission'] < $perm) {
            continue;
        }
        $result[$dbHostGroup['groupid']] = $dbHostGroup;
    }
    CArrayHelper::sort($result, [['field' => 'name', 'order' => ZBX_SORT_UP]]);
    return $result;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:24,代码来源:perm.inc.php

示例3: getParentMaps

/**
 * Get parent maps for current map.
 *
 * @param int $mapId
 *
 * @return array
 */
function getParentMaps($mapId)
{
    $parentMaps = DBfetchArrayAssoc(DBselect('SELECT s.sysmapid,s.name' . ' FROM sysmaps s' . ' JOIN sysmaps_elements se ON se.sysmapid=s.sysmapid' . ' WHERE se.elementtype=' . SYSMAP_ELEMENT_TYPE_MAP . ' AND se.elementid=' . zbx_dbstr($mapId)), 'sysmapid');
    CArrayHelper::sort($parentMaps, array('name'));
    return $parentMaps;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:13,代码来源:maps.inc.php

示例4: getMenuPopupTrigger

/**
 * Prepare data for trigger menu popup.
 *
 * @param array  $trigger						trigger data
 * @param string $trigger['triggerid']			trigger id
 * @param int    $trigger['flags']				trigger flags (TRIGGER_FLAG_DISCOVERY*)
 * @param array  $trigger['hosts']				hosts, used by trigger expression
 * @param string $trigger['hosts'][]['hostid']	host id
 * @param string $trigger['url']				url
 * @param array  $items							trigger items (optional)
 * @param string $items[]['name']				item name
 * @param array  $items[]['params']				item url parameters ("name" => "value")
 * @param array  $acknowledge					acknowledge link parameters (optional)
 * @param string $acknowledge['eventid']		event id
 * @param string $acknowledge['screenid']		screen id (optional)
 * @param string $acknowledge['backurl']		return url (optional)
 * @param string $eventTime						event navigation time parameter (optional)
 *
 * @return array
 */
function getMenuPopupTrigger(array $trigger, array $items = null, array $acknowledge = null, $eventTime = null)
{
    if ($items) {
        CArrayHelper::sort($items, array('name'));
    }
    $data = array('type' => 'trigger', 'triggerid' => $trigger['triggerid'], 'items' => $items, 'acknowledge' => $acknowledge, 'eventTime' => $eventTime, 'configuration' => null, 'url' => resolveTriggerUrl($trigger));
    if ((CWebUser::$data['type'] == USER_TYPE_ZABBIX_ADMIN || CWebUser::$data['type'] == USER_TYPE_SUPER_ADMIN) && $trigger['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $host = reset($trigger['hosts']);
        $data['configuration'] = array('hostid' => $host['hostid'], 'switchNode' => id2nodeid($trigger['triggerid']));
    }
    return $data;
}
开发者ID:itnihao,项目名称:Zabbix_,代码行数:32,代码来源:func.inc.php

示例5: CTableInfo

** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$table = (new CTableInfo())->setHeader([_('Host group'), _('Without problems'), _('With problems'), _('Total')]);
// get host groups
$groups = API::HostGroup()->get(['output' => ['groupid', 'name'], 'groupids' => $data['filter']['groupids'], 'hostids' => isset($data['filter']['hostids']) ? $data['filter']['hostids'] : null, 'monitored_hosts' => true, 'preservekeys' => true]);
CArrayHelper::sort($groups, ['name']);
// get hosts
$hosts = API::Host()->get(['output' => ['hostid', 'name'], 'selectGroups' => ['groupid'], 'groupids' => array_keys($groups), 'hostids' => isset($data['filter']['hostids']) ? $data['filter']['hostids'] : null, 'filter' => ['maintenance_status' => $data['filter']['maintenance']], 'monitored_hosts' => true, 'preservekeys' => true]);
CArrayHelper::sort($hosts, ['name']);
// get triggers
$triggers = API::Trigger()->get(['output' => ['triggerid', 'priority'], 'selectHosts' => ['hostid'], 'search' => $data['filter']['trigger_name'] !== '' ? ['description' => $data['filter']['trigger_name']] : null, 'filter' => ['priority' => $data['filter']['severity'], 'value' => TRIGGER_VALUE_TRUE], 'maintenance' => $data['filter']['maintenance'], 'monitored' => true]);
if ($data['filter']['extAck']) {
    $hosts_with_unack_triggers = [];
    $triggers_unack = API::Trigger()->get(['output' => ['triggerid'], 'selectHosts' => ['hostid'], 'search' => $data['filter']['trigger_name'] !== '' ? ['description' => $data['filter']['trigger_name']] : null, 'filter' => ['priority' => $data['filter']['severity'], 'value' => TRIGGER_VALUE_TRUE], 'withLastEventUnacknowledged' => true, 'maintenance' => $data['filter']['maintenance'], 'monitored' => true, 'preservekeys' => true]);
    foreach ($triggers_unack as $tunack) {
        foreach ($tunack['hosts'] as $unack_host) {
            $hosts_with_unack_triggers[$unack_host['hostid']] = $unack_host['hostid'];
        }
    }
}
$hosts_data = [];
$problematic_host_list = [];
$lastUnack_host_list = [];
$highest_severity = [];
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.widget.hosts.view.php

示例6: array_unshift

         array_unshift($header, _('From'), _('Till'));
         $max = $year == $currentYear ? date('W') - 1 : 52;
         for ($i = 0; $i <= $max; $i++) {
             $intervals[strtotime('+' . $i . ' week', $minTime)] = strtotime('+' . ($i + 1) . ' week', $minTime);
         }
         break;
 }
 // time till
 $maxTime = $year == $currentYear ? time() : mktime(0, 0, 0, 1, 1, $year + 1);
 // fetch alerts
 $alerts = [];
 foreach (eventSourceObjects() as $sourceObject) {
     $alerts = array_merge($alerts, API::Alert()->get(['output' => ['mediatypeid', 'userid', 'clock'], 'eventsource' => $sourceObject['source'], 'eventobject' => $sourceObject['object'], 'mediatypeids' => getRequest('media_type') ? getRequest('media_type') : null, 'time_from' => $minTime, 'time_till' => $maxTime]));
 }
 // sort alerts in chronological order so we could easily iterate through them later
 CArrayHelper::sort($alerts, ['clock']);
 $table->setHeader($header);
 foreach ($intervals as $from => $till) {
     // interval start
     $row = [zbx_date2str($dateFormat, $from)];
     // interval end, displayed only for week intervals
     if ($period == 'weekly') {
         $row[] = zbx_date2str($dateFormat, min($till, time()));
     }
     // counting alert count for each user and media type
     $summary = [];
     foreach ($users as $userid) {
         $summary[$userid] = [];
         $summary[$userid]['total'] = 0;
         $summary[$userid]['medias'] = [];
         foreach ($media_types as $media_type_nr => $mt) {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:report4.php

示例7: get_request

         } else {
             $data['action']['def_shortdata'] = get_request('def_shortdata');
             $data['action']['def_longdata'] = get_request('def_longdata');
             $data['action']['r_shortdata'] = get_request('r_shortdata');
             $data['action']['r_longdata'] = get_request('r_longdata');
         }
     }
 }
 if (!$data['actionid'] && !hasRequest('form_refresh') && $data['eventsource'] == EVENT_SOURCE_TRIGGERS) {
     $data['action']['conditions'] = array(array('conditiontype' => CONDITION_TYPE_TRIGGER_VALUE, 'operator' => CONDITION_OPERATOR_EQUAL, 'value' => TRIGGER_VALUE_TRUE), array('conditiontype' => CONDITION_TYPE_MAINTENANCE, 'operator' => CONDITION_OPERATOR_NOT_IN, 'value' => ''));
 }
 $data['allowedConditions'] = get_conditions_by_eventsource($data['eventsource']);
 $data['allowedOperations'] = get_operations_by_eventsource($data['eventsource']);
 // sort conditions
 $sortFields = array(array('field' => 'conditiontype', 'order' => ZBX_SORT_DOWN), array('field' => 'operator', 'order' => ZBX_SORT_DOWN), array('field' => 'value', 'order' => ZBX_SORT_DOWN));
 CArrayHelper::sort($data['action']['conditions'], $sortFields);
 // new condition
 $data['new_condition'] = array('conditiontype' => isset($data['new_condition']['conditiontype']) ? $data['new_condition']['conditiontype'] : CONDITION_TYPE_TRIGGER_NAME, 'operator' => isset($data['new_condition']['operator']) ? $data['new_condition']['operator'] : CONDITION_OPERATOR_LIKE, 'value' => isset($data['new_condition']['value']) ? $data['new_condition']['value'] : '');
 if (!str_in_array($data['new_condition']['conditiontype'], $data['allowedConditions'])) {
     $data['new_condition']['conditiontype'] = $data['allowedConditions'][0];
 }
 // new operation
 if (!empty($data['new_operation'])) {
     if (!is_array($data['new_operation'])) {
         $data['new_operation'] = array('action' => 'create', 'operationtype' => 0, 'esc_period' => 0, 'esc_step_from' => 1, 'esc_step_to' => 1, 'evaltype' => 0);
     }
 }
 // render view
 $actionView = new CView('configuration.action.edit', $data);
 $actionView->render();
 $actionView->show();
开发者ID:hujingguang,项目名称:work,代码行数:31,代码来源:actionconf.php

示例8: elseif

        } elseif ($sortField === 'lastclock') {
            $sortFields = array(array('field' => 'lastclock', 'order' => $sortOrder), 'name_expanded', 'itemid');
        } else {
            $sortFields = array('name_expanded', 'itemid');
        }
        CArrayHelper::sort($items, $sortFields);
        if ($applications) {
            foreach ($applications as &$application) {
                $application['hostname'] = $hosts[$application['hostid']]['name'];
                $application['item_cnt'] = 0;
            }
            unset($application);
            // by default order by application name and application id
            $sortFields = $sortField === 'host' ? array(array('field' => 'hostname', 'order' => $sortOrder)) : array();
            array_push($sortFields, 'name', 'applicationid');
            CArrayHelper::sort($applications, $sortFields);
        }
        if (!$singleHostSelected) {
            // get host scripts
            $hostScripts = API::Script()->getScriptsByHosts($hostIds);
            // get templates screen count
            $screens = API::TemplateScreen()->get(array('hostids' => $hostIds, 'countOutput' => true, 'groupCount' => true));
            $screens = zbx_toHash($screens, 'hostid');
            foreach ($hosts as &$host) {
                $host['screens'] = isset($screens[$host['hostid']]);
            }
            unset($host);
        }
    }
}
if ($filter['showDetails']) {
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:latest.php

示例9: makeTriggersPopup

/**
 * Generate table for dashboard triggers popup.
 *
 * @see make_system_status
 *
 * @param array $triggers
 * @param string $backurl
 * @param array $actions
 * @param array $config
 *
 * @return CTableInfo
 */
function makeTriggersPopup(array $triggers, $backurl, array $actions, array $config)
{
    $popupTable = (new CTableInfo())->setHeader([_('Host'), _('Issue'), _('Age'), _('Info'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions')]);
    CArrayHelper::sort($triggers, [['field' => 'lastchange', 'order' => ZBX_SORT_DOWN]]);
    foreach ($triggers as $trigger) {
        $description = CMacrosResolverHelper::resolveEventDescription(zbx_array_merge($trigger, array('clock' => $trigger['event']['clock'], 'ns' => $trigger['event']['ns'])));
        // unknown triggers
        $unknown = '';
        if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
            $unknown = makeUnknownIcon($trigger['error']);
        }
        // ack
        if ($config['event_ack_enable']) {
            $ack = isset($trigger['event']['eventid']) ? getEventAckState($trigger['event'], $backurl) : (new CSpan(_('No events')))->addClass(ZBX_STYLE_GREY);
        } else {
            $ack = null;
        }
        // action
        $action = isset($trigger['event']['eventid']) && isset($actions[$trigger['event']['eventid']]) ? $actions[$trigger['event']['eventid']] : '';
        $popupTable->addRow([$trigger['hosts'][0]['name'], getSeverityCell($trigger['priority'], $config, $description), zbx_date2age($trigger['lastchange']), $unknown, $ack, (new CCol($action))->addClass(ZBX_STYLE_NOWRAP)]);
    }
    return $popupTable;
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:35,代码来源:blocks.inc.php

示例10: reset

        $dbTrigger = reset($dbTrigger);
        $host = reset($dbTrigger['hosts']);
        $link['linktriggers'][$lnum]['desc_exp'] = $host['name'] . NAME_DELIMITER . $dbTrigger['description'];
    }
    order_result($link['linktriggers'], 'desc_exp');
}
unset($link);
// get iconmapping
if ($data['sysmap']['iconmapid']) {
    $iconMap = API::IconMap()->get(['iconmapids' => $data['sysmap']['iconmapid'], 'output' => ['default_iconid'], 'preservekeys' => true]);
    $iconMap = reset($iconMap);
    $data['defaultAutoIconId'] = $iconMap['default_iconid'];
}
// get icon list
$icons = DBselect('SELECT i.imageid,i.name FROM images i WHERE i.imagetype=' . IMAGE_TYPE_ICON);
while ($icon = DBfetch($icons)) {
    $data['iconList'][] = ['imageid' => $icon['imageid'], 'name' => $icon['name']];
    if ($icon['name'] == MAP_DEFAULT_ICON || !isset($data['defaultIconId'])) {
        $data['defaultIconId'] = $icon['imageid'];
        $data['defaultIconName'] = $icon['name'];
    }
}
if ($data['iconList']) {
    CArrayHelper::sort($data['iconList'], ['name']);
    $data['iconList'] = array_values($data['iconList']);
}
// render view
$sysmapView = new CView('monitoring.sysmap.constructor', $data);
$sysmapView->render();
$sysmapView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:sysmap.php

示例11: reset

        $dbTrigger = reset($dbTrigger);
        $host = reset($dbTrigger['hosts']);
        $link['linktriggers'][$lnum]['desc_exp'] = $host['name'] . NAME_DELIMITER . $dbTrigger['description'];
    }
    order_result($link['linktriggers'], 'desc_exp');
}
unset($link);
// get iconmapping
if ($data['sysmap']['iconmapid']) {
    $iconMap = API::IconMap()->get(array('iconmapids' => $data['sysmap']['iconmapid'], 'output' => array('default_iconid'), 'preservekeys' => true));
    $iconMap = reset($iconMap);
    $data['defaultAutoIconId'] = $iconMap['default_iconid'];
}
// get icon list
$icons = DBselect('SELECT i.imageid,i.name FROM images i WHERE i.imagetype=' . IMAGE_TYPE_ICON);
while ($icon = DBfetch($icons)) {
    $data['iconList'][] = array('imageid' => $icon['imageid'], 'name' => $icon['name']);
    if ($icon['name'] == MAP_DEFAULT_ICON || !isset($data['defaultIconId'])) {
        $data['defaultIconId'] = $icon['imageid'];
        $data['defaultIconName'] = $icon['name'];
    }
}
if ($data['iconList']) {
    CArrayHelper::sort($data['iconList'], array('name'));
    $data['iconList'] = array_values($data['iconList']);
}
// render view
$sysmapView = new CView('configuration.sysmap.constructor', $data);
$sysmapView->render();
$sysmapView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:sysmap.php

示例12: zbx_objectValues

    $data['groupIds'] = zbx_objectValues($data['groupIds'], 'value');
    $data['groupIds'] = zbx_toHash($data['groupIds']);
    $data['hideGroupIds'] = CFavorite::get('web.dashconf.groups.hide.groupids');
    $data['hideGroupIds'] = zbx_objectValues($data['hideGroupIds'], 'value');
    $data['hideGroupIds'] = zbx_toHash($data['hideGroupIds']);
}
$data['severity'] = zbx_toHash($data['severity']);
$data['severities'] = array(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING, TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER);
if ($data['grpswitch']) {
    // show groups
    $data['groups'] = API::HostGroup()->get(array('groupids' => $data['groupIds'], 'output' => array('groupid', 'name')));
    CArrayHelper::sort($data['groups'], array(array('field' => 'name', 'order' => ZBX_SORT_UP)));
    foreach ($data['groups'] as &$group) {
        $group['id'] = $group['groupid'];
        unset($group['groupid']);
    }
    unset($group);
    // hide groups
    $data['hideGroups'] = API::HostGroup()->get(array('groupids' => $data['hideGroupIds'], 'output' => array('groupid', 'name')));
    CArrayHelper::sort($data['hideGroups'], array(array('field' => 'name', 'order' => ZBX_SORT_UP)));
    foreach ($data['hideGroups'] as &$group) {
        $group['id'] = $group['groupid'];
        unset($group['groupid']);
    }
    unset($group);
}
// render view
$dashconfView = new CView('monitoring.dashconf', $data);
$dashconfView->render();
$dashconfView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:dashconf.php

示例13: array

$queryData = true;
$firstAlert = null;
if ($data['alias']) {
    $user = API::User()->get(array('output' => array('userid'), 'filter' => array('alias' => $data['alias'])));
    if ($user) {
        $user = reset($user);
    } else {
        $queryData = false;
    }
}
// fetch alerts for different objects and sources and combine them in a single stream
if ($queryData) {
    foreach (eventSourceObjects() as $eventSource) {
        $data['alerts'] = array_merge($data['alerts'], API::Alert()->get(array('output' => API_OUTPUT_EXTEND, 'selectMediatypes' => API_OUTPUT_EXTEND, 'userids' => $data['alias'] ? $user['userid'] : null, 'time_from' => $from, 'time_till' => $till, 'eventsource' => $eventSource['source'], 'eventobject' => $eventSource['object'], 'limit' => $config['search_limit'] + 1)));
    }
    CArrayHelper::sort($data['alerts'], array(array('field' => 'alertid', 'order' => ZBX_SORT_DOWN)));
    $data['alerts'] = array_slice($data['alerts'], 0, $config['search_limit'] + 1);
    // get first alert
    if ($user) {
        $firstAlert = DBfetch(DBselect('SELECT MIN(a.clock) AS clock' . ' FROM alerts a' . ' WHERE a.userid=' . zbx_dbstr($user['userid'])));
    }
}
// padding
$data['paging'] = getPagingLine($data['alerts']);
// timeline
$data['timeline'] = array('period' => $effectivePeriod, 'starttime' => date(TIMESTAMP_FORMAT, $firstAlert ? $firstAlert['clock'] : ZBX_MAX_PERIOD), 'usertime' => isset($data['stime']) ? date(TIMESTAMP_FORMAT, zbxDateToTime($data['stime']) + $effectivePeriod) : null);
// render view
$auditView = new CView('administration.auditacts.list', $data);
$auditView->render();
$auditView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:auditacts.php

示例14: array_values

    $data['macros'] = array_values(order_macros($data['macros'], 'macro'));
    if (!$data['macros'] && $data['flags'] != ZBX_FLAG_DISCOVERY_CREATED) {
        $macro = ['macro' => '', 'value' => ''];
        if ($data['show_inherited_macros']) {
            $macro['type'] = MACRO_TYPE_HOSTMACRO;
        }
        $data['macros'][] = $macro;
    }
    // groups with RW permissions
    $data['groupsAllowed'] = API::HostGroup()->get(['output' => [], 'editable' => true, 'preservekeys' => true]);
    // all available groups
    $data['groupsAll'] = API::HostGroup()->get(['output' => ['groupid', 'name']]);
    CArrayHelper::sort($data['groupsAll'], ['name']);
    if ($data['templates']) {
        $data['linked_templates'] = API::Template()->get(['output' => ['templateid', 'name'], 'templateids' => $data['templates']]);
        CArrayHelper::sort($data['linked_templates'], ['name']);
    }
    $hostView = new CView('configuration.host.edit', $data);
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
    CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
    CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
    // get Hosts
    $hosts = [];
    if ($pageFilter->groupsSelected) {
        $hosts = API::Host()->get(['output' => ['hostid', $sortField], 'groupids' => $pageFilter->groupid > 0 ? $pageFilter->groupid : null, 'editable' => true, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1, 'search' => ['name' => $filter['host'] === '' ? null : $filter['host'], 'ip' => $filter['ip'] === '' ? null : $filter['ip'], 'dns' => $filter['dns'] === '' ? null : $filter['dns']], 'filter' => ['port' => $filter['port'] === '' ? null : $filter['port']]]);
    }
    order_result($hosts, $sortField, $sortOrder);
    $url = (new CUrl('hosts.php'))->setArgument('groupid', $pageFilter->groupid);
    $pagingLine = getPagingLine($hosts, $sortOrder, $url);
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:hosts.php

示例15: getRequest

$graph->setSTime($timeline['stime']);
if (isset($_REQUEST['border'])) {
    $graph->setBorder(0);
}
$width = getRequest('width', 0);
if ($width <= 0) {
    $width = $dbGraph['width'];
}
$height = getRequest('height', 0);
if ($height <= 0) {
    $height = $dbGraph['height'];
}
$graph->setWidth($width);
$graph->setHeight($height);
// array sorting
CArrayHelper::sort($dbGraph['gitems'], array(array('field' => 'sortorder', 'order' => ZBX_SORT_UP), array('field' => 'itemid', 'order' => ZBX_SORT_DOWN)));
// get graph items
foreach ($dbGraph['gitems'] as $gItem) {
    $graph->addItem($gItem['itemid'], $gItem['calc_fnc'], $gItem['color'], $gItem['type']);
}
$hostName = '';
foreach ($dbGraph['hosts'] as $gItemHost) {
    if ($hostName === '') {
        $hostName = $gItemHost['name'];
    } elseif ($hostName !== $gItemHost['name']) {
        $hostName = '';
        break;
    }
}
$graph->setHeader($hostName === '' ? $dbGraph['name'] : $hostName . NAME_DELIMITER . $dbGraph['name']);
if ($dbGraph['show_3d']) {
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:chart6.php


注:本文中的CArrayHelper::sort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。