function get_item_data_overview_cells(&$table_row, &$ithosts, $hostname)
{
    $css_class = '';
    unset($it_ov_menu);
    $value = '-';
    $ack = null;
    if (isset($ithosts[$hostname])) {
        if ($ithosts[$hostname]['tr_value'] == TRIGGER_VALUE_TRUE) {
            $css_class = getSeverityStyle($ithosts[$hostname]['severity']);
            $ack = get_last_event_by_triggerid($ithosts[$hostname]['triggerid']);
            $ack = $ack['acknowledged'] == 1 ? array(SPACE, new CImg('images/general/tick.png', 'ack')) : null;
        }
        $value = formatItemValue($ithosts[$hostname]);
        $it_ov_menu = array(array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('500 latest values'), 'history.php?action=showlatest&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')));
        switch ($ithosts[$hostname]['value_type']) {
            case ITEM_VALUE_TYPE_UINT64:
            case ITEM_VALUE_TYPE_FLOAT:
                $it_ov_menu = array_merge(array(array(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Last hour graph'), 'history.php?period=3600&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(_('Last week graph'), 'history.php?period=604800&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(_('Last month graph'), 'history.php?period=2678400&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank'))), $it_ov_menu);
                break;
            default:
                break;
        }
    }
    if ($value != '-') {
        $value = new CSpan($value, 'link');
    }
    $value_col = new CCol(array($value, $ack), $css_class);
    if (isset($it_ov_menu)) {
        $it_ov_menu = new CPUMenu($it_ov_menu, 170);
        $value_col->onClick($it_ov_menu->getOnActionJS());
        unset($it_ov_menu);
    }
    array_push($table_row, $value_col);
    return $table_row;
}
/**
 * Creates and returns a trigger status cell for the trigger overview table.
 *
 * @see get_triggers_overview()
 *
 * @param array $triggerHosts	an array with the data about the trigger for each host
 * @param string $hostName		the name of the cells corresponding host
 * @param string $screenId
 *
 * @return CCol
 */
function get_trigger_overview_cells($triggerHosts, $hostName, $screenId = null)
{
    $ack = null;
    $css_class = null;
    $desc = array();
    $config = select_config();
    // for how long triggers should blink on status change (set by user in administration->general)
    if (isset($triggerHosts[$hostName])) {
        // problem trigger
        if ($triggerHosts[$hostName]['value'] == TRIGGER_VALUE_TRUE) {
            $css_class = getSeverityStyle($triggerHosts[$hostName]['priority']);
            $ack = null;
            if ($config['event_ack_enable'] == 1) {
                $event = get_last_event_by_triggerid($triggerHosts[$hostName]['triggerid']);
                if ($event) {
                    if ($screenId) {
                        global $page;
                        $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&screenid=' . $screenId . '&backurl=' . $page['file']);
                    } else {
                        $ack_menu = array(_('Acknowledge'), 'acknow.php?eventid=' . $event['eventid'] . '&backurl=overview.php', array('tw' => '_blank'));
                    }
                    if ($event['acknowledged'] == 1) {
                        $ack = new CImg('images/general/tick.png', 'ack');
                    }
                }
            }
        } else {
            $css_class = 'normal';
        }
        $style = 'cursor: pointer; ';
        // set blinking gif as background if trigger age is less then $config['blink_period']
        if ($config['blink_period'] > 0 && time() - $triggerHosts[$hostName]['lastchange'] < $config['blink_period']) {
            $style .= 'background-image: url(images/gradients/blink.gif); background-position: top left; background-repeat: repeat;';
        }
        unset($item_menu);
        $tr_ov_menu = array(array(_('Trigger'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Events'), 'events.php?triggerid=' . $triggerHosts[$hostName]['triggerid'], array('tw' => '_blank')));
        if (isset($ack_menu)) {
            $tr_ov_menu[] = $ack_menu;
        }
        $dbItems = DBselect('SELECT DISTINCT i.itemid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . $triggerHosts[$hostName]['triggerid']);
        while ($item = DBfetch($dbItems)) {
            $description = itemName($item);
            switch ($item['value_type']) {
                case ITEM_VALUE_TYPE_UINT64:
                case ITEM_VALUE_TYPE_FLOAT:
                    $action = 'showgraph';
                    $status_bar = _('Show graph of item') . ' \'' . $description . '\'';
                    break;
                case ITEM_VALUE_TYPE_LOG:
                case ITEM_VALUE_TYPE_STR:
                case ITEM_VALUE_TYPE_TEXT:
                default:
                    $action = 'showlatest';
                    $status_bar = _('Show values of item') . ' \'' . $description . '\'';
                    break;
            }
            if (zbx_strlen($description) > 25) {
                $description = zbx_substr($description, 0, 22) . '...';
            }
            $item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
        }
        if (isset($item_menu['showgraph'])) {
            $tr_ov_menu[] = array(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
            $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']);
        }
        if (isset($item_menu['showlatest'])) {
            $tr_ov_menu[] = array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
            $tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']);
        }
        unset($item_menu);
        // dependency: triggers on which depends this
        $triggerid = !empty($triggerHosts[$hostName]['triggerid']) ? $triggerHosts[$hostName]['triggerid'] : 0;
        $dep_table = new CTableInfo();
        $dep_table->setAttribute('style', 'width: 200px;');
        $dep_table->addRow(bold(_('Depends on') . ':'));
        $dependency = false;
        $dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . $triggerid);
        while ($dep_row = DBfetch($dep_res)) {
            $dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_up']));
            $dependency = true;
        }
        if ($dependency) {
            $img = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN');
            $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
            $img->setHint($dep_table, '', '', false);
            array_push($desc, $img);
        }
        unset($img, $dep_table, $dependency);
        // triggers that depend on this
        $dep_table = new CTableInfo();
        $dep_table->setAttribute('style', 'width: 200px;');
        $dep_table->addRow(bold(_('Dependent') . ':'));
        $dependency = false;
        $dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . $triggerid);
        while ($dep_row = DBfetch($dep_res)) {
            $dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_down']));
            $dependency = true;
        }
        if ($dependency) {
            $img = new Cimg('images/general/arrow_up2.png', 'DEP_UP');
            $img->setAttribute('style', 'vertical-align: middle; border: 0px;');
            $img->setHint($dep_table, '', '', false);
            array_push($desc, $img);
        }
        unset($img, $dep_table, $dependency);
    }
    if (is_array($desc) && count($desc) > 0 || $ack) {
        $tableColumn = new CCol(array($desc, $ack), $css_class . ' hosts');
    } else {
        $tableColumn = new CCol(SPACE, $css_class . ' hosts');
    }
    if (isset($style)) {
        $tableColumn->setAttribute('style', $style);
    }
    if (isset($tr_ov_menu)) {
        $tr_ov_menu = new CPUMenu($tr_ov_menu, 170);
        $tableColumn->onClick($tr_ov_menu->getOnActionJS());
        $tableColumn->addAction('onmouseover', 'jQuery(this).css({border: "1px dotted #0C0CF0", padding: "0 2px"})');
        $tableColumn->addAction('onmouseout', 'jQuery(this).css({border: "", padding: "1px 3px"})');
    }
    return $tableColumn;
}