コード例 #1
0
ファイル: aicml_staff.php プロジェクト: papersdb/papersdb
 public function __construct()
 {
     parent::__construct('aicml_staff');
     if ($this->loginError) {
         return;
     }
     echo '<h1>AICML Staff</h1>';
     $table = new HTML_Table(array('class' => 'stats'));
     $table->addRow(array('Name', 'Start', 'End', 'Num Pubs', 'Pub Ids'));
     $table->setRowType(0, 'th');
     //pdDb::debugOn();
     $staff_list = pdAicmlStaffList::create($this->db);
     foreach ($staff_list as $staff_id => $author_id) {
         $staff = pdAicmlStaff::newFromDb($this->db, $staff_id, pdAicmlStaff::DB_LOAD_PUBS_MIN);
         $author = pdAuthor::newFromDb($this->db, $author_id, pdAuthor::DB_LOAD_MIN);
         //debugVar('staff', array($staff, $author));
         $pub_links = array();
         if (isset($staff->pub_ids)) {
             foreach ($staff->pub_ids as $pub_id) {
                 $pub_links[] = '<a href="../view_publication.php?pub_id=' . $pub_id . '">' . $pub_id . '</a>';
             }
         }
         $table->addRow(array($author->name, $staff->start_date, $staff->end_date, count($staff->pub_ids), implode(', ', $pub_links)), array('class' => 'stats_odd'));
     }
     echo $table->toHtml();
 }
コード例 #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
ファイル: auth_success.php プロジェクト: papersdb/papersdb
 public function __construct()
 {
     parent::__construct('auth_success', 'Authorization Success', 'Admin/auth_success.php');
     if ($this->loginError) {
         return;
     }
     echo "<h2>Authorization Successful</h2>" . "\n<p>The following users have been granted access.</p>";
     $table = new HTML_Table(array('class' => 'stats'));
     $table->addRow(array('Access Level', 'Login', 'Name', 'Conf. Email'));
     $table->setRowType(0, 'th');
     foreach ($_SESSION['auth_success'] as $auth) {
         $table->addRow(array(AccessLevel::getAccessLevelStr($auth['user']->access_level), $auth['user']->login, $auth['user']->name, $auth['email']), array('class' => 'stats_odd'));
     }
     echo $table->toHtml();
 }
コード例 #4
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);
     }
 }
コード例 #5
0
ファイル: auth_error.php プロジェクト: papersdb/papersdb
 public function __construct()
 {
     parent::__construct('auth_error', 'Authorization Error', 'Admin/auth_error.php');
     if ($this->loginError) {
         return;
     }
     echo "<h2>Invalid Access Level</h2>" . "\n<p>The following users have incorrect access level.</p>";
     $table = new HTML_Table(array('class' => 'stats'));
     $table->addRow(array('Access Level', 'Login', 'Name'));
     $table->setRowType(0, 'th');
     foreach ($_SESSION['auth_errors'] as $auth_err) {
         $table->addRow(array(AccessLevel::getAccessLevelStr($auth_err['access']), $auth_err['user']->login, $auth_err['user']->name), array('class' => 'stats_odd'));
     }
     echo $table->toHtml();
     echo '<p><a href="authorize_new_users.php">Authorize new users</a></p>';
 }
コード例 #6
0
    function getTable($res, $width = '850', $obj = '')
    {
        $extra_table_attr = array('width' => $width);
        $tbl = new HTML_Table(get_class($this), 'display', 0, 0, 2, $extra_table_attr);
        $frm = new HTML_Form();
        $kk_trick = array();
        $tbl->addRow('', $kk_trick, '<tfoot>');
        $tbl->addCell(tableFooter($obj), NULL, 'data', array('colspan' => '5'));
        $tbl->addRow('main_table');
        $tbl->addCell($frm->addInput('checkbox', 'checkboxall', '', array('class' => 'check-all')), 'first', 'header');
        $tbl->addCell('Location', null, 'header');
        $tbl->addCell('Time on site', null, 'header');
        $tbl->addCell('User', null, 'header');
        $tbl->addCell('On-Page', null, 'header');
        $tbl->addCell('Referer', null, 'header');
        $tbl->addCell('', null, 'header');
        if ($res) {
            $objGeoIP = new GeoIP();
            while ($res->fetch($res)) {
                $objGeoIP->search_ip($res->ip);
                if ($objGeoIP->found()) {
                    $country = $objGeoIP->getCountryName();
                } else {
                    $country = $res->ip;
                }
                $check_this = $frm->addInput('checkbox', 'check_row[]', $res->id, array('id' => 'check_row[]'));
                $tbl->addRow($class);
                $tbl->addCell($check_this);
                $tbl->addCell('<a href="http://www.geoiptool.com/es/?IP=' . $res->ip . '" target="_blank">' . $country . '</a>');
                $tbl->addCell(round(($res->hora - $res->conected_from) / 60, 2) . ' Min.');
                $tbl->addCell($res->user != '' ? $res->user : '******');
                $tbl->addCell('<a href="http://www.' . $web->domain . $res->page . '" target="_blank">' . $res->page . '</a>');
                $tbl->addCell('<a href="' . $res->referer . '" target="_blank">' . substr($res->referer, 0, 20) . '</a>');
                $tbl->addCell('<a href="admin-generic-edit.php?id=' . $res->id . '&fld=' . strtolower(get_class()) . '">
									<img src="/template/kadmin/images/icons/pencil.png" alt="Edit" />
									</a>&nbsp;&nbsp;&nbsp;
									<a href="admin-generic-list.php?id=' . $res->id . '&fld=' . strtolower(get_class()) . '&action=delete" 
											onClick="return confirmDel();">
									<img src="/template/kadmin/images/icons/cross.png" alt="Delete" />
									</a>');
            }
        }
        return $tbl->display();
    }
コード例 #7
0
ファイル: html.php プロジェクト: pear/PEAR_Size
 /**
  * addRow
  *
  * @param string $contents data to add to row
  *
  * @return void
  */
 public function addRow($contents)
 {
     if ($this->rowcount % 2 == 0) {
         $class = "first";
     } else {
         $class = "second";
     }
     parent::addRow($contents, array("class" => $class));
     $this->rowcount++;
 }
コード例 #8
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;
 }
コード例 #9
0
ファイル: index.php プロジェクト: papersdb/papersdb
 private function pubByYears()
 {
     $pub_years = pdPubList::create($this->db, array('year_list' => true));
     if (empty($pub_years) || count($pub_years) == 0) {
         return;
     }
     $table = new HTML_Table(array('class' => 'nomargins', 'width' => '60%'));
     $text = '';
     foreach (array_values($pub_years) as $item) {
         $text .= '<a href="list_publication.php?year=' . $item['year'] . '">' . $item['year'] . '</a> ';
     }
     $table->addRow(array($text));
     echo '<h2>Publications by Year:</h2>', $table->toHtml();
 }
コード例 #10
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();
 }
コード例 #11
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);
     }
 }
