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


PHP HTML::table方法代码示例

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


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

示例1: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     include_once "lib/imdb.php";
     $imdb = new imdb();
     if (method_exists($imdb, $query)) {
         $SqlResult = $imdb->{$query}($title ? $title : $name);
     } else {
         $SqlResult = array();
     }
     // if ($limit) ; // TODO: fill paging vars (see PageList)
     if ($ordered) {
         $html = HTML::ol(array('class' => 'sqlresult'));
         foreach ($SqlResult as $row) {
             $html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0]));
         }
     } else {
         $html = HTML::table(array('class' => 'sqlresult'));
         $i = 0;
         foreach ($SqlResult as $row) {
             $tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'));
             foreach ($row as $col) {
                 $tr->pushContent(HTML::td($col));
             }
             $html->pushContent($tr);
         }
     }
     // if ($limit) ; // do paging via pagelink template
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:Imdb.php

示例2: showForm

 function showForm(&$dbi, &$request, $args, $allrelations)
 {
     global $WikiTheme;
     $action = $request->getPostURL();
     $hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's'));
     $pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
     $help = Button('submit:semsearch[help]', "?", false);
     $svalues = empty($allrelations) ? "" : join("','", $allrelations);
     $reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')");
     $querybox = HTML::textarea(array('name' => 's', 'title' => _("Enter a valid query expression"), 'rows' => 4, 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), $args['s']);
     $submit = Button('submit:semsearch[relations]', _("Search"), false, array('title' => 'Move to help page. No seperate window'));
     $instructions = _("Search in all specified pages for the expression.");
     $form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => '0', 'width' => '100%'), HTML::tr(HTML::td(_("Pagename(s): "), $pagefilter), HTML::td(array('align' => 'right'), $help)), HTML::tr(HTML::td(array('colspan' => 2), $querybox))), HTML::br(), HTML::div(array('align' => 'center'), $submit));
     return $form;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:15,代码来源:SemanticSearchAdvanced.php

示例3: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $h = HTML();
     $this->_generatePageheader($info, $h);
     if (!REQUIRE_ADMIN || $request->_user->isadmin()) {
         $h->pushContent(HTML::h2(_("Plugins")));
         $table = HTML::table(array('class' => "pagelist"));
         $this->_generateColheadings($info, $table);
         $this->_generateTableBody($info, $dbi, $request, $table);
         $h->pushContent($table);
     } else {
         $h->pushContent(fmt("You must be an administrator to %s.", _("use this plugin")));
     }
     return $h;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:16,代码来源:PluginManager.php

