JSlip  1.0
View.php
Go to the documentation of this file.
1 <?php
8 class View
9 {
10  public function valid($v) {
11  return ($v) ? '&#9711;' : '&#x2613;';
12  }
13 
14  public function validSelect($v) {
15  $opt = '<option value="true"' . (($v) ? ' selected' : '') . '>&#9711;</option>'
16  . '<option value="false"' . (($v) ? '' : ' selected') . '>&#x2613;</option>'
17  ;
18  return $opt;
19  }
20 
21  public function calendarOption() {
22  $opt = '<option value="ac">西暦</option>'
23  . '<option value="japanese">和暦</option>'
24  ;
25  return $opt;
26  }
27 
28  public function str($str) {
29  return htmlspecialchars($str);
30  }
31 
32  public function strDate($date) {
33  return htmlspecialchars(str_replace('-', '/', $date));
34  }
35 
36  public function strBasic($basic) {
37  return $this->str($basic['disp_name'])
38  . ' ' . $this->str($basic['era']['name']) . '年度'
39  . '(' . $this->strDate($basic['term_begin'])
40  . '~' . $this->strDate($basic['term_end']) . ')'
41  ;
42  }
43 
44  public function week($ymd) {
45  $datetime = new DateTime($ymd);
46  $week = array("日", "月", "火", "水", "木", "金", "土");
47  $w = (int)$datetime->format('w');
48  return $week[$w];
49  }
50 
51  public function checkFlag($flg) {
52  return (empty($flg)) ? '-' : '&#9711;';
53  }
54 
55  public function settledFlag($flg, $settled) {
56  return (empty($flg)) ? '-' : $settled[$flg];
57  }
58 }
View\str
str($str)
Definition: View.php:28
View\strBasic
strBasic($basic)
Definition: View.php:36
View\strDate
strDate($date)
Definition: View.php:32
View
Definition: View.php:8
View\validSelect
validSelect($v)
Definition: View.php:14
View\week
week($ymd)
Definition: View.php:44
View\checkFlag
checkFlag($flg)
Definition: View.php:51
View\valid
valid($v)
Definition: View.php:10
View\settledFlag
settledFlag($flg, $settled)
Definition: View.php:55
View\calendarOption
calendarOption()
Definition: View.php:21