<?php
/**
 * 领导机构-二维码管理
 * $Id: government_qr_list.php,v 1.1 2020/01/03 11:18:46  Exp $
 * @author lixq
 * @package manager.public_html
 */
// 底层包含
require_once("manager_include.inc");

// 登录检查
require_once("check_login.inc");

// 权限检查
if (!checkAuthority("2")) {
	// エラー表示
	$layout_pages = array();
	$layout_pages["left"] = "menu.inc";
	$layout_pages["right"] = "error.inc";
	$message = "权限不足，请联系系统管理员。";
	require_once(MANAGER_TEMPLATE_DIR_PATH . "/layout/leftmenu_layout.inc");
	exit;
}

$id = ParamUtil::getRequestString("id");
$government_mst = GovernmentMst::getById($id);
if ($government_mst == null) {
  // エラー表示
  $layout_pages = array();
  $layout_pages["left"] = "menu.inc";
  $layout_pages["right"] = "error.inc";
  require_once(MANAGER_TEMPLATE_DIR_PATH . "/layout/leftmenu_layout.inc");
  exit;
}


$government_qr_list = [];
$order_key = ParamUtil::getRequestString("order_key", "id");
$sort = ParamUtil::getRequestString("sort", "DESC");
$page_num = ParamUtil::getRequestNumber("page_num", 1);
$page_row = MANAGER_DEFAULT_ROW_COUNT;
$paging_url_link = "./government_qr_list.php";
// 一览取得
$param = array();
$param["delete_flg"] = false;
$param["government_id"] = $id;
//总件数
$government_qr_count = GovernmentQrDat::getListCount($param);
// 获取相应页面的数据
if ($government_qr_count > 0) {
  $offset = ($page_num - 1) * $page_row;
  $government_qr_list = GovernmentQrDat::getList($param, $order_key, $sort, $offset, $page_row);
  $page_count = ceil($government_qr_count / $page_row);
  $show_page_num = MANAGER_PAGING_SHOW_PAGE_COUNT;
  $page_range = PagingHandler::getPageRange($page_num, $page_count, $show_page_num);
  $page_first = $page_range[0];
  $page_end = $page_range[1];
}


// ページ
$layout_pages = array();
$layout_pages["left"] = "menu.inc";
$layout_pages["right"] = "government_qr_list.inc";
$layout_pages["menu_clicked"] = "5-2";
require_once(MANAGER_TEMPLATE_DIR_PATH . "/layout/leftmenu_layout.inc");
exit;