コード例 #1
0
ファイル: list_categories.php プロジェクト: papersdb/papersdb
 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);
     }
 }
コード例 #2
0
ファイル: delete_author.php プロジェクト: papersdb/papersdb
 public function __construct()
 {
     parent::__construct('delete_author', 'Delete Author', 'Admin/delete_author.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->author_id) || !is_numeric($this->author_id)) {
         $this->pageError = true;
         return;
     }
     $author = new pdAuthor();
     $result = $author->dbLoad($this->db, $this->author_id);
     if (!$result) {
         $this->pageError = true;
         return;
     }
     $pub_list = pdPubList::create($this->db, array('author_id' => $this->author_id));
     if (isset($pub_list) && count($pub_list) > 0) {
         echo 'Cannot delete Author <b>', $author->name, '</b>.<p/>', 'The author has the following publications in the database:', displayPubList($this->db, $pub_list, true, -1, null, null, '../');
         return;
     }
     $form =& $this->confirmForm('deleter');
     $form->addElement('hidden', 'author_id', $this->author_id);
     if ($form->validate()) {
         $values = $form->exportValues();
         // This is where the actual deletion happens.
         $name = $author->name;
         $author->dbDelete($this->db);
         echo 'You have successfully removed the following author from the database:', '<p/><b>', $name, '</b>';
     } else {
         if (!isset($this->author_id) || !is_numeric($this->author_id)) {
             $this->pageError = true;
             return;
         }
         $renderer = new HTML_QuickForm_Renderer_QuickHtml();
         $form->accept($renderer);
         $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
         $table->addRow(array('Name:', $author->name));
         if (isset($author->title) && trim($author->title != '')) {
             $table->addRow(array('Title:', $author->title));
         }
         $table->addRow(array('Email:', $author->email));
         $table->addRow(array('Organization:', $author->organization));
         $cell = '';
         if (isset($author->webpage) && trim($author->webpage != '')) {
             $cell = '<a href="' . $author->webpage . '">' . $author->webpage . '</a>';
         } else {
             $cell = "none";
         }
         $table->addRow(array('Web page:', $cell));
         $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
         echo '<h3>Delete Author</h3><p/>Delete the following author?';
         $this->form =& $form;
         $this->renderer =& $renderer;
         $this->table =& $table;
     }
 }
コード例 #3
0
ファイル: bibtex.php プロジェクト: papersdb/papersdb
 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();
 }
コード例 #4
0
ファイル: list_author.php プロジェクト: papersdb/papersdb
 public function __construct()
 {
     parent::__construct('all_authors');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars(true, false);
     if (!isset($this->tab)) {
         $this->tab = 'A';
     } else {
         $tab = strtoupper($this->tab);
         if (strlen($tab) != 1 || ord($tab) < ord('A') || ord($tab) > ord('Z')) {
             $this->pageError = true;
             return;
         }
     }
     $auth_list = pdAuthorList::create($this->db, null, $this->tab);
     echo $this->alphaSelMenu($this->tab, get_class($this) . '.php');
     echo "<h2>Authors</h2>";
     if (empty($auth_list) || count($auth_list) == 0) {
         echo 'No authors with last name starting with ', $this->tab, '<br/>';
         return;
     }
     foreach ($auth_list as $author_id => $name) {
         $author = new pdAuthor();
         $author->dbLoad($this->db, $author_id, pdAuthor::DB_LOAD_BASIC | pdAuthor::DB_LOAD_PUBS_MIN);
         $name = '<span class="emph"><a href="view_author.php?author_id=' . $author_id . '">' . $name . '</a>&nbsp;';
         $icons = $this->getAuthorIcons($author) . '</span>';
         $info = array();
         if ($author->title != '') {
             $info[] = '<span class="small">' . $author->title . '</span>';
         }
         if ($author->organization != '') {
             $info[] = '<span class="small">' . $author->organization . '</span>';
         }
         $info[] .= '<a href="list_publication.php?author_id=' . $author_id . '&menu=0"><span class="small" style="color:#000;font-weight:normal;">' . 'Publication entries in database: ' . $author->totalPublications . '</span>';
         $table = new HTML_Table(array('class' => 'publist'));
         $table->addRow(array($name . '<br/>' . implode('<br/>', $info), $icons));
         $table->updateColAttributes(1, array('class' => 'icons'), NULL);
         echo $table->toHtml();
         unset($table);
     }
 }
