fix
This commit is contained in:
@@ -4,100 +4,25 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Bkoadmin extends Admin_Controller {
|
||||
|
||||
public $template = array(
|
||||
'table_open' => "<table datatable-scroll-y class='table table-striped table-hover table-bordered table-condensed'>",
|
||||
'thead_open' => '<thead class=\'bg-indigo\'>',
|
||||
'thead_close' => '</thead>',
|
||||
'heading_row_start' => '<tr>',
|
||||
'heading_row_end' => '</tr>',
|
||||
'heading_cell_start' => '<th>',
|
||||
'heading_cell_end' => '</th>',
|
||||
'tbody_open' => '<tbody>',
|
||||
'tbody_close' => '</tbody>',
|
||||
'row_start' => '<tr>',
|
||||
'row_end' => '</tr>',
|
||||
'cell_start' => '<td>',
|
||||
'cell_end' => '</td>',
|
||||
'row_alt_start' => '<tr>',
|
||||
'row_alt_end' => '</tr>',
|
||||
'cell_alt_start' => '<td>',
|
||||
'cell_alt_end' => '</td>',
|
||||
'table_close' => '</table>',
|
||||
);
|
||||
|
||||
public function index() {
|
||||
|
||||
$this->load->helper('url');
|
||||
$data = array();
|
||||
|
||||
$this->load->library('table');
|
||||
$this->table->set_template($this->template);
|
||||
|
||||
$data['recent_members'] = "";
|
||||
$mysql = "SELECT id,username,firstname,lastname,added::date,loc,last_login,acc_link FROM members ORDER by id DESC LIMIT 15";
|
||||
$query = $this->db->query($mysql);
|
||||
//$this->table->set_heading( array('data' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px'));
|
||||
$data['recent_members'] = $this->table->generate($query);
|
||||
|
||||
|
||||
$mysql="SELECT '<button type=\"button\" class=\"btn btn-primary\">View</button>' AS View,name,username,email,added,last_login from practice ORDER BY id DESC LIMIT 7";
|
||||
$data['recent_practice'] = "";
|
||||
$query = $this->db->query($mysql);
|
||||
//$this->table->set_heading( array('data' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px'));
|
||||
$data['recent_practice'] = $this->table->generate($query);
|
||||
|
||||
$mysql="SELECT '<a href=\"/practice/viewPendingPractice/'||id||'\"><button type=\"button\" class=\"btn btn-warning\"><i class=\"fa fa-check-circle\"></i></button></a>' AS process,
|
||||
'<button type=\"button\" class=\"btn btn-danger\" id=\"bremail'||id||'\" onclick=\"resendEmail('||id||');\"><i class=\"fa fa-bars\"></i></button>' AS semail,
|
||||
status,
|
||||
practice_name,username,email,added::date from practice_pending ORDER BY id DESC LIMIT 7";
|
||||
$data['pending_practice'] = "";
|
||||
$query = $this->db->query($mysql);
|
||||
//$this->table->set_heading( array('data' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px'));
|
||||
$data['pending_practice'] = $this->table->generate($query);
|
||||
|
||||
|
||||
$this->renderAdminPage('view_dash', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function pendingpractice(){
|
||||
|
||||
$data = array();
|
||||
$data["page_title"] = "Pending Practice";
|
||||
|
||||
$this->load->library('table');
|
||||
$this->table->set_template($this->template);
|
||||
$mysql="SELECT '<button type=\"button\" class=\"btn btn-warning\" onclick=\"approvePractice('||id||');\">Approve</button>' AS process,
|
||||
'<button type=\"button\" class=\"btn btn-danger\" onclick=\"resendEmail('||id||');\">Email</button>' AS semail,
|
||||
status,
|
||||
practice_name,username,email,added::date from practice_pending ORDER BY id DESC LIMIT 20";
|
||||
$data['pending_practice'] = "";
|
||||
|
||||
$mysql = "SELECT '<a href=\"/practice/viewPendingPractice/'||id||'\"><button type=\"button\" class=\"btn btn-warning\"><i class=\"fa fa-check-circle\"></i>View</button></a>' AS View"
|
||||
. ",username,firstname, lastname,email,status,added FROM bko_users ORDER BY username LIMIT 15";
|
||||
|
||||
$data['users_list'] = "";
|
||||
$query = $this->db->query($mysql);
|
||||
//$this->table->set_heading( array('data' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px'));
|
||||
$data['pending_practice'] = $this->table->generate($query);
|
||||
$this->renderAdminPage('view_pendingpractice', $data);
|
||||
}
|
||||
$this->table->set_heading(array('data' => 'View', 'style' => 'width:50px'), 'Username', 'Firstname', 'Lastname', 'Email', 'Status', 'Added');
|
||||
$data['users_list'] = $this->table->generate($query);
|
||||
|
||||
public function pendingusers(){
|
||||
$data = array();
|
||||
$data["page_title"] = "Pending Members";
|
||||
$this->load->library('table');
|
||||
$this->table->set_template($this->template);
|
||||
$data['recent_members'] = "";
|
||||
$mysql = "SELECT id,username,firstname,lastname,added::date,loc,last_login,acc_link FROM members ORDER by id DESC LIMIT 15";
|
||||
$query = $this->db->query($mysql);
|
||||
//$this->table->set_heading( array('data' => 'ID', 'style' => 'width:50px'),'Email', 'Firstname', 'Lastname','Last Login','Location', array('data' => 'ACTION', 'style' => 'width:40px'), array('data' => 'Select', 'style' => 'width:40px'));
|
||||
$data['recent_members'] = $this->table->generate($query);
|
||||
$this->renderAdminPage('view_pendingusers', $data);
|
||||
$data['page_title'] = "Back Offfice Users";
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function renderAdminPage($page_name, $data) {
|
||||
$this->load->view('template/secure_header', $data);
|
||||
$this->load->view('admin/' . $page_name, $data);
|
||||
$this->load->view('template/secure_footer', $data);
|
||||
$this->renderBkoadminPage('view_users', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,46 +64,45 @@ class MCORE_Controller extends CI_Controller {
|
||||
|
||||
/*
|
||||
RET: added=2019-10-01 22:11:40.050111
|
||||
- 20:00:59.180 INFO [11950]: RET: backoffice_id=1
|
||||
- 20:00:59.180 INFO [11950]: RET: email=ses66181@gmail.com
|
||||
- 20:00:59.180 INFO [11950]: RET: firstname=Olusesan
|
||||
- 20:00:59.180 INFO [11950]: RET: id=1
|
||||
- 20:00:59.180 INFO [11950]: RET: lastname=Ameye
|
||||
- 20:00:59.180 INFO [11950]: RET: pass=d0fbea2563b377ea7074bced45c88dcb
|
||||
- 20:00:59.180 INFO [11950]: RET: result=YES I GET TO BACK END
|
||||
- 20:00:59.180 INFO [11950]: RET: sessionid=acabab4686eec2d683d9f7595d4880ba
|
||||
- 20:00:59.180 INFO [11950]: RET: status=1
|
||||
- 20:00:59.180 INFO [11950]: RET: stauts=OK
|
||||
- 20:00:59.180 INFO [11950]: RET: username=oameye
|
||||
*/
|
||||
|
||||
- 20:00:59.180 INFO [11950]: RET: backoffice_id=1
|
||||
- 20:00:59.180 INFO [11950]: RET: email=ses66181@gmail.com
|
||||
- 20:00:59.180 INFO [11950]: RET: firstname=Olusesan
|
||||
- 20:00:59.180 INFO [11950]: RET: id=1
|
||||
- 20:00:59.180 INFO [11950]: RET: lastname=Ameye
|
||||
- 20:00:59.180 INFO [11950]: RET: pass=d0fbea2563b377ea7074bced45c88dcb
|
||||
- 20:00:59.180 INFO [11950]: RET: result=YES I GET TO BACK END
|
||||
- 20:00:59.180 INFO [11950]: RET: sessionid=acabab4686eec2d683d9f7595d4880ba
|
||||
- 20:00:59.180 INFO [11950]: RET: status=1
|
||||
- 20:00:59.180 INFO [11950]: RET: stauts=OK
|
||||
- 20:00:59.180 INFO [11950]: RET: username=oameye
|
||||
*/
|
||||
|
||||
protected function loginAdminUser($data, $out) {
|
||||
|
||||
$data['action'] = MERMSEMR_BKO_LOGIN;
|
||||
// $data['mlog'] = $mlog;
|
||||
// $data['member_id'] = $_SESSION['member_id'];
|
||||
$this->load->model('backend_model');
|
||||
$out = array();
|
||||
$res = $this->backend_model->mermsemr_api($data, $out);
|
||||
|
||||
$data['action'] = MERMSEMR_BKO_LOGIN;
|
||||
// $data['mlog'] = $mlog;
|
||||
// $data['member_id'] = $_SESSION['member_id'];
|
||||
$this->load->model('backend_model');
|
||||
$out = array();
|
||||
$res = $this->backend_model->mermsemr_api($data, $out);
|
||||
//echo $res." -------------------------------------++";
|
||||
$loginReturn = false;
|
||||
$loginReturn = false;
|
||||
|
||||
if ($res == PHP_API_OK && isset($out["sessionid"]) && $out["backoffice_id"] > 0) {
|
||||
$_SESSION['session_id'] = $out['sessionid']; // "";
|
||||
$_SESSION['username'] = $out['username']; // "";
|
||||
$_SESSION['backoffice_id'] = $out['backoffice_id'];
|
||||
$_SESSION['user_firstname'] = $out['firstname'];
|
||||
$_SESSION['user_lastname'] = $out['lastname'];
|
||||
$_SESSION['user_email'] = $out['email'];
|
||||
$_SESSION['user_id'] = $out['backoffice_id'];
|
||||
$_SESSION['current_user'] = $out['firstname'] . " " . $out['lastname'];
|
||||
$loginReturn = true;
|
||||
} else {
|
||||
$data['error_message'] = "Invalid Username or Password";
|
||||
}
|
||||
|
||||
if ( $res==PHP_API_OK && isset($out["sessionid"]) && $out["backoffice_id"] > 0 ){
|
||||
$_SESSION['session_id'] =$out['sessionid']; // "";
|
||||
$_SESSION['username'] = $out['username']; // "";
|
||||
$_SESSION['backoffice_id'] = $out['backoffice_id'];
|
||||
$_SESSION['user_firstname'] = $out['firstname'];
|
||||
$_SESSION['user_lastname'] = $out['lastname'];
|
||||
$_SESSION['user_email'] = $out['email'];
|
||||
$_SESSION['user_id'] = $out['backoffice_id'];
|
||||
$_SESSION['current_user'] = $out['firstname']." " . $out['lastname'];
|
||||
$loginReturn = true;
|
||||
}
|
||||
else {
|
||||
$data['error_message']="Invalid Username or Password";
|
||||
}
|
||||
|
||||
|
||||
return $loginReturn;
|
||||
}
|
||||
|
||||
@@ -164,7 +163,6 @@ class MCORE_Controller extends CI_Controller {
|
||||
|
||||
|
||||
return $str;
|
||||
|
||||
}
|
||||
|
||||
protected function sql_escape_func($inp) {
|
||||
@@ -202,8 +200,6 @@ class MCORE_Controller extends CI_Controller {
|
||||
//$this->load->view('users/view_external_footer');
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function readFixedText($text_key) {
|
||||
|
||||
$page_key = trim($text_key);
|
||||
@@ -256,19 +252,22 @@ class MCORE_Controller extends CI_Controller {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function renderProviderSecurePage($page_name, $data) {
|
||||
|
||||
// you dont have bussines here if you are not in session
|
||||
|
||||
// you dont have bussines here if you are not in session
|
||||
if (!isset($_SESSION['session_id']) or ! isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
||||
redirect(logout);
|
||||
}
|
||||
|
||||
|
||||
$this->load->view('template/provider_header', $data);
|
||||
$this->load->view('provider/' . $page_name, $data);
|
||||
$this->load->view('template/provider_footer', $data);
|
||||
}
|
||||
|
||||
protected function renderBkoadminPage($page_name, $data) {
|
||||
$this->load->view('template/secure_header', $data);
|
||||
$this->load->view('bkoadmin/' . $page_name, $data);
|
||||
$this->load->view('template/secure_footer', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,26 @@
|
||||
|
||||
class Admin_Controller extends MCORE_Controller {
|
||||
|
||||
|
||||
public $template = array(
|
||||
'table_open' => "<table datatable-scroll-y class='table table-striped table-hover table-bordered table-condensed'>",
|
||||
'thead_open' => '<thead class=\'bg-indigo\'>',
|
||||
'thead_close' => '</thead>',
|
||||
'heading_row_start' => '<tr>',
|
||||
'heading_row_end' => '</tr>',
|
||||
'heading_cell_start' => '<th>',
|
||||
'heading_cell_end' => '</th>',
|
||||
'tbody_open' => '<tbody>',
|
||||
'tbody_close' => '</tbody>',
|
||||
'row_start' => '<tr>',
|
||||
'row_end' => '</tr>',
|
||||
'cell_start' => '<td>',
|
||||
'cell_end' => '</td>',
|
||||
'row_alt_start' => '<tr>',
|
||||
'row_alt_end' => '</tr>',
|
||||
'cell_alt_start' => '<td>',
|
||||
'cell_alt_end' => '</td>',
|
||||
'table_close' => '</table>',
|
||||
);
|
||||
public $data = array();
|
||||
|
||||
function __construct() {
|
||||
@@ -12,23 +31,19 @@ class Admin_Controller extends MCORE_Controller {
|
||||
$this->load->helper('url');
|
||||
|
||||
// you dont have bussines here if you are not in session
|
||||
if (!isset($_SESSION['session_id']) or ! isset($_SESSION['backoffice_id']) ) {
|
||||
if (!isset($_SESSION['session_id']) or ! isset($_SESSION['backoffice_id'])) {
|
||||
redirect('/logout');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getSessionArray() {
|
||||
$data["current_date"] = date('l jS \of F Y h:i:s A');
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function refreshAccountDetail($member_id) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -284,13 +284,13 @@
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-static-title">Extra Tools</li>
|
||||
<li class="nav-static-title">Configurations & Tools</li>
|
||||
<li>
|
||||
<a class="has-arrow" href="javascript:void(0)" aria-expanded="false"><i class="nav-icon ti ti-map-alt"></i><span class="nav-title">Pending</span></a>
|
||||
<ul aria-expanded="false">
|
||||
<li> <a href="#">Pending</a> </li>
|
||||
<li> <a href="#">Pending </a> </li>
|
||||
<li> <a href="#">Pending </a> </li>
|
||||
<li> <a href="/bkoadmin">Office Users </a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user