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 | * Get the current component model data. |
||
64 | * |
||
65 | * @return array |
||
66 | */ |
||
67 | public function get_model() |
||
71 | |||
72 | /** |
||
73 | * Set the model data for this component. |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | public function set_model( $model ) |
||
81 | |||
82 | /** |
||
83 | * Get the full path to the template file. |
||
84 | * |
||
85 | * @return string The full path. |
||
86 | */ |
||
87 | public function get_template_path() |
||
91 | |||
92 | /** |
||
93 | * Render the template with the local properties. |
||
94 | * |
||
95 | * @return string The rendered template. |
||
96 | * @throws TemplateNotFoundException Thrown if the template file cannot be found. |
||
97 | */ |
||
98 | public function render( $echo = false ) |
||
119 | } |