示例4: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     if (!ACCESS_LOG) {
         return;
     }
     $args = $this->getArgs($argstr, $request);
     $table = HTML::table(array('cellpadding' => 1, 'cellspacing' => 2, 'border' => 0, 'class' => 'pagelist'));
     if (!$args['noheader'] and !empty($args['caption'])) {
         $table->pushContent(HTML::caption(array('align' => 'top'), $args['caption']));
     }
     $logs = array();
     $limit = $args['limit'];
     $accesslog =& $request->_accesslog;
     if ($logiter = $accesslog->get_referer($limit, "external_only") and $logiter->count()) {
         $table->pushContent(HTML::tr(HTML::th("Target"), HTML::th("Referrer"), HTML::th("Host"), HTML::th("Date")));
         while ($logentry = $logiter->next()) {
             $table->pushContent(HTML::tr(HTML::td($logentry['request']), HTML::td($logentry['referer']), HTML::td($logentry['host']), HTML::td($logentry['time'])));
         }
         return $table;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:RecentReferrers.php

示例5: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $this->_args = $this->getArgs($argstr, $request);
     extract($this->_args);
     //trigger_error("1 p= $page a= $author");
     if ($page && $page == 'username') {
         //FIXME: use [username]!!!!!
         $page = $author;
     }
     //trigger_error("2 p= $page a= $author");
     if (!$page || !$author) {
         //user not signed in or no author specified
         return '';
     }
     //$pagelist = new PageList($info, $exclude);
     ///////////////////////////
     $nbsp = HTML::raw(' ');
     global $WikiTheme;
     // date & time formatting
     if (!($page == 'all')) {
         $p = $dbi->getPage($page);
         $t = HTML::table(array('class' => 'pagelist', 'style' => 'font-size:smaller'));
         $th = HTML::thead();
         $tb = HTML::tbody();
         $th->pushContent(HTML::tr(HTML::td(array('align' => 'right'), _("Version")), $includeminor ? HTML::td(_("Minor")) : "", HTML::td(_("Author")), HTML::td(_("Summary")), HTML::td(_("Modified"))));
         $allrevisions_iter = $p->getAllRevisions();
         while ($rev = $allrevisions_iter->next()) {
             $isminor = $rev->get('is_minor_edit');
             $authordoesmatch = $author == $rev->get('author');
             if ($authordoesmatch && (!$isminor || $includeminor && $isminor)) {
                 $difflink = Button(array('action' => 'diff', 'previous' => 'minor'), $rev->getversion(), $rev);
                 $tr = HTML::tr(HTML::td(array('align' => 'right'), $difflink, $nbsp), $includeminor ? HTML::td($nbsp, $isminor ? "minor" : "major", $nbsp) : "", HTML::td($nbsp, WikiLink($rev->get('author'), 'if_known'), $nbsp), HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align' => 'right'), $WikiTheme->formatdatetime($rev->get('mtime'))));
                 $class = $isminor ? 'evenrow' : 'oddrow';
                 $tr->setAttr('class', $class);
                 $tb->pushContent($tr);
                 //$pagelist->addPage($rev->getPage());
             }
         }
         $captext = fmt($includeminor ? "History of all major and minor edits by %s to page %s." : "History of all major edits by %s to page %s.", WikiLink($author, 'auto'), WikiLink($page, 'auto'));
         $t->pushContent(HTML::caption($captext));
         $t->pushContent($th, $tb);
     } else {
         //search all pages for all edits by this author
         /////////////////////////////////////////////////////////////
         $t = HTML::table(array('class' => 'pagelist', 'style' => 'font-size:smaller'));
         $th = HTML::thead();
         $tb = HTML::tbody();
         $th->pushContent(HTML::tr(HTML::td(_("Page Name")), HTML::td(array('align' => 'right'), _("Version")), $includeminor ? HTML::td(_("Minor")) : "", HTML::td(_("Summary")), HTML::td(_("Modified"))));
         /////////////////////////////////////////////////////////////
         $allpages_iter = $dbi->getAllPages($includedeleted);
         while ($p = $allpages_iter->next()) {
             /////////////////////////////////////////////////////////////
             $allrevisions_iter = $p->getAllRevisions();
             while ($rev = $allrevisions_iter->next()) {
                 $isminor = $rev->get('is_minor_edit');
                 $authordoesmatch = $author == $rev->get('author');
                 if ($authordoesmatch && (!$isminor || $includeminor && $isminor)) {
                     $difflink = Button(array('action' => 'diff', 'previous' => 'minor'), $rev->getversion(), $rev);
                     $tr = HTML::tr(HTML::td($nbsp, $isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto')), HTML::td(array('align' => 'right'), $difflink, $nbsp), $includeminor ? HTML::td($nbsp, $isminor ? "minor" : "major", $nbsp) : "", HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align' => 'right'), $WikiTheme->formatdatetime($rev->get('mtime')), $nbsp));
                     $class = $isminor ? 'evenrow' : 'oddrow';
                     $tr->setAttr('class', $class);
                     $tb->pushContent($tr);
                     //$pagelist->addPage($rev->getPage());
                 }
             }
             /////////////////////////////////////////////////////////////
         }
         $captext = fmt($includeminor ? "History of all major and minor modifications for any page edited by %s." : "History of major modifications for any page edited by %s.", WikiLink($author, 'auto'));
         $t->pushContent(HTML::caption($captext));
         $t->pushContent($th, $tb);
     }
     //        if (!$noheader) {
     // total minor, major edits. if include minoredits was specified
     //        }
     return $t;
     //        if (!$noheader) {
     //            $pagelink = WikiLink($page, 'auto');
     //
     //            if ($pagelist->isEmpty())
     //                return HTML::p(fmt("No pages link to %s.", $pagelink));
     //
     //            if ($pagelist->getTotal() == 1)
     //                $pagelist->setCaption(fmt("One page links to %s:",
     //                                          $pagelink));
     //            else
     //                $pagelist->setCaption(fmt("%s pages link to %s:",
     //                                          $pagelist->getTotal(), $pagelink));
     //        }
     //
     //        return $pagelist;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:91,代码来源:AuthorHistory.php

示例6: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     include_once 'lib/InlineParser.php';
     $table = array();
     $lines = preg_split('/\\s*?\\n\\s*/', $argstr);
     foreach ($lines as $line) {
         if (!$line) {
             continue;
         }
         $line = trim($line);
         // If line ends with a '|', remove it
         if ($line[strlen($line) - 1] == '|') {
             $line = substr($line, 0, -1);
         }
         if ($line[0] != '|') {
             // trigger_error(sprintf(_("Line %s does not begin with a '|'."), $line), E_USER_WARNING);
         } else {
             $table[] = $this->_parse_row($line, $basepage);
         }
     }
     $nbrows = sizeof($table);
     // If table is empty, do not generate table markup
     if ($nbrows == 0) {
         return HTML::raw('');
     }
     $nbcols = sizeof($table[0]);
     for ($i = 0; $i < $nbrows; $i++) {
         for ($j = 0; $j < $nbcols; $j++) {
             if (preg_match('/@@/', $table[$i][$j])) {
                 $table[$i][$j] = compute_tablecell($table, $i, $j, $nbrows, $nbcols);
             }
         }
     }
     $htmltable = HTML::table(array('class' => "bordered"));
     foreach ($table as $row) {
         $htmlrow = HTML::tr();
         foreach ($row as $cell) {
             if ($cell && $cell[0] == '=') {
                 $cell = trim(substr($cell, 1));
                 $htmlrow->pushContent(HTML::th(TransformInline($cell, 2.0, $basepage)));
             } else {
                 if (is_numeric($cell)) {
                     $htmlrow->pushContent(HTML::td(array('style' => "text-align:right"), $cell));
                 } else {
                     $htmlrow->pushContent(HTML::td(TransformInline($cell, 2.0, $basepage)));
                 }
             }
         }
         $htmltable->pushContent($htmlrow);
     }
     return $htmltable;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:53,代码来源:WikicreoleTable.php

示例7: _arrayToTable

 function _arrayToTable($array, &$request)
 {
     $thead = HTML::thead();
     $label[0] = _("Wiki Name");
     $label[1] = _("Search");
     $thead->pushContent(HTML::tr(HTML::th($label[0]), HTML::th($label[1])));
     $tbody = HTML::tbody();
     $dbi = $request->getDbh();
     if ($array) {
         foreach ($array as $moniker => $interurl) {
             $monikertd = HTML::td(array('class' => 'interwiki-moniker'), $dbi->isWikiPage($moniker) ? WikiLink($moniker) : $moniker);
             $w = new WikiPluginLoader();
             $p = $w->getPlugin('ExternalSearch');
             $argstr = sprintf('url="%s"', addslashes($interurl));
             $searchtd = HTML::td($p->run($dbi, $argstr, $request, $basepage));
             $tbody->pushContent(HTML::tr($monikertd, $searchtd));
         }
     }
     $table = HTML::table();
     $table->setAttr('class', 'interwiki-map');
     $table->pushContent($thead);
     $table->pushContent($tbody);
     return $table;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:24,代码来源:InterWikiSearch.php

示例8:

<?php

require 'script.php';
?>

<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="stylesheet" href="style.css">
    </head>
    <body>

    <h3>Segmented</h3>

    <?php 
echo HTML::table($originalSource['columns'], $originalSource['rows']);
?>





    </body>
</html>
开发者ID:quallsbenson,项目名称:analytics-repository,代码行数:30,代码来源:index.php

示例9: _

} else {
    $thead[] = _("Profile");
}
$options = array('align' => 'center', 0 => array('align' => 'right'));
$tbody = array();
for ($i = 1; $log = $logQ->fetch(); $i++) {
    $row = $i . '.';
    $row .= OPEN_SEPARATOR;
    $row .= I18n::localDate($log["access_date"]);
    $row .= OPEN_SEPARATOR;
    $row .= $log["login"];
    $row .= OPEN_SEPARATOR;
    if ($table == 'record') {
        $row .= $log["table_name"];
        $row .= OPEN_SEPARATOR;
        $row .= $log["operation"];
        $row .= OPEN_SEPARATOR;
        $row .= htmlspecialchars(var_export(unserialize($log["affected_row"]), true));
    } else {
        $row .= $profiles[$log["id_profile"]];
    }
    $tbody[] = explode(OPEN_SEPARATOR, $row);
}
// end for
$logQ->freeResult();
$logQ->close();
unset($logQ);
unset($log);
echo HTML::rule();
echo HTML::table($thead, $tbody, null, $options);
require_once "../layout/footer.php";
开发者ID:edubort,项目名称:openclinic-1,代码行数:31,代码来源:log_list.php

示例10: _formatMap

 function _formatMap($pagetext)
 {
     $map = $this->_getMap($pagetext);
     if (!$map) {
         return HTML::p("<No interwiki map found>");
     }
     // Shouldn't happen.
     $mon_attr = array('class' => 'interwiki-moniker');
     $url_attr = array('class' => 'interwiki-url');
     $thead = HTML::thead(HTML::tr(HTML::th($mon_attr, _("Moniker")), HTML::th($url_attr, _("InterWiki Address"))));
     foreach ($map as $moniker => $interurl) {
         $rows[] = HTML::tr(HTML::td($mon_attr, new Cached_WikiLinkIfKnown($moniker)), HTML::td($url_attr, HTML::tt($interurl)));
     }
     return HTML::table(array('class' => 'interwiki-map'), $thead, HTML::tbody(false, $rows));
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:15,代码来源:PageType.php

示例11: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $attributes = $attrib ? explode(",", $attrib) : array();
     $photos = array();
     $html = HTML();
     $count = 0;
     // check all parameters
     // what type do we have?
     if (!$src) {
         $showdesc = 'none';
         $src = $request->getArg('pagename');
         $error = $this->fromLocation($src, $photos);
     } else {
         $error = $this->fromFile($src, $photos, $url);
     }
     if ($error) {
         return $this->error($error);
     }
     if ($numcols < 1) {
         $numcols = 1;
     }
     if ($align != 'left' && $align != 'center' && $align != 'right') {
         $align = 'center';
     }
     if (count($photos) == 0) {
         return;
     }
     if (in_array("sort", $attributes)) {
         sort($photos);
     }
     if ($p) {
         $mode = "normal";
     }
     if ($mode == "column") {
         $mode = "normal";
         $numcols = "1";
     }
     // set some fixed properties for each $mode
     if ($mode == 'thumbs' || $mode == 'tiles') {
         $attributes = array_merge($attributes, "alt");
         $attributes = array_merge($attributes, "nowrap");
         $cellwidth = 'auto';
         // else cell won't nowrap
         $width = 50;
     } elseif ($mode == 'list') {
         $numcols = 1;
         $cellwidth = "auto";
         $width = 50;
     } elseif ($mode == 'slide') {
         $tableheight = 0;
         $cell_width = 0;
         $numcols = count($photos);
         $keep = $photos;
         while (list($key, $value) = each($photos)) {
             list($x, $y, $s, $t) = @getimagesize($value['src']);
             if ($height != 'auto') {
                 $y = $this->newSize($y, $height);
             }
             if ($width != 'auto') {
                 $y = round($y * $this->newSize($x, $width) / $x);
             }
             if ($x > $cell_width) {
                 $cell_width = $x;
             }
             if ($y > $tableheight) {
                 $tableheight = $y;
             }
         }
         $tableheight += 50;
         $photos = $keep;
         unset($x, $y, $s, $t, $key, $value, $keep);
     }
     $row = HTML();
     $duration = 1000 * $duration;
     if ($mode == 'slide') {
         $row->pushContent(JavaScript("\ni = 0;\nfunction display_slides() {\n  j = i - 1;\n  cell0 = document.getElementsByName('wikislide' + j);\n  cell = document.getElementsByName('wikislide' + i);\n  if (cell0.item(0) != null)\n    cell0.item(0).style.display='none';\n  if (cell.item(0) != null)\n    cell.item(0).style.display='block';\n  i += 1;\n  if (cell.item(0) == null) i = 0;\n  setTimeout('display_slides()',{$duration});\n}\ndisplay_slides();"));
     }
     while (list($key, $value) = each($photos)) {
         if ($p && basename($value["name"]) != "{$p}") {
             continue;
         }
         if ($h && basename($value["name"]) == "{$h}") {
             $color = $hlcolor ? $hlcolor : $bgcolor;
         } else {
             $color = $bgcolor;
         }
         // $params will be used for each <img > tag
         $params = array('src' => $value["name"], 'src_tile' => $value["name_tile"], 'border' => "0", 'alt' => ($value["desc"] != "" and in_array("alt", $attributes)) ? $value["desc"] : basename($value["name"]));
         if (!@empty($value['location'])) {
             $params = array_merge($params, array("location" => $value['location']));
         }
         // check description
         switch ($showdesc) {
             case 'none':
                 $value["desc"] = '';
                 break;
             case 'name':
                 $value["desc"] = basename($value["name"]);
                 break;
//.........这里部分代码省略.........
开发者ID:neymanna,项目名称:fusionforge,代码行数:101,代码来源:PhotoAlbum.php

示例12: _

    echo Msg::info(_("No medical tests defined for this medical problem."));
    include_once "../layout/footer.php";
    exit;
}
echo HTML::section(2, _("Medical Tests List:"));
$thead = array(_("Function") => array('colspan' => $_SESSION['auth']['is_administrative'] ? 3 : 1), _("Document Type"), _("Path Filename"));
$tbody = array();
while ($test = $testQ->fetch()) {
    $temp = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
    $temp = substr($temp, 0, strrpos($temp, "/")) . "/tests/" . String::translateBrowser($test->getPathFilename(false));
    $row = HTML::link(HTML::image('../img/action_view.png', _("view")), $temp, null, array('class' => 'popup'));
    $row .= OPEN_SEPARATOR;
    if ($_SESSION['auth']['is_administrative']) {
        $row .= HTML::link(HTML::image('../img/action_edit.png', _("edit")), '../medical/test_edit_form.php', array('id_problem' => $idProblem, 'id_patient' => $idPatient, 'id_test' => $test->getIdTest()));
        $row .= OPEN_SEPARATOR;
        $row .= HTML::link(HTML::image('../img/action_delete.png', _("delete")), '../medical/test_del_confirm.php', array('id_problem' => $idProblem, 'id_patient' => $idPatient, 'id_test' => $test->getIdTest()));
        $row .= OPEN_SEPARATOR;
    }
    // end if
    $row .= $test->getDocumentType();
    $row .= OPEN_SEPARATOR;
    $row .= $test->getPathFilename();
    $tbody[] = explode(OPEN_SEPARATOR, $row);
}
// end while
$testQ->freeResult();
$testQ->close();
unset($testQ);
unset($test);
echo HTML::table($thead, $tbody);
require_once "../layout/footer.php";
开发者ID:edubort,项目名称:openclinic-1,代码行数:31,代码来源:test_list.php

示例13: _fixupData

 /**
  * Really should have a _fixupPagedata and _fixupVersiondata, but this works.
  * also used in plugin/EditMetaData
  */
 function _fixupData(&$data, $prefix = '')
 {
     if (!is_array($data)) {
         return;
     }
     global $request;
     $user = $request->getUser();
     foreach ($data as $key => $val) {
         $fullkey = $prefix . '[' . $key . ']';
         if (is_integer($key)) {
         } elseif ($key == 'passwd' and !$user->isAdmin()) {
             $data[$key] = $val ? _("<not displayed>") : _("<empty>");
         } elseif ($key and $key == '_cached_html') {
             $val = TransformedText::unpack($val);
             ob_start();
             print_r($val);
             $data[$key] = HTML::pre(ob_get_contents());
             ob_end_clean();
         } elseif (is_bool($val)) {
             $data[$key] = $this->_showvalue($key, $val ? "true" : "false", $prefix);
         } elseif (is_string($val) && (substr($val, 0, 2) == 'a:' or substr($val, 0, 2) == 'O:')) {
             // how to indent this table?
             $val = unserialize($val);
             $this->_fixupData($val, $fullkey);
             $data[$key] = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0), $this->_showhash(false, $val, $fullkey));
         } elseif (is_array($val)) {
             // how to indent this table?
             $this->_fixupData($val, $fullkey);
             $data[$key] = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0), $this->_showhash(false, $val, $fullkey));
         } elseif (is_object($val)) {
             // how to indent this table?
             ob_start();
             print_r($val);
             $val = HTML::pre(ob_get_contents());
             ob_end_clean();
             $data[$key] = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0), $this->_showhash(false, $val, $fullkey));
         } elseif ($key and $key == '%content') {
             if ($val === true) {
                 $val = '<true>';
             } elseif (strlen($val) > 40) {
                 $val = substr($val, 0, 40) . " ...";
             }
             $data[$key] = $val;
         }
     }
     unset($data['%pagedata']);
     // problem in backend
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:52,代码来源:_BackendInfo.php