コード例 #5
0
ファイル: checkouts.php プロジェクト: tseel/phplicensewatcher
if ($_GET['sortby'] == "date") {
    $sql = "SELECT `flmevent_date`,`flmevent_user`,MAX(`flmevent_feature`),count(*) FROM `flexlm_events` WHERE `flmevent_type`='OUT' GROUP BY `flmevent_date`,`flmevent_user` ORDER BY `flmevent_date`,`flmevent_user`,`flmevent_feature` DESC;";
} else {
    if ($_GET['sortby'] == "user") {
        $sql = "SELECT `flmevent_date`,`flmevent_user`,MAX(`flmevent_feature`),count(*) FROM `flexlm_events` WHERE `flmevent_type`='OUT' GROUP BY `flmevent_user`,`flmevent_date` ORDER BY `flmevent_user`,`flmevent_date`,`flmevent_feature` DESC;";
    } else {
        $sql = "SELECT `flmevent_date`,MAX(flmevent_user),`flmevent_feature`,count(*) FROM `flexlm_events` WHERE `flmevent_type`='OUT' GROUP BY `flmevent_feature`,`flmevent_date` ORDER BY `flmevent_feature`,`flmevent_date`,`flmevent_user` DESC;";
    }
}
if (isset($debug) && $debug == 1) {
    print_sql($sql);
}
$recordset = $db->query($sql);
if (DB::isError($recordset)) {
    die($recordset->getMessage());
}
while ($row = $recordset->fetchRow()) {
    $table->AddRow($row, "style=\"background: " . $features_color[$row[2]] . ";\"");
}
$table->updateColAttributes(3, "align=\"center\"");
$recordset->free();
$db->disconnect();
################################################################
# Right align the 3 column
################################################################
$table->updateColAttributes(2, "align=\"right\"");
$table->display();
include './version.php';
?>
</body></html>
コード例 #6
0
 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();
 }
コード例 #7
0
ファイル: search_results.php プロジェクト: papersdb/papersdb
 public function showSearchParams()
 {
     $sp =& $_SESSION['search_params'];
     $table = new HTML_Table(array('class' => 'nomargins', 'width' => '90%'));
     if ($sp->search != '') {
         $table->addRow(array($sp->search));
     } else {
         // check each field of the search parameter except the dates and
         // authors
         foreach (array_diff(array_keys(get_class_vars(get_class($sp))), array('startdate', 'enddate', 'author_myself', 'authors', 'paper_rank', 'paper_rank_other', 'paper_col')) as $param) {
             if ($sp->{$param} != '') {
                 $name = '';
                 if ($param == 'cat_id') {
                     $cl = pdCatList::create($this->db);
                     $name = 'Category';
                     $value =& $cl[$sp->cat_id];
                 } else {
                     $name = preg_replace('/_/', ' ', ucwords($param));
                     $value = $sp->{$param};
                 }
                 if ($param == 'show_internal_info' && $sp->{$param} == 'no') {
                     continue;
                 }
                 if ($name != '') {
                     $table->addRow(array($name . ':', $value));
                 }
             }
         }
         $al = null;
         $values = array();
         if (!empty($_SESSION['user']) && $sp->author_myself != '' && $_SESSION['user']->author_id != '') {
             $authors = pdAuthorList::create($this->db, null, null, true);
             $values[] = $authors[$_SESSION['user']->author_id];
         }
         if (!empty($sp->authors)) {
             $values[] = $sp->authors;
         }
         if (count($values) > 0) {
             $table->addRow(array('<b>Author(s)</b>:', implode(' AND ', $values)));
         }
         if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) {
             if (!empty($sp->paper_rank)) {
                 // ranking
                 $label = 'Ranking:';
                 $rankings = pdPublication::rankingsGlobalGet($this->db);
                 foreach ($sp->paper_rank as $rank_id => $value) {
                     if ($value != 'yes') {
                         continue;
                     }
                     $table->addRow(array($label, $rankings[$rank_id]));
                     $label = '';
                 }
                 if ($sp->paper_rank_other != '') {
                     $table->addRow(array($label, $sp->paper_rank_other));
                 }
             }
             if (!empty($sp->paper_col)) {
                 // collaboration
                 $label = 'Collaboration:';
                 $collaborations = pdPublication::collaborationsGet($this->db);
                 foreach ($sp->paper_col as $col_id => $value) {
                     if ($value != 'yes') {
                         continue;
                     }
                     $table->addRow(array($label, $collaborations[$col_id]));
                     $label = '';
                 }
             }
         }
         if ($sp->startdate != '' && $sp->enddate != '') {
             $stime = strtotime(implode('-', $sp->startdate) . '-1');
             $etime = strtotime(implode('-', $sp->enddate) . '-1');
             // now check the dates
             if ($etime > $stime) {
                 $table->addRow(array('<b>Start date</b>:', $sp->startdate['Y'] . '-' . sprintf("%02d", $sp->startdate['M'])));
                 $table->addRow(array('<b>End date</b>:', $sp->enddate['Y'] . '-' . sprintf("%02d", $sp->enddate['M'])));
             }
         }
     }
     $table->updateColAttributes(0, array('class' => 'emph'), true);
     echo '<h3>SEARCH RESULTS FOR</h3>';
     echo $table->toHtml();
 }
