1 | <?php |
||
9 | class Template |
||
10 | { |
||
11 | /** |
||
12 | * An associative array holding the model to be used by this controller |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $model; |
||
16 | |||
17 | /** |
||
18 | * @var string The path to the template file |
||
19 | */ |
||
20 | protected $template; |
||
21 | |||
22 | /** |
||
23 | * Constructor |
||
24 | * |
||
25 | * @param array $model |
||
26 | * @param string $template_path |
||
27 | */ |
||
28 | public function __construct( array $model = array(), $template_path = null ) |
||
33 | |||
34 | /** |
||
35 | * Get model argument value by name. |
||
36 | * |
||
37 | * @param string $name The argument's name. |
||
38 | * |
||
39 | * @return mixed the argument's value. |
||
40 | */ |
||
41 | public function __get( $name ) |
||
48 | |||
49 | /** |
||
50 | * Set model argument by name. |
||
51 | * |
||
52 | * @param string $name The argument's name. |
||
53 | * @param mixed $value The value to set. |
||
54 | * |
||
55 | * @return mixed the settings' argument value. |
||
56 | */ |
||
57 | public function __set( $name, $value ) |
||
61 | |||
62 | /** |
||
63 | * Check if a model argument exists |
||
64 | * |
||
65 | * @param string $name The argument's name. |
||
66 | * @return boolean Whether this arguments exists or not. |
||
67 | */ |
||
68 | public function __isset( $name ) |
||
72 | |||
73 | /** |
||
74 | * Get the current component model data. |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | public function get_model() |
||
82 | |||
83 | /** |
||
84 | * Set the model data for this component. |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | public function set_model( $model ) |
||
92 | |||
93 | /** |
||
94 | * Get the full path to the template file. |
||
95 | * |
||
96 | * @return string The full path. |
||
97 | */ |
||
98 | public function get_template_path() |
||
102 | |||
103 | /** |
||
104 | * Render the template with the local properties. |
||
105 | * |
||
106 | * @return string The rendered template. |
||
107 | * @throws TemplateNotFoundException Thrown if the template file cannot be found. |
||
108 | */ |
||
109 | public function render( $echo = false ) |
||
130 | } |