Modules

Controller_Stat
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-2012 Kohana Team
license
http://kohanaframework.org/license

Class declared in APPPATH\classes\Controller\Stat.php on line 3.

Properties

public boolean $auto_render

auto render template

Default value:
bool TRUE

public Request $request

Request that created the controller

Default value:
NULL

public Response $response

The response that will be returned from controller

Default value:
NULL

public $template

Default value:
string(8) "template"

Methods

public action_index( ) (defined in Controller_Stat)

Source Code

public function action_index()
{
	//echo Debug::vars('19', $_GET); 
	$content = View::factory('dashboard', array(
	'list' => 'Панель управления.',
	));
		
       $this->template->content = $content;
   }

public action_regData( ) (defined in Controller_Stat)

Source Code

public function action_regData() //регистрация полученных данных о температуре
{
	//echo Debug::vars('29', $_GET); exit;
	$name=Arr::get($_GET, 'name');
	$value=Arr::get($_GET,'value');
	//echo Debug::vars('31', $name, $value); exit;
	$res=Model::factory('Stat')->regData($name, $value);
	$this->redirect('stat');
}

public before( ) (defined in Controller_Stat)

Loads the template View object.

Source Code

public function before()
{
	parent::before();
	
}	

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->response->body($this->template->render());
	}

	parent::after();
}

public __construct( Request $request , Response $response ) (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
  • Response $response required - The request's response

Return Values

  • void

Source Code

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

	// Assign a response to the controller
	$this->response = $response;
}

public execute( ) (defined in Kohana_Controller)

Executes the given action and calls the Controller::before and Controller::after methods.

Can also be used to catch exceptions from actions in a single place.

  1. Before the controller action is called, the Controller::before method will be called.
  2. Next the controller action will be called.
  3. After the controller action is called, the Controller::after method will be called.

Tags

Return Values

  • Response

Source Code

public function execute()
{
	// Execute the "before action" method
	$this->before();

	// Determine the action to use
	$action = 'action_'.$this->request->action();

	// If the action doesn't exist, it's a 404
	if ( ! method_exists($this, $action))
	{
		throw HTTP_Exception::factory(404,
			'The requested URL :uri was not found on this server.',
			array(':uri' => $this->request->uri())
		)->request($this->request);
	}

	// Execute the action itself
	$this->{$action}();

	// Execute the "after action" method
	$this->after();

	// Return the response
	return $this->response;
}

public static redirect( [ string $uri = string(0) "" , int $code = integer 302 ] ) (defined in Kohana_Controller)

Issues a HTTP redirect.

Proxies to the HTTP::redirect method.

Parameters

  • string $uri = string(0) "" - URI to redirect to
  • int $code = integer 302 - HTTP Status code to use for the redirect

Tags

Source Code

public static function redirect($uri = '', $code = 302)
{
	return HTTP::redirect( (string) $uri, $code);
}

protected check_cache( [ string $etag = NULL ] ) (defined in Kohana_Controller)

Checks the browser cache to see the response needs to be returned, execution will halt and a 304 Not Modified will be sent if the browser cache is up to date.

$this->check_cache(sha1($content));

Parameters

  • string $etag = NULL - Resource Etag

Return Values

  • Response

Source Code

protected function check_cache($etag = NULL)
{
	return HTTP::check_cache($this->request, $this->response, $etag);
}
Documentation comments powered by Disqus