Commit 11165036 authored by Anthony.Suerte's avatar Anthony.Suerte

Admin List Pagination Fix

parent 98fd0e78
......@@ -20,25 +20,26 @@ include_once('template/base_head.php');
</colgroup>
<tr>
<th>User Account Number</th>
<td><input type="text" id="s_user_account" name="s_user_account" value="" class="w100p"></td>
<td><input type="text" id="s_user_account" name="s_user_account" value="<?=$this -> getField("sUserAccount")?>" class="w100p"></td>
</tr>
<tr>
<th>Department</th>
<td><?php echo $this -> getDepartmentDropdown(); ?></td>
<td><?php echo $this -> getDepartmentDropdown($this -> getField("sDepartment")); ?></td>
</tr>
<tr>
<th>Name</th>
<td><input type="text" id="s_name" name="s_name" value="" class="w100p"></td>
<td><input type="text" id="s_name" name="s_name" value="<?=$this -> getField("sName")?>" class="w100p"></td>
</tr>
<tr>
<th>Username</th>
<td><input type="text" id="email" name="email" value="" class="w100p"></td>
<td><input type="text" id="email" name="email" value="<?=$this -> getField("userName")?>" class="w100p"></td>
</tr>
<tr>
<td colspan="2">
<span class="th">Date of Last Login</span>
<?php $this -> dispLoginFlg(); ?>
<input type="text" id="s_last_login_from" name="s_last_login_from" value="" class="px110"> - <input type="text" id="s_last_login_to" name="s_last_login_to" value="" class="px110">
<input type="text" id="s_last_login_from" name="s_last_login_from" value="<?=$this -> getField("sLastLoginFrom")?>" class="px110"> -
<input type="text" id="s_last_login_to" name="s_last_login_to" value="<?=$this -> getField("sLastLoginTo")?>" class="px110">
</td>
</tr>
</table>
......
......@@ -12841,7 +12841,22 @@ WHERE
WHERE
1
__ELEMENT01__
__ELEMENT02__
</LIST_ADMIN_USER>
<COUNT_ADMIN_USER>
SELECT
count(*) AS admin_ctr
FROM
v_users_admin AS data
INNER JOIN
t_admin_user_access AS admin_access
ON (admin_access.user_account = data.user_account)
INNER JOIN
t_admin_department AS department
ON (department.ad_id = admin_access.department_id)
WHERE 1
__ELEMENT01__
</COUNT_ADMIN_USER>
<SELECT_ADMIN_USER>
SELECT
data.u_id AS u_id
......
......@@ -23,16 +23,13 @@ class LogicAdminUser extends AdminUserModelClass {
* @return : TRUE:ロジック成功、FALSE:ロジック失敗
-------------------------------------------------------------------------*/
function logic() {
try {
$saveResult = true;
// 初期データ処理
$this -> init();
if($this -> getType() == TYPE_ADMIN_USER_SEARCH_ALL || $this -> getType() == TYPE_ADMIN_USER_LIST || $this -> getType() == NO_STRING) {
$this -> lists();
} elseif($this -> getType() == TYPE_ADMIN_USER_IMPORT) {
if($this -> getType() == TYPE_ADMIN_USER_IMPORT) {
$saveResult = $this -> saveUserAdminCSV();
//check if save has failed
......@@ -70,7 +67,10 @@ class LogicAdminUser extends AdminUserModelClass {
$this -> deleteAdminUser();
$this -> popUpSessionMessage(INFO, 'I_COMPLATE_DELETE', array());
$this -> lists();
} else {
$this -> lists();
}
} catch (Exception $e) {
throw $e;
......@@ -88,6 +88,14 @@ class LogicAdminUser extends AdminUserModelClass {
// データの取得
$where = $this -> getWhere();
//echo "<pre>";
//echo ($this -> setElementParam('LIST_ADMIN_USER', $where));
$totalFetch = $this -> getRowData($this -> accessSelect("COUNT_ADMIN_USER", $where));
$this -> setTotal($this -> getColumnData($totalFetch, 'admin_ctr'));
$this -> setResult($this -> accessSelect('LIST_ADMIN_USER', $where));
$this -> selectDepartmentList();
}
......
......@@ -33,6 +33,8 @@ class AdminUserModelClass extends ModelClassEx {
*
*/
private $lang = NO_STRING;
private $defPageCount = VAR_DEFAULT_PAGE_COUNT;
private $total;
/*-------------------------------------------------------------------------
* @function_name: コントロールパネルシステムindexモデルクラスコンストラクタ
......@@ -296,7 +298,6 @@ class AdminUserModelClass extends ModelClassEx {
// 変数宣言部
$where = NO_STRING;
$rtn = array();
$statuses = array();
//search via useraccount
if($this -> sUserAccount != NO_STRING) {
......@@ -312,6 +313,10 @@ class AdminUserModelClass extends ModelClassEx {
if($this -> sDepartment != NO_STRING) {
$where .= ' AND department.ad_id LIKE (\')%' . $this -> sDepartment . '%(\')';
}
if($this -> userName != NO_STRING) {
$where .= ' AND data.user_name LIKE (\')%' . $this -> userName . '%(\')';
}
//search via last login date (FROM)
if($this -> loginFlg != NO_STRING){
......@@ -327,10 +332,9 @@ class AdminUserModelClass extends ModelClassEx {
}
// ページ数
$start = ($this -> getTargetPage() - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT;
$end = $this -> getTargetPage() * VAR_DEFAULT_PAGE_COUNT;
$start = ($this -> getTargetPage() - VAL_INT_1) * $this -> defPageCount;
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
$page = ' LIMIT ' . $start . DELIMIT_COMMA . $this -> defPageCount;
//chck if search is not search all
if($this -> getType() == TYPE_ADMIN_USER_SEARCH_ALL) {
......@@ -351,6 +355,10 @@ class AdminUserModelClass extends ModelClassEx {
public function setResult($rs) {
$this -> rs = $rs;
}
public function setTotal($total){
$this -> total = $total;
}
/*-------------------------------------------------------------------------
* @function_name: ページャの表示
......@@ -359,8 +367,8 @@ class AdminUserModelClass extends ModelClassEx {
-------------------------------------------------------------------------*/
function dispPager() {
echo $this -> getPagerCommon($this -> getTargetPage()
, $this -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, count($this -> rs))
, count($this -> rs)
, $this -> getTotalPageCommon($this -> defPageCount, $this -> total)
, $this -> total
, NO_STRING);
}
......@@ -495,26 +503,17 @@ class AdminUserModelClass extends ModelClassEx {
$rtn = NO_STRING;
$row = null;
if($this -> isLoopData($this -> rs)) {
$start = ($this -> getTargetPage() - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT;
$end = $this -> getTargetPage() * VAR_DEFAULT_PAGE_COUNT;
$listCount = count($this -> rs);
for($cnt = $start; $cnt < $end && $cnt < $listCount; $cnt++) {
$row = $this -> getRowData($this -> rs, $cnt);
$rtn .= '<tr>'
. '<td>' . $this -> getColumnData($row, COLUMN_USER_ACCOUNT) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_DEPARTMENT_NAME) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_LAST_NAME) . '&nbsp;' . $this -> getColumnData($row, COLUMN_FIRST_NAME) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_MAIL) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_LAST_LOGIN_TIME) . '</td>'
. '<td class="blocka"><a href="javascript:actionDetail(\'' . $this -> getColumnData($row, COLUMN_USER_ACCOUNT) . '\');"><span class="fa fa-info-circle fa-lg"></span></a></td>'
. '</tr>';
if($this -> isLoopData($this -> rs)) {
foreach($this -> rs as $row){
$rtn .= '<tr>'
. '<td>' . $this -> getColumnData($row, COLUMN_USER_ACCOUNT) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_DEPARTMENT_NAME) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_LAST_NAME) . '&nbsp;' . $this -> getColumnData($row, COLUMN_FIRST_NAME) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_MAIL) . '</td>'
. '<td>' . $this -> getColumnData($row, COLUMN_LAST_LOGIN_TIME) . '</td>'
. '<td class="blocka"><a href="javascript:actionDetail(\'' . $this -> getColumnData($row, COLUMN_USER_ACCOUNT) . '\');"><span class="fa fa-info-circle fa-lg"></span></a></td>'
. '</tr>';
}
} else {
$rtn = '<tr><td colspan="6">' . $this -> getMessage(INFO, 'I_NO_SUCHE_SEARCH_DATA', array()) . '</td></tr>';
}
......@@ -580,7 +579,7 @@ class AdminUserModelClass extends ModelClassEx {
</tr>
<tr>
<th>Department</th>
<td>' . $this -> getDepartmentDropdown($this -> getColumnData($row, COLUMN_DEPARTMENT_NAME)) . '</td>
<td>' . $this -> getDepartmentDropdown($this -> getColumnData($row, COLUMN_DEPARTMENT_NAME), true) . '</td>
</tr>
<tr>
<th>Name</th>
......@@ -772,6 +771,10 @@ class AdminUserModelClass extends ModelClassEx {
echo $rtn;
}
public function getField($fieldName){
return $this -> {$fieldName};
}
/*-------------------------------------------------------------------------
* @function_name: setParameterCSV
* @parameter : $adminUserData - array containing admin user data
......@@ -834,7 +837,7 @@ class AdminUserModelClass extends ModelClassEx {
* @parameter : $departName - default null
* @return :
-------------------------------------------------------------------------*/
public function getDepartmentDropdown($departName = null) {
public function getDepartmentDropdown($findWhat = null, $forDepartmentName = false) {
$rtn = NO_STRING;
$departmentList = $this -> getDepartmentList();
......@@ -842,8 +845,10 @@ class AdminUserModelClass extends ModelClassEx {
<option value="">--- All ---</option>';
foreach ($departmentList as $department) {
//check if department name is not null and is equal to the department name of the current option
if($this -> getColumnData($department, COLUMN_NAME) == $departName) {
$comparedColumn = $forDepartmentName ? COLUMN_NAME : COLUMN_AD_ID;
//check if department name is not null and is equal to the department name of the current option
if($this -> getColumnData($department, $comparedColumn) == $findWhat) {
$rtn .= '<option value=' . $this -> getColumnData($department, COLUMN_AD_ID) . ' selected=\'selected\' >' . $this -> getColumnData($department, COLUMN_NAME) . '</option>';
} else {
$rtn .= '<option value=' . $this -> getColumnData($department, COLUMN_AD_ID) . '>' . $this -> getColumnData($department, COLUMN_NAME) . '</option>';
......
......@@ -20,25 +20,26 @@ include_once('template/base_head.php');
</colgroup>
<tr>
<th>ユーザーアカウント</th>
<td><input type="text" id="s_user_account" name="s_user_account" value="" class="w100p"></td>
<td><input type="text" id="s_user_account" name="s_user_account" value="<?=$this -> getField("sUserAccount")?>" class="w100p"></td>
</tr>
<tr>
<th>部門</th>
<td><?php echo $this -> getDepartmentDropdown(); ?></td>
<td><?php echo $this -> getDepartmentDropdown($this -> getField("sDepartment")); ?></td>
</tr>
<tr>
<th>名前</th>
<td><input type="text" id="s_name" name="s_name" value="" class="w100p"></td>
<td><input type="text" id="s_name" name="s_name" value="<?=$this -> getField("sName")?>" class="w100p"></td>
</tr>
<tr>
<th>ユーザー名</th>
<td><input type="text" id="email" name="email" value="" class="w100p"></td>
<td><input type="text" id="email" name="email" value="<?=$this -> getField("userName")?>" class="w100p"></td>
</tr>
<tr>
<td colspan="2">
<span class="th">最終ログイン</span>
<?php $this -> dispLoginFlg(); ?>
<input type="text" id="s_last_login_from" name="s_last_login_from" value="" class="px110"> - <input type="text" id="s_last_login_to" name="s_last_login_to" value="" class="px110">
<input type="text" id="s_last_login_from" name="s_last_login_from" value="<?=$this -> getField("sLastLoginFrom")?>" class="px110"> -
<input type="text" id="s_last_login_to" name="s_last_login_to" value="<?=$this -> getField("sLastLoginTo")?>" class="px110">
</td>
</tr>
</table>
......
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