コード例 #8
0
ファイル: edit_user.php プロジェクト: papersdb/papersdb
 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:'******'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;
 }
コード例 #9
0
ファイル: details.php プロジェクト: tseel/phplicensewatcher
            #######################################################################
            if ($feature_array[$p]["days_to_expiration"] <= $lead_time) {
                if ($feature_array[$p]["days_to_expiration"] >= 0) {
                    $feature_table->updateRowAttributes($feature_table->getRowCount() - 1, "class=\"expires_soon\"");
                } elseif ($feature_array[$p]["days_to_expiration"] < 0) {
                    $feature_table->updateRowAttributes($feature_table->getRowCount() - 1, "class=\"already_expired\"");
                }
            }
        }
        $table->addRow(array($key, $feature_array[0]["vendor_daemon"], $total_licenses, $feature_table->toHTML()));
        unset($feature_table);
    }
    ########################################################
    # Center columns 2. Columns start with 0 index
    ########################################################
    $table->updateColAttributes(1, "align=\"center\"");
    $table->display();
} else {
    ########################################################
    # Licenses currently being used
    ########################################################
    echo "<p>Following is the list of licenses currently being used. Licenses that are currently not in use are not shown.</p>\n";
    # stop the annoying errors in error_log saying undefined var
    # happens when no user lics been checked out
    if (isset($host['cacti'])) {
        $cactiurl = $cactiurl . $host['cacti'];
        $cactigraph = $cactigraph . $host['cacti'];
        printf("<div align=\"center\"><a href=\"%s\" border=0><img src=\"%s\"></a></div>\n", $cactiurl, $cactigraph);
    }
    $master_array = getDetails($host);
    $users = $master_array['users'];
コード例 #10
0
ファイル: Table_example1.php プロジェクト: Artea/freebeer
$data[0][] = 'i am';
$data[0][] = 'i think';
$data[0][] = 'therefore';
$data[0][] = 'therefore';
$data[1][] = 'i think';
$data[1][] = 'i am';
$data[1][] = 'therefore';
$data[1][] = 'therefore';
$data[2][] = 'i am';
$data[2][] = 'therefore';
$data[2][] = 'i think';
$data[2][] = 'i think';
foreach ($data as $key => $value) {
    $table->addRow($data[$key], array(array('bgcolor' => 'blue', 'align' => 'center'), array('bgcolor' => 'green'), array('bgcolor' => 'red')));
}
foreach ($data as $key => $value) {
    $table->addRow($data[$key], array('bgcolor=blue', 'bgcolor=green', 'bgcolor=red'));
}
foreach ($data as $key => $value) {
    $table->addRow($data[$key], 'bgcolor=yellow align=right', 'TD', true);
}
foreach ($data as $key => $value) {
    $table->addRow($data[$key], array('bgcolor' => 'pink', 'align' => 'center'));
}
$table->setColAttributes(1, 'bgcolor=purple');
$table->updateColAttributes(2, array('bgcolor=blue', 'bgcolor=green', 'bgcolor=red'));
echo '<pre>';
var_dump($table->getCellAttributes(2, 2));
var_dump($table->getRowAttributes(8));
echo '</pre>';
echo $table->toHTML();
コード例 #11
0
/** 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'];
            $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();
    }
    $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR);
    return $res;
}
コード例 #12
0
ファイル: Table_example1.php プロジェクト: pear/html_table
$data[0][] = 'i am';
$data[0][] = 'i think';
$data[0][] = 'therefore';
$data[0][] = 'therefore';
$data[1][] = 'i think';
$data[1][] = 'i am';
$data[1][] = 'therefore';
$data[1][] = 'therefore';
$data[2][] = 'i am';
$data[2][] = 'therefore';
$data[2][] = 'i think';
$data[2][] = 'i think';
foreach ($data as $key => $value) {
    $table->addRow($data[$key], array(array('bgcolor' => 'blue', 'align' => 'center'), array('bgcolor' => 'green'), array('bgcolor' => 'red')));
}
foreach ($data as $key => $value) {
    $table->addRow($data[$key], array('bgcolor = "blue"', 'bgcolor = "green"', 'bgcolor = "red"'));
}
foreach ($data as $key => $value) {
    $table->addRow($data[$key], 'bgcolor = "yellow" align = "right"', 'TD', true);
}
foreach ($data as $key => $value) {
    $table->addRow($data[$key], array('bgcolor' => 'pink', 'align' => 'center'));
}
$table->setColAttributes(1, 'bgcolor = "purple"');
$table->updateColAttributes(2, array('bgcolor = "blue"', 'bgcolor = "green"', 'bgcolor = "red"'));
echo '<pre>';
var_dump($table->getCellAttributes(2, 2));
var_dump($table->getRowAttributes(8));
echo '</pre>';
echo $table->toHTML();
コード例 #13
0
ファイル: list_venues.php プロジェクト: papersdb/papersdb
 public function __construct()
 {
     parent::__construct('list_venues');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars(true, false);
     if (!isset($this->tab)) {
         $this->tab = 'A';
     } else {
         if (strlen($this->tab) != 1 || ord($this->tab) < ord('A') || ord($this->tab) > ord('Z')) {
             $this->pageError = true;
             return;
         }
     }
     $venue_list = pdVenueList::create($this->db, array('starting_with' => $this->tab, 'cat_id' => $this->cat_id));
     $this->category = new pdCategory();
     $this->category->dbLoad($this->db, $this->cat_id);
     $form = new HTML_QuickForm('cat_selection', 'get', 'list_venues.php');
     $form->addElement('hidden', 'tab', $this->tab);
     $form->addElement('select', 'cat_id', 'Category:', array('' => '-- All Categories --') + pdCatList::create($this->db), array('onchange' => 'update();'));
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $form->setDefaults(array('cat_id' => ''));
     $alpha_menu = $this->alphaSelMenu($this->tab, get_class($this) . '.php');
     // put category id in the alpha menu
     if (!empty($this->cat_id)) {
         $alpha_menu = preg_replace('/tab=(\\w)/', "tab=\\1&cat_id={$this->cat_id}", $alpha_menu);
     }
     $this->javascript();
     echo $alpha_menu;
     echo '<h2>Publication Venues</h2>';
     echo $renderer->toHtml();
     if (empty($venue_list) || count($venue_list) == 0) {
         echo 'No venues with name starting with ', $this->tab, '<br/>';
         return;
     }
     foreach ($venue_list as $venue) {
         // only show global venues
         if ($venue->v_usage == 'single') {
             continue;
         }
         $venue->dbLoad($this->db, $venue->venue_id);
         $table = new HTML_Table(array('class' => 'publist'));
         $cells = array();
         $text = '';
         if ($venue->title != '') {
             $text .= '<b>' . $venue->title . '</b><br/>';
         }
         $v_cat = $venue->categoryGet();
         if (!empty($v_cat)) {
             $text .= '<b>' . ucfirst($v_cat) . '</b>:&nbsp;';
         }
         $url = $venue->urlGet();
         if ($url != null) {
             $text .= '<a href="' . $url . '" target="_blank">';
         }
         $text .= $venue->nameGet();
         if ($url != null) {
             $text .= '</a>';
         }
         if (!empty($venue->options)) {
             $vopt_names = $venue->voptsGet();
             foreach ($venue->options as $vopt_id => $value) {
                 if (!empty($value)) {
                     $text .= '<br/><b>' . $vopt_names[$vopt_id] . '</b>:&nbsp;' . $value;
                 }
             }
         }
         if ($venue->editor != '') {
             $text .= "<br/><b>Editor:&nbsp;</b>" . $venue->editor;
         }
         if (isset($venue->ranking)) {
             $text .= '<br/><b>Ranking</b>: ' . $venue->ranking;
         }
         // display occurrences
         if (count($venue->occurrences) > 0) {
             foreach ($venue->occurrences as $occ) {
                 $text .= '<br/>';
                 $date = explode('-', $occ->date);
                 if ($occ->url != '') {
                     $text .= '<a href="' . $occ->url . '" target="_blank">';
                 }
                 $text .= $date[0];
                 if ($occ->url != '') {
                     $text .= '</a>';
                 }
                 if ($occ->location != '') {
                     $text .= ', ' . $occ->location;
                 }
             }
         } else {
             if ($venue->date != '' && $venue->date != '0000-00-00') {
                 $date = explode('-', $venue->date);
                 $text .= "<br/><b>Date:&nbsp;</b>" . $date[0] . '-' . $date[1];
             }
         }
         $pub_count = pdPubList::create($this->db, array('venue_id_count' => $venue->venue_id));
         $text .= '<a href="list_publication.php?venue_id=' . $venue->venue_id . '&menu=0"><span class="small" style="color:#000;font-weight:normal;">' . '<br/>Publication entries: ' . $pub_count . '</span></a>';
         $cells[] = $text;
         if ($this->access_level > 0) {
             $cells[] = $this->getVenueIcons($venue);
         }
         $table->addRow($cells);
         $table->updateColAttributes(1, array('class' => 'icons'), NULL);
         echo $table->toHtml();
         unset($table);
     }
 }
コード例 #14
0
 private function showPublication(&$pub)
 {
     $content = "<h2>" . $pub->title;
     if ($this->access_level > 0) {
         $content .= getPubIcons($this->db, $pub, 0xc);
     }
     $content .= "</h2>\n" . $pub->authorsToHtml();
     if (isset($pub->paper) && strtolower($pub->paper) != 'no paper' && basename($pub->paper) != 'paper_') {
         if ($pub->paperExists()) {
             $content .= 'Full Text: <a href="' . $pub->paperAttGetUrl() . '">';
             $name = split('paper_', $pub->paper);
             if ($name[1] != '') {
                 $content .= $name[1];
             }
             $content .= '</a>&nbsp;';
             $content .= getPubIcons($this->db, $pub, 0x1) . "<br/>\n";
         }
     }
     // Show Additional Materials
     $att_types = pdAttachmentTypesList::create($this->db);
     if (count($pub->additional_info) > 0) {
         $table = new HTML_Table(array('width' => '350', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
         $heading = 'Other Attachments:';
         $add_count = 1;
         foreach ($pub->additional_info as $att) {
             $cell = '';
             if ($pub->attExists($att)) {
                 $name = split('additional_', $att->location);
                 $cell .= '<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">';
                 if ($name[1] != '') {
                     $cell .= $name[1];
                 }
                 $cell .= '</a>';
                 if (in_array($att->type, $att_types)) {
                     $cell .= '&nbsp;[' . $att->type . ']';
                 }
                 $cell .= '&nbsp;<a href="' . $pub->attachmentGetUrl($add_count - 1) . '">' . $this->getPubAddAttIcons($att) . '</a>';
                 $add_count++;
             }
             $table->addRow(array($heading, $cell));
             $heading = '';
         }
         $content .= $table->toHtml();
     }
     $content .= '<p/>' . stripslashes($pub->abstract) . '<p/>' . '<h3>Citation</h3>' . $pub->getCitationHtml() . '<p/>';
     $table = new HTML_Table(array('width' => '600', 'border' => '0', 'cellpadding' => '6', 'cellspacing' => '0'));
     $category = '';
     if (isset($pub->category) && isset($pub->category->category)) {
         $category = $pub->category->category;
     }
     $table->addRow(array('Keywords:', $pub->keywordsGet()));
     $table->addRow(array('Category:', $category));
     if (isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) {
         $table->addRow(array('Ranking:', $pub->ranking));
         if (is_array($pub->collaborations) && count($pub->collaborations) > 0) {
             $col_desciptions = $pub->collaborationsGet($this->db);
             foreach ($pub->collaborations as $col_id) {
                 $values[] = $col_desciptions[$col_id];
             }
             $table->addRow(array('Collaboration:', implode(', ', $values)));
         }
         $table->addRow(array('Extra Info:', $pub->extraInfoGet()));
     }
     if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) {
         $table->addRow(array('User Info:', $pub->user));
     }
     $web_links = $pub->getWebLinks();
     if (count($web_links) > 0) {
         $c = 0;
         foreach ($web_links as $name => $url) {
             if ($c == 0) {
                 $label = 'Web Links:';
             } else {
                 $label = '';
             }
             $table->addRow(array($label, '<a href="' . $url . '" ' . 'target="_blank">' . $name . '</a>'));
             $c++;
         }
     }
     if (count($pub->relatedPubsGet()) > 0) {
         $c = 0;
         foreach ($pub->relatedPubsGet() as $related_pub_id) {
             if ($c == 0) {
                 $label = 'Related Publication(s):';
             } else {
                 $label = '';
             }
             $rel_pub = new pdPublication();
             $rel_pub->dbLoad($this->db, $related_pub_id);
             $table->addRow(array($label, '<a href="view_publication.php?' . 'pub_id=' . $rel_pub->pub_id . '" ' . ' target="_blank">' . $rel_pub->title . '</a>'));
             $c++;
         }
     }
     $table->updateColAttributes(0, array('class' => 'emph', 'width' => '25%'));
     $content .= $table->toHtml();
     $bibtex = $pub->getBibtex();
     if ($bibtex !== false) {
         $content .= '<h3>BibTeX</h3><pre class="bibtex">' . $bibtex . '</pre><p/>';
     }
     $updateStr = $this->lastUpdateGet($pub);
     if ($updateStr != '') {
         $updateStr = 'Last Updated: ' . $updateStr . '<br/>';
     }
     $updateStr .= 'Submitted by ' . $pub->submit;
     echo $content, '<span class="small">', $updateStr, '</span>';
 }
コード例 #15
0
    foreach ($expiration_array as $key => $myarray) {
        for ($j = 0; $j < sizeof($myarray); $j++) {
            if (strcmp($myarray[$j]["days_to_expiration"], "permanent") != 0 && $myarray[$j]["days_to_expiration"] <= $lead_time) {
                if ($myarray[$j]["days_to_expiration"] < 0) {
                    $myarray[$j]["days_to_expiration"] = "<b>Already expired</b>";
                }
                $table->addRow(array($host["hostname"], $host["desc"], $key, $myarray[$j]["version"], $myarray[$j]["expiration_date"], $myarray[$j]["days_to_expiration"], $myarray[$j]["num_licenses"]), "bgcolor='" . $color[$i] . "'");
            }
        }
    }
    //}
}
########################################################
# Center columns 2,4,5and 6. Columns start with 0 index
########################################################
$table->updateColAttributes(1, "align=center");
$table->updateColAttributes(4, "align=center");
$table->updateColAttributes(5, "align=center");
$table->updateColAttributes(3, "align=center");
########################################################
# Dump the table HTML into a variable
########################################################
$table_html = $table->toHTML();
#echo($table_html);
$message = "<HTML>\n<BODY>\nThese licenses will expire within " . $lead_time . " days. Licenses \nwill expire at 23:59 on the day of expiration.<p>";
$message .= $table_html;
########################################################################
# If the table has more than one row (header row will be one) there
# are expiring licenses
########################################################################(
if ($table->getRowCount() > 1) {
コード例 #16
0
ファイル: view_author.php プロジェクト: papersdb/papersdb
 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;
 }
コード例 #17
0
ファイル: denials.php プロジェクト: tseel/phplicensewatcher
################################################################
if ($_GET['sortby'] == "feature") {
    $sql = "SELECT `flmevent_date`,`flmevent_feature`,count(*) FROM `flexlm_events` WHERE `flmevent_type`='DENIED' GROUP BY `flmevent_feature`,`flmevent_date` ORDER BY `flmevent_feature`,`flmevent_date` DESC;";
} else {
    if ($_GET['sortby'] == "numdenials") {
        $sql = "SELECT `flmevent_date`,`flmevent_feature`,count(*) AS `numdenials` FROM `flexlm_events` WHERE `flmevent_type`='DENIED'  GROUP BY `flmevent_date`,`flmevent_feature` ORDER BY `numdenials` DESC;";
    } else {
        $sql = "SELECT `flmevent_date`,`flmevent_feature`,count(*) FROM `flexlm_events` WHERE `flmevent_type`='DENIED' GROUP BY `flmevent_date`,`flmevent_feature` ORDER BY `flmevent_date` DESC,`flmevent_feature`;";
    }
}
if (isset($debug) && $debug == 1) {
    print_sql($sql);
}
$recordset = $db->query($sql);
if (DB::isError($recordset)) {
    die($recordset->getMessage());
}
while ($row = $recordset->fetchRow()) {
    $table->AddRow($row, "style=\"background: " . $features_color[$row[1]] . ";\"");
}
$recordset->free();
$db->disconnect();
################################################################
# Right align the 3 column
################################################################
$table->updateColAttributes(2, "align=\"right\"");
$table->display();
include './version.php';
?>
</body></html>
コード例 #18
0
 public function pubSelect($viewCat = null)
 {
     assert('is_object($this->db)');
     echo $this->pubSelMenu($viewCat), '<br/>';
     $text = '';
     switch ($viewCat) {
         case "year":
             $pub_years = pdPubList::create($this->db, array('year_list' => true));
             echo '<h2>Publications by Year:</h2>';
             if (count($pub_years) > 0) {
                 $table = new HTML_Table(array('class' => 'nomargins', 'width' => '100%'));
                 $table->addRow(array('Year', 'Num. Publications'), array('class' => 'emph'));
                 foreach (array_values($pub_years) as $item) {
                     $cells = array();
                     $cells[] = '<a href="list_publication.php?year=' . $item['year'] . '">' . $item['year'] . '</a>';
                     $cells[] = $item['count'];
                     $table->addRow($cells);
                 }
                 echo $table->toHtml();
             } else {
                 echo 'No publication entries.';
             }
             break;
         case 'author':
             echo '<h2>Publications by Author:</h2>';
             $al = pdAuthorList::create($this->db);
             for ($c = 65; $c <= 90; ++$c) {
                 $table = new HTML_Table(array('class' => 'publist'));
                 $text = '';
                 foreach ($al as $auth_id => $name) {
                     if (substr($name, 0, 1) == chr($c)) {
                         $text .= '<a href="list_publication.php?author_id=' . $auth_id . '">' . $name . '</a>&nbsp;&nbsp; ';
                     }
                 }
                 $table->addRow(array(chr($c), $text));
                 $table->updateColAttributes(0, array('class' => 'item'), NULL);
                 echo $table->toHtml();
             }
             break;
         case 'venue':
             // publications by keyword
             unset($table);
             $vl = pdVenueList::create($this->db);
             echo '<h2>Publications by Venue:</h2>';
             for ($c = 65; $c <= 90; ++$c) {
                 $table = new HTML_Table(array('class' => 'publist'));
                 $text = '';
                 foreach ($vl as $vid => $v) {
                     if (substr($v, 0, 1) == chr($c)) {
                         $text .= '<a href="list_publication.php?venue_id=' . $vid . '">' . $v . '</a>&nbsp;&nbsp; ';
                     }
                 }
                 $table->addRow(array(chr($c), $text));
                 $table->updateColAttributes(0, array('class' => 'item'), NULL);
                 echo $table->toHtml();
             }
             break;
         case 'category':
             $table = new HTML_Table(array('class' => 'nomargins', 'width' => '100%'));
             $cl = pdCatList::create($this->db);
             $table->addRow(array('Category', 'Num. Publications'), array('class' => 'emph'));
             foreach ($cl as $cat_id => $category) {
                 $cells = array();
                 $cells[] = '<a href="list_publication.php?cat_id=' . $cat_id . '">' . $category . '</a><br/>';
                 $cells[] = pdCatList::catNumPubs($this->db, $cat_id);
                 $table->addRow($cells);
             }
             echo '<h2>Publications by Category:</h2>', $table->toHtml();
             break;
         case 'keywords':
             // publications by keyword
             unset($table);
             $kl = pdPubList::create($this->db, array('keywords_list' => true));
             echo '<h2>Publications by Keyword:</h2>';
             for ($c = 65; $c <= 90; ++$c) {
                 $table = new HTML_Table(array('class' => 'publist'));
                 $text = '';
                 foreach ($kl as $kw) {
                     if (substr($kw, 0, 1) == chr($c)) {
                         $text .= '<a href="list_publication.php?keyword=' . $kw . '">' . $kw . '</a>&nbsp;&nbsp; ';
                     }
                 }
                 $table->addRow(array(chr($c), $text));
                 $table->updateColAttributes(0, array('class' => 'item'), NULL);
                 echo $table->toHtml();
             }
             break;
         default:
             $this->pageError = true;
     }
 }
コード例 #19
0
ファイル: htmlUtils.php プロジェクト: papersdb/papersdb
function displayPubListByCategory(&$db, &$pub_list, $enumerate = true, $max = -1, $options = null, $url_prefix = '')
{
    assert('is_object($db)');
    assert('is_array($pub_list)');
    $result = '';
    $count = 0;
    $col_desciptions = pdPublication::collaborationsGet($db);
    foreach (pdPubList::catDisplayOrder() as $category) {
        $pubs =& $pub_list[$category];
        if (empty($pubs)) {
            continue;
        }
        if ($category == 'Other') {
            $result .= "<h3>Other Categories</h3>\n";
        } else {
            $result .= '<h3>' . $category . "</h3>\n";
        }
        foreach ($pubs as $pub) {
            ++$count;
            $pub->dbLoad($db, $pub->pub_id);
            $cells = array();
            $table = new HTML_Table(array('class' => 'publist', 'cellpadding' => '0', 'cellspacing' => '0'));
            $table->setAutoGrow(true);
            $citation = $pub->getCitationHtml($url_prefix) . '&nbsp;' . getPubIcons($db, $pub, 0xf, $url_prefix);
            if (is_array($options) && !empty($options['show_internal_info']) && $options['show_internal_info'] || isset($_SESSION['user']) && $_SESSION['user']->showInternalInfo()) {
                $citation .= '<br/><span style="font-size:80%">';
                if (isset($pub->ranking)) {
                    $citation .= 'Ranking: ' . $pub->ranking;
                }
                if (is_array($pub->collaborations) && count($pub->collaborations) > 0) {
                    $values = array();
                    foreach ($pub->collaborations as $col_id) {
                        $values[] = $col_desciptions[$col_id];
                    }
                    $citation .= '<br/>Collaboration:' . implode(', ', $values);
                }
                if (isset($_SESSION['user']) && $_SESSION['user']->showUserInfo()) {
                    $citation .= "<br/>User Info: {$pub->user}";
                }
                $citation .= '</span>';
            }
            if ($enumerate) {
                $cells[] = $count . '.';
            }
            $cells[] = $citation;
            $table->addRow($cells);
            if ($enumerate) {
                $table->updateColAttributes(0, array('class' => 'item'), NULL);
            }
            $result .= $table->toHtml();
            unset($table);
            if ($max > 0 && $count >= $max) {
                break;
            }
        }
    }
    return $result;
}