Controller_Widget_Date
extends Controller_Widget
extends Controller_Template
extends Kohana_Controller_Template
extends Controller
extends Kohana_Controller

Abstract controller class for automatic templating.

package
Kohana
category
Controller
author
Kohana Team
copyright
© 2008-2010 Kohana Team
license
http://kohanaframework.org/license

Class declared in APPPATH/classes/controller/widget/date.php on line 3.

Properties

public boolean $auto_render

auto render template

public Request $request

Request that created the controller

public $template

protected $_config

Methods

public __construct( Request $request ) (defined in Kohana_Controller)

Creates a new controller instance. Each controller must be constructed with the request object that created it.

Parameters

  • Request $request required - Request that created the controller

Return Values

  • void

Source Code

public function __construct(Request $request)
{
	// Assign the request to the controller
	$this->request = $request;
}

public action_show( ) (defined in Controller_Widget_Date)

Source Code

public function action_show ($format = 'year-day-hour-min')
{
    $fields = explode('-',strval($format));
    
    $d = getdate();
    $date = "";
    foreach ($fields as $field)
    {
        switch ($field)
        {
            case "min":
                $date .= 'Minutes: '.$d['minutes'].'<br />';
            break;
            
            case "hour":
                $date .= 'Hours: '.$d['hours'].'<br />';
            break;
            
            case "day":
                $date .= 'Day: '.$d['month'].' '.$d['mday'].'<br />';
            break;
            
            case "year":
                $date .= 'Year: '.$d['year'].'<br />';
            break;   
        }    
    }
    
    
    $this->template->page = Request::instance()->action;
    $this->template->date = $date;    
}

public after( ) (defined in Kohana_Controller_Template)

Assigns the template View as the request response.

Source Code

public function after()
{
	if ($this->auto_render === TRUE)
	{
		$this->request->response = $this->template;
	}

	return parent::after();
}

public before( ) (defined in Kohana_Controller_Template)

Loads the template View object.

Source Code

public function before()
{
	if ($this->auto_render === TRUE)
	{
		// Load the template
		$this->template = View::factory($this->template);
	}

	return parent::before();
}

public load_config( ) (defined in Controller_Widget)

Source Code

public function load_config($conf_name,$conf_entry='default')
{
    $this->_config = Kohana::config($conf_name.'.'.$conf_entry);
}
Documentation comments powered by Disqus