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


PHP HTML_Table::setAutoGrow方法代码示例

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


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

示例1: array

 function __construct($horarios)
 {
     $this->horarios = $horarios;
     $this->clase = array('class' => 'tablaReporte');
     $this->tabla = new HTML_Table($this->clase);
     $this->tabla->setAutoGrow(true);
 }
开发者ID:jorgeeliecerballesteros,项目名称:controldeacceso,代码行数:7,代码来源:TablaHorarios.php

示例2: array

 function __construct($listaHorasAsignadas, $numeroDocumentoIngresado)
 {
     $this->listaHorasAsignadas = $listaHorasAsignadas;
     $this->clase = array('class' => 'tablaReporte');
     $this->tabla = new HTML_Table($this->clase);
     $this->tabla->setAutoGrow(true);
     $this->formulario = '<form action="horariohabitual.php" method="post">';
     $this->numeroDocumentoIngresado = $numeroDocumentoIngresado;
 }
开发者ID:jorgeeliecerballesteros,项目名称:controldeacceso,代码行数:9,代码来源:TablasHorasAsignadas.php

示例3: imprimirFormularioLogin

 /**
  * Muestra el formulario para iniciar sesión.
  */
 private function imprimirFormularioLogin()
 {
     imprimirTabulados(5);
     echo '<div class="tablaTituloBotones">';
     imprimirTabulados(6);
     echo '<h2>Iniciar sesión</h2>';
     imprimirTabulados(6);
     echo '<form action="index.php" method="post">';
     imprimirTabulados(6);
     echo '<fieldset class="login">';
     imprimirTabulados(6);
     $clase = array('class' => 'tablaCarga');
     $tabla = new HTML_Table($clase);
     $tabla->setAutoGrow(true);
     $tabla->setHeaderContents(0, 0, 'Usuario');
     $tabla->setCellContents(0, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="username" value="" />');
     $tabla->setHeaderContents(1, 0, 'Contraseña');
     $tabla->setCellContents(1, 1, '<input class="campoTexto campoTextoAlineado" type="password" name="password" value="" />');
     $tabla->setColAttributes(0, $clase);
     $tabla->setColAttributes(1, $clase);
     echo $tabla->toHtml();
     imprimirTabulados(6);
     echo '<br /><input type="submit" name="botonIniciarSesion"  value="Iniciar sesión" >';
     imprimirTabulados(6);
     echo '</fieldset>';
     imprimirTabulados(6);
     echo '</form>';
     imprimirTabulados(5);
     echo '</div>';
 }
开发者ID:jorgeeliecerballesteros,项目名称:controldeacceso,代码行数:33,代码来源:CuerpoLogin.php

示例4: __construct

 public function __construct()
 {
     parent::__construct('all_categories');
     if ($this->loginError) {
         return;
     }
     $cat_list = pdCatList::create($this->db);
     echo '<h1>Publication Categories</h1>';
     foreach (array_keys($cat_list) as $cat_id) {
         unset($fields);
         unset($cells);
         $category = new pdCategory();
         $result = $category->dbLoad($this->db, $cat_id);
         assert('$result');
         $table = new HTML_Table(array('class' => 'publist'));
         $table->setAutoGrow(true);
         $cells[] = '<b>' . $category->category . '</b><br/>';
         if (count($category->info) > 0) {
             foreach ($category->info as $info_id => $name) {
                 $fields[] = $name;
             }
             $cells[] = 'Fields: ' . implode(', ', $fields);
         } else {
             $cells[] = '';
         }
         if ($this->access_level > 0) {
             $cells[] = $this->getCategoryIcons($category);
         }
         $table->addRow($cells);
         $table->updateColAttributes(0, array('class' => 'category'), NULL);
         $table->updateColAttributes(2, array('class' => 'icons'), NULL);
         echo $table->toHtml();
         unset($table);
     }
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:35,代码来源:list_categories.php

示例5: viewList

 /**
  * View list
  *
  * @author	John.meng
  * @since    version1.0 - Dec 12, 2005
  */
 function viewList()
 {
     global $__Lang__, $FlushPHPObj, $smarty;
     include_once PEAR_DIR . "HTML/Table.php";
     include_once PEAR_DIR . "HTML/QuickForm.php";
     include_once APP_DIR . "UI.class.php";
     $form =& new HTML_QuickForm();
     $FilesDirsObj = $FlushPHPObj->loadUtility("FilesDirs");
     $FilesDirsObj->FilesDirs(MODULE_DIR, 1, "CVS,General");
     $Module_arr = $FilesDirsObj->listDirs();
     asort($Module_arr);
     reset($Module_arr);
     $data = array();
     $installImageObj = new UIImage(THEMES_DIR . "images/install.gif");
     $unInstallImageObj = new UIImage(THEMES_DIR . "images/uninstall.gif");
     if (sizeof($Module_arr)) {
         foreach ($Module_arr as $key => $value) {
             $temp_Module_arr = $FlushPHPObj->getModuleInfo($value);
             if (file_exists(MODULE_DIR . "/" . $temp_Module_arr['name'] . "/" . $temp_Module_arr['logo']) && $temp_Module_arr['logo']) {
                 $ModuleImageLogo = new UIImage(MODULE_DIR . "/" . $temp_Module_arr['name'] . "/" . $temp_Module_arr['logo']);
                 $Module_logo = $ModuleImageLogo->toHTML() . "<br/>";
             }
             $data[$key] = array($Module_logo . $temp_Module_arr['name'] . " <b> " . $temp_Module_arr['version'] . " <b/> ", $temp_Module_arr['description'], $temp_Module_arr['author'], $unInstallImageObj->toHTML() . "<br/>" . $__Lang__['langGeneralUnInstall'], $installImageObj->toHTML() . "<br/>" . $__Lang__['langGeneralInstall']);
         }
     }
     $tableAttrs = array("class" => "grid_table");
     $table = new HTML_Table($tableAttrs);
     $table->setAutoGrow(true);
     $table->setAutoFill("n/a");
     for ($nr = 0; $nr < count($data); $nr++) {
         $table->setHeaderContents($nr + 1, 0, (string) $nr);
         for ($i = 0; $i < 5; $i++) {
             if ("" != $data[$nr][$i]) {
                 $table->setCellContents($nr + 1, $i + 1, $data[$nr][$i]);
             }
         }
     }
     $table->setColAttributes(3, array(" align" => "center"));
     $table->setColAttributes(4, array(" align" => "center"));
     $table->setColAttributes(5, array(" align" => "center"));
     $altRow = array("class" => "grid_table_tr_alternate");
     $table->altRowAttributes(1, null, $altRow);
     $table->setHeaderContents(0, 0, "");
     $table->setHeaderContents(0, 1, $__Lang__['langMenuModule']);
     $table->setHeaderContents(0, 2, $__Lang__['langGeneralSummary']);
     $table->setHeaderContents(0, 3, $__Lang__['langGeneralAuthor']);
     $table->setHeaderContents(0, 4, $__Lang__['langGeneralStatus']);
     $table->setHeaderContents(0, 5, $__Lang__['langGeneralOperation']);
     $hrAttrs = array("class" => "grid_table_head");
     $table->setRowAttributes(0, $hrAttrs, true);
     $table->setColAttributes(0, $hrAttrs);
     $smarty->assign("Main", $table->toHtml());
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:59,代码来源:Module.class.php

示例6: __construct

 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();
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:45,代码来源:bibtex.php

示例7: authorShow

 public function authorShow($auth)
 {
     $result = '';
     $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
     $table->setAutoGrow(true);
     $table->addRow(array('Name:', $auth->name));
     if (isset($auth->title) && trim($auth->title) != "") {
         $table->addRow(array('Title:', $auth->title));
     }
     $table->addRow(array('Email:', "<a href='mailto:" . $auth->email . "'>" . $auth->email . "</a>"));
     $table->addRow(array('Organization:', $auth->organization));
     $webpage = str_replace('http://', '', $auth->webpage);
     if (isset($auth->webpage) && !empty($webpage)) {
         $webpage = "<a href=\"" . $auth->webpage . "\" target=\"_blank\">" . $auth->webpage . "</a>";
     } else {
         $webpage = "none";
     }
     $table->addRow(array('Webpage:', $webpage));
     $interestsStr = '';
     if (isset($auth->interests) && is_array($auth->interests)) {
         $interestsStr = implode('; ', array_values($auth->interests));
     }
     $table->addRow(array('Interest(s):', $interestsStr));
     if ($auth->totalPublications == 0) {
         $table->addRow(array('No publications by this author'), array('colspan' => 2));
     } else {
         if ($auth->totalPublications <= 6) {
             assert('is_array($auth->pub_list)');
             $headingCell = 'Publications:';
             $table->addRow(array($headingCell));
         } else {
             $table->addRow(array('Publications:', '<a id="start" href="#">Show Publications by this author</a>'));
         }
     }
     $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
     $result .= $table->toHtml();
     if ($auth->totalPublications > 0 && $auth->totalPublications <= 6) {
         $result .= displayPubList($this->db, $auth->pub_list);
     } else {
         $result .= "<div id=\"publist\">&nbsp;</div>";
     }
     $this->css();
     $this->javascript();
     return $result;
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:45,代码来源:view_author.php

示例8: viewList

 /**
  * View list
  *
  * @author	John.meng
  * @since    version - Dec 23, 2005
  * @param	datatype paramname description
  * @return   datatype description
  */
 function viewList()
 {
     global $__Lang__, $UrlParameter, $FlushPHPObj, $table, $page_data, $all_data, $links, $form, $smarty;
     include_once PEAR_DIR . 'HTML/QuickForm.php';
     include_once PEAR_DIR . "HTML/Table.php";
     require_once PEAR_DIR . 'Pager/Pager.php';
     $form = new HTML_QuickForm('viewList');
     $renderer =& $form->defaultRenderer();
     $renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" width=\"99%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n{content}\n</table>\n</form>");
     $tableAttrs = array("class" => "grid_table");
     $table = new HTML_Table($tableAttrs);
     $table->setAutoGrow(true);
     //		$table->setAutoFill("n/a");
     $hrAttrs = array("class" => "grid_table_head");
     $table->setRowAttributes(0, $hrAttrs, true);
     $params = array('itemData' => $all_data, 'perPage' => 10, 'delta' => 3, 'append' => true, 'separator' => ' . ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'mode' => 'Jumping', 'prevImg' => $__Lang__['langPaginationPrev'], 'nextImg' => $__Lang__['langPaginationNext']);
     $pager =& Pager::factory($params);
     $page_data = $pager->getPageData();
     $links = $pager->getLinks();
     $selectBox = $pager->getPerPageSelectBox();
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:29,代码来源:UI.class.php

示例9: get_table

 /**
  * Get HTML table (as string that can be echoed)
  *
  * @param array $row_data (to appear in rows of table)
  * @param array $column_headers (to appear in head of table
  * @return string
  *
  * @access public
  */
 public function get_table($row_data, $column_headers)
 {
     // see http://pear.php.net/manual/en/package.html.html-table.intro.php
     $table = new HTML_Table();
     $table->setAutoGrow(true);
     $table->setAutoFill('n/a');
     for ($nr = 0, $maxr = count($row_data); $nr < $maxr; $nr++) {
         for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
             if ('' != $row_data[$nr][$i]) {
                 $table->setCellContents($nr + 1, $i, $row_data[$nr][$i]);
             }
         }
     }
     for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
         $table->setHeaderContents(0, $i, $column_headers[$i]);
     }
     $header_attribute = array('class' => 'header');
     $table->setRowAttributes(0, $header_attribute, true);
     $table->setColAttributes(0, $header_attribute);
     $altRow = array('class' => 'alt_row');
     $table->altRowAttributes(1, null, $altRow);
     return $table->toHtml();
 }
开发者ID:WillSwales,项目名称:financial-maths-mediawiki,代码行数:32,代码来源:class-ct1-render.php

示例10: showUser

 public function showUser()
 {
     $user =& $_SESSION['user'];
     $user->collaboratorsDbLoad($this->db);
     echo '<h2>Login Information&nbsp;<a href="edit_user.php?status=edit">', '<img src="../images/pencil.gif" title="edit" ', 'alt="edit" height="16" width="16" border="0" ', 'align="top" /></a></h2>';
     $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
     $table->setAutoGrow(true);
     $table->addRow(array('Login:', $user->login));
     $table->addRow(array('Name:', $user->name));
     $table->addRow(array('E-mail:', $user->email));
     $option_value = $user->showInternalInfo() ? 'Yes' : 'No';
     $table->addRow(array('Show Internal Info:', $option_value));
     $option_value = $user->showUserInfo() ? 'Yes' : 'No';
     $table->addRow(array('Show User Info:', $option_value));
     if (is_array($user->collaborators) && count($user->collaborators) > 0) {
         $rowcount = 0;
         foreach ($user->collaborators as $collaborator) {
             if ($rowcount == 0) {
                 $cell1 = 'Favorite Collaborators:';
             } else {
                 $cell1 = '';
             }
             $table->addRow(array($cell1, $collaborator));
             $rowcount++;
         }
     } else {
         $table->addRow(array('Favorite Collaborators:', 'None assigned'));
     }
     $table->updateColAttributes(0, array('class' => 'emph', 'width' => '30%'));
     $this->table =& $table;
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:31,代码来源:edit_user.php

示例11: build_html

function build_html(&$html, &$chartData, $query, $sql_key, $result, $report, $title, $description, $parms, $format = '', $timestamp)
{
    //Create EXCEL output object
    $file_name = "{$report}" . "_" . $timestamp . ".csv";
    if (file_exists("/tmp/{$file_name}")) {
        $csv = fopen("/tmp/{$file_name}", "a") or die("ERROR: Could not open file...");
    } else {
        $csv = fopen("/tmp/{$file_name}", "w") or die("ERROR: Could not open file...");
    }
    fwrite($csv, "{$title}\n");
    fwrite($csv, "{$report}\n");
    fwrite($csv, "{$description}\n");
    fwrite($csv, "\n");
    fwrite($csv, "Parameters Passed:\n");
    foreach ($parms as $key => $value) {
        fwrite($csv, "{$key},{$value}\n");
    }
    fwrite($csv, "\n");
    $column_format = array();
    //$attrs = array('width' => '600', 'border' => '1', 'class' => 'report');
    $attrs = array('border' => '1', 'class' => 'report');
    $table = new \HTML_Table($attrs);
    $table->setAutoGrow(true);
    $hrAttrs = array('bgcolor' => 'silver', 'align' => 'center');
    $table->setRowAttributes(0, $hrAttrs, true);
    $hrAttrs = array('align' => 'right');
    foreach ($format as $key => $value) {
        if ("{$key}" == "name") {
            $column_format[strtolower($value)] = $format['format'];
            break;
        } else {
            foreach ($value as $key2 => $value2) {
                $column_format[strtolower($value2)] = $value['format'];
                break;
            }
        }
    }
    $record = 0;
    $chartData = "function drawChart() {\n                    var data = google.visualization.arrayToDataTable([\n";
    while ($row = $result->fetch_assoc()) {
        if ($record > 0) {
            $col = 0;
            $table->setCellContents($record + 1, $col, $record + 1);
            $table->setRowAttributes($record + 1, $hrAttrs, true);
            $chartData .= ",\n";
            foreach ($row as $key => $value) {
                $col++;
                if (isset($column_format[strtolower($key)])) {
                    $fmt_value = format_column($value, $column_format[strtolower($key)]);
                    $table->setCellContents($record + 1, $col, $fmt_value);
                    // If we have a format, check its type
                    if (in_array($column_format[strtolower($key)], array('string', 'date'))) {
                        if ($col == 1) {
                            $chartData .= "['" . $value . "'";
                        } else {
                            $chartData .= ",'" . $value . "'";
                        }
                    } else {
                        if ($col == 1) {
                            $chartData .= "[" . $value;
                        } else {
                            $chartData .= "," . $value;
                        }
                    }
                } else {
                    // If not format, we assume its a number
                    $table->setCellContents($record + 1, $col, $value);
                    if ($col == 1) {
                        $chartData .= $value;
                    } else {
                        $chartData .= "," . $value;
                    }
                }
                //CSV
                if ($col == 1) {
                    fwrite($csv, "{$value}");
                } else {
                    fwrite($csv, ",{$value}");
                }
                //Chart
            }
            fwrite($csv, "\n");
            $chartData .= "]";
        } else {
            if ($record == 0) {
                $col = 0;
                $table->setHeaderContents(0, $col, '#');
                foreach ($row as $key => $value) {
                    $col++;
                    $table->setHeaderContents($record, $col, ucfirst($key));
                    if ($col == 1) {
                        fwrite($csv, "{$key}");
                        $chartData .= "['" . ucfirst($key) . "'";
                    } else {
                        fwrite($csv, ",{$key}");
                        $chartData .= ",'" . ucfirst($key) . "'";
                    }
                }
                fwrite($csv, "\n");
                $chartData .= "],\n";
//.........这里部分代码省略.........
开发者ID:rjevansatari,项目名称:Analytics,代码行数:101,代码来源:report_run_obj.php

示例12: SiteMenuDAO

 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 6, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function opStep3()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty, $__MODULE__, $__TEMPLATES__;
     include_once PEAR_DIR . "HTML/Table.php";
     include_once MODULE_DIR . "Site/DAO/SiteMenuDAO.class.php";
     parent::opAdd();
     $form->addElement('header', null, $__Lang__['langSite'] . $__Lang__['langWizard'] . $__Lang__['langStep'] . " 3 ");
     $sysMenuDao = new SiteMenuDAO();
     $data_menu = $sysMenuDao->getMenuAllArr();
     $tableAttrs = array("class" => "grid_sub_table", 'cellspacing' => "0");
     $table = new HTML_Table($tableAttrs);
     $table->setAutoGrow(true);
     //		$table->setAutoFill("n/a");
     $cell_x = 0;
     $data_menu = array(NULL => NULL) + $data_menu;
     foreach ($data_menu as $key => $value) {
         $table->addRow(array($value['Title'], $__MODULE__[$value['Module']], $__TEMPLATES__[$value['Template']], $value['URL'], " <table><tr><td><a href='####' onclick=\"popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Update&ID=" . $key . "' , 450, 450)\" ><img src='" . THEMES_DIR . "images/edit.gif' border='0'><br />" . $__Lang__['langGeneralUpdate'] . "</a></td><td><a href='####' onclick=\"confirm ( '" . $__Lang__['langGeneralCancelConfirm'] . "')?popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Cancel&ID=" . $key . "' , 20, 20):'';\"><img src='" . THEMES_DIR . "images/delete.gif' border='0'><br />" . $__Lang__['langGeneralCancel'] . "</a></td></tr></table>"));
         $cell_x++;
     }
     $altRow = array("class" => "grid_table_tr_alternate");
     $table->altRowAttributes(1, null, $altRow);
     $hrAttrs = array("class" => "grid_sub_table_head");
     $table->setRowAttributes(0, $hrAttrs, true);
     $table->setHeaderContents(0, 0, $__Lang__['langMenu']);
     $table->setHeaderContents(0, 1, $__Lang__['langSiteModule']);
     $table->setHeaderContents(0, 2, $__Lang__['langSiteTemplate']);
     $table->setHeaderContents(0, 3, $__Lang__['langGeneralURL']);
     $table->setHeaderContents(0, 4, $__Lang__['langGeneralOperation']);
     $form->addElement('static', NULL, NULL, $table->toHtml());
     $step_nav[] =& HTML_QuickForm::createElement('submit', 'btnPre', $__Lang__['langPreStep'], "onclick=document.forms[0].Step.value='Step2' ");
     $step_nav[] =& HTML_QuickForm::createElement('button', 'btnNew', $__Lang__['langGeneralAdd'] . $__Lang__['langMenu'], "onclick=\"popOpenWindow('PopupWindow.php', '', 'Module=" . $_REQUEST['Module'] . "&Page=SiteMenu&Action=Add', 450, 450)\" ");
     $step_nav[] =& HTML_QuickForm::createElement('button', 'btnNext', $__Lang__['langFinish'], "onclick=\"window.location='?Module=Site&Page=Preview'\" ");
     $form->addGroup($step_nav, 'step_navigation', "    ");
     $form->addElement('hidden', 'Module', $_REQUEST['Module']);
     $form->addElement('hidden', 'Page', $_REQUEST['Page']);
     $form->addElement('hidden', 'Action', $_REQUEST['Action']);
     $form->addElement('hidden', 'Step');
     if ($form->validate()) {
         if ($_POST['Step'] == 'Step2') {
             $this->_redirectURL("?Module=" . $_REQUEST['Module'] . "&Page=" . $_REQUEST['Page'] . "&Action=Step2");
         } else {
             $this->_redirectURL("?Module=" . $_REQUEST['Module'] . "&Page=" . $_REQUEST['Page'] . "&Action=Step4");
         }
     }
     $smarty->assign("Main", $form->toHTML());
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:54,代码来源:Wizard.class.php

示例13: setData

 function setData($result)
 {
     // Reset results pointer
     mysqli_data_seek($result, 0);
     //Create EXCEL output object
     $file_name = $this->csv;
     if (file_exists("/tmp/" . $this->csv)) {
         $fh = fopen("/tmp/" . $this->csv, "a") or die("ERROR: Could not open file...");
     } else {
         $fh = fopen("/tmp/" . $this->csv, "w") or die("ERROR: Could not open file...");
     }
     //$attrs = array('width' => '600', 'border' => '1', 'class' => 'report');
     $attrs = array('class' => 'report', 'id' => 'id');
     $rAttrs = array();
     $table = new \HTML_Table($attrs);
     $table->setAutoGrow(true);
     $table->setRowAttributes(0, $rAttrs, true);
     //$yui_data='var data = [\n';
     //$yui_table='var table = new Y.DataTable({\n';
     $record = 0;
     while ($row = db_fetch_assoc($result)) {
         $row_format = FALSE;
         if ($record > 0) {
             $col = 0;
             $table->setCellContents($record + 1, $col, $record + 1);
             $table->setRowAttributes($record + 1, $rAttrs, true);
             foreach ($row as $key => $value) {
                 $col++;
                 // This checks if we have a valid ROW format based on col 1 value
                 if ($col == 1 && isset($this->formats[strtolower($key)]) && $this->formats[strtolower($key)]->class == 'row' && isset($this->formats[strtolower($key)]->rows[strtolower($value)])) {
                     $row_format = TRUE;
                     $row_format_column = strtolower($key);
                     $row_format_value = strtolower($value);
                 }
                 if ($col > 1 && $row_format == TRUE) {
                     // Valid ROW format
                     $table->setCellContents($record + 1, $col, $this->formatValue($this->formats[$row_format_column]->rows[$row_format_value], $value));
                 } else {
                     if (isset($this->formats[strtolower($key)])) {
                         // Valid format
                         if ($this->formats[strtolower($key)]->class == 'column') {
                             // Valid column format
                             $table->setCellContents($record + 1, $col, $this->formatValue($this->formats[strtolower($key)]->type, $value));
                         } else {
                             // Row format, but invalid value
                             $table->setCellContents($record + 1, $col, $value);
                         }
                     } else {
                         // If not format, we assume its a number
                         $table->setCellContents($record + 1, $col, $value);
                     }
                 }
                 //CSV
                 if ($col == 1) {
                     fwrite($fh, '"' . $value . '"');
                 } else {
                     fwrite($fh, ',"' . $value . '"');
                 }
             }
             fwrite($fh, "\n");
         } else {
             if ($record == 0) {
                 $col = 0;
                 $table->setHeaderContents(0, $col, '#');
                 //$yui_column='columns: [';
                 foreach ($row as $key => $value) {
                     $col++;
                     $table->setHeaderContents($record, $col, ucfirst($key));
                     if ($col > 1) {
                         //$yui_column.=$yui_column.",\"$col\"";
                     } else {
                         //$yui_column.=$yui_column."\"$col\"";
                     }
                     //CSV
                     if ($col == 1) {
                         fwrite($fh, "{$key}");
                     } else {
                         fwrite($fh, ",{$key}");
                     }
                 }
                 //$yui_column.=$yui_column."]";
                 fwrite($fh, "\n");
                 $col = 0;
                 $table->setCellContents($record + 1, $col, $record + 1);
                 $table->setRowAttributes($record + 1, $rAttrs, true);
                 foreach ($row as $key => $value) {
                     $col++;
                     // This checks if we have a valid ROW format based on col 1 value
                     if ($col == 1 && isset($this->formats[strtolower($key)]) && $this->formats[strtolower($key)]->class == 'row' && isset($this->formats[strtolower($key)]->rows[strtolower($value)])) {
                         $row_format = TRUE;
                         $row_format_column = strtolower($key);
                         $row_format_value = strtolower($value);
                     }
                     if ($col > 1 && $row_format == TRUE) {
                         // Valid ROW format
                         $table->setCellContents($record + 1, $col, $this->formatValue($this->formats[$row_format_column]->rows[$row_format_value], $value));
                     } else {
                         if (isset($this->formats[strtolower($key)])) {
                             // Valid Format
                             if ($this->formats[strtolower($key)]->class == 'column') {
//.........这里部分代码省略.........
开发者ID:rjevansatari,项目名称:Analytics,代码行数:101,代码来源:Report_Class.php

示例14: toHtml

 /**
  * Returns Html for the group
  * 
  * @access      public
  * @return      string
  */
 function toHtml()
 {
     include_once 'HTML/Table.php';
     $tripleLinkTable = new HTML_Table();
     $tripleLinkTable->setAutoGrow(true);
     $tripleLinkTable->setAutoFill('');
     $tripleLinkTable->updateAttributes($this->getAttributes());
     $row = 0;
     $col = 0;
     if ($this->_columnNames) {
         foreach ($this->_columnNames as $key => $value) {
             ++$col;
             $tripleLinkTable->setCellContents($row, $col, $value);
             $tripleLinkTable->setCellAttributes($row, $col, array('style' => 'text-align: center'));
         }
         ++$row;
     }
     foreach (array_keys($this->_rows) as $key) {
         $col = 0;
         $tripleLinkTable->setCellContents($row, $col, $this->_rowNames[$key]);
         foreach (array_keys($this->_rows[$key]) as $key2) {
             ++$col;
             $tripleLinkTable->setCellContents($row, $col, $this->_rows[$key][$key2]->toHTML());
             $tripleLinkTable->setCellAttributes($row, $col, array('style' => 'text-align: center'));
         }
         ++$row;
     }
     if ($this->_columnNames) {
         $tripleLinkTable->setRowAttributes(0, array('class' => 'elementTableColumnLabel'), true);
     }
     $tripleLinkTable->setColAttributes(0, array('class' => 'elementTableRowLabel'));
     return $tripleLinkTable->toHTML();
     /*include_once('HTML/QuickForm/Renderer/Default.php');
       $renderer =& new HTML_QuickForm_Renderer_Default();
       $renderer->setElementTemplate('{element}');
       $this->accept($renderer);
       return $renderer->toHtml();*/
 }
开发者ID:bobah,项目名称:acbdb,代码行数:44,代码来源:ElementTable.php

示例15: dataTable

 public function dataTable($data, $header = null, $class = null)
 {
     $table = new HTML_Table();
     $table->setAutoGrow(true);
     $table->setAutoFill('');
     $hrAttrs = $class ? array('class' => $class) : null;
     for ($nr = 0; $nr < count($data); $nr++) {
         $table->setHeaderContents($nr + 1, 0, (string) $data[$nr][0]);
         for ($i = 1; $i < count($data[$nr]); $i++) {
             if ('' != $data[$nr][$i]) {
                 $table->setCellContents($nr + 1, $i, $data[$nr][$i]);
             }
             $table->setRowAttributes($nr + 1, $hrAttrs, true);
         }
     }
     for ($i = 0; $i < count($header); $i++) {
         $table->setHeaderContents(0, $i, $header[$i]);
     }
     return $table;
 }
开发者ID:Rem122,项目名称:Uthando-CMS,代码行数:20,代码来源:Uthando.php


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