本文整理汇总了PHP中Table::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::render方法的具体用法?PHP Table::render怎么用?PHP Table::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::render方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __async_table
/**
* Method for rendering table
* @return array - AJAX Response
*/
public function __async_table()
{
// Create query to get users
$query = dbQuery('user')->Active(1)->order_by('UserID');
// Create generic table for users
$table = new Table($query);
return array('status' => 1, 'table' => $table->render());
}
示例2: renderTable
public static function renderTable($nav = 0, $page = 0, &$pager = null)
{
// Set new pager
$pager = new \samson\pager\Pager($page, 5, 'field/updatetable/' . $nav . '/');
// Create SamsonCMS fields table
$table = new Table($pager, $nav);
// Render view
return m()->view('index')->title('Дополнительные поля')->set('table', $table->render(null, $nav))->set($pager)->output();
}
示例3: base_list_sql
protected function base_list_sql($entity_name, $cols, $sql)
{
if (empty($cols)) {
throw new Exception('Base list error - Undefined columns for table');
}
$class = ucfirst($entity_name);
if (!class_exists($class)) {
throw new Exception('Base list error - Undefined class ' . $class);
}
$list = $class::getList($sql);
$table = new Table('data-table', $entity_name, $list, $cols, ROOT_HTTP . 'admin/' . $entity_name . '/update', ROOT_HTTP . 'admin/' . $entity_name . '/delete');
$vars = array('list' => $list, 'table' => $table->render());
$this->render('admin/' . $entity_name, $vars);
}
示例4: execute
/**
* Executa comando
*
* @param Object $oInput
* @param Object $oOutput
* @access public
* @return void
*/
public function execute($oInput, $oOutput)
{
$oParametros = new \StdClass();
$oParametros->aArquivos = $oInput->getArgument('arquivos');
$oParametros->iTag = ltrim(strtoupper($oInput->getOption('tag')), 'T');
$oParametros->aMensagens = $oInput->getOption('message');
$oParametros->sData = $oInput->getOption('date');
$oArquivoModel = new ArquivoModel();
$aArquivosCommitados = $oArquivoModel->getCommitados($oParametros);
if (empty($aArquivosCommitados)) {
throw new \Exception("Nenhum arquivo encontrado.");
}
$oOutput->writeln("");
$oBuscaOutputFormatter = new OutputFormatterStyle('red', null, array());
$oOutput->getFormatter()->setStyle('busca', $oBuscaOutputFormatter);
foreach ($aArquivosCommitados as $oDadosCommit) {
$sTitulo = "- <comment>" . date('d/m/Y', strtotime($oDadosCommit->date)) . "</comment> as " . date('H:s:i', strtotime($oDadosCommit->date));
$sTitulo .= " " . count($oDadosCommit->aArquivos) . " arquivo(s) commitado(s)";
$oOutput->writeln($sTitulo);
if (!empty($oDadosCommit->title)) {
$oOutput->writeln("\n " . $oDadosCommit->title);
}
$oTabela = new \Table();
$oTabela->setHeaders(array('1', '1', '1', '1'));
foreach ($oDadosCommit->aArquivos as $oArquivo) {
$sArquivo = $this->getApplication()->clearPath($oArquivo->name);
$sTag = $oArquivo->tag;
$sMensagem = $oArquivo->message;
foreach ($oParametros->aArquivos as $sParametroArquivo) {
$sArquivo = $this->colorirBusca($sArquivo, $sParametroArquivo, 'busca');
}
if (!empty($oParametros->iTag)) {
$sTag = $this->colorirBusca($oArquivo->tag, $oParametros->iTag, 'busca');
}
if (!empty($oParametros->aMensagens)) {
foreach ($oParametros->aMensagens as $sMensagemBuscar) {
$sMensagem = $this->colorirBusca($sMensagem, $sMensagemBuscar, 'busca');
}
}
$oTabela->addRow(array($oArquivo->type, " {$sArquivo}", " {$sTag}", " {$sMensagem}"));
}
$oOutput->writeln(" " . str_replace("\n", "\n ", $oTabela->render(true)));
}
}
示例5: getContents
/**
* Default controller action. This is the default action which is executed
* when no action is specified for a given call.
* @see lib/controllers/Controller::getContents()
*/
public function getContents()
{
if (count($this->listFields) > 0) {
$fieldNames = $this->listFields;
} else {
if ($this->app != null) {
$fieldNames = $this->app->xpath("/app:app/app:list/app:field");
$concatenatedLabels = $this->app->xpath("/app:app/app:list/app:field/@label");
} else {
$fieldNames = array();
$keyField = $this->model->getKeyField();
$fieldNames[$keyField] = "{$this->model->package}.{$keyField}";
$fields = $this->model->getFields();
foreach ($fields as $i => $field) {
if ($field["reference"] == "") {
$fieldNames[$i] = $this->model->package . "." . $field["name"];
} else {
$modelInfo = Model::resolvePath($field["reference"]);
$fieldNames[$i] = $modelInfo["model"] . "." . $field["referenceValue"];
}
}
}
}
foreach ($fieldNames as $i => $fieldName) {
$fieldNames[$i] = substr((string) $fieldName, 0, 1) == "." ? $this->redirectedPackage . (string) $fieldName : (string) $fieldName;
}
if (count($this->fieldNames) > 0) {
$fieldNames = $this->fieldNames;
}
if ($this->apiMode === false) {
$this->setupList();
$params["fields"] = $fieldNames;
$params["page"] = 0;
$params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC"));
$this->table->setParams($params);
$return = '<div id="table-wrapper">' . $this->toolbar->render() . $this->table->render() . '</div>';
} else {
$params["fields"] = $fieldNames;
$params["page"] = 0;
$params["sort_field"] = array(array("field" => $this->model->database . "." . $this->model->getKeyField(), "type" => "DESC"));
$return = json_encode(SQLDBDataStore::getMulti($params));
}
return $return;
}
示例6: process
/**
* Render process
*
* @return string
*/
public function process($items, $pager)
{
$table = new Table(array('name' => $this->name, 'class' => 'table table-bordered table-striped shd', 'fields' => $this->getFields()));
$table->object($items);
return $table->render() . $pager->render();
}
示例7: render
/**
* Method render
* @access public
* @param boolean $ajax_render [default value: false]
* @return mixed
* @since 1.1.9
*/
public function render($ajax_render = false)
{
$gallery_table = new Table();
$gallery_table->setId("PhotoGalleryTable" . rand(0, 999999))->activatePagination();
$header = new RowTable();
for ($i = 0; $i < $this->nb_col; $i++) {
$header->add();
}
$gallery_table->addRow($header->setHeaderClass(0));
$ind = 0;
$last_ind = -1;
$gallery_row = null;
$files = scandir($this->path, 1);
for ($i = 0; $i < sizeof($files); $i++) {
$file = $files[$i];
if ($file != "." && $file != "..") {
$getExt = explode(".", $file);
$countExt = count($getExt);
$fExt = $countExt - 1;
$myExt = $getExt[$fExt];
if ((is_dir($this->path . $file) || $this->in_arrayi($myExt, $this->picture_ext)) && $file != $this->thumbnail_folder) {
if ($ind != $last_ind && $ind % $this->nb_col == 0) {
if ($gallery_row != null) {
$gallery_table->addRow($gallery_row);
}
$gallery_row = new RowTable();
$gallery_row->setWidth("25%");
$last_ind = $ind;
}
if (is_dir($this->path . $file)) {
if ($this->subfolder) {
$folder_pic = new Picture($this->folder_pic, 128, 128, 0, Picture::ALIGN_ABSMIDDLE, $file);
$url = $this->getPage()->getCurrentURL();
if (($pos = find($url, "gallery_event=")) > 0) {
$pos2 = find($url, "&", 0, $pos);
if ($pos2 == 0) {
$url = substr($url, 0, $pos - 1);
} else {
$url1 = substr($url, 0, $pos - 1);
$url2 = substr($url, $pos2, strlen($url));
$url = $url1 . $url2;
}
}
if (find($url, "?") > 0) {
$url = $url . "&";
} else {
$url = $url . "?";
}
$url = $url . "gallery_event=" . urlencode(str_replace($this->original_path, "", $this->path . $file));
$folder_link = new Link($url, Link::TARGET_NONE, new Object($folder_pic, "<br/>", $file));
$gallery_row->add($folder_link);
$ind++;
}
} else {
if ($this->in_arrayi($myExt, $this->picture_ext)) {
$pic_file = str_replace(str_replace("\\", "/", realpath(SITE_DIRECTORY)) . "/", "", str_replace("\\", "/", realpath($this->path)) . "/" . $file);
$pic_file_lower_ext = str_replace("." . $myExt, strtolower("." . $myExt), $pic_file);
if ($pic_file_lower_ext != $pic_file) {
$path_file_lower_ext = str_replace($pic_file, $pic_file_lower_ext, str_replace("\\", "/", realpath(SITE_DIRECTORY . "/" . $pic_file)));
if (!rename(realpath(SITE_DIRECTORY . "/" . $pic_file), $path_file_lower_ext)) {
$pic_file_lower_ext = $pic_file;
}
}
$pic_name = str_replace("." . $myExt, "", $file);
$pic_thumbnail = $pic_file_lower_ext;
if (trim($this->thumbnail_folder) != "") {
if (in_array(strtolower($myExt), array("jpg", "jpeg", "gif", "png"))) {
if (!is_dir(realpath($this->path) . "/" . $this->thumbnail_folder)) {
mkdir(realpath($this->path) . "/" . $this->thumbnail_folder);
}
$pic_thumbnail_path = realpath($this->path . "/" . $this->thumbnail_folder) . "/" . str_replace("." . $myExt, strtolower("." . $myExt), $file);
$pic_thumbnail = str_replace(str_replace("\\", "/", realpath(SITE_DIRECTORY)) . "/", "", str_replace("\\", "/", realpath($this->path . "/" . $this->thumbnail_folder)) . "/" . str_replace("." . $myExt, strtolower("." . $myExt), $file));
if (strtolower($myExt) == "gif") {
// convert to jpg
$pic_thumbnail_path = str_replace(".gif", ".jpg", $pic_thumbnail_path);
$pic_thumbnail = str_replace(".gif", ".jpg", $pic_thumbnail);
}
if (!file_exists($pic_thumbnail_path)) {
if (strtolower($myExt) == "jpg" || strtolower($myExt) == "jpeg") {
jpegReductionFixe($pic_file_lower_ext, $pic_thumbnail_path, 128, 128);
} else {
if (strtolower($myExt) == "png") {
pngReductionFixe($pic_file_lower_ext, $pic_thumbnail_path, 128, 128);
} else {
$tmp_file = realpath($this->path . "/" . $this->thumbnail_folder) . "/temp.jpg";
gif2jpeg($pic_file_lower_ext, $tmp_file);
jpegReductionFixe($tmp_file, $pic_thumbnail_path, 128, 128);
unlink($tmp_file);
}
}
}
}
}
//.........这里部分代码省略.........
示例8: testRenderTableLargerThanScreenEstate
public function testRenderTableLargerThanScreenEstate()
{
$rows = [['TY', 'KT Rolster', 'Terran'], ['Maru', 'Jin Air Green Wings', 'Terran']];
$headers = ['Player', 'Team', 'Race'];
$table = new Table($rows, ['headers' => $headers]);
$table->render(['screenEstate' => ['x' => 13]]);
$expected = <<<EXPECTED
Player | Te ▶
-------+--- ▶
TY | KT ▶
Maru | Ji ▶
EXPECTED;
$this->assertEquals(str_split($expected), str_split($this->getActualOutput()));
$this->expectOutputString($expected);
}
示例9: student
public function student()
{
function isEmpty($value)
{
return strlen('' . $value) == 0;
}
//if ($this->user->firstname == 'fred'){
//echo 'user->school_id ♦ '.$this->user->school_id.'<br>';
//echo (int)empty($this->request->get('school')).'<br>';
//echo $this->request->get('school', 0).'<br>';
//echo 'empty(user->school_id) ♦ '.(int)isEmpty($this->user->school_id).'<br>';
//}
$school_id = !isEmpty($this->user->school_id) ? $this->user->school_id : 1;
//if ($this->user->firstname == 'fred') echo '$school_id ♦ '.$school_id.'<br>';
$school_id = !empty($this->request->get('school')) ? $this->request->get('school') : $school_id;
//if ($this->user->firstname == 'fred') echo '$school_id ♦ '.$school_id.'<br>';
$schools = '';
if ($this->user->isRole('admin') or $this->user->isRole('pdt')) {
$schools = School::getList('SELECT * FROM school ORDER BY name DESC');
}
$where = '';
$where = 'AND school_id=' . $school_id;
if ($this->user->isRole('admin')) {
$where = 'AND school_id=' . $school_id;
}
if ($this->user->isRole('pdt')) {
$where = 'AND school_id=' . $school_id;
}
if ($this->user->isRole('dir')) {
//$school_id = $this->user->school_id;
$where = 'AND school_id=' . $school_id;
}
if ($this->user->isRole('prof')) {
$where = 'AND school_id=' . $school_id;
}
$promos = Promotion::getList('SELECT * FROM session WHERE true ' . $where . ' ORDER BY date_start DESC');
function currentPromo_id($promos)
{
$now = date('Y-m-d');
foreach ($promos as $index => $promo) {
if ($now >= $promo->date_start and $now <= $promo->date_end) {
return $promo->id;
}
}
if (!empty($promo[0])) {
return $promo[0]->id;
} else {
return '0';
}
}
$promo_id = $this->request->get('promo', 0);
if ($promo_id == 0) {
$promo_id = currentPromo_id($promos);
}
$students = Student::getList('SELECT s.*, CONCAT(s.firstname," ",s.lastname)as fullname FROM student as s, session as p WHERE p.id=s.session_id AND p.id=' . $promo_id);
$edit_url = $this->user->canDo('student_update') ? ROOT_HTTP . 'admin/student/update' : '';
$delete_url = $this->user->canDo('student_delete') ? ROOT_HTTP . 'admin/student/delete' : '';
$tableStudents = new Table('data-table', 'student', $students, ['id', 'fullname', 'email'], $edit_url, $delete_url);
//if ($this->user->firstname == 'fred') echo '$school_id ♦ '.$school_id.'<br>';
$vars = ['canAddStudent' => $this->user->canDo('student_create'), 'schools' => $schools, 'school_id' => $school_id, 'promos' => $promos, 'promo_id' => $promo_id, 'table' => $tableStudents->render()];
$this->render('admin/student', $vars);
}
示例10: execute
//.........这里部分代码省略.........
if ($lRemovidos) {
$sArquivosRemovidos = '';
foreach ($aRemovidos as $oArquivoRemovido) {
if (in_array($oArquivoRemovido->sArquivo, $aArquivosParaCommit)) {
continue;
}
$sArquivosRemovidos .= "\n " . $oArquivoRemovido->sArquivo;
$aTabelaModificacoes['R'][] = $oArquivoRemovido->sArquivo;
}
if (!empty($sArquivosRemovidos)) {
$sStatusOutput .= "\n- Arquivos marcados como removido: ";
$sStatusOutput .= "\n <info>{$sArquivosRemovidos}</info>\n";
}
$sArquivosRemovidosLocal = '';
foreach ($aRemovidosLocal as $oArquivoRemovidoLocal) {
if (in_array($oArquivoRemovidoLocal->sArquivo, $aArquivosParaCommit)) {
continue;
}
$sArquivosRemovidosLocal .= "\n " . $oArquivoRemovidoLocal->sArquivo;
$aTabelaModificacoes['-'][] = $oArquivoRemovidoLocal->sArquivo;
}
if (!empty($sArquivosRemovidosLocal)) {
$sStatusOutput .= "\n- Arquivos removidos do projeto local: ";
$sStatusOutput .= "\n <error>{$sArquivosRemovidosLocal}</error>\n";
}
}
/**
* Tabela
* - Lista modificações em tableas
*/
if ($lTabela) {
$oTabela = new \Table();
$oTabela->setHeaders(array('Tipo', 'Arquivo'));
foreach ($aTabelaModificacoes as $sTipo => $aArquivosModificacao) {
$sTipoModificacao = "[{$sTipo}] " . strtr($sTipo, $this->aTiposCommit);
foreach ($aArquivosModificacao as $sArquivoModificacao) {
$oTabela->addRow(array($sTipoModificacao, $sArquivoModificacao));
}
}
if (!empty($aTabelaModificacoes)) {
$sStatusOutputTabela .= "\nModificações nao tratadas: \n";
$sStatusOutputTabela .= $oTabela->render();
}
}
/**
* Push
* - arquivos para commit
*/
if ($lPush) {
/**
* Tabela
* - Lista arquivos prontos para commit em tabela
*/
if ($lTabela) {
$oTabelaCommit = new \Table();
$oTabelaCommit->setHeaders(array('Arquivo', 'Tag Mensagem', 'Tag Arquivo', 'Mensagem', 'Tipo'));
foreach ($aArquivos as $oCommit) {
$sTipo = $oCommit->getTipo();
switch ($oCommit->getComando()) {
case Arquivo::COMANDO_ADICIONAR_TAG:
$sTipo = 'Adicionar tag';
break;
case Arquivo::COMANDO_REMOVER_TAG:
$sTipo = 'Remover tag';
break;
}
$oTabelaCommit->addRow(array($this->getApplication()->clearPath($oCommit->getArquivo()), $oCommit->getTagMensagem(), $oCommit->getTagArquivo(), $oCommit->getMensagem(), $sTipo));
}
if (!empty($aArquivos)) {
$sStatusOutputTabela .= "\nArquivos prontos para commit: \n";
$sStatusOutputTabela .= $oTabelaCommit->render();
}
}
/**
* Sem tabela
* - Lista arquivos prontos para commit em linha
*/
if (!$lTabela) {
foreach ($aArquivos as $oCommit) {
$sListaArquivos .= "\n " . $this->getApplication()->clearPath($oCommit->getArquivo()) . " ";
}
if (!empty($sListaArquivos)) {
$sStatusOutput .= "\n- Arquivos prontos para commit: ";
$sStatusOutput .= "\n <info>{$sListaArquivos}</info>\n";
}
}
}
/**
* Nenhuma modifiação encontrada
*/
if (empty($sStatusOutput) && empty($sStatusOutputTabela)) {
$oOutput->writeln('Nenhuma modificação encontrada');
return 0;
}
if ($lTabela) {
$sStatusOutput = $sStatusOutputTabela;
}
$sStatusOutput = ltrim($sStatusOutput, "\n");
$oOutput->writeln($sStatusOutput);
}
示例11: Evans
$t->add_cell('Pastor');
$t->add_cell('Rev. Dr. Thomas Evans (a.k.a. Pastor Tom)');
$t->add_cell('(407) 277-4351');
$t->add_cell('<a href="mailto:pastor@sspch.org">pastor@sspch.org</a>');
$t->add_row();
$t->add_cell('Director of Music');
$t->add_cell('Jill Heckert');
$t->add_cell('(407) 496-1289');
$t->add_cell('<a href="mailto:music@sspch.org">music@sspch.org</a>');
$t->add_row();
$t->add_cell('Clerk of Session');
$t->add_cell('Georgia Rife');
$t->add_cell('N/A');
$t->add_cell('<a href="mailto:clerk@sspch.org">clerk@sspch.org</a>');
$t->add_row();
$contacts = $t->render();
$page->leftcontent = <<<EOF
<div class="post">
<h4>Staff Contacts</h4>
<div class="contentarea">
{$contacts}
</div>
</div>
EOF;
$page->rightcontent = <<<EOF
<div>
<h4>Office Hours</h4>
<div class="contentarea">
示例12: function
$rows = $db->query('select * from City', PDO::FETCH_OBJ)->fetchAll();
$table = new Table;
$table->add(
array(
array('header' => 'ID', 'value' => function($o) { return $o->ID;}),
array('header' => function() { return 'Name'; }, 'value' => function($o) {return $o->Name; }),
array('value' => 'Test Value')
)
)
->setDataSource($rows);
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="datatables.css" />
<link rel="stylesheet" type="text/css" href="datatables_jui.css" />
</head>
<body>
<? echo $table->render(); ?>
</body>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="datatables.js"></script>
<? echo $table->js(); ?>
</html>
示例13: render
public function render($headers = true)
{
global $redirectedPackage;
$results = $this->tableData;
$this->fields = $results["fieldInfos"];
foreach ($this->fields as $field) {
if ($field["type"] == "number" || $field["type"] == "double" || $field["type"] == "integer") {
$this->headerParams[$field["name"]]["type"] = "number";
}
}
$this->headers = $results["headers"];
array_shift($this->headers);
if ($headers === true) {
$table = $this->renderHeader();
}
if ($this->useAjax) {
$table .= "<tr>\n <td align='center' colspan='" . count($this->headers) . "'>\n <img style='margin:80px' src='/" . Application::getLink(Application::getWyfHome("tapi/images/loading-image-big.gif")) . "' />\n </td></tr>";
} else {
$this->data = $results["data"];
$table .= parent::render(false);
}
if ($headers === true) {
$table .= $this->renderFooter();
}
if ($this->useAjax) {
$this->params['redirected_package'] = $redirectedPackage;
$table .= "<div id='{$this->name}-operations'></div>\n <script type='text/javascript'>\n wyf.tapi.addTable('{$this->name}',(" . json_encode($this->params) . "));\n var externalConditions = [];\n var externalBoundData = [];\n function {$this->name}Search()\n {\n var conditions = '';\n var boundData = [];\n {$this->searchScript}\n wyf.tapi.tables['{$this->name}'].filter = conditions;\n wyf.tapi.tables['{$this->name}'].bind = boundData;\n if(externalConditions['{$this->name}'])\n {\n wyf.tapi.tables['{$this->name}'].filter += ((conditions != '' ?' AND ':'') + externalConditions['{$this->name}']);\n wyf.tapi.tables['{$this->name}'].bind = boundData.concat(externalBoundData);\n }\n wyf.tapi.tables['{$this->name}'].page = 0;\n wyf.tapi.render(wyf.tapi.tables['{$this->name}']);\n }\n </script>";
}
return $table;
}