-
Notifications
You must be signed in to change notification settings - Fork 623
/
Copy pathMY_View.php
49 lines (44 loc) · 1.58 KB
/
MY_View.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Ushahidi View class
* Adds extra hooks to views
*
* PHP version 5
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
*
* @author Ushahidi Team <team@ushahidi.com>
* @package Ushahidi - http://source.ushahididev.com
* @subpackage Controllers
* @copyright Ushahidi - http://www.ushahidi.com
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
*/
class View extends View_Core
{
// Save name for use in hook
protected $name = FALSE;
public function __construct($name = NULL, $data = NULL, $type = NULL)
{
$this->name = $name;
parent::__construct($name, $data, $type);
}
/**
* Renders a view.
*
* Add an additional filter to modify view data
*
* @param boolean set to TRUE to echo the output instead of returning it
* @param callback special renderer to pass the output through
* @return string if print is FALSE
* @return void if print is TRUE
*/
public function render($print = FALSE, $renderer = FALSE)
{
// Run view_pre_render filter to allow plugins/themes to add extra data to a view
Event::run('ushahidi_filter.view_pre_render', $this->kohana_local_data);
// View specific hook pre render hook ie. ushahidi_filter.view_pre_render.reports_main
Event::run('ushahidi_filter.view_pre_render.'.str_replace('/','_',$this->name), $this->kohana_local_data);
return parent::render($print, $renderer);
}
}