mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
improved group handling
This commit is contained in:
16
webui/controller/common/layout-email.php
Normal file
16
webui/controller/common/layout-email.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class ControllerCommonLayoutemail extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
$this->template = "common/layout-email.tpl";
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
26
webui/controller/common/layout-minimal.php
Normal file
26
webui/controller/common/layout-minimal.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class ControllerCommonLayoutMinimal extends Controller {
|
||||
|
||||
protected function index() {
|
||||
|
||||
|
||||
$this->data['title'] = $this->document->title;
|
||||
|
||||
$this->template = "common/layout-minimal.tpl";
|
||||
|
||||
|
||||
$this->children = array(
|
||||
"common/menu",
|
||||
"common/footer"
|
||||
);
|
||||
|
||||
$this->render();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -7,8 +7,8 @@ class ControllerGroupEmail extends Controller {
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "user/list.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
$this->template = "group/email.tpl";
|
||||
$this->layout = "common/layout-email";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
@ -17,28 +17,60 @@ class ControllerGroupEmail extends Controller {
|
||||
|
||||
$this->load->model('group/group');
|
||||
|
||||
$this->data['page'] = 0;
|
||||
$this->data['page_len'] = get_page_length();
|
||||
|
||||
$this->data['total'] = 0;
|
||||
|
||||
$this->data['sort'] = 'email';
|
||||
|
||||
$this->data['term'] = '';
|
||||
|
||||
if(!isset($this->request->get['term']) || strlen($this->request->get['term']) < 2) { die("no data"); }
|
||||
if(!isset($this->request->get['term']) || strlen($this->request->get['term']) < 1) { die("no data"); }
|
||||
|
||||
if(isset($this->request->get['page']) && is_numeric($this->request->get['page']) && $this->request->get['page'] > 0) {
|
||||
$this->data['page'] = $this->request->get['page'];
|
||||
}
|
||||
|
||||
$this->data['search'] = $this->request->get['term'];
|
||||
|
||||
/* check if we are admin */
|
||||
|
||||
if(Registry::get('admin_user') == 1) {
|
||||
$emails = $this->model_group_group->get_emails_by_string($this->request->get['term']);
|
||||
|
||||
$i = 0;
|
||||
$s = '[ ';
|
||||
// for autocomplete
|
||||
|
||||
foreach($emails as $email) {
|
||||
$i++;
|
||||
$s .= '{ "id": "' . $i . '", "value": "' . $email['email'] . '" },';
|
||||
if(strlen($this->request->get['term']) >= 2) {
|
||||
$emails = $this->model_group_group->get_emails_by_string($this->request->get['term']);
|
||||
|
||||
$i = 0;
|
||||
$s = '[ ';
|
||||
|
||||
foreach($emails as $email) {
|
||||
$i++;
|
||||
$s .= '{ "id": "' . $i . '", "value": "' . $email['email'] . '" },';
|
||||
}
|
||||
|
||||
$s = preg_replace("/,$/", "", $s) . " ]";
|
||||
|
||||
print $s;
|
||||
}
|
||||
|
||||
$s = preg_replace("/,$/", "", $s) . " ]";
|
||||
// for email list
|
||||
|
||||
if(strlen($this->request->get['term']) == 1) {
|
||||
$this->data['emails'] = $this->model_group_group->get_emails_by_string($this->request->get['term'], $this->data['page'], $this->data['page_len']);
|
||||
|
||||
$this->data['total'] = $this->model_group_group->count_emails($this->request->get['term']);
|
||||
|
||||
$this->data['prev_page'] = $this->data['page'] - 1;
|
||||
$this->data['next_page'] = $this->data['page'] + 1;
|
||||
|
||||
$this->data['total_pages'] = floor($this->data['total'] / $this->data['page_len']);
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
print $s;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ class ControllerLoginLogout extends Controller {
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "login/logout.tpl";
|
||||
$this->layout = "common/layout";
|
||||
$this->layout = "common/layout-minimal";
|
||||
|
||||
$request = Registry::get('request');
|
||||
|
||||
|
Reference in New Issue
Block a user