/** * Show the list of campaigns. */ function listCampaigns() { if (isset($this->viewList[$this->view])) { return call_user_func_array($this->viewList[$this->view], array(&$this)); } $pageNum = (int) edkURI::getArg('page'); switch ($this->view) { case '': $activelist = new ContractList(); $activelist->setActive('yes'); $this->page->setTitle('Active campaigns'); $table = new ContractListTable($activelist); $table->paginate(10, $pageNum); return $table->generate(); break; case 'past': $pastlist = new ContractList(); $pastlist->setActive('no'); $this->page->setTitle('Past campaigns'); $table = new ContractListTable($pastlist); $table->paginate(10, $pageNum); return $table->generate(); break; } return $html; }
function campaigns() { // Display campaigns, if any. if (Killboard::hasCampaigns(true)) { $html = ''; $html .= "<div class=\"kb-campaigns-header\">Active campaigns</div>"; $list = new ContractList(); $list->setActive("yes"); $list->setCampaigns(true); $table = new ContractListTable($list); $html .= $table->generate(); return $html; } }
/** * Generates a table for this list of contracts. * @return string Valid HTML for this list of contracts. */ function generate() { if ($table = $this->getTableStats()) { global $smarty; $smarty->assign('contract_getactive', $this->contractlist->getActive()); $smarty->assignByRef('contracts', $table); $pagesplitter = new PageSplitter($this->contractlist->getCount(), 10); return $smarty->fetch(get_tpl('contractlisttable')) . $pagesplitter->generate(); } else { return ""; } }
<?php /** * @package EDK */ require_once 'common/admin/admin_menu.php'; $page = new Page(); $page->setAdmin(); $ctrID = (int) edkURI::getArg('ctr_id'); if (edkURI::getArg('op') == 'view') { $page->setTitle('Administration - Campaigns'); $list = new ContractList(); $html = '[<a href="' . edkuri::build(array('op', 'add', false)) . '">Add</a>]<br />'; if ($list->getCount() > 0) { $html .= '<table class="kb-table" cellspacing="1">'; $html .= "<tr class='kb-table-header'><td class='kb-table-cell' width='160'>Name</td><td class='kb-table-cell' width='80'>Startdate</td><td class='kb-table-cell' width='80'>Enddate</td><td class='kb-table-cell' width='140' colspan='2' align='center'>Action</td></tr>"; } while ($contract = $list->getContract()) { $html .= "<tr class='kb-table-row-odd'>"; $html .= "<td class='kb-table-cell'>" . $contract->getName() . "</td>"; $html .= "<td class='kb-table-cell'>" . substr($contract->getStartDate(), 0, 10) . "</td>"; $html .= "<td class='kb-table-cell'>" . substr($contract->getEndDate(), 0, 10) . "</td>"; $html .= '<td class="kb-table-cell" align="center" width="70"><a href="' . edkuri::build(array(array('ctr_id', $contract->getID(), false), array('op', 'edit', false))) . '">Edit</a></td><td align="center"><a href="' . edkuri::build(array(array('ctr_id', $contract->getID(), false), array('op', 'del', false))) . '">Delete</a></td>'; $html .= "</tr>"; } if ($list->getCount() > 0) { $html .= "</table><br />"; } if ($list->getCount() > 10) { $html .= '[<a href="' . edkuri::build(array('op', 'add', false)) . '">Add</a>]'; }
/** * Returns HTML string for campaigns, if any. * @return string HTML string for campaigns, if any */ function campaigns() { // Display campaigns, if any. if (Killboard::hasCampaigns(true) && $this->isCurrentPeriod()) { $html = "<div class='kb-campaigns-header'>Active campaigns</div>"; $list = new ContractList(); $list->setActive("yes"); $table = new ContractListTable($list); $html .= $table->generate(); return $html; } }