* add pager, orderBy and tag.
This commit is contained in:
@@ -141,9 +141,13 @@ class ai extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function miniPrograms($category = '', $status = '')
|
||||
public function miniPrograms($category = '', $status = '', $orderBy = 'createdDate_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
|
||||
{
|
||||
$programs = $this->ai->getMiniPrograms($category, $status);
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
$order = common::appendOrder($orderBy);
|
||||
|
||||
$programs = $this->ai->getMiniPrograms($category, $status, $order, $pager);
|
||||
foreach($programs as $program)
|
||||
{
|
||||
$program->canPublish = empty($program->published) && $this->ai->canPublishMiniProgram($program);
|
||||
@@ -158,6 +162,8 @@ class ai extends control
|
||||
$this->view->miniPrograms = $programs;
|
||||
$this->view->category = $category;
|
||||
$this->view->status = $status;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -482,6 +482,8 @@ $lang->ai->miniPrograms->statuses = array(
|
||||
'createdByMe' => '由我创建'
|
||||
);
|
||||
|
||||
$lang->ai->miniPrograms->summary = '本页共 %s 个小程序。';
|
||||
|
||||
$lang->ai->models = new stdclass();
|
||||
$lang->ai->models->title = '语言模型配置';
|
||||
$lang->ai->models->common = '语言模型';
|
||||
|
||||
+3
-1
@@ -330,7 +330,7 @@ class aiModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getMiniPrograms($category, $status)
|
||||
public function getMiniPrograms($category = '', $status = '', $order = 'createdDate_desc', $pager = null)
|
||||
{
|
||||
return $this->dao->select('*')
|
||||
->from(TABLE_MINIPROGRAM)
|
||||
@@ -339,6 +339,8 @@ class aiModel extends model
|
||||
->beginIF($status === 'active')->andWhere('published')->eq('1')->fi()
|
||||
->beginIF($status === 'draft')->andWhere('published')->ne('1')->fi()
|
||||
->beginIF($status === 'createdByMe')->andWhere('createdBy')->eq($this->app->user->account)->fi()
|
||||
->orderBy($order)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,14 +93,15 @@
|
||||
<table class="main-table table has-sort-head table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="c-id" style="width: 70px;">ID</td>
|
||||
<td class="c-name" style="width: 30%;"><?= $lang->prompt->name; ?></td>
|
||||
<td class="c-status"><?= $lang->prompt->status; ?></td>
|
||||
<td class="c-category"><?= $lang->prompt->module; ?></td>
|
||||
<td class="c-createdby"><?= $lang->prompt->createdBy; ?></td>
|
||||
<td class="c-createddate"><?= $lang->prompt->createdDate; ?></td>
|
||||
<td class="c-publisheddate"><?= $lang->ai->miniPrograms->latestPublishedDate; ?></td>
|
||||
<td class="c-actions" style="width: 160px;"><?php echo $lang->actions; ?></td>
|
||||
<?php $vars = "category=$category&status=$status&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
|
||||
<th class="c-id" style="width: 70px;"><?php common::printOrderLink('id', $orderBy, $vars, 'ID');?></th>
|
||||
<th class="c-name" style="width: 30%;"><?= $lang->prompt->name; ?></th>
|
||||
<th class="c-status"><?= $lang->prompt->status; ?></th>
|
||||
<th class="c-category"><?= $lang->prompt->module; ?></th>
|
||||
<th class="c-createdby"><?= $lang->prompt->createdBy; ?></th>
|
||||
<th class="c-createddate"><?php common::printOrderLink('createdDate', $orderBy, $vars, $lang->prompt->createdDate); ?></th>
|
||||
<th class="c-publisheddate"><?php common::printOrderLink('publishedDate', $orderBy, $vars, $lang->ai->miniPrograms->latestPublishedDate); ?></th>
|
||||
<th class="c-actions" style="width: 160px;"><?php echo $lang->actions; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -144,6 +145,10 @@
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='table-footer'>
|
||||
<div class="table-statistic"><?php echo sprintf($lang->ai->miniPrograms->summary, count($miniPrograms));?></div>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user