示例14: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     // When 'phpweather/phpweather.php' is not installed then
     // PHPWEATHER_BASE_DIR will be undefined.
     if (!defined('PHPWEATHER_BASE_DIR')) {
         return $this->error(_("You have to define PHPWEATHER_BASE_DIR before use. (config/config.ini)"));
     }
     //early return
     require_once PHPWEATHER_BASE_DIR . '/output/pw_images.php';
     require_once PHPWEATHER_BASE_DIR . '/pw_utilities.php';
     extract($this->getArgs($argstr, $request));
     $html = HTML();
     $w = new phpweather();
     // Our weather object
     if (!empty($icao)) {
         /* We assign the ICAO to the weather object: */
         $w->set_icao($icao);
         if (!$w->get_country_code()) {
             /* The country code couldn't be resolved, so we
              * shouldn't use the ICAO: */
             trigger_error(sprintf(_("The ICAO '%s' wasn't recognized."), $icao), E_USER_NOTICE);
             $icao = '';
         }
     }
     if (!empty($icao)) {
         /* We check and correct the language if necessary: */
         //if (!in_array($language, array_keys($w->get_languages('text')))) {
         if (!in_array($language, array_keys(get_languages('text')))) {
             trigger_error(sprintf(_("%s does not know about the language '%s', using 'en' instead."), $this->getName(), $language), E_USER_NOTICE);
             $language = 'en';
         }
         $class = "pw_text_{$language}";
         require_once PHPWEATHER_BASE_DIR . "/output/{$class}.php";
         $t = new $class($w);
         $t->set_pref_units($units);
         $i = new pw_images($w);
         $i_temp = HTML::img(array('src' => $i->get_temp_image()));
         $i_wind = HTML::img(array('src' => $i->get_winddir_image()));
         $i_sky = HTML::img(array('src' => $i->get_sky_image()));
         $m = $t->print_pretty();
         $m_td = HTML::td(HTML::p(new RawXml($m)));
         $i_tr = HTML::tr();
         $i_tr->pushContent(HTML::td($i_temp));
         $i_tr->pushContent(HTML::td($i_wind));
         $i_table = HTML::table($i_tr);
         $i_table->pushContent(HTML::tr(HTML::td(array('colspan' => '2'), $i_sky)));
         $tr = HTML::tr();
         $tr->pushContent($m_td);
         $tr->pushContent(HTML::td($i_table));
         $html->pushContent(HTML::table($tr));
     }
     /* We make a menu if asked to, or if $icao is empty: */
     if ($menu || empty($icao)) {
         $form_arg = array('action' => $request->getURLtoSelf(), 'method' => 'get');
         /* The country box is always part of the menu: */
         $p1 = HTML::p(new RawXml(get_countries_select($w, $cc)));
         /* We want to save the language: */
         $p1->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'language', 'value' => $language)));
         /* And also the ICAO: */
         $p1->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'icao', 'value' => $icao)));
         $caption = empty($cc) ? _("Submit country") : _("Change country");
         $p1->pushContent(HTML::input(array('type' => 'submit', 'value' => $caption)));
         $html->pushContent(HTML::form($form_arg, $p1));
         if (!empty($cc)) {
             /* We have selected a country, now display a list with
              * the available stations in that country: */
             $p2 = HTML::p();
             /* We need the country code after the form is submitted: */
             $p2->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'cc', 'value' => $cc)));
             $p2->pushContent(new RawXml(get_stations_select($w, $cc, $icao)));
             $p2->pushContent(new RawXml(get_languages_select($language)));
             $p2->pushContent(HTML::input(array('type' => 'submit', 'value' => _("Submit location"))));
             $html->pushContent(HTML::form($form_arg, $p2));
         }
     }
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:77,代码来源:PhpWeather.php