コード例 #12
0
    public function mZ_mindbody_show_schedule($atts, $account = 0)
    {
        require_once MZ_MINDBODY_SCHEDULE_DIR . '/lib/html_table.class.php';
        global $add_mz_ajax_script;
        $add_mz_ajax_script = true;
        // optionally pass in a type parameter. Defaults to week.
        $atts = shortcode_atts(array('type' => 'week', 'location' => '1', 'account' => '0', 'filter' => '0', 'grid' => '0', 'hide' => ''), $atts);
        $type = $atts['type'];
        $location = $atts['location'];
        $account = $atts['account'];
        $filter = $atts['filter'];
        $grid = $atts['grid'];
        if ($grid == 1 && $type == 'day') {
            return '<div style="color:red"><h2>' . __('Grid Calendar Incompatible with Single Day Mode!', 'mz_mndbody_api') . '</h2></div>';
        }
        if ($grid == 0) {
            $mz_date = empty($_GET['mz_date']) ? date_i18n('Y-m-d') : mz_validate_date($_GET['mz_date']);
        } else {
            $hide = explode(', ', $atts['hide']);
            $mz_date = empty($_GET['mz_date']) ? date_i18n('Y-m-d', strtotime('last monday')) : mz_validate_date($_GET['mz_date']);
        }
        if ($type == __('day', 'mz-mindbody-api')) {
            $mz_timeframe = array_slice(mz_getDateRange($mz_date, 1), 0, 1);
            $mz_schedule_cache = "mz_schedule_day_cache_" . mt_rand(1, 10);
        } else {
            $mz_timeframe = array_slice(mz_getDateRange($mz_date, 7), 0, 1);
            $mz_schedule_cache = "mz_schedule_week_cache_" . mt_rand(1, 10);
        }
        //While we still need to support php 5.2 and can't use [0] on above
        $mz_timeframe = array_pop($mz_timeframe);
        // START caching
        $mz_cache_reset = isset($options['mz_mindbody_clear_cache']) ? "on" : "off";
        if ($mz_cache_reset == "on") {
            delete_transient($mz_schedule_cache);
        }
        $mz_schedule_data = get_transient($mz_schedule_cache);
        mz_pr('' == $mz_schedule_data);
        if (isset($_GET['mz_date']) || '' == $mz_schedule_data) {
            //Send the timeframe to the GetClasses class, unless already cached
            $mb = instantiate_mbo_API();
            if ($account == 0) {
                $mz_schedule_data = $mb->GetClasses($mz_timeframe);
            } else {
                $mb->sourceCredentials['SiteIDs'][0] = $account;
                $mz_schedule_data = $mb->GetClasses($mz_timeframe);
            }
            //Cache the mindbody call for 24 hours
            // TODO make cache timeout configurable.
            set_transient($mz_schedule_cache, $mz_schedule_data, 60 * 60 * 24);
        }
        $return = '';
        if (!empty($mz_schedule_data['GetClassesResult']['Classes']['Class'])) {
            $mz_days = $this->makeNumericArray($mz_schedule_data['GetClassesResult']['Classes']['Class']);
            if ($grid == 0) {
                $mz_days = sortClassesByDate($mz_days, $this->time_format, $location);
            } else {
                $mz_days = sortClassesByTimeThenDay($mz_days, $this->time_format, $location);
            }
            $return .= '<div id="mz_mbo_schedule" class="mz_mbo_schedule">';
            if ($type == __('week', 'mz-mindbody-api')) {
                $return .= mz_mbo_schedule_nav($mz_date, __('Week', 'mz-mindbody-api'));
            }
            if ($filter == 1) {
                $tbl = new HTML_Table('', 'mz-schedule-filter');
            } else {
                $tbl = new HTML_Table('', 'mz-schedule-table');
            }
            if ($grid == 0) {
                foreach ($mz_days as $classDate => $mz_classes) {
                    $tbl->addRow('header');
                    // arguments: cell content, class, type (default is 'data' for td, pass 'header' for th)
                    // can include associative array of optional additional attributes
                    $tbl->addCell(date_i18n($this->mz_date_display, strtotime($classDate)), '', 'header', array('scope' => 'header'));
                    $tbl->addCell(__('Class Name', 'mz-mindbody-api'), '', 'header', array('scope' => 'header'));
                    $tbl->addCell(__('Instructor', 'mz-mindbody-api'), '', 'header', array('scope' => 'header'));
                    $tbl->addCell(__('Class Type', 'mz-mindbody-api'), '', 'header', array('scope' => 'header'));
                    $tbl->addTSection('tbody');
                    foreach ($mz_classes as $class) {
                        // mz_pr($class);
                        $sDate = date_i18n('m/d/Y', strtotime($class['StartDateTime']));
                        $sLoc = $class['Location']['ID'];
                        $sTG = $class['ClassDescription']['Program']['ID'];
                        $studioid = $class['Location']['SiteID'];
                        $sclassid = $class['ClassScheduleID'];
                        $sclassidID = $class['ID'];
                        $classDescription = $class['ClassDescription']['Description'];
                        $sType = -7;
                        $showCancelled = $class['IsCanceled'] == 1 ? '<div class="mz_cancelled_class">' . __('Cancelled', 'mz-mindbody-api') . '</div>' : '';
                        $className = $class['ClassDescription']['Name'];
                        $startDateTime = date_i18n('Y-m-d H:i:s', strtotime($class['StartDateTime']));
                        $endDateTime = date_i18n('Y-m-d H:i:s', strtotime($class['EndDateTime']));
                        $staffName = $class['Staff']['Name'];
                        $sessionType = $class['ClassDescription']['SessionType']['Name'];
                        $isAvailable = $class['IsAvailable'];
                        $linkURL = "https://clients.mindbodyonline.com/ws.asp?sDate={$sDate}&amp;sLoc={$sLoc}&amp;sTG={$sTG}&amp;sType={$sType}&amp;sclassid={$sclassid}&amp;studioid={$studioid}";
                        if (date_i18n('H', strtotime($startDateTime)) < 12) {
                            $time_of_day = __('morning', 'mz-mindbody-api');
                        } else {
                            if (date_i18n('H', strtotime($startDateTime)) > 16) {
                                $time_of_day = __('evening', 'mz-mindbody-api');
                            } else {
                                $time_of_day = __('afternoon', 'mz-mindbody-api');
                            }
                        }
                        // start building table rows
                        $tbl->addRow('mz_description_holder');
                        $tbl->addCell($time_of_day, 'hidden', 'data');
                        if (isset($isAvailable) && $isAvailable != 0) {
                            $tbl->addCell(date_i18n($this->time_format, strtotime($startDateTime)) . ' - ' . date_i18n($this->time_format, strtotime($endDateTime)) . '<br/><a class="btn" href="' . $linkURL . '" target="_blank">' . __('Sign-Up', 'mz-mindbody-api') . '</a>');
                        } else {
                            $tbl->addCell(date_i18n($this->time_format, strtotime($startDateTime)) . ' - ' . date_i18n($this->time_format, strtotime($endDateTime)));
                        }
                        $tbl->addCell('<a data-toggle="modal" data-target="#mzModal" href="' . MZ_MINDBODY_SCHEDULE_URL . 'inc/modal_descriptions.php?classDescription=' . urlencode(substr($classDescription, 0, 1000)) . '&amp;className=' . urlencode(substr($className, 0, 1000)) . '">' . $className . '</a>' . '<br/><div id="visitMBO" class="btn visitMBO" style="display:none">' . '<a href="' . $linkURL . '" target="_blank">' . __('Manage on MindBody Site', ' mz-mindbody-api') . '</a></div>' . $showCancelled);
                        $tbl->addCell($staffName);
                        $tbl->addCell($sessionType);
                    }
                    // EOF foreach class
                }
                // EOF foreach day
                $tbl->addTSection('tfoot');
                $tbl->addRow();
                $tbl->addCell('', '', '', array('colspan' => 4));
                $return .= $tbl->display();
            } else {
                //Display grid
                $week_starting = date_i18n($this->date_format, strtotime($mz_date));
                //
                $return .= '<h4 class="mz_grid_date">';
                $return .= sprintf(__('Week of %1$s', 'mz-mindbody-api'), $week_starting);
                $return .= '</h4>';
                $tbl->addTSection('thead');
                $tbl->addRow();
                // arguments: cell content, class, type (default is 'data' for td, pass 'header' for th)
                // can include associative array of optional additional attributes
                $tbl->addCell('', '', 'header');
                $tbl->addCell(__('Monday', 'mz-mindbody-api'), '', 'header');
                $tbl->addCell(__('Tuesday', 'mz-mindbody-api'), '', 'header');
                $tbl->addCell(__('Wednesday', 'mz-mindbody-api'), '', 'header');
                $tbl->addCell(__('Thursday', 'mz-mindbody-api'), '', 'header');
                $tbl->addCell(__('Friday', 'mz-mindbody-api'), '', 'header');
                $tbl->addCell(__('Saturday', 'mz-mindbody-api'), '', 'header');
                $tbl->addCell(__('Sunday', 'mz-mindbody-api'), '', 'header');
                $tbl->addTSection('tbody');
                foreach ($mz_days as $classDate => $mz_classes) {
                    if ($classDate < 12) {
                        $time_of_day = __('morning', 'mz-mindbody-api');
                    } else {
                        if ($classDate > 16) {
                            $time_of_day = __('evening', 'mz-mindbody-api');
                        } else {
                            $time_of_day = __('afternoon', 'mz-mindbody-api');
                        }
                    }
                    $tbl->addRow();
                    $tbl->addCell($time_of_day, 'hidden', 'data');
                    $tbl->addCell($mz_classes['display_time']);
                    //mz_pr($mz_classes['display_time']);
                    foreach ($mz_classes['classes'] as $key => $classes) {
                        //mz_pr($key);
                        //mz_pr($classes);
                        //die();
                        if (empty($classes) || null === $classes[0]['ClassDescription']['Name']) {
                            $class_details = '';
                            $num_classes_min_one = 50;
                            //Set to a number that won't match key
                        } else {
                            $class_details = '';
                            $num_classes_min_one = count($classes) - 1;
                            foreach ($classes as $key => $class) {
                                $className = $class['ClassDescription']['Name'];
                                if (!in_array('teacher', $hide)) {
                                    $teacher = __('with', 'mz-mindbody-api') . '&nbsp;' . $class['Staff']['Name'] . '<br/>';
                                } else {
                                    $teacher = '';
                                }
                                $showCancelled = $class['IsCanceled'] == 1 ? '<div class="mz_cancelled_class">' . __('Cancelled') . '</div>' : '';
                                $classDescription = $class['ClassDescription']['Description'];
                                $sessionTypeName = $class['ClassDescription']['SessionType']['Name'];
                                $showCancelled = $class['IsCanceled'] == 1 ? '<div class="mz_cancelled_class">' . __('Cancelled') . '</div>' : '';
                                if (!in_array('duration', $hide) && $class['IsCanceled'] != 1) {
                                    $classStartTime = new DateTime($class['StartDateTime']);
                                    $classEndTime = new DateTime($class['EndDateTime']);
                                    if (phpversion() >= 5.3) {
                                        $classLength = $classEndTime->diff($classStartTime);
                                        $classLength = __('Duration:', 'mz-mindbody-api') . '<br/>&nbsp;' . $classLength->format('%H:%I');
                                    } else {
                                        $classLength = round($classEndTime->format('U') - $classStartTime->format('U'));
                                        $classLength = __('Duration:', 'mz-mindbody-api') . '<br/>&nbsp;' . gmdate("H:i", $classLength);
                                    }
                                } else {
                                    $classLength = '';
                                }
                                // Initialize $signupButton
                                $signupButton = '';
                                // Variables for class URL
                                $sDate = date_i18n('m/d/Y', strtotime($class['StartDateTime']));
                                $sLoc = $class['Location']['ID'];
                                $sTG = $class['ClassDescription']['Program']['ID'];
                                $studioid = $class['Location']['SiteID'];
                                $sclassid = $class['ClassScheduleID'];
                                $sclassidID = $class['ID'];
                                $sType = -7;
                                $isAvailable = $class['IsAvailable'];
                                $class_separator = $key == $num_classes_min_one ? '' : '<hr/>';
                                $linkURL = "https://clients.mindbodyonline.com/ws.asp?sDate={$sDate}&amp;sLoc={$sLoc}&amp;sTG={$sTG}&amp;sType={$sType}&amp;sclassid={$sclassid}&amp;studioid={$studioid}";
                                if (!in_array('signup', $hide)) {
                                    $signupButton = '&nbsp;<a href="' . $linkURL . '" target="_blank" title="' . __('Sign-Up', 'mz-mindbody-api') . '"><i class="fa fa-sign-in"></i></a><br/>';
                                } else {
                                    $signupButton = '';
                                }
                                $class_details .= '<div class="' . 'mz_' . sanitize_html_class($sessionTypeName, 'mz_session_type') . '">' . '<a data-toggle="modal" data-target="#mzModal" href="' . MZ_MINDBODY_SCHEDULE_URL . 'inc/modal_descriptions.php?classDescription=' . urlencode(substr($classDescription, 0, 1000)) . '&amp;className=' . urlencode(substr($className, 0, 1000)) . '">' . $className . '</a>' . '<br/>' . $teacher . $signupButton . $classLength . $showCancelled . '</div>' . $class_separator;
                            }
                        }
                        $tbl->addCell($class_details, 'mz_description_holder');
                    }
                    //end foreach mz_classes
                }
                //end foreach mz_days
                $return .= $tbl->display();
            }
            //End if grid
            if ($type == 'week') {
                // schedule navigation
                $return .= mz_mbo_schedule_nav($mz_date, __('Week', 'mz-mindbody-api'));
            }
            $return .= '<div id="mzModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mzSmallModalLabel" aria-hidden="true">
					 <div class="modal-content">

					</div>
			</div>';
            $return .= '</div>';
        } else {
            if (!empty($mz_schedule_data['GetClassesResult']['Message'])) {
                $return = $mz_schedule_data['GetClassesResult']['Message'];
            } else {
                $return = __('Error getting classes. Try re-loading the page.', ' mz-mindbody-api') . '<br />';
                $return .= '<pre>' . print_r($mz_schedule_data, 1) . '</pre>';
            }
        }
        //EOF If Result / Else
        $mz_schedule_display = 'mz_schedule_display_' . mt_rand(1, 1000000);
        mz_pr($mz_schedule_display);
        set_transient($mz_schedule_display, $return, 60 * 60 * 24);
        return get_transient($mz_schedule_display);
    }
