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


PHP CTableInfo::ItemsCount方法代码示例

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


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

示例1: foreach

 foreach ($timeperiods as $id => $timeperiod) {
     $tblPeriod->addRow(array(new CCheckBox('g_timeperiodid[]', 'no', null, $id), timeperiod_type2str($timeperiod['timeperiod_type']), new CCol(shedule2str($timeperiod), 'wraptext'), zbx_date2age(0, $timeperiod['period']), new CButton('edit_timeperiodid[' . $id . ']', S_EDIT)));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][timeperiod_type]', $timeperiod['timeperiod_type']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][every]', $timeperiod['every']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][month]', $timeperiod['month']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][dayofweek]', $timeperiod['dayofweek']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][day]', $timeperiod['day']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][start_time]', $timeperiod['start_time']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][start_date]', $timeperiod['start_date']));
     $tblPeriod->addItem(new Cvar('timeperiods[' . $id . '][period]', $timeperiod['period']));
 }
 $footer = array();
 if (!isset($_REQUEST['new_timeperiod'])) {
     $footer[] = new CButton('new_timeperiod', S_NEW);
 }
 if ($tblPeriod->ItemsCount() > 0) {
     $footer[] = new CButton('del_timeperiod', S_DELETE_SELECTED);
 }
 $left_tab->addRow(new CFormElement(S_MAINTENANCE, $tblPeriod, $footer));
 // }}} MAINTENANCE PERIODS
 if (isset($_REQUEST['new_timeperiod'])) {
     $new_timeperiod = $_REQUEST['new_timeperiod'];
     $left_tab->addRow(create_hat(is_array($new_timeperiod) && isset($new_timeperiod['id']) ? S_EDIT_MAINTENANCE_PERIOD : S_NEW_MAINTENANCE_PERIOD, get_timeperiod_form(), null, 'hat_new_timeperiod'));
 }
 $right_tab = new CTable();
 $right_tab->setCellPadding(3);
 $right_tab->setCellSpacing(3);
 // MAINTENANCE HOSTS {{{
 $options = array('editable' => true, 'output' => API_OUTPUT_EXTEND, 'real_hosts' => true, 'preservekeys' => true);
 $all_groups = CHostGroup::get($options);
 order_result($all_groups, 'name');
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:maintenance.php

示例2: get_act_operations_form