示例15: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($since) {
         $since = strtotime($since);
     }
     if ($month) {
         $since = strtotime($month);
         $since = mktime(0, 0, 0, date("m", $since), 1, date("Y", $since));
         $until = mktime(23, 59, 59, date("m", $since) + 1, 0, date("Y", $since));
     } else {
         $until = 0;
     }
     $iter = $dbi->getAllPages(false, '-mtime');
     $pages = array();
     while ($page = $iter->next()) {
         $pagename = $page->getName();
         if (!$page->exists()) {
             continue;
         }
         $rev = $page->getRevision(1, false);
         $date = $rev->get('mtime');
         //$author = $rev->get('author_id');
         $author = $page->getOwner();
         if (defined('DEBUG') && DEBUG && $debug) {
             echo "<i>{$pagename}, ", strftime("%Y-%m-%d %h:%m:%s", $date), ", {$author}</i><br />\n";
         }
         if ($userid and !preg_match("/" . $userid . "/", $author)) {
             continue;
         }
         if ($since and $date < $since) {
             continue;
         }
         if ($until and $date > $until) {
             continue;
         }
         if (!$comments and preg_match("/\\/Comment/", $pagename)) {
             continue;
         }
         $monthnum = strftime("%Y%m", $date);
         if (!isset($pages[$monthnum])) {
             $pages[$monthnum] = array('author' => array(), 'month' => strftime("%B, %Y", $date));
         }
         if (!isset($pages[$monthnum]['author'][$author])) {
             $pages[$monthnum]['author'][$author] = array('count' => 0, 'pages' => array());
         }
         $pages[$monthnum]['author'][$author]['count']++;
         $pages[$monthnum]['author'][$author]['pages'][] = $pagename;
     }
     $iter->free();
     $html = HTML::table(HTML::col(array('span' => 2, 'align' => 'left')));
     $nbsp = HTML::raw('&nbsp;');
     krsort($pages);
     foreach ($pages as $monthname => $parr) {
         $html->pushContent(HTML::tr(HTML::td(array('colspan' => 2), HTML::strong($parr['month']))));
         uasort($parr['author'], 'cmp_by_count');
         foreach ($parr['author'] as $user => $authorarr) {
             $count = $authorarr['count'];
             $id = preg_replace("/ /", "_", 'pages-' . $monthname . '-' . $user);
             $html->pushContent(HTML::tr(HTML::td($nbsp, $nbsp, HTML::img(array('id' => "{$id}-img", 'src' => $WikiTheme->_findData("images/folderArrowClosed.png"), 'onclick' => "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show"))), $nbsp, $user), HTML::td($count)));
             if ($links) {
                 $pagelist = HTML();
                 foreach ($authorarr['pages'] as $p) {
                     $pagelist->pushContent(WikiLink($p), ', ');
                 }
             } else {
                 $pagelist = join(', ', $authorarr['pages']);
             }
             $html->pushContent(HTML::tr(array('id' => $id . '-body', 'style' => 'display:none; background-color: #eee;'), HTML::td(array('colspan' => 2, 'style' => 'font-size:smaller'), $pagelist)));
         }
     }
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:75,代码来源:NewPagesPerUser.php


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