Commit 9429f7ad by Trần Văn Minh

chỉnh sửa hiển thị danh sách user

parent 33c1587a
...@@ -21,7 +21,7 @@ class User_model extends CI_Model { ...@@ -21,7 +21,7 @@ class User_model extends CI_Model {
// lấy danh sách các đơn vị tổ chức cùng nhánh // lấy danh sách các đơn vị tổ chức cùng nhánh
$organization_id = $this->session->userdata('organization_id'); $organization_id = $this->session->userdata('organization_id');
$arr = all_child_organization($organization_id); $arr = all_child_organization($organization_id);
array_push($arr, $organization_id); // array_push($arr, $organization_id);
if ($this->session->userdata('account_type') < 4) { if ($this->session->userdata('account_type') < 4) {
if ($this->session->userdata('is_supper_admin') == 0){ if ($this->session->userdata('is_supper_admin') == 0){
if($this->session->userdata('account_type') == 1) { if($this->session->userdata('account_type') == 1) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
$result = account_type($number, $is_supper_admin, $children_org); $result = account_type($number, $is_supper_admin, $children_org);
?> ?>
<?php <?php
function children_orgs($organization, $parent_id = 0, $text = "") function children_orgs($organization, $parent_id = 0,$is_supper_admin, $text = "")
{ {
foreach($organization as $k=>$organ) foreach($organization as $k=>$organ)
{ {
...@@ -15,11 +15,11 @@ function children_orgs($organization, $parent_id = 0, $text = "") ...@@ -15,11 +15,11 @@ function children_orgs($organization, $parent_id = 0, $text = "")
{ {
echo '<option value=\''.$organ['id'].'\''; echo '<option value=\''.$organ['id'].'\'';
if($is_supper_admin == 0) { if($is_supper_admin == 0) {
if($organ['id'] == $organization_id) echo 'disabled'; }; if($organ['id'] == $parent_id) echo 'disabled'; };
echo '>'.$text.' '.$organ['name'].'</option>'; echo '>'.$text.' '.$organ['name'].'</option>';
$id = $organ['id']; $id = $organ['id'];
unset($organization[$k]); unset($organization[$k]);
children_orgs($organization, $id, $text."--"); children_orgs($organization, $id, $is_supper_admin, $text."--");
} }
} }
} }
...@@ -103,9 +103,9 @@ function children_orgs($organization, $parent_id = 0, $text = "") ...@@ -103,9 +103,9 @@ function children_orgs($organization, $parent_id = 0, $text = "")
<?php <?php
if($children_org != array()) { if($children_org != array()) {
if($is_supper_admin == 0) { if($is_supper_admin == 0) {
children_orgs($organization, $organization_id); children_orgs($organization, $organization_id, $is_supper_admin);
} else { } else {
children_orgs($organization); children_orgs($organization,0, $is_supper_admin);
} }
} else { } else {
foreach ($organization as $organ): ?> foreach ($organization as $organ): ?>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
$number = $this->session->userdata('account_type'); $number = $this->session->userdata('account_type');
$result = account_type($number, $is_supper_admin, $children_org); $result = account_type($number, $is_supper_admin, $children_org);
function children_orgs($organization, $parent_id = 0, $text = "") function children_orgs($organization, $parent_id = 0, $is_supper_admin, $text = "")
{ {
foreach($organization as $k=>$organ) foreach($organization as $k=>$organ)
{ {
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
{ {
echo '<option value=\''.$organ['id'].'\''; echo '<option value=\''.$organ['id'].'\'';
if($is_supper_admin == 0) { if($is_supper_admin == 0) {
if($organ['id'] == $organization_id) echo 'disabled'; }; if($organ['id'] == $parent_id) echo 'disabled'; };
if($organ['id'] == $user_data['organization_id']) echo 'selected'; if($organ['id'] == $parent_id) echo 'selected';
echo '>'.$text.' '.$organ['name'].'</option>'; echo '>'.$text.' '.$organ['name'].'</option>';
$id = $organ['id']; $id = $organ['id'];
unset($organization[$k]); unset($organization[$k]);
children_orgs($organization, $id, $text."--"); children_orgs($organization, $id, $is_supper_admin, $text."--");
} }
} }
} }
...@@ -104,9 +104,9 @@ ...@@ -104,9 +104,9 @@
<?php <?php
if($children_org != array()) { if($children_org != array()) {
if($is_supper_admin == 0) { if($is_supper_admin == 0) {
children_orgs($organization, $user_data['organization_id']); children_orgs($organization, $user_data['organization_id'], $is_supper_admin);
} else { } else {
children_orgs($organization); children_orgs($organization, 0, $is_supper_admin);
} }
} else { } else {
foreach ($organization as $organ): ?> foreach ($organization as $organ): ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment