View.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2017 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
12 
13 /**
14  * View defines the interface for all view implementations.
15  *
16  * @author ingo herwig <ingo@wemove.com>
17  */
18 interface View {
19 
20  /**
21  * Assign a value to the view
22  * @param $name The variable name
23  * @param $value The value
24  */
25  public function setValue($name, $value);
26 
27  /**
28  * Get a value from the view
29  * @param $name The variable name
30  * @return Mixed
31  */
32  public function getValue($name);
33 
34  /**
35  * Get all values from the view
36  * @return Array
37  */
38  public function getValues();
39 
40  /**
41  * Clear all values in the view
42  */
43  public function clearAllValues();
44 
45  /**
46  * Render the given template
47  * @param $tplFile The template file
48  * @param $cacheId The id of the view (@see Controller::getCacheId())
49  * @param $display Boolean whether to output the result or return it (default: _true_)
50  */
51  public function render($tplFile, $cacheId=null, $display=true);
52 
53  /**
54  * Clear the cache
55  * @return Integer number of cache files deleted
56  */
57  public static function clearCache();
58 
59  /**
60  * Check if a view is cached
61  * @param $tplFile The template file
62  * @param $cacheId The id of the view (@see Controller::getCacheId())
63  */
64  public static function isCached($tplFile, $cacheId=null);
65 
66  /**
67  * Get the date of the cache entry, if the view is cached
68  * @param $tplFile The template file
69  * @param $cacheId The id of the view (@see Controller::getCacheId())
70  * @return DateTime or null, if not cached
71  */
72  public static function getCacheDate($tplFile, $cacheId=null);
73 
74  /**
75  * Get the template filename for the view from the configfile for the given action key.
76  * @param $controller The name of the controller
77  * @param $context The name of the context
78  * @param $action The name of the action
79  * @return The filename of the template or false, if no view is defined
80  */
81  public static function getTemplate($controller, $context, $action);
82 }
83 ?>
static getCacheDate($tplFile, $cacheId=null)
Get the date of the cache entry, if the view is cached.
static getTemplate($controller, $context, $action)
Get the template filename for the view from the configfile for the given action key.
clearAllValues()
Clear all values in the view.
getValues()
Get all values from the view.
static isCached($tplFile, $cacheId=null)
Check if a view is cached.
static clearCache()
Clear the cache.
View defines the interface for all view implementations.
Definition: View.php:18
render($tplFile, $cacheId=null, $display=true)
Render the given template.
setValue($name, $value)
Assign a value to the view.
getValue($name)
Get a value from the view.