Example #1
0
 private function makeSImgStr($id)
 {
     $tr = new CRow();
     $count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0;
     for ($i = 0; $i < $count; $i++) {
         $td = new CCol();
         $img = null;
         switch ($this->tree[$id]['nodeimg'][$i]) {
             case 'O':
                 $img = new CImg('images/general/tree/zero.gif', 'o', '22', '14');
                 break;
             case 'I':
                 $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);');
                 $img = new CImg('images/general/tree/zero.gif', 'i', '22', '14');
                 break;
             case 'L':
                 $td->setAttribute('valign', 'top');
                 $div = new CTag('div', 'yes');
                 $div->setAttribute('style', 'height: 10px; background-image: url(images/general/tree/pointc.gif);');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $img = new CImg('images/general/tree/plus.gif', 'y', '22', '14');
                     $img->setAttribute('onclick', $this->treename . '.closeSNodeX("' . $id . '", this);');
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setAttribute('class', 'pointer');
                 } else {
                     $img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14');
                 }
                 $div->addItem($img);
                 $img = $div;
                 break;
             case 'T':
                 $td->setAttribute('valign', 'top');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/plus.gif', 't', '22', '14');
                     $img->setAttribute('onclick', $this->treename . '.closeSNodeX("' . $id . '", this);');
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setAttribute('class', 'pointer');
                     $img->setAttribute('style', 'top: 1px; position: relative;');
                 } else {
                     $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/pointl.gif', 't', '22', '14');
                 }
                 break;
         }
         $td->addItem($img);
         $tr->addItem($td);
     }
     return $tr;
 }
