JSlip  1.0
UserBasicInfoModel.php
Go to the documentation of this file.
1 <?php
8 require_once(dirname(__FILE__) . '/../../lib/Model.php');
9 
11 {
12  public function getData($bid) {
13 
14  $this->connect();
15  $sql = "SELECT * FROM `t_basic` WHERE `id` = '" . $this->esc($bid) . "'";
16  $rec = $this->getRecord($sql);
17  $this->close();
18 
19  return (empty($rec[0])) ? [] : $rec[0];
20  }
21 
22  public function getRound() {
23 
24  $this->connect();
25  $sql = "SELECT * FROM `c_round` ORDER BY `c0`";
26  $rec = $this->getRecord($sql);
27  $this->close();
28 
29  return $rec;
30  }
31 
32  public function regist($param) {
33 
34  $err = '';
35 
36  $this->connect();
37  $this->begin();
38 
39  try {
40 
41  $sql = "UPDATE `t_basic` SET"
42  . " `disp_name`" . " = '" . $this->esc($param['disp_name']) . "'"
43  . ", `term_year`" . " = '" . $this->esc($param['term_year']) . "'"
44  . ", `term_begin`" . " = '" . $this->esc($param['term_begin']) . "'"
45  . ", `term_end`" . " = '" . $this->esc($param['term_end']) . "'"
46  . ", `round`" . " = '" . $this->esc($param['round']) . "'"
47  . ", `calendar`" . " = '" . $this->esc($param['calendar']) . "'"
48  . ", `update_person`" . " = " . $_SESSION['minfo']['mid']
49  . " WHERE `id` = '" . $this->esc($param['bid']) . "'"
50  ;
51  $ans = $this->query($sql);
52 
53  } catch(Exception $e) {
54  $err = $e->getMessage();
55  }
56 
57  if (empty($err)) {
58  $this->commit();
59  } else {
60  $this->rollback();
61  }
62 
63  $this->close();
64 
65  return $err;
66  }
67 }
Model\connect
connect()
Definition: Model.php:12
Model\begin
begin()
Definition: Model.php:31
Model\query
query($sql)
Definition: Model.php:47
Model\getRecord
getRecord($sql)
Definition: Model.php:55
UserBasicInfoModel
Definition: UserBasicInfoModel.php:10
UserBasicInfoModel\regist
regist($param)
Definition: UserBasicInfoModel.php:32
Model
Definition: Model.php:8
Model\commit
commit()
Definition: Model.php:35
Model\close
close()
Definition: Model.php:27
Model\esc
esc($str)
Definition: Model.php:43
UserBasicInfoModel\getRound
getRound()
Definition: UserBasicInfoModel.php:22
Model\rollback
rollback()
Definition: Model.php:39
UserBasicInfoModel\getData
getData($bid)
Definition: UserBasicInfoModel.php:12