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


PHP HTML_Table::altRowAttributes方法代码示例

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


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

示例1: 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

示例2: manage_display

function manage_display($task)
{
    global $cfg, $db, $cache;
    if ($task == '') {
        $task = 'status';
    }
    // Verify that the user has management perms for the selected contest
    $res =& db_query('contest_by_id', $_GET['id']);
    $res->fetchInto($row);
    $res->free();
    if ($_SESSION['user_id'] != $row['manager'] && !auth_user_in_group('Administrators')) {
        error("Access denied. You are not the contest-manager for this contest.");
    }
    switch ($task) {
        case 'status':
            $table = new HTML_Table();
            // Re-use $row from above
            if ($row['show_future'] == 1) {
                $status = 'Hidden (not activated yet)';
            } else {
                if ($row['begin_future'] == 1) {
                    $status = 'Not started';
                } else {
                    if ($row['end_future'] == 1) {
                        $status = 'Running';
                    } else {
                        $status = 'Ended';
                    }
                }
            }
            $table->addRow(array('Contest status: ', $status), null, 'TH');
            $table->addRow(array('Name: ', $row['name']));
            $table->addRow(array('Description: ', $row['description']));
            $table->addRow(array('Activation time: ', $row['show_time']));
            $table->addRow(array('Begin time: ', $row['begin_time']));
            $table->addRow(array('End time: ', $row['end_time']));
            if ($row['team_size'] != 1) {
                $table->addRow(array('Max size of team: ', $row['team_size']));
                $prefix = 'Teams';
            } else {
                $table->addRow(array('Individual event: ', 'Yes'));
                $prefix = 'Participants';
            }
            // No. of registered teams
            $res =& db_query('count_teams_by_contest_id', $_GET['id']);
            $res->fetchInto($row);
            $res->free();
            $table->addRow(array($prefix . ' registered: ', $row['count']));
            // No. of teams logged in
            $res =& db_query('count_last_teams_by_contest_id', $_GET['id']);
            $res->fetchInto($row);
            $res->free();
            $table->addRow(array($prefix . ' seen in last 30 minutes: ', $row['count']));
            $table->altRowAttributes(1, null, array("class" => "altrow"));
            echo '<div class="overflow">' . $table->toHtml() . '</div>';
            break;
        case 'problems':
            // display problem info as table
            $table = new HTML_Table();
            $res =& db_query('problems_by_contest_id', $_GET['id']);
            if (!$res->fetchInto($row)) {
                ?>
<p>No problems added yet.</p>			
			<?php 
            } else {
                // extra attributes
                $row['content'] = null;
                $row['actions'] = null;
                $table->addRow(array_keys($row), null, 'TH');
                while ($row) {
                    $row['content'] = "<a href=\"index.php?view=manage&amp;task=show_problem&amp;id={$_GET['id']}&amp;prob_id={$row['prob_id']}\">show</a>";
                    $row['actions'] = "<a href=\"index.php?view=manage&amp;task=edit_problem&amp;id={$_GET['id']}&amp;prob_id={$row['prob_id']}\">edit</a>, " . "<a href=\"index.php?view=manage&amp;task=del_problem&amp;id={$_GET['id']}&amp;prob_id={$row['prob_id']}\">delete</a>";
                    $table->addRow(array_values($row));
                    $res->fetchInto($row);
                }
                $res->free();
                // display tables
                $table->altRowAttributes(1, null, array("class" => "altrow"));
                echo '<div class="overflow">' . $table->toHtml() . '</div>';
            }
            echo "<hr />";
            // form for adding a problem
            $form = new HTML_QuickForm('problemAddForm', 'post', selflink());
            $form->addElement('header', null, 'Add a problem');
            $form->addElement('text', 'prob_id', 'Name (one word ID): ');
            $form->addElement('text', 'summary', 'Summary: ');
            $form->addElement('text', 'weight', 'Points weightage: ');
            $form->addElement('text', 'time_limit', 'Time limit: ');
            $form->addElement('text', 'mem_limit', 'Memory limit: ');
            $elem =& $form->addElement('textarea', 'content', 'Problem content (XML): ');
            $elem->setRows(10);
            $elem->setCols(80);
            $form->addElement('submit', null, 'Submit');
            $form->applyFilter('prob_id', 'trim');
            $form->applyFilter('summary', 'trim');
            $form->applyFilter('weight', 'trim');
            $form->applyFilter('time_limit', 'trim');
            $form->applyFilter('mem_limit', 'trim');
            $form->addRule('prob_id', 'Problem ID is required', 'required', null, 'client');
            $form->addRule('summary', 'Problem summary is required', 'required', null, 'client');
//.........这里部分代码省略.........
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:101,代码来源:manage.php

示例3: admin_display

function admin_display($task)
{
    global $db, $cfg;
    if ($task == NULL) {
        $task = 'contests';
    }
    switch ($task) {
        case 'users':
            $table = new HTML_Table();
            $res =& db_query('users_list');
            $res->fetchInto($row);
            // add users table headers
            $headers = array_keys($row);
            array_push($headers, 'groups');
            array_push($headers, 'actions');
            $table->addRow($headers, null, 'TH');
            // add user records
            while ($row) {
                $res2 =& db_query('groups_by_user_id', $row['user_id']);
                // get list of gourps for this user
                $groups = '';
                $res2->fetchInto($row2);
                while ($row2) {
                    $groups .= $row2['name'];
                    if ($res2->fetchInto($row2)) {
                        $groups .= ', ';
                    }
                }
                $res2->free();
                array_push($row, $groups);
                // actions
                array_push($row, "<a href=\"index.php?view=admin&amp;task=edit_user&amp;id={$row['user_id']}\">edit</a>" . ", <a href=\"index.php?view=admin&amp;task=del_user&amp;id={$row['user_id']}\">delete</a>");
                $table->addRow(array_values($row));
                $res->fetchInto($row);
            }
            $res->free();
            $table->altRowAttributes(1, null, array("class" => "altrow"));
            echo '<div class="overflow">' . $table->toHtml() . '</div>';
            break;
        case 'del_user':
            db_query('del_user_by_id', $_GET['id']);
            db_query('del_user_perms_by_id', $_GET['id']);
            redirect('index.php?view=admin&task=users');
            break;
        case 'edit_user':
            // user id to edit given as arg
            $res =& db_query('groups_by_user_id', $_GET['id']);
            // get list of all groups for this user
            $user_groups = array();
            while ($res->fetchInto($row)) {
                array_push($user_groups, $row['group_id']);
            }
            $res->free();
            // get hanndle of user
            $res =& db_query('user_by_id', $_GET['id']);
            $res->fetchInto($row);
            $handle = $row['handle'];
            $res->free();
            $form = new HTML_QuickForm('userForm', 'post', 'index.php?view=admin&task=edit_user&id=' . $_GET['id']);
            $form->addElement('header', null, 'Groups for user ' . $handle . ' (id: ' . $_GET['id'] . ')');
            // get list of all available groups
            $res =& db_query('groups_list');
            // add checkbox for each group
            $groups = array();
            while ($res->fetchInto($row)) {
                $elem =& $form->addElement('checkbox', $row['group_id'], $row['name']);
                if (in_array($row['group_id'], $user_groups)) {
                    $elem->setChecked(true);
                }
                $groups[$row['group_id']] = $row['name'];
            }
            $res->free();
            $form->addElement('submit', 'submit', 'Apply Changes');
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                foreach ($groups as $gid => $name) {
                    $elem =& $form->getElement($gid);
                    if ($data[$gid] == 1) {
                        auth_set_perm($_GET['id'], $gid);
                        $elem->setChecked(true);
                    } else {
                        auth_clear_perm($_GET['id'], $gid);
                        $elem->setChecked(false);
                    }
                }
            }
            $form->display();
            break;
        case 'groups':
            $table = new HTML_Table();
            $res =& db_query('groups_list');
            $res->fetchInto($row);
            // add groups table header
            $headers = array_keys($row);
            array_push($headers, 'views');
            array_push($headers, 'actions');
            $table->addRow($headers, null, 'TH');
            // add group records
            while ($row) {
                $res2 =& db_query('views_by_group_id', $row['group_id']);
//.........这里部分代码省略.........
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:101,代码来源:admin.php

示例4: statistics_display

function statistics_display($task) {
    global $db, $cfg;
    
    switch ($task) {
        case 'overall':
            ?>
            <p><b>Overall member ratings.</b><br />Below are the present standings of all registered members,
            based on ratings calculated over their performance in various contests.</p>
            <?php
          
          
          //for($i = 0; $i < 3; $i++)
          //{  
          if(!isset($_GET['div'])) {
			$_GET['div'] = '0';
		}
          
          
          	echo '<p><b>';
          	
          	$i = 0;
          	
          	
          	for($i = '0'; $i < $cfg["tcl"]["divcount"]; $i++)
          	{
          		if($i == $_GET['div'])
          		echo $cfg["tcl"]["divisions"][$_GET['div']];
          		else
          	   		echo '<a href="index.php?view=statistics&amp;task=overall&amp;div='.$i.'">'.$cfg["tcl"]["divisions"][$i].'</a>';
          	    
          	    if($i <> $cfg["tcl"]["divcount"] - '1')
          	    	echo '&nbsp;|&nbsp;';
          	}
          	/*
          	while(true)
          	{
          		echo 'here';
          		if($i != $_GET['div'])
          		echo $cfg["tcl"]["divisions"][$_GET['div']];
          	   else
          	   	echo '<a href="index.php?view=statistics&amp;task=overall&amp;div='.$i;
          	   	
          	   	if($i != 2)
          	   	{ echo '&nbsp;|&nbsp;'; break; }
          	   		$i++;
          	};*/
          	echo '</b></p>';
            $table = new HTML_Table;
            $table->addRow(array('<a href="index.php?view=statistics&amp;task=overall">Rank</a>', 
            '<a href="index.php?view=statistics&amp;task=overall&amp;sort=handle">User Handle</a>', 
            'Name',
            '<a href="index.php?view=statistics&amp;task=overall">Rating</a>', 
            '<a href="index.php?view=statistics&amp;task=overall&amp;sort=volatility">Volatility</a>', 
            'Participated contests'), null, 'TH');
            
            if (!isset($_GET['sort'])) {
                $_GET['sort'] = 'rating DESC';
            }
                    
            $res =& $db->query('SELECT user_id, first_name, last_name, handle, rating, volatility FROM users WHERE division = '.$_GET['div'].' ORDER BY '.$_GET['sort']);
            if (PEAR::isError($res)) error($res->toString());
            
            $prev_rat = -1;
            $rank = 0;
            $carried = 0;
            
            while ($res->fetchInto($user)) {
                if ($user['handle'] == 'tester') continue;
                if (abs($prev_rat-$user['rating']) < 1e-4) {
                    ++$carried;
                } else {
                    $rank = $rank + $carried + 1;
                    $prev_rat = $user['rating'];
                    $carried = 0;
                }
                
                $res2 =& $db->query('SELECT COUNT(*) AS count FROM members WHERE user_id = '.$user['user_id']);
                if (PEAR::isError($res)) error($res->toString());
                $res2->fetchInto($count);
                $res2->free();
                
                $table->addRow(array($rank, user_handle($user['handle']), 
                    ucwords(strtolower($user['first_name'].' '.$user['last_name'])),
                    $user['rating'], $user['volatility'], $count['count']));
            }
            $res->free();
            
            $table->altRowAttributes(1, null, array ("class" => "altrow"));
            echo '<div class="overflow">'.$table->toHtml().'</div>';
            
            
		//}
            break;
        
        case 'contest':
            $res =& db_query('contest_by_id', $_GET['id']);
            $res->fetchInto($contest);
            $res->free();
            
            /*
//.........这里部分代码省略.........
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:101,代码来源:statistics.php

示例5: html_escape

echo '<b>Language:</b> ' . $func();
echo '<pre class="solution_code">';
echo html_escape($soln['source']);
echo '</pre>';
ob_end_flush();
if ($contest['end_future'] != '1' && ($contest['tested'] == 1 || auth_user_in_group('Administrators'))) {
    // Show test-case passing summary
    require_once 'problem.php';
    require_once 'HTML/Table.php';
    $table = new HTML_Table();
    $table->addRow(array('Test Case', 'Passed', 'Input'), null, 'TH');
    $res =& db_query('problem_by_id', array($_GET['prob_id'], $_GET['id']));
    $res->fetchInto($problem);
    $prob = problem_load($problem);
    $show_eg = strlen($soln['passed']) == count($prob->tests);
    $i = '0';
    foreach ($prob->tests as $id => $case) {
        if (!$show_eg && array_key_exists($id, $prob->examples)) {
            continue;
        }
        $passed = "no";
        if ($soln['passed'][$i] == '1') {
            $passed = "yes";
        }
        $table->addRow(array($i, $passed, '<pre>' . $case->getInput() . '</pre>'));
        ++$i;
    }
    $table->altRowAttributes(1, null, array("class" => "altrow"));
    echo '<div class="overflow">' . $table->toHtml() . '</div>';
}
html_footer();
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:31,代码来源:solution.php

示例6: getDetails

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

示例7: 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

示例8: 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 private
  */
 private function get_table($row_data, $column_headers, $delete = false, $deleteColumn = -999, $deleteField = 'dummy-field-name')
 {
     // 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 (isset($row_data[$nr][$i])) {
                 if ('' != $row_data[$nr][$i]) {
                     if ($deleteColumn == $i) {
                         if ($delete) {
                             $table->setCellContents($nr + 1, $i, $this->getDeleteButton($row_data[$nr][$i], $deleteField));
                         }
                     } else {
                         $table->setCellContents($nr + 1, $i, $row_data[$nr][$i]);
                     }
                 }
             } else {
                 $table->setCellContents($nr + 1, $i, $this->fillerForEmptyCell);
             }
         }
     }
     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:owen-kellie-smith,项目名称:reservation,代码行数:42,代码来源:ReservationRender.php

示例9: url

$link_back .= url(array('module' => 'product', 'action' => 'overview', 'id' => $category));
$link_back .= '">';
$link_back .= $lang->translate("back");
$link_back .= '</a>';
include_once 'HTML/Table.php';
$tbl = new HTML_Table('class="overview"');
$tbl->addRow(array($lang->translate('name'), $row->{product_name}));
$tbl->addRow(array($lang->translate('chemical nomenclature'), $row->{info . '_' . LC_LANG}));
$tbl->addRow(array($lang->translate('further information'), $row->{bem_ . LC_LANG}));
$tbl->addRow(array($lang->translate('manufacturer'), '<a href="' . url(array('module' => 'company', 'action' => 'details', 'id' => $row->id)) . '"><img src="' . $cfg['path']['logo'] . $row->url_logo . '"><br>' . $row->{company_name} . '</a>'));
$tbl->addRow(array($lang->translate('website'), $row->product_url));
$tbl->setColAttributes(0, 'width="100"');
$tbl->setColAttributes(1, 'width="300"');
$row1Style = array('class' => 'overview');
$row2Style = array('class' => 'overviewalternate');
$tbl->altRowAttributes(0, $row1Style, $row2Style);
$tpl->setVariable("UEBERSCHRIFT", $row->product_name);
$tpl->SetVariable("TABELLE_UEBERSCHRIFT", $row->product_name . " (" . $link_back . ")");
/** BEGIN Vertrieb **/
$query = "select *,t_reseller.name as reseller\n        from {$table['product']},{$table['company']} as t_reseller, {$table['reseller']}\n        where {$table['product']}.id={$id}\n        AND {$table['product']}.id={$table['reseller']}.id_produkt\n        AND {$table['reseller']}.id_firma=t_reseller.id";
require_once 'mms_tablepager.php';
$tabpage = new PageTable($cfg['database']['dsn'], "overview");
$tabpage->fields = array('name', 'land');
$tabpage->make_url = false;
$tabpage->add_extra = false;
$tabpage->col_view = 'name';
$tabpage->url_view = url(array('module' => 'company', 'action' => 'details'));
$res_vertrieb = '<h2>' . $lang->translate('reseller') . '</h2>' . $tabpage->get($query, $from, 'overview') . '<br>';
/** END Vertrieb **/
/** BEGIN Beispielmischungen **/
$query = "select *,{$table['compound']}.id as mixid, {$table['compound']}.name_" . LC_LANG . " as mischname from {$table['product']},{$table['compound_details']},{$table['compound']} where {$table['compound_details']}.id_produkt={$table['product']}.id AND {$table['compound']}.id = {$table['compound_details']}.id_mischung AND {$table['product']}.id={$id}";
开发者ID:BackupTheBerlios,项目名称:molecms,代码行数:31,代码来源:details.php

示例10: array

<?php

$data = array('0' => array('Bakken', 'Stig', '', 'stig@example.com'), '1' => array('Merz', 'Alexander', 'alex.example.com', 'alex@example.com'), '2' => array('Daniel', 'Adam', '', ''));
require_once 'HTML/Table.php';
$attrs = array('width' => '600');
$table = new HTML_Table($attrs);
$table->setAutoGrow(true);
$table->setAutoFill('n/a');
for ($nr = 0; $nr < count($data); $nr++) {
    // La primer columna es cabecera de tabla tambien
    $table->setHeaderContents($nr + 1, 0, (string) $nr);
    for ($i = 0; $i <= 3; $i++) {
        if ('' != $data[$nr][$i]) {
            $table->setCellContents($nr + 1, $i + 1, $data[$nr][$i]);
        }
    }
}
$altRow = array('bgcolor' => 'red');
$table->altRowAttributes(1, null, $altRow);
$table->setHeaderContents(0, 0, '');
$table->setHeaderContents(0, 1, 'Surname');
$table->setHeaderContents(0, 2, 'Name');
$table->setHeaderContents(0, 3, 'Website');
$table->setHeaderContents(0, 4, 'EMail');
$hrAttrs = array('bgcolor' => 'silver');
$table->setRowAttributes(0, $hrAttrs, true);
$table->setColAttributes(0, $hrAttrs);
echo $table->toHtml();
开发者ID:jorgeeliecerballesteros,项目名称:controldeacceso,代码行数:28,代码来源:PruebaHTML_Table.php

示例11: fiches_a_valider

/** fiches_a_valider () - Renvoie les annonces restant a valider par un administrateur
*
* @return   string  HTML
*/
function fiches_a_valider()
{
    // Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique
    // On effectue une requete sur le bazar pour voir les fiches a administrer
    $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_ADMIN);
    $res = '<h2>' . BAZ_ANNONCES_A_ADMINISTRER . '</h2><br />' . "\n";
    $requete = 'SELECT * FROM ' . BAZ_PREFIXE . 'fiche, ' . BAZ_PREFIXE . 'nature WHERE bf_statut_fiche=0 AND ' . 'bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN (' . $GLOBALS['_BAZAR_']['categorie_nature'] . ') ';
    if (isset($GLOBALS['_BAZAR_']['langue'])) {
        $requete .= ' and bn_ce_i18n like "' . $GLOBALS['_BAZAR_']['langue'] . '%" ';
    }
    $requete .= 'ORDER BY bf_date_maj_fiche DESC';
    $resultat = $GLOBALS['_BAZAR_']['db']->query($requete);
    if (DB::isError($resultat)) {
        echo 'Echec de la requete<br />' . $resultat->getMessage() . '<br />' . $resultat->getDebugInfo();
    }
    if ($resultat->numRows() != 0) {
        $tableAttr = array('id' => 'table_bazar');
        $table = new HTML_Table($tableAttr);
        $entete = array(BAZ_TITREANNONCE, BAZ_ANNONCEUR, BAZ_TYPE_FICHE, BAZ_PUBLIER, BAZ_SUPPRIMER);
        $table->addRow($entete);
        $table->setRowType(0, 'th');
        // On affiche une ligne par proposition
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
            //Requete pour trouver le nom et prenom de l'annonceur
            $requetenomprenom = 'SELECT ' . BAZ_CHAMPS_PRENOM . ', ' . BAZ_CHAMPS_NOM . ' FROM ' . BAZ_ANNUAIRE . ' WHERE ' . BAZ_CHAMPS_ID . '=' . $ligne['bf_ce_utilisateur'];
            $resultatnomprenom = $GLOBALS['_BAZAR_']['db']->query($requetenomprenom);
            if (DB::isError($resultatnomprenom)) {
                echo "Echec de la requete<br />" . $resultatnomprenom->getMessage() . "<br />" . $resultatnomprenom->getDebugInfo();
            }
            while ($lignenomprenom = $resultatnomprenom->fetchRow(DB_FETCHMODE_ASSOC)) {
                $annonceur = $lignenomprenom[BAZ_CHAMPS_PRENOM] . " " . $lignenomprenom[BAZ_CHAMPS_NOM];
            }
            $lien_voir = $GLOBALS['_BAZAR_']['url'];
            $lien_voir->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE);
            $lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
            //$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']);
            // Nettoyage de l'url
            // NOTE (jpm - 23 mai 2007): pour �tre compatible avec PHP5 il faut utiliser tjrs $GLOBALS['_BAZAR_']['url'] car en php4 on
            // copie bien une variable mais pas en php5, cela reste une r�f�rence...
            $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
            $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
            //$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
            $GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']);
            $GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $ligne['bn_id_nature']);
            $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE);
            $lien_voir = $GLOBALS['_BAZAR_']['url']->getURL();
            $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
            $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_PUBLIER);
            $lien_publie_oui = $GLOBALS['_BAZAR_']['url']->getURL();
            $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
            $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_PAS_PUBLIER);
            $lien_publie_non = $GLOBALS['_BAZAR_']['url']->getURL();
            $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
            $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_ACTION_SUPPRESSION);
            $lien_supprimer = $GLOBALS['_BAZAR_']['url']->getURL();
            $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
            $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
            $GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
            $table->addRow(array('<a href="' . $lien_voir . '">' . $ligne['bf_titre'] . '</a>' . "\n", $annonceur . "\n", $ligne['bn_label_nature'] . "\n", "<a href=\"" . $lien_publie_oui . "\">" . BAZ_OUI . "</a> / \n" . "<a href=\"" . $lien_publie_non . "\">" . BAZ_NON . "</a>", "<a href=\"" . $lien_supprimer . "\"" . " onclick=\"javascript:return confirm('" . BAZ_CONFIRMATION_SUPPRESSION . "');\">" . BAZ_SUPPRIMER . "</a>\n"));
            // col 5 : supprimer
        }
        $table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
        $table->updateColAttributes(1, array("align" => "center"));
        $table->updateColAttributes(2, array("align" => "center"));
        $table->updateColAttributes(3, array("align" => "center"));
        $table->updateColAttributes(4, array("align" => "center"));
        $res .= $table->toHTML();
    } else {
        $res .= '<p class="zone_info">' . BAZ_PAS_DE_FICHE_A_VALIDER . '</p>' . "\n";
    }
    $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_TOUTES_ANNONCES);
    // Nettoyage de l'url
    $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION);
    $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
    $GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
    // Les autres fiches, deja validees
    $res .= '<h2>' . BAZ_TOUTES_LES_FICHES . '</h2>' . "\n";
    $requete = 'SELECT * FROM ' . BAZ_PREFIXE . 'fiche, ' . BAZ_PREFIXE . 'nature WHERE bf_statut_fiche=1 AND ' . 'bn_id_nature=bf_ce_nature AND bn_ce_id_menu IN (' . $GLOBALS['_BAZAR_']['categorie_nature'] . ') ';
    if (isset($GLOBALS['_BAZAR_']['langue'])) {
        $requete .= ' and bn_ce_i18n like "' . $GLOBALS['_BAZAR_']['langue'] . '%" ';
    }
    $requete .= 'ORDER BY bf_date_maj_fiche DESC';
    $resultat = $GLOBALS['_BAZAR_']['db']->query($requete);
    if (DB::isError($resultat)) {
        echo 'Echec de la requete<br />' . $resultat->getMessage() . '<br />' . $resultat->getDebugInfo();
    }
    if ($resultat->numRows() != 0) {
        $tableAttr = array('class' => 'table_bazar');
        $table = new HTML_Table($tableAttr);
        $entete = array(BAZ_TITREANNONCE, BAZ_ANNONCEUR, BAZ_TYPE_FICHE, BAZ_PUBLIER, BAZ_SUPPRIMER);
        $table->addRow($entete);
        $table->setRowType(0, 'th');
        // On affiche une ligne par proposition
        while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
            //Requete pour trouver le nom et prenom de l'annonceur
            $requetenomprenom = 'SELECT ' . BAZ_CHAMPS_PRENOM . ', ' . BAZ_CHAMPS_NOM . ' FROM ' . BAZ_ANNUAIRE . ' WHERE ' . BAZ_CHAMPS_ID . '=' . $ligne['bf_ce_utilisateur'];
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:wikiplug,代码行数:101,代码来源:bazar.fonct.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: array

      th, td { padding: 0.4em; }
      tr.alt td { background: #ddd; }
    </style>
  </head>
  <body>

    <h2>Fibonacci sequence using HTML_Table</h2>

<?php 
require_once "HTML/Table.php";
$attrs = array("cellspacing" => 0, "border" => 0, "style" => "width: 20em; border: 1px solid #666;");
$table = new HTML_Table($attrs);
$table->addRow(array("Sequence #", "Value"), null, "th");
$iterations = 10;
$num1 = 0;
$num2 = 1;
$table->addRow(array("F<sub>0</sub>", "0"));
$table->addRow(array("F<sub>1</sub>", "1"));
for ($i = 2; $i <= $iterations; $i++) {
    $sum = $num1 + $num2;
    $num1 = $num2;
    $num2 = $sum;
    $table->addRow(array("F<sub>{$i}</sub>", $num2));
}
$attrs = array("class" => "alt");
$table->altRowAttributes(1, null, $attrs, true);
echo $table->toHtml();
?>
  </body>
</html>
开发者ID:raynaldmo,项目名称:php-education,代码行数:30,代码来源:fibonacci2.php

示例14: bulletin_tabulate

function bulletin_tabulate($level)
{
    global $db, $cfg;
    $start_limit = 0;
    if (array_key_exists('start', $_GET)) {
        $start_limit = $_GET['start'];
    }
    $count_limit = 15;
    if (array_key_exists('count', $_GET)) {
        $start_limit = $_GET['count'];
    }
    $is_admin = auth_user_in_group('Administrators');
    if (!$is_admin && $level == 2) {
        error("Admin Chat not authorised for non-admins.");
    }
    if ($level > 2 || $is_admin) {
        $form = new HTML_QuickForm('shoutForm', 'post', selflink());
        $form->addElement('header', null, 'Post your message here:');
        $form->addElement('text', 'subject', 'Subject: ');
        $elem =& $form->addElement('checkbox', 'addbreaks', null);
        $elem->setChecked(false);
        $elem->setText('Allow HTML formatting tags. Makes line-break tags necessary.');
        $elem =& $form->addElement('textarea', 'message', 'Shout Message: ');
        $elem->setRows(6);
        $elem->setCols(60);
        $form->addElement('submit', 'submit', 'Post');
        $form->addRule('subject', 'Subject must be maximum 100 characters.', 'maxlength', 100, 'client');
        if ($form->validate()) {
            $data = $form->getSubmitValues();
            if (!isset($data['addbreaks'])) {
                $data['addbreaks'] = 1;
                $data['message'] = htmlentities($data['message']);
            } else {
                $data['addbreaks'] = 0;
            }
            db_query('bulletin_post', array($_SESSION['user_id'], $data['subject'], $data['message'], $level, $data['addbreaks']));
            redirect('index.php?view=bulletin&task=' . $_GET['task']);
        }
    }
    if ($level > 2 || $is_admin) {
        $form->display();
        echo '<hr />';
    }
    bulletin_navbar($start_limit, $count_limit);
    $res =& $db->query($cfg['sql']['bulletin_by_level'] . " LIMIT {$start_limit}, {$count_limit}", array($level));
    if (PEAR::isError($res)) {
        error($res->toString());
    }
    $table = new HTML_Table();
    if ($res->numRows() == 0) {
        $table->addRow(array('Sorry, no more messages on this bulletin page.'));
    }
    while ($res->fetchInto($row)) {
        $action = "";
        if ($row['poster_id'] == $_SESSION['user_id']) {
            $action = ' [<a href="index.php?view=bulletin&task=edit&prev=' . $_GET['task'] . '&id=' . $row['post_id'] . '">edit</a>, <a href="index.php?view=bulletin&task=delete&prev=' . $_GET['task'] . '&id=' . $row['post_id'] . '">delete</a>]';
        } else {
            if ($is_admin) {
                $action = ' [<a href="index.php?view=bulletin&task=delete&prev=' . $_GET['task'] . '&id=' . $row['post_id'] . '">delete</a>]';
            }
        }
        $table->addRow(array('Subject: <b>' . $row['subject'] . '</b>', 'Posted by: <b>' . user_handle($row['handle']) . '</b>' . $action . ' on <i>' . $row['posted'] . '</i>'));
        if ($row['addbreaks'] == 1) {
            $table->addRow(array('<div class="message">' . preg_replace('/\\n/', '<br />', $row['message']) . '</div>'), array(colspan => "2"));
        } else {
            $table->addRow(array('<div class="message">' . $row['message'] . '</div>'), array(colspan => "2"));
        }
    }
    $table->altRowAttributes(0, array("class" => "altrow"), null);
    echo $table->toHtml();
    bulletin_navbar($start_limit, $count_limit);
}
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:72,代码来源:bulletin.php


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