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


PHP HTML_Table::updateCellAttributes方法代码示例

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


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

示例1: convert_array_to_html

 /**
  * @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;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:39,代码来源:export.lib.inc.php

示例2: array

    } else {
        $header_names = array(get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'), get_lang('Result'));
    }
    $table = new HTML_Table(array('class' => 'data_table'));
    $row = 0;
    $column = 0;
    foreach ($header_names as $item) {
        $table->setHeaderContents($row, $column, $item);
        $column++;
    }
    $row = 1;
    if (!empty($newarray)) {
        foreach ($newarray as $data) {
            $column = 0;
            $table->setCellContents($row, $column, $data);
            $table->updateCellAttributes($row, $column, 'align="center"');
            $column++;
            $row++;
        }
    }
    $html .= $table->toHtml();
    $pdf = new PDF();
    $pdf->content_to_pdf($html);
    exit;
}
$actions = '<div class="actions">';
if (isset($_GET['selectcat'])) {
    $interbreadcrumb[] = array('url' => 'gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView'));
    $actions .= '<a href=gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '>' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
}
if (isset($_GET['selecteval'])) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_stats.php

示例3: export_pdf_flatview

 /**
  * @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';
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:GradebookUtils.php

示例4: show_tool_3column

 /**
  * Gets the html content to show in the 3 column view
  */
 public static function show_tool_3column($cat)
 {
     global $_user;
     $TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
     $TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
     $numcols = 3;
     $table = new HTML_Table('width="100%"');
     $all_tools = array();
     $course_id = api_get_course_int_id();
     switch ($cat) {
         case 'Basic':
             $condition_display_tools = ' WHERE a.c_id = ' . $course_id . ' AND  a.link=t.link AND t.position="basic" ';
             if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') {
                 $condition_display_tools = ' WHERE a.c_id = ' . $course_id . ' AND a.link=t.link AND (t.position="basic" OR a.name = "' . TOOL_TRACKING . '") ';
             }
             $sql = "SELECT a.*, t.image img, t.row, t.column  FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                        {$condition_display_tools} ORDER BY t.row, t.column";
             break;
         case 'External':
             if (api_is_allowed_to_edit()) {
                 $sql = "SELECT a.*, t.image img FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                            WHERE a.c_id = {$course_id} AND ((a.link=t.link AND t.position='external')\n                            OR (a.visibility <= 1 AND (a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image))\n                            ORDER BY a.id";
             } else {
                 $sql = "SELECT a.*, t.image img FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                            WHERE a.c_id = {$course_id} AND (a.visibility = 1 AND ((a.link=t.link AND t.position='external')\n                            OR ((a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image)))\n                            ORDER BY a.id";
             }
             break;
         case 'courseAdmin':
             $sql = "SELECT a.*, t.image img, t.row, t.column  FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                        WHERE a.c_id = {$course_id} AND admin=1 AND a.link=t.link ORDER BY t.row, t.column";
             break;
         case 'platformAdmin':
             $sql = "SELECT *, image img FROM {$TBL_ACCUEIL} WHERE c_id = {$course_id} AND visibility = 2 ORDER BY id";
     }
     $result = Database::query($sql);
     // Grabbing all the tools from $course_tool_table
     while ($tool = Database::fetch_array($result)) {
         $all_tools[] = $tool;
     }
     $course_id = api_get_course_int_id();
     // Grabbing all the links that have the property on_homepage set to 1
     if ($cat == 'External') {
         $tbl_link = Database::get_course_table(TABLE_LINK);
         $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
         if (api_is_allowed_to_edit(null, true)) {
             $sql_links = "SELECT tl.*, tip.visibility\n\t\t\t\t\t\t\t\tFROM {$tbl_link} tl\n                                LEFT JOIN {$tbl_item_property} tip ON tip.tool='link' AND tip.ref=tl.id\n                                WHERE \ttl.c_id = {$course_id} AND\n                                \t\ttip.c_id = {$course_id} AND\n                \t\t\t\t\t\ttl.on_homepage='1' AND\n                \t\t\t\t\t\ttip.visibility != 2";
         } else {
             $sql_links = "SELECT tl.*, tip.visibility\n                                    FROM {$tbl_link} tl\n                                    LEFT JOIN {$tbl_item_property} tip ON tip.tool='link' AND tip.ref=tl.id\n                                    WHERE \ttl.c_id = {$course_id} AND\n                                \t\t\ttip.c_id = {$course_id} AND\n                \t\t\t\t\t\t\ttl.on_homepage='1' AND\n                \t\t\t\t\t\t\ttip.visibility = 1";
         }
         $result_links = Database::query($sql_links);
         while ($links_row = Database::fetch_array($result_links)) {
             $properties = array();
             $properties['name'] = $links_row['title'];
             $properties['link'] = $links_row['url'];
             $properties['visibility'] = $links_row['visibility'];
             $properties['img'] = 'external.gif';
             $properties['adminlink'] = api_get_path(WEB_CODE_PATH) . 'link/link.php?action=editlink&amp;id=' . $links_row['id'];
             $all_tools[] = $properties;
         }
     }
     $cell_number = 0;
     // Draw line between basic and external, only if there are entries in External
     if ($cat == 'External' && count($all_tools)) {
         $table->setCellContents(0, 0, '<hr noshade="noshade" size="1"/>');
         $table->updateCellAttributes(0, 0, 'colspan="3"');
         $cell_number += $numcols;
     }
     foreach ($all_tools as &$tool) {
         if ($tool['image'] == 'scormbuilder.gif') {
             // check if the published learnpath is visible for student
             $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
             if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id(), api_get_course_id(), api_get_session_id())) {
                 continue;
             }
         }
         if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
             continue;
         }
         $cell_content = '';
         // The name of the tool
         $tool_name = self::translate_tool_name($tool);
         $link_annex = '';
         // The url of the tool
         if ($tool['img'] != 'external.gif') {
             $tool['link'] = api_get_path(WEB_CODE_PATH) . $tool['link'];
             $qm_or_amp = strpos($tool['link'], '?') === false ? '?' : '&amp;';
             $link_annex = $qm_or_amp . api_get_cidreq();
         } else {
             // If an external link ends with 'login=', add the actual login...
             $pos = strpos($tool['link'], '?login=');
             $pos2 = strpos($tool['link'], '&amp;login=');
             if ($pos !== false or $pos2 !== false) {
                 $link_annex = $_user['username'];
             }
         }
         // Setting the actual image url
         $tool['img'] = api_get_path(WEB_IMG_PATH) . $tool['img'];
         // VISIBLE
         if ($tool['visibility'] || (api_is_coach() || api_is_course_tutor()) && $tool['name'] == TOOL_TRACKING || $cat == 'courseAdmin' || $cat == 'platformAdmin') {
             if (strpos($tool['name'], 'visio_') !== false) {
                 $cell_content .= '<a  href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_visio' . $_SESSION['_cid'] . '\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:course_home.lib.php

示例5: current

    if (sizeof($servers) > 0) {
        $table->addRow(array(strtoupper($type) . " Servers"), $headerStyle, "TH");
        $table->setCellAttributes($table->getRowCount() - 1, 0, "colspan='" . $table->getColCount() . "'");
        for ($i = 0; $i < sizeof($servers); $i++) {
            $cur = current($servers);
            $status_array = getDetails($cur);
            # does this host contain a webui?
            # currently only RLM offers webui
            if (isset($cur["webui"])) {
                $host = "<a href=\"" . $cur["webui"] . "\">" . $cur["hostname"] . "</a>";
            } else {
                $host = $cur["hostname"];
            }
            $table->AddRow(array($host, $cur["desc"], strtoupper($status_array["status"]["service"]), $status_array["status"]["clients"], $status_array["status"]["listing"], $status_array["status"]["master"], $status_array["status"]["version"]));
            # Set the background color of status cell
            $table->updateCellAttributes($table->getRowCount() - 1, 2, "class='" . $status_array["status"]["service"] . "'");
            $table->updateCellAttributes(1, 0, "");
            # fetch status
            $statusMsg = AppendStatusMsg($statusMsg, $status_array["status"]["msg"]);
            # next!
            next($servers);
        }
    }
}
# Display the table
$table->display();
#footer
include_once 'version.php';
print "\n";
print '<script language="javascript" type="text/javascript">';
print "document.getElementById('msg').innerHTML = \"" . $statusMsg . "\";";
开发者ID:tseel,项目名称:phplicensewatcher,代码行数:31,代码来源:index.php

示例6: piPublicationsTable

 private function piPublicationsTable($pi_name)
 {
     $table = new HTML_Table(array('class' => 'stats'));
     $table->addRow(array('Fiscal Year Start', 'T1', 'Author(s)', 'Num Pubs', 'Pub Ids'));
     $table->setRowType(0, 'th');
     $row_count = 0;
     $pub_count = array('N' => 0, 'Y' => 0);
     foreach ($this->stats['per_pi'][$pi_name] as $fy => $subarr1) {
         krsort($subarr1);
         foreach ($subarr1 as $t1 => $subarr2) {
             ksort($subarr2);
             foreach ($subarr2 as $authors => $pub_ids) {
                 $pub_links = array();
                 rsort($pub_ids);
                 foreach ($pub_ids as $pub_id) {
                     $pub_links[] = '<a href="../view_publication.php?pub_id=' . $pub_id . '">' . $pub_id . '</a>';
                 }
                 $class = $t1 == 'Y' ? 'stats_odd' : 'stats_even';
                 $table->addRow(array(self::$fiscal_years[$fy][0], $t1, $authors, count($pub_ids), implode(', ', $pub_links)), array('class' => $class));
                 ++$row_count;
                 $table->updateCellAttributes($row_count, 4, array('class' => $class . '_pub_id'));
                 $pub_count[$t1] += count($pub_ids);
             }
         }
     }
     $table->addRow(array('<b>TOTAL</b>', 'Y', null, $pub_count['Y'], null), array('class' => 'stats_odd'));
     $table->addRow(array('<b>TOTAL</b>', 'N', null, $pub_count['N'], null), array('class' => 'stats_even'));
     echo '<h3>', $pi_name, '</h3>', "\n", $table->toHtml();
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:29,代码来源:aicml_stats.php

示例7: generateTable

 /**
  * Generate the HTML_Table object of the calendar
  *
  * @param day   day of the calendar to generate, null = today's day
  * @param month month of the calendar to generate, null = today's  month
  * @param year  year of the calendar to generate, null = today's year
  *
  * @access public
  * @return the HTML_Table object of the calendar
  */
 function generateTable($day = null, $month = null, $year = null)
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow('%d');
     }
     $year = sprintf('%04d', $year);
     $month = sprintf('%02d', $month);
     $day = sprintf('%02d', $day);
     // get month structure for generating calendar
     $month_cal = Date_Calc::getCalendarMonth($month, $year, '%E');
     $this->_todayDays = Date_Calc::dateFormat(null, null, null, '%E');
     $this->_thisMonth = Date_Calc::dateFormat($day, $month, $year, '%m');
     $row = 0;
     $table = new HTML_Table($this->_attributes['table']);
     $table->addRow(array($this->drawTitle($day, $month, $year)));
     $table->setRowAttributes($row, $this->_attributes['title']);
     $row++;
     for ($col = 0; $col < 7; $col++) {
         $table->setCellContents($row, $col, $this->drawWeekDayText($col), 'TH');
     }
     $table->setRowAttributes($row++, $this->_attributes['weekday']);
     for ($week = 0; $week < count($month_cal); $week++) {
         for ($col = 0; $col < 7; $col++) {
             $table->setCellContents($row, $col, $this->drawCell($month_cal[$week][$col], $week, $col));
             $type = $this->getType($month_cal[$week][$col]);
             $table->setCellAttributes($row, $col, $this->_attributes['cell']);
             $table->updateCellAttributes($row, $col, $this->_attributes['cell_' . $type]);
         }
         $row++;
     }
     return $table;
 }
开发者ID:Artea,项目名称:freebeer,代码行数:48,代码来源:Calendar.php


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