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


PHP order_by函数代码示例

本文整理汇总了PHP中order_by函数的典型用法代码示例。如果您正苦于以下问题:PHP order_by函数的具体用法?PHP order_by怎么用?PHP order_by使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_ad

 public function get_ad()
 {
     $query = $this->db_ > order_by('Name')->get('New_ad');
     $result = array();
     foreach ($query->result_array() as $row) {
         $result[$row['id']] = $row['Name'];
     }
     return $result;
 }
开发者ID:iplayfast,项目名称:sc,代码行数:9,代码来源:table_model.php

示例2: displayProfileLinks

 protected function displayProfileLinks()
 {
     $out = "";
     $ar = order_by($this->app->getConfig("channels", "profile", "pages"), "topmenu_position");
     foreach ($ar as $rw) {
         if (!$rw["topmenu_position"]) {
             continue;
         }
         if ($rw["auth_required"] && !$this->app->getUser()) {
             continue;
         }
         if ($rw["auth_denied"] && $this->app->getUser()) {
             continue;
         }
         $out .= ($out ? "&nbsp;|&nbsp;" : "") . "<a href='" . $this->app->makeLink(array("CID" => "profile", "page" => $rw[id]), null, 1) . "'>" . $rw["topmenu"] . "</a>";
     }
     if ($this->app->getUser()) {
         $out = "<!--[Short_greeting]-->, " . $this->app->getUser("displayName") . "&nbsp;|&nbsp;" . $out;
     }
     return $out;
 }
开发者ID:Kasheftin,项目名称:test_fotostrana,代码行数:21,代码来源:common.class.php

示例3: make_latest_data

