public function __construct() { parent::__construct('bibtex', null, false); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->pub_ids)) { $this->pageError = true; return; } $pubs = explode(',', $this->pub_ids); if (!is_array($pubs) || count($pubs) == 0) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('pub_ids' => $pubs)); if (!is_array($pub_list) || count($pub_list) == 0) { $this->pageError = true; return; } $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '0', 'cellspacing' => '0')); $table->setAutoGrow(true); $pub_count = 0; foreach ($pub_list as $pub) { $pub_count++; $result = $pub->dbLoad($this->db, $pub->pub_id); if ($result === false) { $this->pageError = true; return; } $table->addRow(array('<pre>' . $pub->getBibtex() . '</pre>')); } // now assign table attributes including highlighting for even and odd // rows for ($i = 0; $i < $table->getRowCount(); $i++) { if ($i & 1) { $table->updateRowAttributes($i, array('class' => 'even'), true); } else { $table->updateRowAttributes($i, array('class' => 'odd'), true); } } $table->updateColAttributes(0, array('class' => 'publist'), true); echo $table->toHtml(); }
if ($current_access_url_id == $url_info['access_url_id']) { $add_user = false; } $access_info_to_string .= $url_info['url'] . '<br />'; } } if ($add_user) { $row_table = array(); $row_table[] = api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ') '; $row_table[] = $access_info_to_string; $url = api_get_self() . '?action=add_user_to_my_url&user_id=' . $user['id'] . '&sec_token=' . $_SESSION['sec_token']; $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn')); foreach ($row_table as $cell) { $table->setCellContents($row, $column, $cell); $table->updateCellAttributes($row, $column, 'align="center"'); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); $row++; } } $extra_search_options .= $table->toHtml(); $table_result = ''; } } } $tpl = new Template($tool_name); $tpl->assign('actions', $actions); $tpl->assign('message', $message); $tpl->assign('content', $form . $table_result . $extra_search_options); $tpl->display_one_col_template();
/** * @param array $data * @param array $params * * @return string */ public static function convert_array_to_html($data, $params = array()) { $headers = $data[0]; unset($data[0]); $header_attributes = isset($params['header_attributes']) ? $params['header_attributes'] : array(); $table = new HTML_Table(array('class' => 'data_table', 'repeat_header' => '1')); $row = 0; $column = 0; foreach ($headers as $header) { $table->setHeaderContents($row, $column, $header); $attributes = array(); if (isset($header_attributes) && isset($header_attributes[$column])) { $attributes = $header_attributes[$column]; } if (!empty($attributes)) { $table->updateCellAttributes($row, $column, $attributes); } $column++; } $row++; foreach ($data as &$printable_data_row) { $column = 0; foreach ($printable_data_row as &$printable_data_cell) { $table->setCellContents($row, $column, $printable_data_cell); //$table->updateCellAttributes($row, $column, $atributes); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); $row++; } $table_tp_html = $table->toHtml(); return $table_tp_html; }
/** * @param FlatViewTable $flatviewtable * @param Category $cat * @param $users * @param $alleval * @param $alllinks * @param array $params * @param null $mainCourseCategory */ public static function export_pdf_flatview($flatviewtable, $cat, $users, $alleval, $alllinks, $params = array(), $mainCourseCategory = null) { // Getting data $printable_data = self::get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory); // HTML report creation first $course_code = trim($cat[0]->get_course_code()); $displayscore = ScoreDisplay::instance(); $customdisplays = $displayscore->get_custom_score_display_settings(); $total = array(); if (is_array($customdisplays) && count($customdisplays)) { foreach ($customdisplays as $custom) { $total[$custom['display']] = 0; } $user_results = $flatviewtable->datagen->get_data_to_graph2(false); foreach ($user_results as $user_result) { $total[$user_result[count($user_result) - 1][1]]++; } } $parent_id = $cat[0]->get_parent_id(); if (isset($cat[0]) && isset($parent_id)) { if ($parent_id == 0) { $grade_model_id = $cat[0]->get_grade_model_id(); } else { $parent_cat = Category::load($parent_id); $grade_model_id = $parent_cat[0]->get_grade_model_id(); } } $use_grade_model = true; if (empty($grade_model_id) || $grade_model_id == -1) { $use_grade_model = false; } if ($use_grade_model) { if ($parent_id == 0) { $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); } else { $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; } } else { if ($parent_id == 0) { $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); } else { $title = api_strtoupper(get_lang('Average')); } } $columns = count($printable_data[0]); $has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0; $table = new HTML_Table(array('class' => 'data_table')); $row = 0; $column = 0; $table->setHeaderContents($row, $column, get_lang('NumberAbbreviation')); $column++; foreach ($printable_data[0] as $printable_data_cell) { if (!is_array($printable_data_cell)) { $printable_data_cell = strip_tags($printable_data_cell); } $table->setHeaderContents($row, $column, $printable_data_cell); $column++; } $row++; if ($has_data) { $counter = 1; foreach ($printable_data[1] as &$printable_data_row) { $column = 0; $table->setCellContents($row, $column, $counter); $table->updateCellAttributes($row, $column, 'align="center"'); $column++; $counter++; foreach ($printable_data_row as $key => &$printable_data_cell) { $attributes = array(); $attributes['align'] = 'center'; $attributes['style'] = null; if ($key === 'name') { $attributes['align'] = 'left'; } if ($key === 'total') { $attributes['style'] = 'font-weight:bold'; } $table->setCellContents($row, $column, $printable_data_cell); $table->updateCellAttributes($row, $column, $attributes); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); $row++; } } else { $column = 0; $table->setCellContents($row, $column, get_lang('NoResults')); $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"'); } $pdfParams = array('filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), 'pdf_title' => $title, 'course_code' => $course_code, 'add_signatures' => true); $page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4'; $pdf = new PDF($page_format, $page_format, $pdfParams); $pdf->html_to_pdf_with_template($flatviewtable->return_table()); exit; }
function getDetails($id, $tplname = 'details.tpl.html') { $this->tpl = new HTML_Template_IT($basedir); $this->tpl->loadTemplateFile($this->basedir . $tplname); $query = "select * from " . $this->cfg['table']['compound'] . " where id = {$id}"; $row = $this->db_con->getRow($query); $this->tpl->setVariable("HEADING", $row->{"name_" . LC_LANG}); $this->tpl->setVariable('LC_SPECIFICATIONS', $this->lang->translate('specifications')); $query = "select *,comp.id as mixid, comp.name_de as mischname_de,comp.name_en as mischname_en,cat_comp.name_de as mischkatname_de,cat_comp.name_en as mischkatname_en\n from " . $this->cfg['table']['cat_compound'] . ' as cat_comp, ' . $this->cfg['table']['compound'] . " as comp\n where comp.id_mischungkat=cat_comp.id AND comp.id={$id}"; $row = $this->db_con->getRow($query); include_once 'HTML/Table.php'; $tbl = new HTML_Table('class="overview"'); $tbl->addRow(array($this->lang->translate('name'), $row->{"mischname_" . LC_LANG})); $tbl->addRow(array($this->lang->translate('category'), $row->{"mischkatname_" . LC_LANG})); $tbl->addRow(array('M100', $row->m100)); $tbl->addRow(array('M300', $row->m300)); $tbl->addRow(array('TS', $row->ts)); $tbl->addRow(array('EAB', $row->eab)); $tbl->addRow(array('Rebound', $row->rebound)); $tbl->addRow(array('Shore A', $row->shore_a)); $tbl->addRow(array('SG', $row->sg)); $tbl->setColAttributes(0, 'width="100"'); $tbl->setColAttributes(1, 'width="300"'); $row1Style = array('class' => 'overview'); $row2Style = array('class' => 'overviewalternate'); $tbl->altRowAttributes(0, $row1Style, $row2Style); $this->tpl->setVariable("COMPOUND_DATA", $tbl->toHTML()); $tbl = new HTML_Table('class="overview"'); $tbl->addRow(array('Name', 'phr'), 'class="overview"', 'TH'); $query = "select * from " . $this->cfg['table']['details_compound'] . " where id_mischung={$id}"; $this->db_res = $this->db_con->Query($query); while ($row = $this->db_res->fetchrow(DB_FETCHMODE_OBJECT)) { if ($row->id_produkt) { $_url = '<a class="maroon" href="' . url(array('module' => 'product', 'action' => 'details', 'id' => $row->id_produkt)) . '">' . $row->name . '</a>'; } else { $_url = $row->name; } $tbl->addRow(array($_url, $row->phr)); } $query = "select sum(phr) as phrsum from " . $this->cfg['table']['details_compound'] . " where id_mischung={$id}"; $row = $this->db_con->getRow($query); $tbl->addRow(array('', $row->phrsum)); $tbl->updateColAttributes(1, 'align="right" "bgcolor=#eeeeee"'); $tbl->updateRowAttributes($tbl->getrowCount() - 1, "bgcolor=#CCCCCC"); $this->tpl->setVariable('TBL_DETAILS', $tbl->toHTML()); $this->tpl->setVariable("CATEGORY_COLOR", $this->color); return $this->tpl->get(); }
/** * Draw the cell for the day $days * * @param days Date_Calc's 'days' value * @param week week number of this cell in the calendar * @param col column number of this cell in the calendar * * @access public * @return string of the rendered HTML */ function drawCell($days, $week, $col) { $type = $this->getType($days); $a = array_merge($this->_attributes['day'], $this->_attributes['day_' . $type]); $t = new HTML_Table($a); $t->addRow(array($this->drawCellLabel($days, $week, $col))); $t->setRowAttributes(0, $this->_attributes['label']); $t->updateRowAttributes(0, $this->_attributes['label_' . $type]); if ($this->_size & HTML_CALENDAR_FULL) { $type = $this->getType($days); if (!$this->_otherMonths && $type == 'other_month') { $cell_text = ' '; } else { $cell_text = $this->drawCellText($days, $week, $col); } $t->addRow(array($cell_text)); $t->setRowAttributes(1, $this->_attributes['text']); $t->updateRowAttributes(1, $this->_attributes['text_' . $type]); } return $t->toHTML(); }
####################################################### foreach ($expiration_array as $key => $feature_array) { $total_licenses = 0; $feature_string = ""; $feature_table = new HTML_Table("width=100%"); for ($p = 0; $p < sizeof($feature_array); $p++) { # Keep track of total number of licenses for a particular feature # this is since you can have licenses with different expiration $total_licenses += $feature_array[$p]["num_licenses"]; $feature_table->addRow(array($feature_array[$p]["num_licenses"] . " license(s) expire(s) in " . $feature_array[$p]["days_to_expiration"] . " day(s) Date of expiration: " . $feature_array[$p]["expiration_date"]), "colspan=\"3\""); ####################################################################### # Check whether license is close to expiration date ####################################################################### if ($feature_array[$p]["days_to_expiration"] <= $lead_time) { if ($feature_array[$p]["days_to_expiration"] >= 0) { $feature_table->updateRowAttributes($feature_table->getRowCount() - 1, "class=\"expires_soon\""); } elseif ($feature_array[$p]["days_to_expiration"] < 0) { $feature_table->updateRowAttributes($feature_table->getRowCount() - 1, "class=\"already_expired\""); } } } $table->addRow(array($key, $feature_array[0]["vendor_daemon"], $total_licenses, $feature_table->toHTML())); unset($feature_table); } ######################################################## # Center columns 2. Columns start with 0 index ######################################################## $table->updateColAttributes(1, "align=\"center\""); $table->display(); } else { ########################################################