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


PHP CTable::ItemsCount方法代码示例

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


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

示例1: get_act_new_oper_form


//.........这里部分代码省略.........
            $tblOper->addItem(new CVar('new_operation[longdata]', ''));
            if ($object_name = DBfetch(DBselect('SELECT host FROM hosts ' . ' WHERE status=' . HOST_STATUS_TEMPLATE . ' AND hostid=' . $new_operation['objectid']))) {
                $object_name = $object_name['host'];
            }
            $tblNewOperation->addRow(array(S_TEMPLATE, array(new CTextBox('object_name', $object_name, 40, 'yes'), new CButton('select_object', S_SELECT, 'return PopUp("popup.php?dstfrm=' . S_ACTION . '&dstfld1=new_operation%5Bobjectid%5D&dstfld2=object_name' . '&srctbl=host_templates&srcfld1=hostid&srcfld2=host' . '",450,450)', 'T'))));
            break;
        case OPERATION_TYPE_TEMPLATE_REMOVE:
            $tblOper->addItem(new CVar('new_operation[object]', 0));
            $tblOper->addItem(new CVar('new_operation[objectid]', $new_operation['objectid']));
            $tblOper->addItem(new CVar('new_operation[shortdata]', ''));
            $tblOper->addItem(new CVar('new_operation[longdata]', ''));
            if ($object_name = DBfetch(DBselect('SELECT host FROM hosts ' . ' WHERE status=' . HOST_STATUS_TEMPLATE . ' AND hostid=' . $new_operation['objectid']))) {
                $object_name = $object_name['host'];
            }
            $tblNewOperation->addRow(array(S_TEMPLATE, array(new CTextBox('object_name', $object_name, 40, 'yes'), new CButton('select_object', S_SELECT, 'return PopUp("popup.php?dstfrm=' . S_ACTION . '&dstfld1=new_operation%5Bobjectid%5D&dstfld2=object_name' . '&srctbl=host_templates&srcfld1=hostid&srcfld2=host' . '",450,450)', 'T'))));
            break;
    }
    // new Operation conditions
    if (isset($_REQUEST['escalation'])) {
        $tblCond = new CTable();
        $opconditions = $new_operation['opconditions'];
        $allowed_opconditions = get_opconditions_by_eventsource($eventsource);
        // show opcondition LIST
        zbx_rksort($opconditions);
        /* group opconditions by type */
        $grouped_opconditions = array();
        $cond_el = new CTable(S_NO_CONDITIONS_DEFINED);
        $i = 0;
        foreach ($opconditions as $val) {
            if (!isset($val['conditiontype'])) {
                $val['conditiontype'] = 0;
            }
            if (!isset($val['operator'])) {
                $val['operator'] = 0;
            }
            if (!isset($val['value'])) {
                $val['value'] = 0;
            }
            if (!str_in_array($val["conditiontype"], $allowed_opconditions)) {
                continue;
            }
            $label = chr(ord('A') + $i);
            $cond_el->addRow(array('(' . $label . ')', array(new CCheckBox("g_opconditionid[]", 'no', null, $i), get_condition_desc($val["conditiontype"], $val["operator"], $val["value"]))));
            $tblCond->addItem(new CVar("new_operation[opconditions][{$i}][conditiontype]", $val["conditiontype"]));
            $tblCond->addItem(new CVar("new_operation[opconditions][{$i}][operator]", $val["operator"]));
            $tblCond->addItem(new CVar("new_operation[opconditions][{$i}][value]", $val["value"]));
            $grouped_opconditions[$val["conditiontype"]][] = $label;
            $i++;
        }
        unset($opconditions);
        $cond_buttons = array();
        if (!isset($_REQUEST['new_opcondition'])) {
            $cond_buttons[] = new CButton('new_opcondition', S_NEW);
        }
        if ($cond_el->ItemsCount() > 0) {
            if ($cond_el->ItemsCount() > 1) {
                /* prepare opcondition calcuation type selector */
                switch ($evaltype) {
                    case ACTION_EVAL_TYPE_AND:
                        $group_op = $glog_op = S_AND;
                        break;
                    case ACTION_EVAL_TYPE_OR:
                        $group_op = $glog_op = S_OR;
                        break;
                    default:
                        $group_op = S_OR;
                        $glog_op = S_AND;
                        break;
                }
                foreach ($grouped_opconditions as $id => $val) {
                    $grouped_opconditions[$id] = '(' . implode(' ' . $group_op . ' ', $val) . ')';
                }
                $grouped_opconditions = implode(' ' . $glog_op . ' ', $grouped_opconditions);
                $cmb_calc_type = new CComboBox('new_operation[evaltype]', $evaltype, 'submit()');
                $cmb_calc_type->addItem(ACTION_EVAL_TYPE_AND_OR, S_AND_OR_BIG);
                $cmb_calc_type->addItem(ACTION_EVAL_TYPE_AND, S_AND_BIG);
                $cmb_calc_type->addItem(ACTION_EVAL_TYPE_OR, S_OR_BIG);
                $tblNewOperation->addRow(array(S_TYPE_OF_CALCULATION, new CCol(array($cmb_calc_type, new CTextBox('preview', $grouped_opconditions, 60, 'yes')))));
                unset($cmb_calc_type, $group_op, $glog_op);
                /* end of calcuation type selector */
            } else {
                $tblCond->addItem(new CVar('new_operation[evaltype]', ACTION_EVAL_TYPE_AND_OR));
            }
            $cond_buttons[] = new CButton('del_opcondition', S_DELETE_SELECTED);
        } else {
            $tblCond->addItem(new CVar('new_operation[evaltype]', ACTION_EVAL_TYPE_AND_OR));
        }
        $tblCond->addRow($cond_el);
        $tblCond->addRow(new CCol($cond_buttons));
        // end of opcondition LIST
        $tblNewOperation->addRow(array(S_CONDITIONS, $tblCond));
        unset($grouped_opconditions, $cond_el, $cond_buttons, $tblCond);
    }
    $tblOper->addRow($tblNewOperation);
    $td = new CCol(array(new CButton('add_operation', isset($update_mode) ? S_SAVE : S_ADD), SPACE, new CButton('cancel_new_operation', S_CANCEL)));
    $td->addOption('colspan', '3');
    $td->addOption('style', 'text-align: right;');
    $tblOper->SetFooter($td);
    return $tblOper;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php