function make_latest_data()
{
    global $USER_DETAILS;
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
    while ($db_app = DBfetch($db_applications)) {
        $db_items = DBselect('SELECT DISTINCT i.* ' . ' FROM items i,items_applications ia' . ' WHERE ia.applicationid=' . $db_app['applicationid'] . ' AND i.itemid=ia.itemid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . order_by('i.description,i.itemid,i.lastclock'));
        $app_rows = array();
        $item_cnt = 0;
        while ($db_item = DBfetch($db_items)) {
            $description = item_description($db_item);
            if (!zbx_empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) {
                continue;
            }
            ++$item_cnt;
            if (!uint_in_array($db_app['applicationid'], $_REQUEST['applications']) && !isset($show_all_apps)) {
                continue;
            }
            if (isset($db_item['lastclock'])) {
                $lastclock = date(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']);
            } else {
                $lastclock = new CCol('-', 'center');
            }
            $lastvalue = format_lastvalue($db_item);
            if (isset($db_item['lastvalue']) && isset($db_item['prevvalue']) && $db_item['value_type'] == 0 && $db_item['lastvalue'] - $db_item['prevvalue'] != 0) {
                if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) {
                    $change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
                } else {
                    $change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']);
                }
                $change = nbsp($change);
            } else {
                $change = new CCol('-', 'center');
            }
            if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) {
                $actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action');
            } else {
                $actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action');
            }
            array_push($app_rows, new CRow(array(is_show_all_nodes() ? SPACE : null, $_REQUEST['hostid'] > 0 ? NULL : SPACE, str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue, $lastvalue == '-' ? 'center' : null), $change, $actions)));
        }
        if ($item_cnt > 0) {
            if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($show_all_apps)) {
                $link = new CLink(new CImg('images/general/opened.gif'), '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'));
            } else {
                $link = new CLink(new CImg('images/general/closed.gif'), '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'));
            }
            $col = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . $item_cnt . SPACE . S_ITEMS . ')'));
            $col->setColSpan(5);
            $table->ShowRow(array(get_node_name_by_elid($db_app['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col));
            $any_app_exist = true;
            foreach ($app_rows as $row) {
                $table->ShowRow($row);
            }
        }
    }
}
开发者ID:phedders,项目名称:zabbix,代码行数:56,代码来源:blocks.inc.php

示例4: CButton

$form->SetMethod('get');
$form->AddItem(new CButton("form", S_CREATE_MAP));
show_table_header(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
echo SBR;
if (isset($_REQUEST["form"])) {
    insert_map_form();
} else {
    $form = new CForm();
    $form->setName('frm_maps');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
    $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
    while ($row = DBfetch($result)) {
        if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
            continue;
        }
        $table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
    }
    //----- GO ------
    $goBox = new CComboBox('go');
    $goBox->addItem('delete', S_DELETE_SELECTED);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "maps";');
    $table->setFooter(new CCol(array($goBox, $goButton)));
    $form->addItem($table);
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:sysmaps.php

示例5: CTableInfo

$table = new CTableInfo();
$table->SetHeader(array(is_show_subnodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_link(S_HOST, 'h.host') : NULL, array($link, SPACE, make_sorting_link(S_DESCRIPTION, 'i.description')), make_sorting_link(S_LAST_CHECK, 'i.lastclock'), S_LAST_VALUE, S_CHANGE, S_HISTORY));
//	$table->ShowStart();
$db_apps = array();
$db_appids = array();
$sql_where .= $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : '';
$sql = 'SELECT DISTINCT h.host,h.hostid, a.* ' . ' FROM applications a, hosts h ' . $sql_from . ' WHERE a.hostid=h.hostid' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND h.status=' . HOST_STATUS_MONITORED . order_by('h.host,h.hostid', 'a.name,a.applicationid');
//SDI($sql);
$db_app_res = DBselect($sql);
while ($db_app = DBfetch($db_app_res)) {
    $db_app['item_cnt'] = 0;
    $db_apps[$db_app['applicationid']] = $db_app;
    $db_appids[$db_app['applicationid']] = $db_app['applicationid'];
}
$tab_rows = array();
$sql = 'SELECT DISTINCT i.*, ia.applicationid ' . ' FROM items i,items_applications ia' . ' WHERE ' . DBcondition('ia.applicationid', $db_appids) . ' AND i.itemid=ia.itemid AND i.lastvalue IS NOT NULL' . ' AND (i.status=' . ITEM_STATUS_ACTIVE . ' OR i.status=' . ITEM_STATUS_NOTSUPPORTED . ')' . order_by('i.description,i.itemid,i.lastclock');
//SDI($sql);
$db_items = DBselect($sql);
while ($db_item = DBfetch($db_items)) {
    $description = item_description($db_item);
    if (!empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) {
        continue;
    }
    $db_app =& $db_apps[$db_item['applicationid']];
    if (!isset($tab_rows[$db_app['applicationid']])) {
        $tab_rows[$db_app['applicationid']] = array();
    }
    $app_rows =& $tab_rows[$db_app['applicationid']];
    $db_app['item_cnt']++;
    if (!uint_in_array($db_app['applicationid'], $_REQUEST['applications']) && !isset($show_all_apps)) {
        continue;
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:latest.php

示例6: get_data

 function get_data($type, $equipment_type = 0, $department = 0, $area = 0, $unit = 0, $status = -1, $hospitals = 0, $vendor_id = 0)
 {
     if ($type == "equipment_types") {
         $this->db->select("equipment_type_id,equipment_type")->from("equipment_type");
         $this->db->order_by("equipment_type");
     }
     if ($type == "vendor_types") {
         $this->db->select("vendor_type_id,vendor_type")->from("vendor_type");
         $this->db->order_by("vendor_type");
     } else {
         if ($type == "hospital") {
             $this->db->select("hospital_id,hospital")->from("hospital");
         } else {
             if ($type == "department") {
                 $this->db->select("department_id,hospital_id,department")->from("department")->order_by('department');
             } elseif ($type == "equipment_filter") {
                 if ($this->input->post('department')) {
                     $this->db->where('equipment.department_id', $this->input->post('department'));
                 }
                 if ($this->input->post('unit')) {
                     $this->db->where('equipment.unit_id', $this->input->post('unit'));
                 }
                 if ($this->input->post('area')) {
                     $this->db->where('equipment.area_id', $this->input->post('area'));
                 }
                 if ($this->input->post('equipment_status') != NULL) {
                     $this->db->where('equipment.equipment_status', $this->input->post('equipment_status'));
                 }
                 if ($this->input->post('equipment_type')) {
                     $this->db->where('equipment.equipment_type_id', $this->input->post('equipment_type'));
                 }
                 $this->db->select("equipment.equipment_type_id,equipment_type,equipment.department_id,department,equipment.area_id,area_name,equipment.unit_id,unit_name,equipment_status,equipment_id,make,model,serial_number,asset_number,procured_by,cost,supply_date,warranty_start_date,warranty_end_date,service_engineer,service_engineer_contact,department\n\t\t")->from("equipment")->join("equipment_type", "equipment.equipment_type_id=equipment_type.equipment_type_id")->join("department", "equipment.department_id=department.department_id")->join("unit", "equipment.unit_id=unit.unit_id", "left")->join("area", "equipment.area_id=area.area_id", "left")->order_by("equipment_type");
                 $query = $this->db->get();
                 return $query->result();
             } elseif ($type == "filter") {
                 if ($this->input->post('department')) {
                     $this->db->where('equipment.department_id', $this->input->post('department'));
                 }
                 if ($this->input->post('unit')) {
                     $this->db->where('equipment.unit_id', $this->input->post('unit'));
                 }
                 if ($this->input->post('area')) {
                     $this->db->where('equipment.area_id', $this->input->post('area'));
                 }
                 if ($this->input->post('equipment_status') != NULL) {
                     $this->db->where('equipment.equipment_status', $this->input->post('equipment_status'));
                 }
                 if ($this->input->post('equipment_type')) {
                     $this->db->where('equipment.equipment_type_id', $this->input->post('equipment_type'));
                 }
                 $this->db->select("equipment.equipment_type_id,equipment_type,equipment.department_id,department,equipment.area_id,area_name,equipment.unit_id,unit_name,equipment_status,equipment_id,make,model,serial_number,asset_number,procured_by,cost,supply_date,warranty_start_date,warranty_end_date,service_engineer,service_engineer_contact,department,equipment_status\n\t\t")->from("equipment")->join("equipment_type", "equipment.equipment_type_id=equipment_type.equipment_type_id")->join("department", "equipment.department_id=department.department_id")->join("unit", "equipment.unit_id=unit.unit_id", "left")->join("area", "equipment.area_id=area.area_id", "left")->order_by("equipment_type");
                 $query = $this->db->get();
                 return $query->result();
             } elseif ($type == "service_filter") {
                 if ($this->input->post('department')) {
                     $this->db->where('equipment.department_id', $this->input->post('department'));
                 }
                 if ($this->input->post('equipment_type')) {
                     $this->db->where('equipment.equipment_type_id', $this->input->post('equipment_type'));
                 }
                 if ($this->input->post('working_status') != NULL) {
                     $this->db->where('service_record.working_status', $this->input->post('working_status'));
                 }
                 $this->db->select("equipment.equipment_id,equipment.equipment_type_id,equipment.department_id,contact_person.contact_person_id,vendor.vendor_id,request_id,equipment_type,call_date,call_time,call_information_type,call_information,service_person_remarks,service_date,service_time,problem_status,working_status,vendor_name,contact_person_first_name,contact_person_last_name\n\t\t")->from("service_record")->join("equipment", "service_record.equipment_id=equipment.equipment_id")->join("vendor", "service_record.vendor_id=vendor.vendor_id", 'left')->join("contact_person", "service_record.contact_person_id=contact_person.contact_person_id", 'left')->join("equipment_type", "equipment.equipment_type_id=equipment_type.equipment_type_id")->group_by("equipment_id")->order_by("equipment_id");
                 $query = $this->db->get();
                 //echo $this->db->last_query();
                 return $query->result();
             } else {
                 if ($type == "area") {
                     if ($hospitals != 0) {
                         $hosp_id = array();
                         foreach ($hospitals as $hospital) {
                             $hosp_id[] = $hospital->hospital_id;
                         }
                         $this->db->where_in('hospital_id', $hosp_id);
                     }
                     $this->db->select("area_id,area_name,area.department_id,hospital_id")->from("area")->join('department', 'area.department_id=department.department_id', 'left');
                 } else {
                     if ($type == "unit") {
                         $this->db->select("unit_id,unit_name,department_id")->from("unit");
                     } else {
                         if ($type == "icd_chapters") {
                             $this->db->select("chapter_id,chapter_title")->from("icd_chapter")->order_by('chapter_title');
                         } else {
                             if ($type == "icd_blocks") {
                                 $this->db->select("*")->from("icd_block")->order_by('block_title');
                             } else {
                                 if ($type == "icd_codes") {
                                     $this->db->select("*")->from("icd_code")->order_by('code_title');
                                 } else {
                                     if ($type == "unit") {
                                         $this->db->select("unit_id,unit_name,department_id")->from("unit");
                                     } else {
                                         if ($type == "user") {
                                             $this->db->select("user.user_id,username,password,user.staff_id,first_name,last_name,designation,phone,department")->from("user")->join('staff', 'user.staff_id=staff.staff_id')->join('department', 'staff.department_id=department.department_id');
                                             if ($this->input->post('search')) {
                                                 $user = strtolower($this->input->post('user'));
                                                 $this->db->like('LOWER(username)', $user, 'after');
                                             }
                                             if ($this->input->post('select') || $this->input->post('update')) {
//.........这里部分代码省略.........
开发者ID:BottuShiva,项目名称:health4all_v2,代码行数:101,代码来源:masters_model.php

示例7: get_action_cmds_for_event

function get_action_cmds_for_event($eventid)
{
    $hostids = array();
    $sql = 'SELECT DISTINCT i.hostid ' . ' FROM events e, functions f, items i ' . ' WHERE e.eventid=' . $eventid . ' AND e.objectid=' . EVENT_SOURCE_TRIGGERS . ' AND f.triggerid=' . $_REQUEST['triggerid'] . ' AND i.itemid=f.itemid';
    if ($host = DBfetch(DBselect($sql, 1))) {
        $hostids[$host['hostid']] = $host['hostid'];
    }
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids);
    $table = new CTableInfo(S_NO_ACTIONS_FOUND);
    $table->SetHeader(array(is_show_subnodes() ? S_NODES : null, S_TIME, S_STATUS, S_COMMAND, S_ERROR));
    $sql = 'SELECT DISTINCT a.alertid,a.clock,a.sendto,a.esc_step,a.subject,a.message,a.status,a.retries,a.error ' . ' FROM events e,alerts a' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype=' . ALERT_TYPE_COMMAND . ' AND e.eventid = a.eventid' . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . order_by('a.clock,a.alertid,a.sendto,a.status,a.retries');
    $result = DBselect($sql);
    while ($row = DBfetch($result)) {
        $time = date("Y.M.d H:i:s", $row["clock"]);
        if ($row['esc_step'] > 0) {
            $time = array(bold(S_STEP . ': '), $row["esc_step"], br(), bold(S_TIME . ': '), br(), $time);
        }
        if ($row["status"] == ALERT_STATUS_SENT) {
            $status = new CSpan(S_EXECUTED, "green");
        } else {
            if ($row["status"] == ALERT_STATUS_NOT_SENT) {
                $status = new CSpan(S_IN_PROGRESS, "orange");
            } else {
                $status = new CSpan(S_NOT_SENT, "red");
            }
        }
        $message = array(bold(S_COMMAND . ':'));
        $msg = explode("\n", $row['message']);
        foreach ($msg as $m) {
            array_push($message, BR(), $m);
        }
        if (empty($row["error"])) {
            $error = new CSpan(SPACE, "off");
        } else {
            $error = new CSpan($row["error"], "on");
        }
        $table->addRow(array(get_node_name_by_elid($row['alertid']), new CCol($time, 'top'), new CCol($status, 'top'), new CCol($message, 'wraptext top'), new CCol($error, 'wraptext top')));
    }
    return $table;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:40,代码来源:actions.inc.php

示例8: CButtonCancel

    }
    $frmScr->addItemToBottomRow(new CButtonCancel());
    $frmScr->Show();
} else {
    validate_sort_and_sortorder('s.name', ZBX_SORT_UP);
    $form = new CForm();
    $form->setName('scripts');
    $form->setAttribute('id', 'scripts');
    $form->addVar('action', '1');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_SCRIPTS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_SCRIPTS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_scripts', null, "checkAll('" . $form->getName() . "','all_scripts','scripts');"), make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_COMMAND, 's.command'), S_USER_GROUP, S_HOST_GROUP, S_HOST_ACCESS));
    $sql = 'SELECT s.* ' . ' FROM scripts s ' . ' WHERE ' . DBin_node('s.scriptid') . order_by('s.name,s.command');
    $scripts = DBselect($sql);
    while ($script = DBfetch($scripts)) {
        $user_group_name = S_ALL_S;
        if ($script['usrgrpid'] > 0) {
            $user_group = get_group_by_usrgrpid($script['usrgrpid']);
            $user_group_name = $user_group['name'];
        }
        $host_group_name = S_ALL_S;
        if ($script['groupid'] > 0) {
            $group = get_hostgroup_by_groupid($script['groupid']);
            $host_group_name = $group['name'];
        }
        $table->addRow(array(new CCheckBox('scripts[' . $script['scriptid'] . ']', 'no', NULL, $script['scriptid']), new CLink($script['name'], 'scripts.php?form=1' . '&scriptid=' . $script['scriptid'] . '#form'), htmlspecialchars($script['command']), $user_group_name, $host_group_name, PERM_READ_WRITE == $script['host_access'] ? S_WRITE : S_READ));
        $row_count++;
    }
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:scripts.php

示例9: CLink

                continue;
            }
            $table->AddRow(array(new CLink($row["name"], "?config=0&form=update&screenid=" . $row["screenid"], 'action'), $row["hsize"] . " x " . $row["vsize"], new CLink(S_EDIT, "screenedit.php?screenid=" . $row["screenid"])));
            $row_count++;
        }
        $table->Show();
    }
} else {
    if (isset($_REQUEST["form"])) {
        insert_slideshow_form();
    } else {
        $row_count = 0;
        $numrows = new CSpan(null, 'info');
        $numrows->addOption('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
            $row_count++;
        }
        $table->Show();
    }
}
zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
include_once "include/page_footer.php";
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:screenconf.php

示例10: array

 $db_appids = array();
 $sql_where = '';
 if ($_REQUEST['hostid'] > 0) {
     $sql_where = ' AND h.hostid=' . $_REQUEST['hostid'];
 }
 $sql = 'SELECT DISTINCT h.host,h.hostid,a.* ' . ' FROM applications a,hosts h ' . ' WHERE a.hostid=h.hostid ' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . order_by('a.applicationid,h.host,h.hostid', 'a.name');
 //SDI($sql);
 $db_app_res = DBselect($sql);
 while ($db_app = DBfetch($db_app_res)) {
     $db_app['scenarios_cnt'] = 0;
     $db_apps[$db_app['applicationid']] = $db_app;
     $db_appids[$db_app['applicationid']] = $db_app['applicationid'];
 }
 $db_httptests = array();
 $db_httptestids = array();
 $sql = 'SELECT wt.*,a.name as application, h.host,h.hostid ' . ' FROM httptest wt ' . ' LEFT JOIN applications a on wt.applicationid=a.applicationid ' . ' LEFT JOIN hosts h on h.hostid=a.hostid ' . ' WHERE ' . DBcondition('a.applicationid', $db_appids) . ($showdisabled == 0 ? ' AND wt.status <> 1' : '') . order_by('wt.name', 'h.host');
 //SDI($sql);
 $db_httptests_res = DBselect($sql);
 while ($httptest_data = DBfetch($db_httptests_res)) {
     $httptest_data['step_cout'] = null;
     $db_apps[$httptest_data['applicationid']]['scenarios_cnt']++;
     $db_httptests[$httptest_data['httptestid']] = $httptest_data;
     $db_httptestids[$httptest_data['httptestid']] = $httptest_data['httptestid'];
 }
 $sql = 'SELECT hs.httptestid, COUNT(hs.httpstepid) as cnt ' . ' FROM httpstep hs' . ' WHERE ' . DBcondition('hs.httptestid', $db_httptestids) . ' GROUP BY hs.httptestid';
 //SDI($sql);
 $httpstep_res = DBselect($sql);
 while ($step_cout = DBfetch($httpstep_res)) {
     $db_httptests[$step_cout['httptestid']]['step_cout'] = $step_cout['cnt'];
 }
 $tab_rows = array();
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:httpconf.php

示例11: CTableInfo

    }
} else {
    $table = new CTableInfo();
    if ($prof_type) {
        $table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), $_REQUEST['groupid'] > 0 ? null : make_sorting_link(S_GROUP, 'g.name'), make_sorting_link(S_DEVICE_OS_SHORT, 'hpe.device_os_short'), make_sorting_link(S_DEVICE_HW_ARCH, 'hpe.device_hw_arch'), make_sorting_link(S_DEVICE_TYPE, 'hpe.device_type'), make_sorting_link(S_DEVICE_STATUS, 'hpe.device_status')));
        $sql_where = '';
        if ($_REQUEST['groupid'] > 0) {
            $sql_where = ' AND hg.groupid=' . $_REQUEST['groupid'];
        }
        $sql = 'SELECT DISTINCT g.name, h.hostid,h.host,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status' . ' FROM hosts h,hosts_profiles_ext hpe,hosts_groups hg,groups g ' . ' WHERE h.hostid=hpe.hostid ' . ' AND h.hostid=hg.hostid ' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,g.name,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status');
        $result = DBselect($sql);
        while ($row = DBfetch($result)) {
            $table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], "?hostid=" . $row["hostid"] . url_param("groupid") . '&prof_type=' . $prof_type, "action"), $_REQUEST["groupid"] > 0 ? null : $row["name"], $row["device_os_short"], $row["device_hw_arch"], $row["device_type"], $row["device_status"]));
        }
    } else {
        $table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 'p.name'), make_sorting_link(S_OS, 'p.os'), make_sorting_link(S_SERIALNO, 'p.serialno'), make_sorting_link(S_TAG, 'p.tag'), make_sorting_link(S_MACADDRESS, 'p.macaddress')));
        $sql_from = '';
        $sql_where = '';
        if ($_REQUEST['groupid'] > 0) {
            $sql_from = ', hosts_groups hg ';
            $sql_where = ' and h.hostid=hg.hostid AND hg.groupid=' . $_REQUEST['groupid'];
        }
        $sql = 'SELECT h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress' . ' FROM hosts h,hosts_profiles p ' . $sql_from . ' WHERE h.hostid=p.hostid' . ' and ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,p.name,p.os,p.serialno,p.tag,p.macaddress');
        $result = DBselect($sql);
        while ($row = DBfetch($result)) {
            $table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], '?hostid=' . $row['hostid'] . url_param('groupid') . '&prof_type=' . $prof_type, "action"), $row["name"], $row["os"], $row["serialno"], $row["tag"], $row["macaddress"]));
        }
    }
    $table->show();
}
include_once "include/page_footer.php";
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:hostprofiles.php