Example #2
0
 $description = new CSpan($description, 'link_menu');
 // trigger description js menu {{{
 $hosts = reset($trigger['hosts']);
 $menu_trigger_conf = 'null';
 if ($admin_links) {
     $menu_trigger_conf = "['" . S_CONFIGURATION_OF_TRIGGERS . "',\"javascript:\n\t\t\t\tredirect('triggers.php?form=update&triggerid=" . $trigger['triggerid'] . '&switch_node=' . id2nodeid($trigger['triggerid']) . "')\",\n\t\t\t\tnull, {'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
 }
 $menu_trigger_url = 'null';
 if (!zbx_empty($trigger['url'])) {
     $menu_trigger_url = "['" . S_URL . "',\"javascript: window.location.href='" . $trigger['url'] . "'\",\n\t\t\t\tnull, {'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
 }
 $description->addAction('onclick', "javascript: create_mon_trigger_menu(event, new Array({'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $trigger['lastchange'] . "'}, " . $menu_trigger_conf . ", " . $menu_trigger_url . ")," . zbx_jsvalue($items, true) . ");");
 // }}} trigger description js menu
 if ($_REQUEST['show_details']) {
     $font = new CTag('font', 'yes');
     $font->setAttribute('color', '#000');
     $font->setAttribute('size', '-2');
     $font->addItem(explode_exp($trigger['expression'], 1, false, true));
     $description = array($description, BR(), $font);
 }
 // DEPENDENCIES {{{
 if (!empty($trigger['dependencies'])) {
     $dep_table = new CTableInfo();
     $dep_table->setAttribute('style', 'width: 200px;');
     $dep_table->addRow(bold(S_DEPENDS_ON . ':'));
     foreach ($trigger['dependencies'] as $dep) {
         $dep_table->addRow(' - ' . expand_trigger_description($dep['triggerid']));
     }
     $img = new Cimg('images/general/down_icon.png', 'DEP_UP');
     $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
     $img->setHint($dep_table);
Example #3
0
    //--
    $table->addRow(array($show_event_col ? SPACE : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $value, $clock, get_node_name_by_elid($row['triggerid']), $host, $tr_desc, $actions, $show_event_col ? SPACE : NULL, new CLink(zbx_empty($row['comments']) ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
    $event_limit = 0;
    foreach ($row['events'] as $eventid => $row_event) {
        $value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
        if ($config['event_ack_enable']) {
            if ($row_event['acknowledged'] == 1) {
                $acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid']));
                $ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'], 'action'), ')');
            } else {
                $ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
            }
        }
        $description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
        $font = new CTag('font', 'yes');
        $font->setAttribute('color', '#808080');
        $font->addItem(array('&nbsp;-&nbsp;', $description));
        $description = $font;
        $description = new CCol($description);
        $description->setAttribute('style', 'white-space: normal; width: 90%;');
        $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row_event['eventid'], 'action');
        $table->addRow(array($config['event_ack_enable'] ? $row_event['acknowledged'] == 1 ? SPACE : new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']) : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row_event['value'])), $value, $clock, get_node_name_by_elid($row['triggerid']), $host, $description, $actions, $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, new CLink($row['comments'] == '' ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
        $event_limit++;
        if ($event_limit >= $config['event_show_max']) {
            break;
        }
    }
    unset($row, $description, $actions);
}
//----- GO ------
if ($config['event_ack_enable']) {
Example #4
0
 private function makeSImgStr($id)
 {
     $tr = new CRow();
     $td = new CCol();
     $count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0;
     for ($i = 0; $i < $count; $i++) {
         switch ($this->tree[$id]['nodeimg'][$i]) {
             case 'O':
                 $td->setAttribute('style', 'width: 22px');
                 $img = new CImg('images/general/tree/zero.gif', 'o', '22', '14');
                 break;
             case 'I':
                 $td->setAttribute('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
                 $img = new CImg('images/general/tree/zero.gif', 'i', '22', '14');
                 break;
             case 'L':
                 $td->setAttribute('valign', 'top');
                 //					$td->setAttribute('style','width:22px; background-image:url(images/general/tree/pointc.gif);');
                 $div = new CTag('div', 'yes');
                 $div->setAttribute('style', 'height: 10px; width:22px; background-image:url(images/general/tree/pointc.gif);');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $img = new CImg('images/general/tree/plus.gif', 'y', '22', '14');
                     $img->setAttribute('onclick', 'javascript: ' . $this->treename . '.closeSNodeX(' . $id . ',this);' . " showPopupDiv('div_node_tree','select_iframe');");
                     // IE6 Fix
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setClass('imgnode');
                 } else {
                     $img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14');
                 }
                 $div->addItem($img);
                 $img = $div;
                 break;
             case 'T':
                 $td->setAttribute('valign', 'top');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $td->setAttribute('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/plus.gif', 't', '22', '14');
                     $img->setAttribute('onclick', 'javascript: ' . $this->treename . '.closeSNodeX(' . $id . ',this);' . " showPopupDiv('div_node_tree','select_iframe');");
                     // IE6 Fix
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setClass('imgnode');
                 } else {
                     $td->setAttribute('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/pointl.gif', 't', '22', '14');
                 }
                 break;
         }
         $td->addItem($img);
         $tr->addItem($td);
         $td = new CCol();
     }
     //	echo $txt.' '.$this->tree[$id]['Name'].'<br />';
     return $tr;
 }
Example #5
0
function get_timeperiod_form()
{
    $tblPeriod = new CTableInfo();
    /* init new_timeperiod variable */
    $new_timeperiod = get_request('new_timeperiod', array());
    if (is_array($new_timeperiod) && isset($new_timeperiod['id'])) {
        $tblPeriod->addItem(new Cvar('new_timeperiod[id]', $new_timeperiod['id']));
    }
    if (!is_array($new_timeperiod)) {
        $new_timeperiod = array();
        $new_timeperiod['timeperiod_type'] = TIMEPERIOD_TYPE_ONETIME;
    }
    if (!isset($new_timeperiod['every'])) {
        $new_timeperiod['every'] = 1;
    }
    if (!isset($new_timeperiod['day'])) {
        $new_timeperiod['day'] = 1;
    }
    if (!isset($new_timeperiod['hour'])) {
        $new_timeperiod['hour'] = 12;
    }
    if (!isset($new_timeperiod['minute'])) {
        $new_timeperiod['minute'] = 0;
    }
    if (!isset($new_timeperiod['date'])) {
        $new_timeperiod['date'] = 0;
    }
    if (!isset($new_timeperiod['period_days'])) {
        $new_timeperiod['period_days'] = 0;
    }
    if (!isset($new_timeperiod['period_hours'])) {
        $new_timeperiod['period_hours'] = 1;
    }
    if (!isset($new_timeperiod['period_minutes'])) {
        $new_timeperiod['period_minutes'] = 0;
    }
    if (!isset($new_timeperiod['month_date_type'])) {
        $new_timeperiod['month_date_type'] = !(bool) $new_timeperiod['day'];
    }
    // START TIME
    if (isset($new_timeperiod['start_time'])) {
        $new_timeperiod['hour'] = floor($new_timeperiod['start_time'] / 3600);
        $new_timeperiod['minute'] = floor(($new_timeperiod['start_time'] - $new_timeperiod['hour'] * 3600) / 60);
    }
    //--
    // PERIOD
    if (isset($new_timeperiod['period'])) {
        $new_timeperiod['period_days'] = floor($new_timeperiod['period'] / 86400);
        $new_timeperiod['period_hours'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * 86400) / 3600);
        $new_timeperiod['period_minutes'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * 86400 - $new_timeperiod['period_hours'] * 3600) / 60);
    }
    //--
    // DAYSOFWEEK
    $dayofweek = '';
    $dayofweek .= !isset($new_timeperiod['dayofweek_mo']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_tu']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_we']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_th']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_fr']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_sa']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_su']) ? '0' : '1';
    if (isset($new_timeperiod['dayofweek'])) {
        $dayofweek = zbx_num2bitstr($new_timeperiod['dayofweek'], true);
    }
    $new_timeperiod['dayofweek_mo'] = $dayofweek[0];
    $new_timeperiod['dayofweek_tu'] = $dayofweek[1];
    $new_timeperiod['dayofweek_we'] = $dayofweek[2];
    $new_timeperiod['dayofweek_th'] = $dayofweek[3];
    $new_timeperiod['dayofweek_fr'] = $dayofweek[4];
    $new_timeperiod['dayofweek_sa'] = $dayofweek[5];
    $new_timeperiod['dayofweek_su'] = $dayofweek[6];
    //--
    // MONTHS
    $month = '';
    $month .= !isset($new_timeperiod['month_jan']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_feb']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_mar']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_apr']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_may']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_jun']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_jul']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_aug']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_sep']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_oct']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_nov']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_dec']) ? '0' : '1';
    if (isset($new_timeperiod['month'])) {
        $month = zbx_num2bitstr($new_timeperiod['month'], true);
    }
    $new_timeperiod['month_jan'] = $month[0];
    $new_timeperiod['month_feb'] = $month[1];
    $new_timeperiod['month_mar'] = $month[2];
    $new_timeperiod['month_apr'] = $month[3];
    $new_timeperiod['month_may'] = $month[4];
    $new_timeperiod['month_jun'] = $month[5];
    $new_timeperiod['month_jul'] = $month[6];
    $new_timeperiod['month_aug'] = $month[7];
    $new_timeperiod['month_sep'] = $month[8];
    $new_timeperiod['month_oct'] = $month[9];
    $new_timeperiod['month_nov'] = $month[10];
    $new_timeperiod['month_dec'] = $month[11];
    //--
    $bit_dayofweek = zbx_str_revert($dayofweek);
    $bit_month = zbx_str_revert($month);
    $cmbType = new CComboBox('new_timeperiod[timeperiod_type]', $new_timeperiod['timeperiod_type'], 'submit()');
    $cmbType->addItem(TIMEPERIOD_TYPE_ONETIME, S_ONE_TIME_ONLY);
    $cmbType->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY);
    $cmbType->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY);
    $cmbType->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY);
    $tblPeriod->addRow(array(S_PERIOD_TYPE, $cmbType));
    if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_DAILY) {
        $tblPeriod->addItem(new Cvar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
        $tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
        $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
        $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
        $tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
        $tblPeriod->addRow(array(S_EVERY_DAY_S, new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 3)));
    } else {
        if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) {
            $tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
            $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
            $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
            $tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
            $tblPeriod->addRow(array(S_EVERY_WEEK_S, new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 2)));
            $tabDays = new CTable();
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), S_MONDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), S_TUESDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), S_WEDNESDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), S_THURSDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), S_FRIDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), S_SATURDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), S_SUNDAY));
            $tblPeriod->addRow(array(S_DAY_OF_WEEK, $tabDays));
        } else {
            if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) {
                $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
                $tabMonths = new CTable();
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jan]', $month[0], null, 1), S_JANUARY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_jul]', $month[6], null, 1), S_JULY));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_feb]', $month[1], null, 1), S_FEBRUARY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_aug]', $month[7], null, 1), S_AUGUST));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_mar]', $month[2], null, 1), S_MARCH, SPACE, SPACE, new CCheckBox('new_timeperiod[month_sep]', $month[8], null, 1), S_SEPTEMBER));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_apr]', $month[3], null, 1), S_APRIL, SPACE, SPACE, new CCheckBox('new_timeperiod[month_oct]', $month[9], null, 1), S_OCTOBER));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_may]', $month[4], null, 1), S_MAY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_nov]', $month[10], null, 1), S_NOVEMBER));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jun]', $month[5], null, 1), S_JUNE, SPACE, SPACE, new CCheckBox('new_timeperiod[month_dec]', $month[11], null, 1), S_DECEMBER));
                $tblPeriod->addRow(array(S_MONTH, $tabMonths));
                $radioDaily = new CTag('input');
                $radioDaily->setAttribute('type', 'radio');
                $radioDaily->setAttribute('name', 'new_timeperiod[month_date_type]');
                $radioDaily->setAttribute('value', '0');
                $radioDaily->setAttribute('onclick', 'submit()');
                $radioDaily2 = new CTag('input');
                $radioDaily2->setAttribute('type', 'radio');
                $radioDaily2->setAttribute('name', 'new_timeperiod[month_date_type]');
                $radioDaily2->setAttribute('value', '1');
                $radioDaily2->setAttribute('onclick', 'submit()');
                if ($new_timeperiod['month_date_type']) {
                    $radioDaily2->setAttribute('checked', 'checked');
                } else {
                    $radioDaily->setAttribute('checked', 'checked');
                }
                $tblPeriod->addRow(array(S_DATE, array($radioDaily, S_DAY, SPACE, SPACE, $radioDaily2, S_DAY_OF_WEEK)));
                if ($new_timeperiod['month_date_type'] > 0) {
                    $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
                    $cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
                    $cmbCount->addItem(1, S_FIRST);
                    $cmbCount->addItem(2, S_SECOND);
                    $cmbCount->addItem(3, S_THIRD);
                    $cmbCount->addItem(4, S_FOURTH);
                    $cmbCount->addItem(5, S_LAST);
                    $td = new CCol($cmbCount);
                    $td->setColSpan(2);
                    $tabDays = new CTable();
                    $tabDays->addRow($td);
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), S_MONDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), S_TUESDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), S_WEDNESDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), S_THURSDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), S_FRIDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), S_SATURDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), S_SUNDAY));
                    $tblPeriod->addRow(array(S_DAY_OF_WEEK, $tabDays));
                } else {
                    $tblPeriod->addItem(new Cvar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
                    $tblPeriod->addRow(array(S_DAY_OF_MONTH, new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2)));
                }
            } else {
                $tblPeriod->addItem(new Cvar('new_timeperiod[every]', $new_timeperiod['every']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
                $tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
                $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[hour]', $new_timeperiod['hour']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[minute]', $new_timeperiod['minute']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
                /***********************************************************/
                $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
                $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
                $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['new_timeperiod_date'].clndr.clndrshow(pos.top,pos.left);");
                $filtertimetab = new CTable(null, 'calendar');
                $filtertimetab->setAttribute('width', '10%');
                $filtertimetab->SetCellPadding(0);
                $filtertimetab->SetCellSpacing(0);
                $filtertimetab->addRow(array(new CNumericBox('new_timeperiod_day', $new_timeperiod['date'] > 0 ? date('d', $new_timeperiod['date']) : '', 2), '/', new CNumericBox('new_timeperiod_month', $new_timeperiod['date'] > 0 ? date('m', $new_timeperiod['date']) : '', 2), '/', new CNumericBox('new_timeperiod_year', $new_timeperiod['date'] > 0 ? date('Y', $new_timeperiod['date']) : '', 4), SPACE, new CNumericBox('new_timeperiod_hour', $new_timeperiod['date'] > 0 ? date('H', $new_timeperiod['date']) : '', 2), ':', new CNumericBox('new_timeperiod_minute', $new_timeperiod['date'] > 0 ? date('i', $new_timeperiod['date']) : '', 2), $clndr_icon));
                zbx_add_post_js('create_calendar(null,' . '["new_timeperiod_day","new_timeperiod_month","new_timeperiod_year","new_timeperiod_hour","new_timeperiod_minute"],' . '"new_timeperiod_date",' . '"new_timeperiod[date]");');
                $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['mntc_active_till'].clndr.clndrshow(pos.top,pos.left);");
                $tblPeriod->addRow(array(S_DATE, $filtertimetab));
                zbx_add_post_js('if("undefined" != typeof(CLNDR["new_timeperiod_date"]))' . ' addListener($("hat_new_timeperiod_icon"),' . '"click",' . 'CLNDR["new_timeperiod_date"].clndr.clndrhide.bindAsEventListener(CLNDR["new_timeperiod_date"].clndr));');
                //-------
            }
        }
    }
    if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) {
        $tabTime = new CTable(null, 'calendar');
        $tabTime->addRow(array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2)));
        $tblPeriod->addRow(array(S_AT . SPACE . '(' . S_HOUR . ':' . S_MINUTE . ')', $tabTime));
    }
    $perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours']);
    for ($i = 0; $i < 25; $i++) {
        $perHours->addItem($i, $i . SPACE);
    }
    $perMinutes = new CComboBox('new_timeperiod[period_minutes]', $new_timeperiod['period_minutes']);
    for ($i = 0; $i < 60; $i++) {
        $perMinutes->addItem($i, $i . SPACE);
    }
    $tblPeriod->addRow(array(S_MAINTENANCE_PERIOD_LENGTH, array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), S_DAYS . SPACE . SPACE, $perHours, SPACE . S_HOURS, $perMinutes, SPACE . S_MINUTES)));
    //			$tabPeriod = new CTable();
    //			$tabPeriod->addRow(S_DAYS)
    //			$tblPeriod->addRow(array(S_AT.SPACE.'('.S_HOUR.':'.S_MINUTE.')', $tabTime));
    $td = new CCol(array(new CButton('add_timeperiod', S_SAVE), SPACE, new CButton('cancel_new_timeperiod', S_CANCEL)));
    $td->setAttribute('colspan', '3');
    $td->setAttribute('style', 'text-align: right;');
    $tblPeriod->SetFooter($td);
    return $tblPeriod;
}
function get_timeperiod_form()
{
    $tblPeriod = new CTableInfo();
    // init new_timeperiod variable
    $new_timeperiod = get_request('new_timeperiod', array());
    $new = is_array($new_timeperiod);
    if (is_array($new_timeperiod)) {
        if (isset($new_timeperiod['id'])) {
            $tblPeriod->addItem(new CVar('new_timeperiod[id]', $new_timeperiod['id']));
        }
        if (isset($new_timeperiod['timeperiodid'])) {
            $tblPeriod->addItem(new CVar('new_timeperiod[timeperiodid]', $new_timeperiod['timeperiodid']));
        }
    }
    if (!is_array($new_timeperiod)) {
        $new_timeperiod = array();
        $new_timeperiod['timeperiod_type'] = TIMEPERIOD_TYPE_ONETIME;
    }
    if (!isset($new_timeperiod['every'])) {
        $new_timeperiod['every'] = 1;
    }
    if (!isset($new_timeperiod['day'])) {
        $new_timeperiod['day'] = 1;
    }
    if (!isset($new_timeperiod['hour'])) {
        $new_timeperiod['hour'] = 12;
    }
    if (!isset($new_timeperiod['minute'])) {
        $new_timeperiod['minute'] = 0;
    }
    if (!isset($new_timeperiod['start_date'])) {
        $new_timeperiod['start_date'] = 0;
    }
    if (!isset($new_timeperiod['period_days'])) {
        $new_timeperiod['period_days'] = 0;
    }
    if (!isset($new_timeperiod['period_hours'])) {
        $new_timeperiod['period_hours'] = 1;
    }
    if (!isset($new_timeperiod['period_minutes'])) {
        $new_timeperiod['period_minutes'] = 0;
    }
    if (!isset($new_timeperiod['month_date_type'])) {
        $new_timeperiod['month_date_type'] = !(bool) $new_timeperiod['day'];
    }
    // start time
    if (isset($new_timeperiod['start_time'])) {
        $new_timeperiod['hour'] = floor($new_timeperiod['start_time'] / SEC_PER_HOUR);
        $new_timeperiod['minute'] = floor(($new_timeperiod['start_time'] - $new_timeperiod['hour'] * SEC_PER_HOUR) / SEC_PER_MIN);
    }
    // period
    if (isset($new_timeperiod['period'])) {
        $new_timeperiod['period_days'] = floor($new_timeperiod['period'] / SEC_PER_DAY);
        $new_timeperiod['period_hours'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * SEC_PER_DAY) / SEC_PER_HOUR);
        $new_timeperiod['period_minutes'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * SEC_PER_DAY - $new_timeperiod['period_hours'] * SEC_PER_HOUR) / SEC_PER_MIN);
    }
    // daysofweek
    $dayofweek = '';
    $dayofweek .= !isset($new_timeperiod['dayofweek_mo']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_tu']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_we']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_th']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_fr']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_sa']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_su']) ? '0' : '1';
    if (isset($new_timeperiod['dayofweek'])) {
        $dayofweek = zbx_num2bitstr($new_timeperiod['dayofweek'], true);
    }
    $new_timeperiod['dayofweek_mo'] = $dayofweek[0];
    $new_timeperiod['dayofweek_tu'] = $dayofweek[1];
    $new_timeperiod['dayofweek_we'] = $dayofweek[2];
    $new_timeperiod['dayofweek_th'] = $dayofweek[3];
    $new_timeperiod['dayofweek_fr'] = $dayofweek[4];
    $new_timeperiod['dayofweek_sa'] = $dayofweek[5];
    $new_timeperiod['dayofweek_su'] = $dayofweek[6];
    // months
    $month = '';
    $month .= !isset($new_timeperiod['month_jan']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_feb']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_mar']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_apr']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_may']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_jun']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_jul']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_aug']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_sep']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_oct']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_nov']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_dec']) ? '0' : '1';
    if (isset($new_timeperiod['month'])) {
        $month = zbx_num2bitstr($new_timeperiod['month'], true);
    }
    $new_timeperiod['month_jan'] = $month[0];
    $new_timeperiod['month_feb'] = $month[1];
    $new_timeperiod['month_mar'] = $month[2];
    $new_timeperiod['month_apr'] = $month[3];
    $new_timeperiod['month_may'] = $month[4];
    $new_timeperiod['month_jun'] = $month[5];
    $new_timeperiod['month_jul'] = $month[6];
    $new_timeperiod['month_aug'] = $month[7];
    $new_timeperiod['month_sep'] = $month[8];
    $new_timeperiod['month_oct'] = $month[9];
    $new_timeperiod['month_nov'] = $month[10];
    $new_timeperiod['month_dec'] = $month[11];
    $bit_dayofweek = zbx_str_revert($dayofweek);
    $bit_month = zbx_str_revert($month);
    $cmbType = new CComboBox('new_timeperiod[timeperiod_type]', $new_timeperiod['timeperiod_type'], 'submit()');
    $cmbType->addItem(TIMEPERIOD_TYPE_ONETIME, _('One time only'));
    $cmbType->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
    $cmbType->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
    $cmbType->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
    $tblPeriod->addRow(array(_('Period type'), $cmbType));
    if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_DAILY) {
        $tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
        $tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month)));
        $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
        $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
        $tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
        $tblPeriod->addRow(array(_('Every day(s)'), new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 3)));
    } elseif ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) {
        $tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month)));
        $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
        $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
        $tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
        $tblPeriod->addRow(array(_('Every week(s)'), new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 2)));
        $tabDays = new CTable();
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday')));
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday')));
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday')));
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday')));
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday')));
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday')));
        $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday')));
        $tblPeriod->addRow(array(_('Day of week'), $tabDays));
    } elseif ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) {
        $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
        $tabMonths = new CTable();
        $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jan]', $month[0], null, 1), _('January'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_jul]', $month[6], null, 1), _('July')));
        $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_feb]', $month[1], null, 1), _('February'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_aug]', $month[7], null, 1), _('August')));
        $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_mar]', $month[2], null, 1), _('March'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_sep]', $month[8], null, 1), _('September')));
        $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_apr]', $month[3], null, 1), _('April'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_oct]', $month[9], null, 1), _('October')));
        $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_may]', $month[4], null, 1), _('May'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_nov]', $month[10], null, 1), _('November')));
        $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jun]', $month[5], null, 1), _('June'), SPACE, SPACE, new CCheckBox('new_timeperiod[month_dec]', $month[11], null, 1), _('December')));
        $tblPeriod->addRow(array(_('Month'), $tabMonths));
        $radioDaily = new CTag('input');
        $radioDaily->setAttribute('type', 'radio');
        $radioDaily->setAttribute('name', 'new_timeperiod[month_date_type]');
        $radioDaily->setAttribute('value', '0');
        $radioDaily->setAttribute('onclick', 'submit()');
        $radioDaily2 = new CTag('input');
        $radioDaily2->setAttribute('type', 'radio');
        $radioDaily2->setAttribute('name', 'new_timeperiod[month_date_type]');
        $radioDaily2->setAttribute('value', '1');
        $radioDaily2->setAttribute('onclick', 'submit()');
        if ($new_timeperiod['month_date_type']) {
            $radioDaily2->setAttribute('checked', 'checked');
        } else {
            $radioDaily->setAttribute('checked', 'checked');
        }
        $tblPeriod->addRow(array(_('Date'), array($radioDaily, _('Day'), SPACE, SPACE, $radioDaily2, _('Day of week'))));
        if ($new_timeperiod['month_date_type'] > 0) {
            $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
            $cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
            $cmbCount->addItem(1, _('First'));
            $cmbCount->addItem(2, _('Second'));
            $cmbCount->addItem(3, _('Third'));
            $cmbCount->addItem(4, _('Fourth'));
            $cmbCount->addItem(5, _('Last'));
            $td = new CCol($cmbCount);
            $td->setColSpan(2);
            $tabDays = new CTable();
            $tabDays->addRow($td);
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday')));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday')));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday')));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday')));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday')));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday')));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday')));
            $tblPeriod->addRow(array(_('Day of week'), $tabDays));
        } else {
            $tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
            $tblPeriod->addRow(array(_('Day of month'), new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2)));
        }
    } else {
        $tblPeriod->addItem(new CVar('new_timeperiod[every]', $new_timeperiod['every'], 'new_timeperiod_every_tmp'));
        $tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month), 'new_timeperiod_month_tmp'));
        $tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'], 'new_timeperiod_day_tmp'));
        $tblPeriod->addItem(new CVar('new_timeperiod[hour]', $new_timeperiod['hour'], 'new_timeperiod_hour_tmp'));
        $tblPeriod->addItem(new CVar('new_timeperiod[minute]', $new_timeperiod['minute'], 'new_timeperiod_minute_tmp'));
        $tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
        $tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
        $tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
        $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
        $clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); pos.top += 10; pos.left += 16; CLNDR["new_timeperiod_date"].clndr.clndrshow(pos.top, pos.left);');
        $filtertimetab = new CTable(null, 'calendar');
        $filtertimetab->setAttribute('width', '10%');
        $filtertimetab->setCellPadding(0);
        $filtertimetab->setCellSpacing(0);
        $startDate = zbxDateToTime($new_timeperiod['start_date']);
        if (isset($_REQUEST['add_timeperiod'])) {
            $newTimePeriodYear = get_request('new_timeperiod_year');
            $newTimePeriodMonth = get_request('new_timeperiod_month');
            $newTimePeriodDay = get_request('new_timeperiod_day');
            $newTimePeriodHours = get_request('new_timeperiod_hour');
            $newTimePeriodMinutes = get_request('new_timeperiod_minute');
        } elseif ($startDate > 0) {
            $newTimePeriodYear = date('Y', $startDate);
            $newTimePeriodMonth = date('m', $startDate);
            $newTimePeriodDay = date('d', $startDate);
            $newTimePeriodHours = date('H', $startDate);
            $newTimePeriodMinutes = date('i', $startDate);
        } else {
            $newTimePeriodYear = '';
            $newTimePeriodMonth = '';
            $newTimePeriodDay = '';
            $newTimePeriodHours = '';
            $newTimePeriodMinutes = '';
        }
        $filtertimetab->addRow(array(new CNumericBox('new_timeperiod_day', $newTimePeriodDay, 2), '/', new CNumericBox('new_timeperiod_month', $newTimePeriodMonth, 2), '/', new CNumericBox('new_timeperiod_year', $newTimePeriodYear, 4), SPACE, new CNumericBox('new_timeperiod_hour', $newTimePeriodHours, 2), ':', new CNumericBox('new_timeperiod_minute', $newTimePeriodMinutes, 2), $clndr_icon));
        zbx_add_post_js('create_calendar(null, ["new_timeperiod_day", "new_timeperiod_month", "new_timeperiod_year", "new_timeperiod_hour", "new_timeperiod_minute"], "new_timeperiod_date", "new_timeperiod_start_date");');
        $tblPeriod->addRow(array(_('Date'), $filtertimetab));
    }
    if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) {
        $tabTime = new CTable(null, 'calendar');
        $tabTime->addRow(array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2)));
        $tblPeriod->addRow(array(_('At (hour:minute)'), $tabTime));
    }
    $perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours']);
    for ($i = 0; $i < 24; $i++) {
        $perHours->addItem($i, $i);
    }
    $perMinutes = new CComboBox('new_timeperiod[period_minutes]', $new_timeperiod['period_minutes']);
    for ($i = 0; $i < 60; $i++) {
        $perMinutes->addItem($i, $i);
    }
    $tblPeriod->addRow(array(_('Maintenance period length'), array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), _('Days') . SPACE . SPACE, $perHours, SPACE . _('Hours'), $perMinutes, SPACE . _('Minutes'))));
    $td = new CCol(array(new CSubmit('add_timeperiod', $new ? _('Save') : _('Add')), SPACE, new CSubmit('cancel_new_timeperiod', _('Cancel'))));
    $td->setAttribute('colspan', '3');
    $td->setAttribute('style', 'text-align: right;');
    $tblPeriod->setFooter($td);
    return $tblPeriod;
}
Example #7
0
function explode_exp($expression, $html, $template = false)
{
    //		echo "EXPRESSION:",$expression,"<Br>";
    $functionid = '';
    if (0 == $html) {
        $exp = '';
    } else {
        $exp = array();
    }
    $state = '';
    for ($i = 0, $max = strlen($expression); $i < $max; $i++) {
        if ($expression[$i] == '{') {
            $functionid = '';
            $state = 'FUNCTIONID';
            continue;
        }
        if ($expression[$i] == '}') {
            $state = '';
            if ($functionid == 'TRIGGER.VALUE') {
                if (0 == $html) {
                    $exp .= '{' . $functionid . '}';
                } else {
                    array_push($exp, '{' . $functionid . '}');
                }
            } else {
                if (is_numeric($functionid) && ($function_data = DBfetch(DBselect('SELECT h.host,i.key_,f.function,f.parameter,i.itemid,i.value_type' . ' FROM items i,functions f,hosts h' . ' WHERE f.functionid=' . $functionid . ' AND i.itemid=f.itemid ' . ' AND h.hostid=i.hostid')))) {
                    if ($template) {
                        $function_data['host'] = '{HOSTNAME}';
                    }
                    if ($html == 0) {
                        $exp .= '{' . $function_data['host'] . ':' . $function_data['key_'] . '.' . $function_data['function'] . '(' . $function_data['parameter'] . ')}';
                    } else {
                        $link = new CLink($function_data['host'] . ':' . $function_data['key_'], 'history.php?action=' . ($function_data['value_type'] == ITEM_VALUE_TYPE_FLOAT || $function_data['value_type'] == ITEM_VALUE_TYPE_UINT64 ? 'showgraph' : 'showvalues') . '&itemid=' . $function_data['itemid']);
                        array_push($exp, array('{', $link, '.', bold($function_data['function'] . '('), $function_data['parameter'], bold(')'), '}'));
                    }
                } else {
                    if (1 == $html) {
                        $font = new CTag('font', 'yes');
                        $font->setAttribute('color', '#AA0000');
                        $font->addItem('*ERROR*');
                        array_push($exp, $font);
                    } else {
                        $exp .= '*ERROR*';
                    }
                }
            }
            continue;
        }
        if ($state == 'FUNCTIONID') {
            $functionid = $functionid . $expression[$i];
            continue;
        }
        if (1 == $html) {
            array_push($exp, $expression[$i]);
        } else {
            $exp .= $expression[$i];
        }
    }
    #		echo "EXP:",$exp,"<Br>";
    return $exp;
}