示例2: chr

     if (!str_in_array($condition['conditiontype'], $allowed_opconditions)) {
         continue;
     }
     $label = chr(ord('A') + $i);
     $cond_el->addRow(array('(' . $label . ')', array(new CCheckBox('g_opconditionid[]', 'no', null, $i), get_condition_desc($condition['conditiontype'], $condition['operator'], $condition['value']))));
     $tblCond->addItem(new CVar("new_operation[opconditions][{$i}][conditiontype]", $condition["conditiontype"]));
     $tblCond->addItem(new CVar("new_operation[opconditions][{$i}][operator]", $condition["operator"]));
     $tblCond->addItem(new CVar("new_operation[opconditions][{$i}][value]", $condition["value"]));
     $grouped_opconditions[$condition["conditiontype"]][] = $label;
     $i++;
 }
 $cond_buttons = array();
 if (!isset($_REQUEST['new_opcondition'])) {
     $cond_buttons[] = new CButton('new_opcondition', S_NEW);
 }
 if ($cond_el->ItemsCount() > 0) {
     $cond_buttons[] = new CButton('del_opcondition', S_DELETE_SELECTED);
 }
 if ($cond_el->ItemsCount() > 1) {
     /* prepare opcondition calcuation type selector */
     switch ($evaltype) {
         case ACTION_EVAL_TYPE_AND:
             $group_op = $glog_op = S_AND;
             break;
         case ACTION_EVAL_TYPE_OR:
             $group_op = $glog_op = S_OR;
             break;
         default:
             $group_op = S_OR;
             $glog_op = S_AND;
             break;
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:actionconf.php


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