8 require_once(dirname(__FILE__) .
'/../../lib/View.php');
9 require_once(dirname(__FILE__) .
'/../../lib/Controller.php');
10 require_once(dirname(__FILE__) .
'/UserSectionModel.php');
12 define(
'PAGER_RPP', 10);
31 $this->bid = $_SESSION[
'minfo'][
'bid'];
33 $this->view =
new View();
35 $this->param[
'base'] = dirname(__FILE__);
37 $basic = $this->model->getBasicByBid($this->bid);
40 $this->
_error(
'基本情報が見つかりません。');
46 if (empty($this->param[
'act'])) {
49 switch ($this->param[
'act']) {
50 case 'create': $this->
_create();
break;
51 case 'drop': $this->
_drop();
break;
52 case 'edit': $this->
_edit();
break;
53 case 'remember': $this->
_remember();
break;
54 case 'search': $this->
_search();
break;
55 case 'check': $this->
_check();
break;
56 case 'regist': $this->
_regist();
break;
57 default: $this->
_list();
break;
64 $this->viewName =
'user_section_err';
70 $this->viewName =
'user_section_list';
75 'pager' => [
'page' => 1,
'rpp' =>
PAGER_RPP],
78 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
80 $_SESSION[
'user_section_list_cnd'] = $this->dat[
'cnd'];
85 $this->viewName =
'user_section_list';
88 'cnd_kana' => $this->param[
'cnd_kana'],
89 'cnd_name' => $this->param[
'cnd_name'],
90 'pager' => [
'page' => $this->param[
'page_curr'],
'rpp' =>
PAGER_RPP],
93 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
95 $_SESSION[
'user_section_list_cnd'] = $this->dat[
'cnd'];
100 $this->viewName =
'user_section_list';
101 $this->dat[
'cnd'] = $_SESSION[
'user_section_list_cnd'];
102 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
107 $this->viewName =
'user_section_edit';
108 $this->dat = $this->model->getData($this->param[
'id']);
115 $insert = (empty($this->param[
'insert'])) ?
false :
true;
116 $kana = $this->param[
'kana'];
117 $name = $this->param[
'name'];
120 $err[] =
'部門(かな)は必須です。';
127 if ($this->model->chkDup($name) > 0) {
128 $err[] =
'部門名は既に存在します。';
132 $this->rest = json_encode([
'sts' =>
'OK']);
134 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
140 $insert = (empty($this->param[
'insert'])) ?
false :
true;
143 $err = $this->model->insert($this->param);
145 $err = $this->model->regist($this->param);
149 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
153 $this->rest = json_encode([
'sts' =>
'OK']);
158 $this->viewName =
'user_section_create';
163 $err = $this->model->delete($this->param);
166 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
170 $this->rest = json_encode([
'sts' =>
'OK']);