コード例 #13
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();
 }
コード例 #14
0
ファイル: checkouts.php プロジェクト: tseel/phplicensewatcher
</form>
    
<?php 
##############################################################
# We are using PHP Pear stuff ie. pear.php.net
##############################################################
require_once "HTML/Table.php";
require_once 'DB.php';
$tableStyle = "border=\"1\" cellpadding=\"1\" cellspacing=\"2\"";
# Create a new table object
$table = new HTML_Table($tableStyle);
$table->setColAttributes(1, "align=\"right\"");
#  Define a table header
$headerStyle = "style=\"background: yellow;\"";
$colHeaders = array("Date", "User", "Feature", "Total number of checkouts");
$table->addRow($colHeaders, $headerStyle, "TH");
################################################################
# First let's get license usage for the product specified in $feature
##############################################################
################################################################
#  Connect to the database
#   Use persistent connections
################################################################
$db = DB::connect($dsn, true);
if (DB::isError($db)) {
    die($db->getMessage());
}
$sql = "SELECT DISTINCT `flmevent_feature` FROM `flexlm_events` WHERE `flmevent_type`='OUT'";
$recordset = $db->query($sql);
if (DB::isError($recordset)) {
    die($recordset->getMessage());
コード例 #15
0
    include_once './tools.php';
}
#########################################################
# Date when the licenses will expire
#########################################################
$expire_date = mktime(0, 0, 0, date("m"), date("d") + $lead_time, date("Y"));
$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$message = "<p align=\"center\"><a href=\"admin.php\"><img src=\"back.jpg\" alt=\"up page\" border=\"0\"></a></p>";
##############################################################
# We are using PHP Pear stuff ie. pear.php.net
##############################################################
require_once "HTML/Table.php";
$table = new HTML_Table();
$headerStyle = "bgcolor=lightblue";
$colHeaders = array("Server", "Server description", "Feature", "Version", "Expiration", "Days to expiration", "Number of license(s) expiring");
$table->addRow($colHeaders, $headerStyle, "TH");
#######################################################
# Get names of different colors. These will be used to group visually
# licenses from the same license server
#######################################################
$color = explode(",", $colors);
$i = 0;
foreach ($server as $host) {
    $master_array = getDetails($host);
    $expiration_array = $master_array['expiration'];
    # Now after the expiration has been built loop through all the fileservers
    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>";
コード例 #16
0
ファイル: package-approval.php プロジェクト: stof/pearweb
            $mailtext = wordwrap($mailtext, 72);
            $query = 'SELECT u.email FROM users u, maintains m WHERE m.package = ? AND u.handle = m.handle';
            $rows = $dbh->getAll($query, array($id), DB_FETCHMODE_ASSOC);
            foreach ($rows as $u_row) {
                mail($u_row['email'], SITE_BIG . ' Package ' . $action, $mailtext, 'From: "' . SITE_BIG . ' Package Approval System" <' . PEAR_GROUP_EMAIL . '>', '-f ' . PEAR_BOUNCE_EMAIL);
            }
        }
        echo "Successfully <b>" . $action . " package</b>.<br /><br />";
    } else {
        echo "There have been problems: Either an error occured while " . "updating the database or the package has already been " . $action . " by someone else.<br /><br />";
    }
}
$query = 'SELECT id, name FROM packages WHERE approved = 0 AND package_type = ?';
$rows = $dbh->getAll($query, array(SITE), DB_FETCHMODE_ASSOC);
$self = htmlspecialchars($_SERVER['PHP_SELF']);
if (count($rows) == 0) {
    echo "<b>Currently there are no unapproved packages.</b>\n";
} else {
    require_once 'HTML/Table.php';
    $table = new HTML_Table('style="width: 90%"');
    $table->setCaption('Unapproved packages', 'style="background-color: #CCCCCC;"');
    $csrf_link = '&amp;' . urlencode($csrf_token_name) . '=' . urlencode(create_csrf_token($csrf_token_name));
    foreach ($rows as $row) {
        $tmp = array($row['name'], make_link("{$self}?approve=" . $row['id'] . $csrf_link, "Approve") . ' / ' . make_link("{$self}?reject=" . $row['id'] . $csrf_link, "Reject"));
        $table->addRow($tmp);
    }
    echo $table->toHTML();
}
echo "<br /><br />";
echo make_link('/admin/', 'Back');
response_footer();
コード例 #17
0
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();
            
            /*
            if ($contest['tested'] != 1 && $contest['end_future'] != 1 && !auth_user_in_group('Administrators')) {
                ?>
                <p><b>System tests for this contest have not finished yet.</b><br /> Contest statistics containing the scores and standings of each team will be put up here, once the testing phase is over. Please check back in a few minutes.</p>
                <?php
                return;
            }
            */
            $table = new HTML_Table;
		
            if ($contest['show_future'] == 1) {
                $status = 'Hidden (not activated yet)';
            } else if ($contest['begin_future'] == 1) {
                $status = 'Not started';
            } else if ($contest['end_future'] == 1) {
                $status = 'Running';
            } else {
                $status = 'Ended';
            }
            $table->addRow(array('Contest status: ', $status), null, 'TH');
            $table->addRow(array('Name: ', $contest['name']));
            $table->addRow(array('Description: ', $contest['description']));

            $table->addRow(array('Begin time: ', $contest['begin_time']));
            $table->addRow(array('End time: ', $contest['end_time']));

            if ($contest['team_size'] != 1) {
                $table->addRow(array('Max size of team: ', $contest['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($count);
            $res->free();
            $table->addRow(array($prefix.' registered: ', $count['count']));

            $table->altRowAttributes(1, null, array ("class" => "altrow"));
            echo '<div class="overflow">'.$table->toHtml().'</div>';
            echo "<hr />\n";
            
            if ($contest['end_future'] == 1) {
                ?>  
                <p><b>Contest Standings.</b><br/></p>
                <?php
            } else {
                ?>  
                <p><b>System testing results.</b><br /> For details about particular solutions, please click on the underlined scores.</p>
                <?php
            }
            
            $header = array('Rank');
                array_push($header, 'Coder');
                array_push($header, 'College');
                
            $probs = array();
            
            $res =& db_query('problems_by_contest_id', $_GET['id']);
            while ($res->fetchInto($problem)) {
                array_push($header, '<i>'.$problem['prob_id'].'</i>');
                array_push($probs, $problem['prob_id']);
            }
            $res->free();
            array_push($header, 'Score');
            
            $table = new HTML_Table;
            $table->addRow($header, null, 'TH');
            
            if ($contest['end_future'] != 1)
                $res =& db_query('teams_by_contest_id', $_GET['id']);
            else
                $res =& db_query('standings_by_contest_id', $_GET['id']);
                
            if ($res->numRows() == 0) {
                ?>
                <p><b>No Rankings!</b><br />No teams participated in this contest.</p>
                <?php
                return;
            }
            
            $prev_score = -1;
            $rank = 0;
            $carried = 0;
            while ($res->fetchInto($team)) {
                // calculate rank
                if (abs($prev_score-$team['score']) < 1e-4) {
                    ++$carried;
                } else {
                    $rank = $rank + $carried + 1;
                    $prev_score = $team['score'];
                    $carried = 0;
                }
                
                $row = array($rank, $team['name'], $team['college']);
                
                // add users
                if ($contest['team_size'] > 1) {
                    $res2 =& db_query('users_by_team_id', array($_GET['id'], $team['team_id']));
                    if ($res2->fetchInto($user)) {
                        $users = user_handle($user['handle']);
                        while ($res2->fetchInto($user)) {
                            $users .= ', '.user_handle($user['handle']);
                        }
                    }
                    $res2->free();
                    array_push($row, $users);
                }
                
                // add prob scores
                foreach ($probs as $prob_id) {
                    $res2 =& db_query('score_by_id', array($_GET['id'], $team['team_id'], $prob_id));
                    if ($res2->fetchInto($solution) && isset($solution['language'])) {
                        if ($contest['end_future'] == 1)
                            array_push($row, sprintf("%.3f", $solution['score']));
                        else
                            array_push($row, '<a target="_blank" href="solution.php?id='.$_GET['id'].'&amp;prob_id='.$prob_id.'&amp;team_id='.$team['team_id'].'">'.sprintf("%.3f", $solution['score']).'</a>');
                    } else {
                        array_push($row, '-');
                    }
                    $res2->free();
                }
                
                // add total score
                array_push($row, sprintf("%.3f", $team['score']));
                $table->addRow($row);
            }
            
            $table->altRowAttributes(1, null, array ("class" => "altrow"));
            echo '<div class="overflow">'.$table->toHtml().'</div>';
            break;
            
        case 'profile':
            $table = new HTML_Table;
            
            $res =& db_query('user_by_handle', $_GET['handle']);
            if (!$res->fetchInto($user)) {
                ?>
                <p><b>No such handle!</b><br/>Maybe you mistyped the user handle.</p>
                <?php;
                return;
            }
            
            $table->addRow(array('User handle: ', $_GET['handle']), null, 'TH');
            $table->addRow(array('Division: ', $cfg["tcl"]["divisions"][$user['division']]));
            $table->addRow(array('Rating: ', $user['rating']));
            $table->addRow(array('Volatility: ', $user['volatility']));
            $table->addRow(array('Name: ', $user['first_name'].' '.$user['last_name']));
            $table->addRow(array('Date of Birth: ', $user['birth_date']));
            $table->addRow(array('City: ', $user['city']));
            $table->addRow(array('Country: ', $user['country']));
            $table->addRow(array('Quote: ', $user['quote']));
            
            $table->altRowAttributes(1, null, array ("class" => "altrow"));
            echo '<div class="overflow">'.$table->toHtml().'</div>';
            break;
    }
}
コード例 #18
0
        $this->set($attr, $val);
    }
    // Parse the product template (usually 'browse_x') for each product
    // and store it in our $data array
    $data[$row][] = $this->fetch('browse/' . $templatefile . '.php');
    // Start a new row ?
    if ($i % $products_per_row == 0) {
        $row++;
    }
    $i++;
}
// Creates a new HTML_Table object that will help us
// to build a table holding all the products
$table = new HTML_Table('width="100%"');
// Loop through each row and build the table
foreach ($data as $key => $value) {
    $table->addRow($data[$key]);
}
// Display the table
echo $table->toHtml();
?>
<br class="clr" />
<?php 
echo $browsepage_footer;
// Show Featured Products
if ($this->get_cfg('showFeatured', 1)) {
    /* featuredproducts(random, no_of_products,category_based) no_of_products 0 = all else numeric amount
       edit featuredproduct.tpl.php to edit layout */
    echo $ps_product->featuredProducts(true, 10, true);
}
echo $recent_products;
コード例 #19
0
ファイル: index.php プロジェクト: tseel/phplicensewatcher
<?php 
##########################################################################
# We are using PHP Pear library to create tables :-)
##########################################################################
require_once "HTML/Table.php";
# empty statusmsg
$statusMsg = "";
$tableStyle = array('cellpadding' => '1', 'cellspacing' => '2', 'class' => 'table table-striped');
# Create a new table object
$table = new HTML_Table();
$table->setAttributes($tableStyle);
$table->setColAttributes(1, "align=\"center\"");
# Define a table header
$headerStyle = "";
$colHeaders = array("License Server", "Description", "Status", "Current Usage", "Available features/license", "Master", "Version");
$table->addRow($colHeaders, $headerStyle, "TH");
# set width on description col
$table->setColAttributes(1, "width=\"180\"");
# grab all the different server types
foreach ($server as $host) {
    $type[] = $host['type'];
}
# return only unique types
$types = array_unique($type);
# loop thru each unique type and make up status table
foreach ($types as $type) {
    $servers = findServers($type, "type");
    if (sizeof($servers) > 0) {
        $table->addRow(array(strtoupper($type) . " Servers"), $headerStyle, "TH");
        $table->setCellAttributes($table->getRowCount() - 1, 0, "colspan='" . $table->getColCount() . "'");
        for ($i = 0; $i < sizeof($servers); $i++) {
コード例 #20
0
<?php

$tbl2 = new HTML_Table('', 'data-table table table-striped table-bordered', array('data-title' => 'List of Draft Talents'));
$tbl2->addTSection('thead');
$tbl2->addRow();
$tbl2->addCell('Photo', '', 'header');
$tbl2->addCell('Full Name', '', 'header');
$tbl2->addCell('Gender', '', 'header');
$tbl2->addCell('Age', '', 'header');
$tbl2->addCell('Height', '', 'header');
$tbl2->addCell('weight', '', 'header');
$tbl2->addCell('Nationality', '', 'header');
$tbl2->addCell('Experience', '', 'header');
$tbl2->addCell('Actions', '', 'header');
$tbl2->addTSection('tbody');
$mysql = 'SELECT * FROM tams_talent_experience WHERE talent_id ="$talent_id"';
$experience = DB::queryFirstRow($mysql);
$experience_item_id = $experience['experience_item_id'];
$talent_experience_item_id = $experience['talent_experience_item_id'];
$created_on = $experience['created_on'];
$created_by = $experience['created_by'];
$last_modified_by = $experience['last_modified_by'];
$last_modified_on = $experience['last_modified_on'];
$sql = 'SELECT * FROM tams_talent WHERE talent_status = "draft"';
$get_talents = DB::query($sql);
foreach ($get_talents as $talent) {
    $tbl2->addRow();
    $tbl2->addCell("<a href='" . $_SERVER['PHP_SELF'] . "?route=modules/talent/view_talent_profile&talent_id=" . $talent['talent_id'] . "'><img src='" . $talent['photo1_url'] . "' alt='Photo1' width='100px' height='100px'; /></a>");
    $tbl2->addCell($talent['first_name'] . " " . $talent['last_name']);
    $tbl2->addCell($talent['sex']);
    $tbl2->addCell(getAge($talent['dob']));
コード例 #21
0
$sql = 'SELECT * FROM ' . DB_PREFIX . $_SESSION['co_prefix'] . 'journal_vouchers  WHERE voucher_status="draft" ORDER by voucher_id DESC';
$draft_jvs = DB::query($sql);
foreach ($draft_jvs as $draft_jv) {
    $tbl_draft->addRow();
    $tbl_draft->addCell($draft_jv['voucher_id']);
    $tbl_draft->addCell(getDateTime($draft_jv['voucher_date'], "dShort"));
    $tbl_draft->addCell($draft_jv['voucher_ref_no']);
    $tbl_draft->addCell($draft_jv['voucher description']);
    $tbl_draft->addCell($draft_jv['debits_total']);
    $tbl_draft->addCell($draft_jv['credits_total']);
    $tbl_draft->addCell("More info here like created on, last modify etc");
    $tbl_draft->addCell("<a class='pull btn btn-primary btn-xs' href ='" . SITE_ROOT . "?route=modules/gl/transactions/journal_vouchers/add_journal_voucher_detail&voucher_id=" . $draft_jv['voucher_id'] . "'>Edit&nbsp;&nbsp;<span class='glyphicon glyphicon-edit'></span></a> <a class='pull btn btn-danger btn-xs' href ='#'>Delete&nbsp;&nbsp;<span class='glyphicon glyphicon-trash'></span></a>");
}
//Journal Vouchers Pending Approvel
$tbl_pending = new HTML_Table('', 'table table-striped table-bordered');
$tbl_pending->addRow();
$tbl_pending->addCell('Voucher ID', '', 'header');
$tbl_pending->addCell('Ref #', '', 'header');
$tbl_pending->addCell('Voucher Description', '', 'header');
$tbl_pending->addCell('Total Amount', '', 'header');
$tbl_pending->addCell('Voucher Approved By', '', 'header');
$tbl_pending->addCell('Voucher Status', '', 'header');
$tbl_pending->addCell('Actions', '', 'header');
?>

<?php 
$sql = 'SELECT * FROM ' . DB_PREFIX . $_SESSION['co_prefix'] . 'journal_vouchers WHERE voucher_status = "pending" ORDER by voucher_id DESC';
$pending_jvs = DB::query($sql);
foreach ($pending_jvs as $pending_jv) {
    $tbl_pending->addRow();
    $tbl_pending->addCell($pending_jv['voucher_id']);
コード例 #22
0
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');
            $form->addRule('weight', 'Points weightage is required', 'required', null, 'client');
            $form->addRule('time_limit', 'Time limit is required', 'required', null, 'client');
            $form->addRule('mem_limit', 'Memory limit is required', 'required', null, 'client');
            $form->addRule('content', 'Problem content in XML is required', 'required', null, 'client');
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $errs = problem_check($data['content']);
                if ($errs == null) {
                    $data['contest_id'] = $_GET['id'];
                    $res =& $db->autoExecute('problems', $data, DB_AUTOQUERY_INSERT);
                    if (PEAR::isError($res)) {
                        error($res->toString());
                    }
                    $cache->remove(problem_cache_id($_GET['id'], $data['prob_id']) . '.htm');
                    $cache->remove(problem_cache_id($_GET['id'], $data['prob_id']) . '.prob');
                    redirect('index.php?view=manage&task=problems&id=' . $_GET['id']);
                } else {
                    ?>
<p><b>Error:</b> The problem could not be added due to the following errors encountered while
parsing the problem XML file. Please fix them and try submitting again.</p>
				<?php 
                    echo "<ol class=\"errors\">\n";
                    foreach ($errs as $line) {
                        echo "<li>{$line}</li>\n";
                    }
                    echo "</ol>\n<hr />\n";
                }
            }
            $form->display();
            break;
        case 'del_problem':
            db_query('del_problem_by_id', array($_GET['prob_id'], $_GET['id']));
            redirect('index.php?view=manage&task=problems&id=' . $_GET['id']);
            break;
        case 'edit_problem':
            $res =& db_query('problem_by_id', array($_GET['prob_id'], $_GET['id']));
            $res->fetchInto($row);
            $res->free();
            // Get XML content too
            $res =& db_query('problem_content_by_id', array($_GET['prob_id'], $_GET['id']));
            $res->fetchInto($row2);
            $res->free();
            $row['content'] =& $row2['content'];
            // form for editing a problem
            $form = new HTML_QuickForm('problemAddForm', 'post', selflink());
            $form->addElement('header', null, 'Edit 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');
            $form->addRule('weight', 'Points weightage is required', 'required', null, 'client');
            $form->addRule('time_limit', 'Time limit is required', 'required', null, 'client');
            $form->addRule('mem_limit', 'Memory limit is required', 'required', null, 'client');
            $form->addRule('content', 'Problem content in XML is required', 'required', null, 'client');
            $form->setDefaults($row);
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $errs = problem_check($data['content']);
                if ($errs == null) {
                    //$data['contest_id'] = $_GET['id'];
                    $data['version'] = $row['version'] + 1;
                    // increment version
                    $res =& $db->autoExecute('problems', $data, DB_AUTOQUERY_UPDATE, 'contest_id=' . $_GET['id'] . " AND prob_id='" . $data['prob_id'] . "'");
                    if (PEAR::isError($res)) {
                        error($res->toString());
                    }
                    $cache->remove(problem_cache_id($_GET['id'], $data['prob_id']) . '.htm');
                    $cache->remove(problem_cache_id($_GET['id'], $data['prob_id']) . '.prob');
                    redirect('index.php?view=manage&task=problems&id=' . $_GET['id']);
                } else {
                    ?>
<p><b>Error:</b> The changes could not be saved due to the following errors encountered while
parsing the problem XML file. Please fix them and try submitting again.</p>
				<?php 
                    echo "<ol class=\"errors\">\n";
                    foreach ($errs as $line) {
                        echo "<li>{$line}</li>\n";
                    }
                    echo "</ol>\n<hr />\n";
                }
            }
            $form->display();
            break;
        case 'show_problem':
            $res =& db_query('problem_by_id', array($_GET['prob_id'], $_GET['id']));
            $res->fetchInto($problem);
            $res->free();
            problem_display($problem);
            break;
        case 'settings':
            // Re-using $row from above
            // form for editing the contest
            $form = new HTML_QuickForm('contestEditForm', 'post', selflink());
            $form->addElement('header', null, "Edit contest {$row['name']} (id: {$row['contest_id']})");
            $form->addElement('text', 'name', 'Name: ');
            $form->addElement('text', 'description', 'Description: ');
            $elem =& $form->addElement('text', 'team_size', 'Size of team: ');
            $elem->setValue('1');
            $date = getdate();
            $form->addElement('date', 'show_time', 'Activation time: ', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('date', 'begin_time', 'Begin time: ', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('date', 'end_time', 'End time: ', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('text', 'rules', 'Rules URL: ');
            $form->addElement('submit', null, 'Submit');
            // convert date format and store default values
            $row['show_time'] = sql2form_datetime($row['show_time']);
            $row['begin_time'] = sql2form_datetime($row['begin_time']);
            $row['end_time'] = sql2form_datetime($row['end_time']);
            $form->setDefaults($row);
            $form->applyFilter('name', 'trim');
            $form->applyFilter('description', 'trim');
            $form->applyFilter('team_size', 'trim');
            $form->addRule('name', 'Contest name is required.', 'required', null, 'client');
            $form->addRule('team_size', 'Team size is required.', 'required', null, 'client');
            // validate or display form
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $data['show_time'] = form2sql_datetime($data['show_time']);
                $data['begin_time'] = form2sql_datetime($data['begin_time']);
                $data['end_time'] = form2sql_datetime($data['end_time']);
                $db->autoExecute('contests', $data, DB_AUTOQUERY_UPDATE, 'contest_id=' . $_GET['id']);
                if (PEAR::isError($res)) {
                    error($db->toString());
                }
                redirect('index.php?view=manage&id=' . $_GET['id']);
            } else {
                $form->display();
            }
            break;
        case 'submissions':
            // Re-use $row from above
            if ($row['end_future'] != '1') {
                // Contest has ended, show system test button
                if ($row['tested'] != 1) {
                    ?>
    <p>Contest has ended. 
    <a class="button" href="index.php?view=manage&amp;&amp;task=test&amp;updateratings=false&amp;id=<?php 
                    echo $_GET['id'];
                    ?>
">Test and grade all submissions.</a>
    <a class="button" href="index.php?view=manage&amp;task=test&amp;updateratings=true&amp;id=<?php 
                    echo $_GET['id'];
                    ?>
">Update Ratings</a>

    </p>
                <?php 
                } else {
                    ?>
    <p>Contest has ended and system tests are over.
    <a class="button" href="index.php?view=manage&amp;task=test&amp;id=<?php 
                    echo $_GET['id'];
                    ?>
">Re-run system tests.</a>
    </p>
                <?php 
                }
            }
            // Show table of all solutions in the contest
            $table = new HTML_Table();
            $res =& db_query('solutions_by_contest_id', $_GET['id']);
            if (!$res->fetchInto($row)) {
                // If no solutions in yet
                ?>
<p>Sorry, no solutions have been submitted yet.</p>
			<?php 
            } else {
                $table->addRow(array_keys($row), null, 'TH');
                if ($row['score'] == '') {
                    $row['score'] = 'n/a';
                }
                if ($row['passed'] == '') {
                    $row['passed'] = 'n/a';
                }
                $table->addRow(array_values($row));
                while ($res->fetchInto($row)) {
                    if ($row['score'] == '') {
                        $row['score'] = 'n/a';
                    }
                    if ($row['passed'] == '') {
                        $row['passed'] = 'n/a';
                    }
                    $table->addRow(array_values($row));
                }
                $table->altRowAttributes(1, null, array("class" => "altrow"));
                echo '<div class="overflow">' . $table->toHtml() . '</div>';
            }
            break;
        case 'test':
            require_once 'tester.php';
            ob_end_clean();
            html_reset();
            html_header(null, $cfg["dir"]["themes"] . '/' . $_SESSION["theme"] . '.css', $cfg["dir"]["themes"] . '/' . $_SESSION["theme"] . '-ie.css', null, "submit_frame");
            $contest_id = $_GET['id'];
            $update_ratings = $_GET['updateratings'];
            session_write_close();
            test_contest($update_ratings, $contest_id);
            echo ' <a class="white" href="index.php?view=statistics&amp;task=contest&amp;id=' . $_GET['id'] . '">See the results.</a>';
            html_footer();
            exit;
    }
}
コード例 #23
0
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']);
                // get list of views allowed for this group
                $views = '';
                $res2->fetchInto($row2);
                while ($row2) {
                    $views .= $row2['view'];
                    if ($res2->fetchInto($row2)) {
                        $views .= ', ';
                    }
                }
                $res2->free();
                array_push($row, $views);
                array_push($row, "<a href=\"index.php?view=admin&amp;task=edit_group&amp;id={$row['group_id']}\">edit</a>" . ", <a href=\"index.php?view=admin&amp;task=del_group&amp;id={$row['group_id']}\">delete</a>");
                $table->addRow(array_values($row));
                $res->fetchInto($row);
            }
            $res->free();
            // decor
            $table->altRowAttributes(1, null, array("class" => "altrow"));
            echo '<div class="overflow">' . $table->toHtml() . '</div>';
            echo "<hr />";
            // form for adding a group
            $form = new HTML_QuickForm('addGroupForm', 'post', 'index.php?view=admin&task=groups');
            $form->addElement('header', null, 'Add a group');
            $form->addElement('text', 'name', 'Name: ');
            $form->addElement('submit', null, 'Submit');
            $form->applyFilter('name', 'trim');
            $form->addRule('name', 'Group name is required.', 'required', null, 'client');
            if ($form->validate()) {
                $res =& $db->autoExecute('groups', $form->getSubmitValues(), DB_AUTOQUERY_INSERT);
                if (PEAR::isError($res)) {
                    error($db->toString());
                }
                redirect('index.php?view=admin&task=groups');
            }
            $form->display();
            break;
        case 'del_group':
            db_query('del_group_by_id', $_GET['id']);
            redirect('index.php?view=admin&task=groups');
            break;
        case 'edit_group':
            // get list of views allowed for this group
            $group_views = array();
            $res =& db_query('views_by_group_id', $_GET['id']);
            while ($res->fetchInto($row)) {
                array_push($group_views, $row['view']);
            }
            $res->free();
            // get name of group
            $res =& db_query('group_by_id', $_GET['id']);
            $res->fetchInto($row);
            $name = $row['name'];
            $res->free();
            $form = new HTML_QuickForm('groupForm', 'post', 'index.php?view=admin&task=edit_group&id=' . $_GET['id']);
            $form->addElement('header', null, 'Views for group ' . $name . ' (id: ' . $_GET['id'] . ')');
            // get list of all available views
            $view_paths = glob($cfg['dir']['views'] . '/*.php');
            $views = array();
            // create the checkboxes, add each view to $views for later checking
            foreach ($view_paths as $path) {
                $tmp = explode('.', basename($path));
                $elem =& $form->addElement('checkbox', $tmp[0], $tmp[0]);
                if (in_array($tmp[0], $group_views)) {
                    $elem->setChecked(true);
                }
                array_push($views, $tmp[0]);
            }
            $form->addElement('submit', 'submit', 'Apply Changes');
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                foreach ($views as $view) {
                    $elem =& $form->getElement($view);
                    if ($data[$view] == 1) {
                        auth_set_view($_GET['id'], $view);
                        $elem->setChecked(true);
                    } else {
                        auth_clear_view($_GET['id'], $view);
                        $elem->setChecked(false);
                    }
                }
            }
            $form->display();
            break;
        case 'views':
            $table = new HTML_Table();
            $table->addRow(array('name', 'path'), null, 'TH');
            // display list of views
            $view_paths = glob($cfg['dir']['views'] . '/*.php');
            foreach ($view_paths as $path) {
                $tmp = explode('.', basename($path));
                $table->addRow(array($tmp[0], $path));
            }
            $table->altRowAttributes(1, null, array("class" => "altrow"));
            echo '<div class="overflow">' . $table->toHtml() . '</div>';
            ?>
<p>To add a view, just drop a .php view-module file inside the views directory.
You can remove a view by deleting or renaming the corresponding file
inside the views directory.
</p> 
		<?php 
            break;
        case 'contests':
            $table = new HTML_Table();
            $res =& db_query('contests_list');
            $res->fetchInto($row);
            if ($row) {
                // add contests table headers
                $headers = array_keys($row);
                array_push($headers, 'actions');
                $table->addRow($headers, null, 'TH');
                // add contests table records
                while ($row) {
                    // Get the handle of the manager for displaying
                    $manager_name = '[none]';
                    $res2 =& $db->query($cfg['sql']['user_by_id'], $row['manager']);
                    if (!PEAR::isError($res2)) {
                        $res2->fetchInto($row2);
                        $manager_name = $row2['handle'];
                        $res2->free();
                    }
                    $row['manager'] = $manager_name;
                    // add edit,delete actions
                    $row['actions'] = "<a href=\"index.php?view=admin&amp;task=edit_contest&amp;id={$row['contest_id']}\">edit</a>, " . "<a href=\"index.php?view=admin&amp;task=del_contest&amp;id={$row['contest_id']}\">delete</a>";
                    $table->addRow(array_values($row));
                    $res->fetchInto($row);
                }
                $res->free();
                // decoration
                $table->altRowAttributes(1, null, array("class" => "altrow"));
                echo '<div class="overflow">' . $table->toHtml() . '</div>';
            } else {
                ?>
<p>No contests added yet.</p>			
			<?php 
            }
            echo "<hr />";
            // get list of all available managers
            $res =& db_query('users_by_group_name', 'Managers');
            while ($res->fetchInto($row)) {
                $managers[$row['user_id']] = $row['handle'];
            }
            // form for adding a contest
            $form = new HTML_QuickForm('contestAddForm', 'post', selflink());
            $form->addElement('header', null, 'Add a contest');
            $form->addElement('text', 'name', 'Name:');
            $form->addElement('text', 'description', 'Description:');
            $elem =& $form->addElement('text', 'team_size', 'Size of team:');
            $form->addElement('select', 'division', 'Division:', $cfg['tcl']['divisions']);
            $elem->setValue('1');
            $date = getdate();
            $form->addElement('date', 'show_time', 'Activation time:', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('date', 'begin_time', 'Begin time:', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('date', 'end_time', 'End time:', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('select', 'manager', 'Contest manager:', $managers);
            $form->addElement('submit', null, 'Submit');
            $form->applyFilter('name', 'trim');
            $form->applyFilter('description', 'trim');
            $form->applyFilter('team_size', 'trim');
            $form->addRule('name', 'Contest name is required.', 'required', null, 'client');
            $form->addRule('manager', 'Contest manager is required.', 'required', null, 'client');
            $form->addRule('team_size', 'Team size is required.', 'required', null, 'client');
            // validate or display form
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $data['show_time'] = form2sql_datetime($data['show_time']);
                $data['begin_time'] = form2sql_datetime($data['begin_time']);
                $data['end_time'] = form2sql_datetime($data['end_time']);
                $db->autoExecute('contests', $data, DB_AUTOQUERY_INSERT);
                if (PEAR::isError($res)) {
                    error($db->toString());
                }
                redirect('index.php?view=admin&task=contests');
            } else {
                $form->display();
            }
            break;
        case 'del_contest':
            $res =& db_query('del_contest_by_id', $_GET['id']);
            redirect('index.php?view=admin&task=contests');
            break;
        case 'edit_contest':
            // contest to edit given as arg
            $res =& db_query('contest_by_id', $_GET['id']);
            $res->fetchInto($row);
            $res->free();
            // get list of all available managers
            $res =& db_query('users_by_group_name', 'Managers');
            while ($res->fetchInto($row2)) {
                $managers[$row2['user_id']] = $row2['handle'];
            }
            // form for editing the contest
            $form = new HTML_QuickForm('contestEditForm', 'post', selflink());
            $form->addElement('header', null, "Edit contest {$row['name']} (id: {$row['contest_id']})");
            $form->addElement('text', 'name', 'Name:');
            $form->addElement('text', 'description', 'Description:');
            $elem =& $form->addElement('text', 'team_size', 'Size of team:');
            $elem->setValue('1');
            $form->addElement('select', 'division', 'Division:', $cfg['tcl']['divisions']);
            $date = getdate();
            $form->addElement('date', 'show_time', 'Activation time:', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('date', 'begin_time', 'Begin time:', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('date', 'end_time', 'End time:', array('format' => 'dMY H:i', 'minYear' => $date['year'], 'maxYear' => $date['year'] + 5));
            $form->addElement('select', 'manager', 'Contest manager:', $managers);
            $form->addElement('text', 'rules', 'Rules URL:');
            $form->addElement('submit', null, 'Submit');
            // convert date format and dtore default values
            $row['show_time'] = sql2form_datetime($row['show_time']);
            $row['begin_time'] = sql2form_datetime($row['begin_time']);
            $row['end_time'] = sql2form_datetime($row['end_time']);
            $form->setDefaults($row);
            $form->applyFilter('name', 'trim');
            $form->applyFilter('description', 'trim');
            $form->applyFilter('team_size', 'trim');
            $form->addRule('name', 'Contest name is required.', 'required', null, 'client');
            $form->addRule('manager', 'Contest manager is required.', 'required', null, 'client');
            $form->addRule('team_size', 'Team size is required.', 'required', null, 'client');
            // validate or display form
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $data['show_time'] = form2sql_datetime($data['show_time']);
                $data['begin_time'] = form2sql_datetime($data['begin_time']);
                $data['end_time'] = form2sql_datetime($data['end_time']);
                $db->autoExecute('contests', $data, DB_AUTOQUERY_UPDATE, 'contest_id=' . $_GET['id']);
                if (PEAR::isError($res)) {
                    error($db->toString());
                }
                redirect('index.php?view=admin&task=contests');
            } else {
                $form->display();
            }
            break;
        case 'shell':
            $form = new HTML_QuickForm('shellForm', 'post', selflink());
            $field =& $form->addElement('text', 'command', 'Command:');
            $field->setSize(100);
            $ifield =& $form->addElement('textarea', 'input', 'Standard Input:');
            $ifield->setRows(10);
            $ifield->SetCols(80);
            $form->addElement('submit', null, 'Submit');
            $form->display();
            if ($form->validate()) {
                // Write std input file
                $iname = tempnam("/tmp", "in");
                $ifile = fopen($iname, 'w');
                fwrite($ifile, $form->getSubmitValue('input'));
                fclose($ifile);
                $cmd = $form->getSubmitValue('command');
                echo "<pre class=\"shell_output\">";
                echo "<b>\$ " . html_escape($cmd) . "</b>\n";
                exec("{$cmd} 2>&1 < {$iname}", $out, $ret);
                foreach ($out as $line) {
                    echo html_escape($line) . "\n";
                }
                echo "</pre>\n";
                echo "<p>Command returned: {$ret}</p>\n";
            }
            break;
        case 'uploader':
            // Get list of directories to which files can be uploaded
            $dirs = subdir_list('.');
            array_unshift($dirs, './');
            $form = new HTML_QuickForm('uploaderForm', 'post', selflink());
            $form->addElement('header', null, 'Upload a File:');
            $file =& $form->addElement('file', 'file', 'File:');
            $form->addElement('select', 'dir', 'Destination:', $dirs);
            $form->addElement('submit', 'upload', 'Upload');
            $form->addRule('file', 'Please select file to upload.', 'required', null, 'client');
            $form->setMaxFileSize(10485760);
            // try 10 MB max file size
            if ($form->validate()) {
                if ($file->isUploadedFile()) {
                    $dir = $dirs[$form->getSubmitValue('dir')];
                    if ($file->moveUploadedFile($dir)) {
                        echo "<p>File uploaded successfully to {$dir}.</p>";
                    } else {
                        echo "<p>Failed to save uploaded file to {$dir} (insufficient permissions?).</p>";
                    }
                } else {
                    echo "<p>File upload did not finish successfully</p>";
                }
            }
            $form->display();
            echo "<p><b>Note:</b> Any previous file with the same name will be replaced.</p>";
            echo "<hr />";
            $form = new HTML_QuickForm('mkdirForm', 'post', selflink());
            $form->addElement('header', null, 'Create a Directory:');
            $form->addElement('text', 'name', 'Name:');
            $form->addElement('select', 'dir', 'Destination:', $dirs);
            $form->addElement('submit', 'mkdir', 'Mkdir');
            $form->addRule('name', 'Please enter directory name.', 'required', null, 'client');
            if ($form->validate()) {
                $path = $dirs[$form->getSubmitValue('dir')] . '/' . $form->getSubmitValue('name');
                if (file_exists($path)) {
                    echo "<p><b>Warning:</b> File or directory {$path} already exists.</p>";
                } else {
                    if (mkdir($path)) {
                        echo "<p>Directory {$path} created.</p>";
                    } else {
                        echo "<p>Failed to create directory {$path}. Make sure parent directory permissions allow it.</p>";
                    }
                }
            }
            $form->display();
            break;
        case 'phpinfo':
            phpinfo();
            break;
    }
}
コード例 #24
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;
 }
コード例 #25
0
ファイル: karma.php プロジェクト: stof/pearweb
    $table = new HTML_Table('style="width: 100%"');
    $table->setCaption("Grant karma to " . htmlspecialchars($handle), 'style="background-color: #CCCCCC;"');
    $form = new HTML_QuickForm2('karma_grant', 'post', array('action' => 'karma.php?action=grant'));
    $form->removeAttribute('name');
    $form->addElement('text', 'level')->setLabel('Level:&nbsp;');
    $form->addElement('hidden', 'handle')->setValue(htmlspecialchars($handle));
    $form->addElement('submit', 'submit')->setLabel('Submit Changes');
    $csrf_token_value = create_csrf_token($csrf_token_name);
    $form->addElement('hidden', $csrf_token_name)->setValue($csrf_token_value);
    $table->addRow(array((string) $form));
    echo $table->toHTML();
}
echo "<p>&nbsp;</p><hr />";
$table = new HTML_Table('style="width: 90%"');
$table->setCaption("Karma Statistics", 'style="background-color: #CCCCCC;"');
if (!empty($_GET['a']) && $_GET['a'] == "details" && !empty($_GET['level'])) {
    $table->addRow(array('Handle', 'Granted'), null, 'th');
    foreach ($karma->getUsers($_GET['level']) as $user) {
        $detail = sprintf("Granted by <a href=\"/user/%s\">%s</a> on %s", htmlspecialchars($user['granted_by']), htmlspecialchars($user['granted_by']), htmlspecialchars($user['granted_at']));
        $table->addRow(array(make_link("/user/" . htmlspecialchars($user['user']), htmlspecialchars($user['user'])), $detail));
    }
} else {
    $table->addRow(array('Level', '# of users'));
    foreach ($karma->getLevels() as $level) {
        $table->addRow(array(make_link("karma.php?a=details&amp;level=" . htmlspecialchars($level['level']), htmlspecialchars($level['level'])), htmlspecialchars($level['sum'])));
    }
}
echo $table->toHTML();
echo '<br /><br />';
echo make_link('/admin/karma.php', 'Back');
response_footer();
コード例 #26
0
ファイル: roster.php プロジェクト: acato1/SoftENG
    $sql = "SELECT name FROM testcal";
    $result = $conn->query($sql);
    if ($result) {
        while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        }
    } else {
        echo "Error retrieving class: " . $conn->error;
    }
    $conn->close();
}
require 'includes/html_table.class.php';
$table = new HTML_Table('', 'classTbl');
//$table->setAutoGrow(true);
for ($nr = 0; $nr < count($row); $nr) {
    $tbl .= '<tr style="border: 1px solid black">';
    $table->addRow();
    $col = 0;
    while ($col < 4) {
        if ($nr < count($row)) {
            if ($time[$nr] > 6) {
                $tbl .= '<th style="background-color:#FF1010" width="250">' . $row[$nr] . '</th>';
            } else {
                if ($time[$nr] > 4) {
                    $tbl .= '<th style="background-color:yellow" width="250">' . $row[$nr] . '</th>';
                } else {
                    $tbl .= '<th style="background-color:#00FFFF" width="250">' . $row[$nr] . '</th>';
                }
            }
            //$table->addCell($row[$nr], '', 'data', $color);
        } else {
            $tbl .= '<th style="border: 1px solid black">';
コード例 #27
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;
     }
 }
コード例 #28
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();
 }
