62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
|
|
//include('modules/admin/libraries/tplcontroller.php');
|
|
|
|
class GenerateAdminClass {
|
|
|
|
public $fields_edit;
|
|
public $fields_list;
|
|
public $model;
|
|
public $url;
|
|
public $tpl;
|
|
|
|
public function __construct($model, $fields_edit, $fields_list, $url, $tpl) {
|
|
|
|
$this->model=$model;
|
|
$this->fields_edit=$fields_edit;
|
|
$this->fields_list=$fields_list;
|
|
$this->url=$url;
|
|
$this->tpl=$tpl;
|
|
|
|
|
|
}
|
|
|
|
public function show() {
|
|
|
|
$op=$_GET['op'] ?? '';
|
|
|
|
switch($op) {
|
|
|
|
default:
|
|
|
|
echo $this->list();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function list() {
|
|
|
|
echo $this->tpl->load_template('list', []);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class AppController extends Admin\AdminController\AdminController {
|
|
|
|
public function app($op='') {
|
|
|
|
$admin=new GenerateAdminClass($this->db->tables['useradmin'], ['username', 'password', 'email', 'double_auth', 'theme'], ['username', 'email'], \PhangoApp\PhaRouter\Url::make_url('admin', 'users'), $this->tpl);
|
|
|
|
echo $this->tpl->load_template('users', ['title' => _('Edit users'), 'path_module' => 'admin.users', 'content' => $admin->show()]);
|
|
|
|
}
|
|
|
|
}
|
|
|