first commit
This commit is contained in:
35
admin/lists/NewsList.php
Normal file
35
admin/lists/NewsList.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use KupShop\AdminBundle\AdminList\BaseList;
|
||||
|
||||
class NewsList extends BaseList
|
||||
{
|
||||
protected $tableDef = [
|
||||
'id' => 'a.id',
|
||||
'fields' => [
|
||||
'Nadpis' => ['field' => 'a.title', 'size' => 2.5],
|
||||
'Číslo' => ['field' => 'a.id', 'size' => 0.5],
|
||||
'Zobrazovat novinku' => ['field' => 'a.figure', 'render' => 'renderBoolean', 'size' => 1],
|
||||
'Zobrazen' => ['field' => 'a.seen', 'render' => 'renderSeen', 'size' => 0.5],
|
||||
'Datum přidání' => ['field' => 'datef', 'raw_field' => 'date', 'size' => 1.5],
|
||||
],
|
||||
];
|
||||
|
||||
public function renderSeen($values, $column)
|
||||
{
|
||||
$value = $this->getListRowValue($values, $column['field']);
|
||||
|
||||
return "{$value}x";
|
||||
}
|
||||
|
||||
public function getQuery()
|
||||
{
|
||||
$qb = sqlQueryBuilder()
|
||||
->select('a.id', 'a.title', 'DATE_FORMAT(a.date,\''.$GLOBALS['dbcfg']['date_format'].' '.$GLOBALS['dbcfg']['time_format'].'\') AS datef', 'a.figure', 'a.type', 'a.seen')
|
||||
->from('articles AS a , articles_relation AS ar')
|
||||
->where('a.id=ar.id_art')
|
||||
->andWhere('ar.id_branch=2');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user