function get_act_operations_form($action = null)
{
    $tblOper = new CTableInfo(S_NO_OPERATIONS_DEFINED);
    $tblOper->addOption('style', 'background-color: #CCC;');
    if (isset($_REQUEST['actionid']) && empty($action)) {
        $action = get_action_by_actionid($_REQUEST['actionid']);
    }
    $operations = get_request('operations', array());
    if (isset($_REQUEST['actionid']) && !isset($_REQUEST['form_refresh'])) {
        $eventsource = $action['eventsource'];
        $evaltype = $action['evaltype'];
        $esc_period = $action['esc_period'];
        /* prepate operations */
        $db_operations = DBselect('SELECT * ' . ' FROM operations' . ' WHERE actionid=' . $_REQUEST['actionid'] . ' ORDER BY esc_step_from,operationtype,object,operationid');
        while ($operation_data = DBfetch($db_operations)) {
            $operation_data = array('operationtype' => $operation_data['operationtype'], 'operationid' => $operation_data['operationid'], 'object' => $operation_data['object'], 'objectid' => $operation_data['objectid'], 'shortdata' => $operation_data['shortdata'], 'longdata' => $operation_data['longdata'], 'esc_period' => $operation_data['esc_period'], 'esc_step_from' => $operation_data['esc_step_from'], 'esc_step_to' => $operation_data['esc_step_to'], 'default_msg' => $operation_data['default_msg'], 'evaltype' => $operation_data['evaltype']);
            $operation_data['opconditions'] = array();
            $sql = 'SELECT * FROM opconditions WHERE operationid=' . $operation_data['operationid'];
            $db_opconds = DBselect($sql);
            while ($db_opcond = DBfetch($db_opconds)) {
                $operation_data['opconditions'][] = $db_opcond;
            }
            if (str_in_array($operation_data, $operations)) {
                continue;
            }
            array_push($operations, $operation_data);
        }
        unset($db_operations, $operation_data);
    } else {
        $eventsource = get_request('eventsource');
        $evaltype = get_request('evaltype');
        $esc_period = get_request('esc_period');
    }
    $esc_step_from = array();
    foreach ($operations as $key => $operation) {
        $esc_step_from[$key] = $operation['esc_step_from'];
    }
    array_multisort($esc_step_from, SORT_ASC, $operations);
    $tblOper->SetHeader(array(new CCheckBox('all_operations', null, 'CheckAll("' . S_ACTION . '","all_operations","g_operationid");'), isset($_REQUEST['escalation']) ? S_STEPS : null, S_DETAILS, isset($_REQUEST['escalation']) ? S_PERIOD . ' (' . S_SEC_SMALL . ')' : null, isset($_REQUEST['escalation']) ? S_DELAY : null, S_ACTION));
    $allowed_operations = get_operations_by_eventsource($eventsource);
    zbx_rksort($operations);
    $delay = count_operations_delay($operations, $esc_period);
    foreach ($operations as $id => $val) {
        if (!str_in_array($val['operationtype'], $allowed_operations)) {
            continue;
        }
        if (!isset($val['default_msg'])) {
            $val['default_msg'] = 0;
        }
        if (!isset($val['opconditions'])) {
            $val['opconditions'] = array();
        }
        $oper_details = new CSpan(get_operation_desc(SHORT_DESCRITION, $val));
        $oper_details->SetHint(nl2br(get_operation_desc(LONG_DESCRITION, $val)));
        $esc_steps_txt = null;
        $esc_period_txt = null;
        $esc_delay_txt = null;
        if ($val['esc_step_from'] < 1) {
            $val['esc_step_from'] = 1;
        }
        if (isset($_REQUEST['escalation'])) {
            $esc_steps_txt = $val['esc_step_from'] . ' - ' . $val['esc_step_to'];
            $esc_period_txt = $val['esc_period'] ? $val['esc_period'] : S_DEFAULT;
            $esc_delay_txt = $delay[$val['esc_step_from']] ? convert_units($delay[$val['esc_step_from']], 'uptime') : S_AT_MOMENT;
        }
        $tblOper->addRow(array(new CCheckBox("g_operationid[]", 'no', null, $id), $esc_steps_txt, $oper_details, $esc_period_txt, $esc_delay_txt, new CButton('edit_operationid[' . $id . ']', S_EDIT)));
        $tblOper->addItem(new CVar('operations[' . $id . '][operationtype]', $val['operationtype']));
        $tblOper->addItem(new CVar('operations[' . $id . '][object]', $val['object']));
        $tblOper->addItem(new CVar('operations[' . $id . '][objectid]', $val['objectid']));
        $tblOper->addItem(new CVar('operations[' . $id . '][shortdata]', $val['shortdata']));
        $tblOper->addItem(new CVar('operations[' . $id . '][longdata]', $val['longdata']));
        $tblOper->addItem(new CVar('operations[' . $id . '][esc_period]', $val['esc_period']));
        $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_from]', $val['esc_step_from']));
        $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_to]', $val['esc_step_to']));
        $tblOper->addItem(new CVar('operations[' . $id . '][default_msg]', $val['default_msg']));
        $tblOper->addItem(new CVar('operations[' . $id . '][evaltype]', $val['evaltype']));
        foreach ($val['opconditions'] as $opcondid => $opcond) {
            foreach ($opcond as $field => $value) {
                $tblOper->addItem(new CVar('operations[' . $id . '][opconditions][' . $opcondid . '][' . $field . ']', $value));
            }
        }
    }
    unset($operations);
    $tblOperFooter = new CTableInfo(null);
    $oper_buttons = array();
    if (!isset($_REQUEST['new_operation'])) {
        $oper_buttons[] = new CButton('new_operation', S_NEW);
    }
    if ($tblOper->ItemsCount() > 0) {
        $oper_buttons[] = new CButton('del_operation', S_DELETE_SELECTED);
    }
    $td = new CCol($oper_buttons);
    $td->addOption('colspan', isset($_REQUEST['escalation']) ? 6 : 3);
    $td->addOption('style', 'text-align: right;');
    $tblOperFooter->SetFooter($td);
    // end of condition list preparation
    return array($tblOper, $tblOperFooter);
}
开发者ID:rennhak,项目名称:zabbix,代码行数:98,代码来源:forms.inc.php

示例3: CVar

     $tblOper->addItem(new CVar('operations[' . $id . '][esc_period]', $condition['esc_period']));
     $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_from]', $condition['esc_step_from']));
     $tblOper->addItem(new CVar('operations[' . $id . '][esc_step_to]', $condition['esc_step_to']));
     $tblOper->addItem(new CVar('operations[' . $id . '][default_msg]', $condition['default_msg']));
     $tblOper->addItem(new CVar('operations[' . $id . '][evaltype]', $condition['evaltype']));
     foreach ($condition['opconditions'] as $opcondid => $opcond) {
         foreach ($opcond as $field => $value) {
             $tblOper->addItem(new CVar('operations[' . $id . '][opconditions][' . $opcondid . '][' . $field . ']', $value));
         }
     }
 }
 $footer = array();
 if (!isset($_REQUEST['new_operation'])) {
     $footer[] = new CButton('new_operation', S_NEW);
 }
 if ($tblOper->ItemsCount() > 0) {
     $footer[] = new CButton('del_operation', S_DELETE_SELECTED);
 }
 $right_tab->addRow(new CFormElement(S_ACTION_OPERATIONS, $tblOper, $footer));
 // }}} ACTION OPERATIONS FORM
 // NEW OPERATION FORM {{{
 if (isset($_REQUEST['new_operation'])) {
     $tblOper = new CTable(null, 'formElementTable');
     $operations = get_request('operations', array());
     if (isset($_REQUEST['actionid']) && !isset($_REQUEST['form_refresh'])) {
         $eventsource = $action['eventsource'];
     } else {
         $eventsource = get_request('eventsource');
     }
     $allowed_operations = get_operations_by_eventsource($eventsource);
     /* init new_operation variable */
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:actionconf.php


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