first commit
This commit is contained in:
49
admin/menu/ArticlesMenu.php
Normal file
49
admin/menu/ArticlesMenu.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Admin\Menu;
|
||||
|
||||
use Query\Operator;
|
||||
|
||||
class ArticlesMenu extends \Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$AS = $this->articlesSections();
|
||||
$AA = [];
|
||||
$SQL = sqlQuery('SELECT id, nick
|
||||
FROM '.getTableName('articles_authors').'
|
||||
ORDER BY nick ASC');
|
||||
foreach ($SQL as $key => $row) {
|
||||
$AA[$key]['id'] = $row['id'];
|
||||
$AA[$key]['nick'] = $row['nick'];
|
||||
}
|
||||
|
||||
return array_merge($vars, [
|
||||
'article_sec' => $AS,
|
||||
'article_aut' => $AA,
|
||||
]);
|
||||
}
|
||||
|
||||
public function articlesSections($topCat = null)
|
||||
{
|
||||
$data = [];
|
||||
$SQL = sqlQueryBuilder()->select('ab.id, ab.name')
|
||||
->from('articles_branches', 'ab')
|
||||
->where(Operator::equalsNullable(['ab.top_branch' => $topCat]))
|
||||
->orderBy('ab.name', 'ASC')
|
||||
->execute();
|
||||
|
||||
foreach ($SQL as $key => $row) {
|
||||
$data[$key]['id'] = $row['id'];
|
||||
$data[$key]['topCat'] = $row['id'];
|
||||
$data[$key]['title'] = $row['name'];
|
||||
$data[$key]['submenu'] = $this->articlesSections($data[$key]['topCat']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
return ArticlesMenu::class;
|
||||
Reference in New Issue
Block a user