示例12: CSpan

 $form->setName('users');
 $numrows = new CSpan(null, 'info');
 $numrows->setAttribute('name', 'numrows');
 $header = get_table_header(array(S_USERS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header);
 $table = new CTableInfo(S_NO_USERS_DEFINED);
 $table->setHeader(array(new CCheckBox('all_users', NULL, "checkAll('" . $form->GetName() . "','all_users','group_userid');"), make_sorting_link(S_ALIAS, 'u.alias'), make_sorting_link(S_NAME, 'u.name'), make_sorting_link(S_SURNAME, 'u.surname'), make_sorting_link(S_USER_TYPE, 'u.type'), S_GROUPS, S_IS_ONLINE_Q, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE, S_STATUS));
 $cond_from = '';
 $cond_where = '';
 if ($_REQUEST['filter_usrgrpid'] > 0) {
     $cond_from = ', users_groups ug, usrgrp ugrp ';
     $cond_where = ' AND ug.userid = u.userid ' . ' AND ug.usrgrpid=' . $_REQUEST['filter_usrgrpid'];
 }
 $users = array();
 $userids = array();
 $db_users = DBselect('SELECT DISTINCT u.userid,u.alias,u.name,u.surname,u.type,u.autologout ' . ' FROM users u ' . $cond_from . ' WHERE ' . DBin_node('u.userid') . $cond_where . order_by('u.alias,u.name,u.surname,u.type', 'u.userid'));
 while ($db_user = DBfetch($db_users)) {
     $users[$db_user['userid']] = $db_user;
     $userids[$db_user['userid']] = $db_user['userid'];
 }
 $users_sessions = array();
 $sql = 'SELECT s.userid, MAX(s.lastaccess) as lastaccess, s.status ' . ' FROM sessions s, users u' . ' WHERE ' . DBcondition('s.userid', $userids) . ' AND s.userid=u.userid ' . ' GROUP BY s.userid,s.status';
 //SDI($sql);
 $db_sessions = DBselect($sql);
 while ($db_ses = DBfetch($db_sessions)) {
     if (!isset($users_sessions[$db_ses['userid']])) {
         $users_sessions[$db_ses['userid']] = $db_ses;
     }
     if (isset($users_sessions[$db_ses['userid']]) && $users_sessions[$db_ses['userid']]['lastaccess'] < $db_ses['lastaccess']) {
         $users_sessions[$db_ses['userid']] = $db_ses;
     }
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:users.php

示例13: ksort

ksort($services);
$header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(make_sorting_link(S_DISCOVERED_DEVICE, 'ip'), 'center'), new CCol(S_MONITORED_HOST, 'center'), new CCol(array(S_UPTIME . '/', S_DOWNTIME), 'center'));
foreach ($services as $name => $foo) {
    $header[] = new CImg('vtext.php?text=' . $name);
}
$table = new CTableInfo();
$table->setHeader($header, 'vertical_header');
$sql_where = '';
if ($druleid > 0) {
    $sql_where = ' AND druleid=' . $druleid;
}
$sql = 'SELECT DISTINCT druleid,proxy_hostid,name ' . ' FROM drules ' . ' WHERE ' . DBin_node('druleid') . $sql_where . ' AND status=' . DRULE_STATUS_ACTIVE . ' ORDER BY name';
$db_drules = DBselect($sql);
while ($drule = DBfetch($db_drules)) {
    $discovery_info = array();
    $db_dhosts = DBselect('SELECT dh.dhostid,dh.druleid,dh.ip,dh.status,dh.lastup,dh.lastdown,h.host' . ' FROM dhosts dh' . ' LEFT JOIN hosts h ON h.ip=dh.ip and h.proxy_hostid=' . $drule['proxy_hostid'] . ' WHERE ' . DBin_node('dh.dhostid') . ' AND dh.druleid=' . $drule['druleid'] . order_by('dh.ip', 'dh.dhostid,dh.status'));
    while ($dhost = DBfetch($db_dhosts)) {
        $class = 'enabled';
        $time = 'lastup';
        if (DHOST_STATUS_DISABLED == $dhost['status']) {
            $class = 'disabled';
            $time = 'lastdown';
        }
        $discovery_info[$dhost['ip']] = array('class' => $class, 'host' => $dhost['host'], 'time' => $dhost[$time], 'druleid' => $dhost['druleid']);
        $db_dservices = DBselect('SELECT type,port,key_,status,lastup,lastdown FROM dservices ' . ' WHERE dhostid=' . $dhost['dhostid'] . ' order by status,type,port');
        while ($dservice = DBfetch($db_dservices)) {
            $class = 'active';
            $time = 'lastup';
            if (DSVC_STATUS_DISABLED == $dservice['status']) {
                $class = 'inactive';
                $time = 'lastdown';
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:discovery.php

示例14: CForm

$form = new CForm(null, 'get');
$form->addItem(new CButton("form", S_CREATE_SLIDESHOW));
$slide_wdgt = new CWidget();
$slide_wdgt->addPageHeader(S_CONFIGURATION_OF_SLIDESHOWS_BIG, $form);
if (isset($_REQUEST['form'])) {
    $slide_wdgt->addItem(insert_slideshow_form());
} else {
    $form = new CForm();
    $form->setName('shows');
    $numrows = new CDiv();
    $numrows->setAttribute('name', 'numrows');
    $slide_wdgt->addHeader(S_SLIDESHOWS_BIG);
    $slide_wdgt->addHeader($numrows);
    $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_shows', NULL, "checkAll('" . $form->getName() . "','all_shows','shows');"), make_sorting_header(S_NAME, 's.name'), make_sorting_header(S_DELAY, 's.delay'), make_sorting_header(S_COUNT_OF_SLIDES, 'cnt')));
    $sql = 'SELECT s.slideshowid, s.name, s.delay, count(sl.slideshowid) as cnt ' . ' FROM slideshows s ' . ' LEFT JOIN slides sl ON sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid');
    $db_slides = DBselect($sql);
    // gathering all data we got from database in array, so we can feed it to pagination function
    $slides_arr = array();
    while ($slide_data = DBfetch($db_slides)) {
        $slides_arr[] = $slide_data;
    }
    // getting paging element
    $paging = getPagingLine($slides_arr);
    foreach ($slides_arr as $slide_data) {
        if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
            continue;
        }
        $table->addRow(array(new CCheckBox('shows[' . $slide_data['slideshowid'] . ']', NULL, NULL, $slide_data['slideshowid']), new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
    }
    // adding paging to widget
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:slideconf.php

示例15: CSpan

 $numrows = new CSpan(null, 'info');
 $numrows->addOption('name', 'numrows');
 $header = get_table_header(array(S_GRAPHS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $r_form);
 /* TABLE */
 $form = new CForm();
 $form->setName('graphs');
 $form->addVar('hostid', $_REQUEST['hostid']);
 $table = new CTableInfo(S_NO_GRAPHS_DEFINED);
 $table->setHeader(array($_REQUEST['hostid'] != 0 ? NULL : S_HOSTS, array(new CCheckBox('all_graphs', NULL, "CheckAll('" . $form->GetName() . "','all_graphs');"), make_sorting_link(S_NAME, 'g.name')), make_sorting_link(S_WIDTH, 'g.width'), make_sorting_link(S_HEIGHT, 'g.height'), make_sorting_link(S_GRAPH_TYPE, 'g.graphtype')));
 $sql_from = '';
 $sql_where = '';
 if ($PAGE_HOSTS['selected'] > 0) {
     $sql_where .= ' AND i.hostid=' . $PAGE_HOSTS['selected'];
 }
 $sql = 'SELECT DISTINCT g.* ' . ' FROM graphs g, graphs_items gi,items i ' . $sql_from . ' WHERE ' . DBcondition('g.graphid', $available_graphs) . ' AND gi.graphid=g.graphid ' . ' AND i.itemid=gi.itemid ' . $sql_where . order_by('g.name,g.width,g.height,g.graphtype', 'g.graphid');
 $result = DBselect($sql);
 while ($row = DBfetch($result)) {
     if ($_REQUEST['hostid'] != 0) {
         $host_list = NULL;
     } else {
         $host_list = array();
         $db_hosts = get_hosts_by_graphid($row['graphid']);
         while ($db_host = DBfetch($db_hosts)) {
             array_push($host_list, $db_host['host']);
         }
         $host_list = implode(',', $host_list);
     }
     if ($row['templateid'] == 0) {
         $name = new CLink($row['name'], 'graphs.php?graphid=' . $row['graphid'] . '&form=update', 'action');
     } else {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:graphs.php


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