36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?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;
|
|
}
|
|
}
|