1: <?php
2: /**
3: * @filesource Kotchasan/Grid.php
4: *
5: * @copyright 2016 Goragod.com
6: * @license http://www.kotchasan.com/license/
7: *
8: * @see http://www.kotchasan.com/
9: */
10:
11: namespace Kotchasan;
12:
13: /**
14: * Grid System.
15: *
16: * @author Goragod Wiriya <admin@goragod.com>
17: *
18: * @since 1.0
19: */
20: class Grid extends \Kotchasan\Template
21: {
22: /**
23: * Construct.
24: */
25: public function __construct()
26: {
27: $this->cols = 1;
28: }
29:
30: /**
31: * คืนค่าจำนวนคอลัมน์ของกริด.
32: *
33: * @return int
34: */
35: public function getCols()
36: {
37: return $this->cols;
38: }
39:
40: /**
41: * กำหนดจำนวนกอลัมน์ของกริด.
42: *
43: * @param int $cols จำนวนคอลัมน์ มากกว่า 0
44: *
45: * @return \static
46: */
47: public function setCols($cols)
48: {
49: $this->cols = max(1, (int) $cols);
50: $this->num = $this->cols;
51:
52: return $this;
53: }
54: }
55: