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 (optional, @see Response::getCacheId())
49  * @param $cacheLifetime The cache lifetime in seconds (optional, default: implementation specific)
50  * @param $display Boolean whether to output the result or return it (default: _true_)
51  */
52  public function render($tplFile, $cacheId=null, $cacheLifetime=null, $display=true);
53 
54  /**
55  * Clear the cache
56  * @return Integer number of cache files deleted
57  */
58  public static function clearCache();
59 
60  /**
61  * Check if a view is cached
62  * @param $tplFile The template file
63  * @param $cacheId The id of the view (@see Controller::getCacheId())
64  */
65  public static function isCached($tplFile, $cacheId=null);
66 
67  /**
68  * Get the date of the cache entry, if the view is cached
69  * @param $tplFile The template file
70  * @param $cacheId The id of the view (@see Controller::getCacheId())
71  * @return DateTime or null, if not cached
72  */
73  public static function getCacheDate($tplFile, $cacheId=null);
74 
75  /**
76  * Get the template filename for the view from the configfile for the given action key.
77  * @param $controller The name of the controller
78  * @param $context The name of the context
79  * @param $action The name of the action
80  * @return The filename of the template or false, if no view is defined
81  */
82  public static function getTemplate($controller, $context, $action);
83 }
84 ?>
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, $cacheLifetime=null, $display=true)
Render the given template.
setValue($name, $value)
Assign a value to the view.
getValue($name)
Get a value from the view.