public function prepareRow($item, $class = null, $id = null) { if ($item === null) { return null; } if (is_object($item) && strtolower(get_class($item)) === 'ccol') { if (isset($this->header) && !isset($item->attributes['colspan'])) { $item->attributes['colspan'] = $this->colnum; } } if (!is_object($item) || strtolower(get_class($item)) !== 'crow') { $item = new CRow($item); if ($id !== null) { $item->setId($id); } } if ($class !== null) { $item->addClass($class); } return $item; }
$openState = CProfile::get('web.latest.toggle_other', null, $host['hostid']); $toggle = new CDiv(null, 'app-list-toggle icon-plus-9x9'); if ($openState) { $toggle->addClass('icon-minus-9x9'); } $toggle->setAttribute('data-app-id', '0_' . $host['hostid']); $toggle->setAttribute('data-open-state', $openState); $hostName = null; if (!$singleHostSelected) { $hostName = new CSpan($host['name'], 'link_menu menu-host' . ($host['status'] == HOST_STATUS_NOT_MONITORED ? ' not-monitored' : '')); $hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $hostScripts[$host['hostid']])); } // add toggle row $table->addRow(array($toggle, '', $hostName, new CCol(array(bold('- ' . 'other' . ' -'), ' (' . _n('%1$s Item', '%1$s Items', $dbHost['item_cnt']) . ')'), null, $filter['showDetails'] ? 10 : 5)), 'odd_row'); // add toggle sub rows foreach ($appRows as $row) { $row->setAttribute('parent_app_id', '0_' . $host['hostid']); $row->addClass('odd_row'); if (!$openState) { $row->addClass('hidden'); } $table->addRow($row); } } $goBox = new CComboBox('graphtype', GRAPH_TYPE_STACKED, null, array(GRAPH_TYPE_STACKED => _('Display stacked graph'), GRAPH_TYPE_NORMAL => _('Display graph'))); $goBox->setAttribute('id', 'action'); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $form->addItem(array($table, get_table_header(array($goBox, $goButton)))); $latestWidget->addItem($form); $latestWidget->show(); require_once dirname(__FILE__) . '/include/page_footer.php';