コード例 #29
0
<?php

$tbl = new HTML_Table('', 'table table-striped table-bordered');
$tbl->addRow();
$tbl->addCell('FY ID', '', 'header');
$tbl->addCell('FY Description', '', 'header');
$tbl->addCell('Start Date', '', 'header');
$tbl->addCell('End Date', '', 'header');
$tbl->addCell('Status', '', 'header');
$tbl->addCell('Actions', '', 'header');
?>

<?php 
$sql = 'SELECT * FROM ' . DB_PREFIX . $_SESSION['co_prefix'] . 'fiscal_years ORDER by fiscal_year_start_date';
$get_fy = DB::query($sql);
foreach ($get_fy as $fy) {
    $tbl->addRow();
    $tbl->addCell($fy['fiscal_year_id']);
    $tbl->addCell($fy['fiscal_year_desc']);
    $tbl->addCell(getDateTime($fy['fiscal_year_start_date'], "dLong"));
    $tbl->addCell(getDateTime($fy['fiscal_year_end_date'], "dLong"));
    $tbl->addCell($fy['fy_status']);
    $tbl->addCell("<a class='pull btn btn-danger btn-xs' href ='" . $_SERVER['PHP_SELF'] . "?route=modules/gl/setup/financial_periods/edit_fiscal_year&fisca_year_id=" . $fy['fiscal_year_id'] . "'>Edit Fiscal Year&nbsp;&nbsp;<span class='glyphicon glyphicon-edit'></span></a>\n\t\t\t   ");
}
?>
 <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
          		Fiscal Years 
            <small>Defined Fiscal Years for Company Accounts.</small>
          </h1>
コード例 #30
0
if (!isset($soln['language'])) {
    error("No submitted solution for this problem.");
}
require_once $cfg['dir']['languages'] . '/' . $soln['language'] . '.php';
$func = 'lang_' . $soln['language'] . '_description';
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;