first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View 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;