Added list functions
This commit is contained in:
parent
e3775e1045
commit
2226e91faf
11 changed files with 116 additions and 9 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "modules/admin/media/js/jsutils"]
|
||||
path = modules/admin/media/js/jsutils
|
||||
url = https://git.cuchulu.com/paramecio/jsutils
|
||||
|
|
@ -36,7 +36,7 @@ spl_autoload_register(function($class_name) {
|
|||
}
|
||||
else if(is_file('modules/'.$module.'/libraries/'.strtolower($arr_library[1]).'.php')) {
|
||||
|
||||
include('modules/'.$module.'/libraries/'.strtolower($arr_library[1]).'.php');
|
||||
include_once('modules/'.$module.'/libraries/'.strtolower($arr_library[1]).'.php');
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ use PHPMailer\PHPMailer\Exception;
|
|||
|
||||
//include('./modules/admin/libraries/login.php');
|
||||
|
||||
include('modules/admin/libraries/tplcontroller.php');
|
||||
//include('modules/admin/libraries/tplcontroller.php');
|
||||
|
||||
class AppController extends TplController{
|
||||
class AppController extends TplController {
|
||||
|
||||
public function app($op='') {
|
||||
|
||||
|
|
|
|||
62
modules/admin/controllers/users.php
Normal file
62
modules/admin/controllers/users.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?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()]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
25
modules/admin/libraries/admincontroller.php
Normal file
25
modules/admin/libraries/admincontroller.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Admin\AdminController;
|
||||
|
||||
use PhangoApp\WPDO;
|
||||
use PhaTemplates\Templates;
|
||||
|
||||
//include('modules/admin/libraries/tplcontroller.php');
|
||||
|
||||
class AdminController extends \Admin\TplController\TplController {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if(!$this->check_login()) {
|
||||
|
||||
header('Location: '.\PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['login']));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Admin\TplController;
|
||||
|
||||
use PhangoApp\WPDO;
|
||||
use PhaTemplates\Templates;
|
||||
|
||||
class TplController extends PhangoApp\PhaRouter\Controller {
|
||||
class TplController extends \PhangoApp\PhaRouter\Controller {
|
||||
|
||||
public $tpl;
|
||||
public $db;
|
||||
|
|
@ -35,12 +37,12 @@ class TplController extends PhangoApp\PhaRouter\Controller {
|
|||
|
||||
if($timestamp_5_min>$timestamp_last_login) {
|
||||
|
||||
header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['logout']));
|
||||
header('Location: '.\PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['logout']));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['check_auth']));
|
||||
header('Location: '.\PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['check_auth']));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
1
modules/admin/media/js/jsutils
Submodule
1
modules/admin/media/js/jsutils
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a915e7be5a47709ad98c38b298893e254876a166
|
||||
|
|
@ -91,7 +91,7 @@ foreach(PhangoApp\PhaRouter\Config::$modules_allowed as $module) {
|
|||
$link_text=$admin[0];
|
||||
|
||||
?>
|
||||
<li><a href="<?=$this->make_url($admin[1])?>" class="<?=$class_selected?>">
|
||||
<li><a href="<?=$admin[1]?>" class="<?=$class_selected?>">
|
||||
<?=$icon_module?>
|
||||
<?=$link_text?>
|
||||
</a>
|
||||
|
|
|
|||
8
modules/admin/templates/list.php
Normal file
8
modules/admin/templates/list.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?=$this->start('footer_js')?>
|
||||
<table>
|
||||
|
||||
</table>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<?=$this->end('footer_js')?>
|
||||
4
modules/admin/templates/users.php
Normal file
4
modules/admin/templates/users.php
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?=$this->layout('layout', ['title' => $title, 'path_module' => 'admin.home'])?>
|
||||
<?=$this->start('content')?>
|
||||
<?=$content?>
|
||||
<?=$this->end('content')?>
|
||||
|
|
@ -127,7 +127,9 @@ class Templates {
|
|||
|
||||
public function end($section_name) {
|
||||
|
||||
$this->section_content[$section_name]=ob_get_contents();
|
||||
$this->section_content[$section_name]=$this->section_content[$section_name] ?? '';
|
||||
|
||||
$this->section_content[$section_name].=ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue