2012-06-13 13:49:10 -04:00
|
|
|
<?php
|
|
|
|
/**
|
2015-08-04 16:45:24 -04:00
|
|
|
* meta
|
2012-06-13 13:49:10 -04:00
|
|
|
*
|
2015-08-04 16:45:24 -04:00
|
|
|
* Hierarchial data tool
|
2012-06-13 13:49:10 -04:00
|
|
|
*
|
2015-08-04 16:45:24 -04:00
|
|
|
* @package meta
|
2012-06-13 13:49:10 -04:00
|
|
|
* @author Timothy J. Warren
|
2015-08-04 16:45:24 -04:00
|
|
|
* @copyright Copyright (c) 2012 - 2015
|
|
|
|
* @link https://github.com/aviat4ion/meta
|
2012-06-13 13:49:10 -04:00
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2015-08-04 16:45:24 -04:00
|
|
|
namespace Meta\Base;
|
|
|
|
use Meta\Model\Data as Data_Model;
|
2012-06-13 13:49:10 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Base Controller Class
|
|
|
|
*/
|
2012-06-14 16:33:16 -04:00
|
|
|
class Controller {
|
2012-06-13 13:49:10 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instance of Page class
|
|
|
|
*
|
|
|
|
* @var Page
|
|
|
|
*/
|
|
|
|
protected $page;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create the controller object
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
// Create the page object
|
2012-08-09 16:36:27 -04:00
|
|
|
if (is_null($this->page))
|
|
|
|
{
|
|
|
|
$this->page = new Page();
|
|
|
|
}
|
2015-06-04 15:46:30 -04:00
|
|
|
|
2012-06-13 13:49:10 -04:00
|
|
|
|
2015-08-04 16:45:24 -04:00
|
|
|
$this->data_model = new Data_Model();
|
2012-06-13 13:49:10 -04:00
|
|
|
|
2015-08-04 16:45:24 -04:00
|
|
|
$db = \Meta\Base\db::get_instance();
|
2012-06-13 13:49:10 -04:00
|
|
|
|
2015-08-04 16:45:24 -04:00
|
|
|
$this->page->queries =& $db->queries;
|
2012-06-13 13:49:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for loading a view
|
|
|
|
*
|
|
|
|
* @param string $file
|
|
|
|
* @param array $data
|
|
|
|
* @param bool $return
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2012-06-14 16:33:16 -04:00
|
|
|
public function load_view($file, array $data=array(), $return=FALSE)
|
2012-06-13 13:49:10 -04:00
|
|
|
{
|
2012-06-14 16:33:16 -04:00
|
|
|
return $this->page->load_view($file, $data, $return);
|
2012-06-13 13:49:10 -04:00
|
|
|
}
|
2015-06-04 15:46:30 -04:00
|
|
|
|
2015-06-04 14:30:42 -04:00
|
|
|
// --------------------------------------------------------------------------
|
2015-06-04 15:46:30 -04:00
|
|
|
|
2015-06-04 14:30:42 -04:00
|
|
|
/**
|
|
|
|
* Automate loading of header and footer
|
|
|
|
*
|
|
|
|
* @param string $file
|
|
|
|
* @param array $data
|
|
|
|
* @param bool $return
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function render($file, array $data=array(), $return=FALSE)
|
|
|
|
{
|
|
|
|
return $this->page->render($file, $data, $return);
|
|
|
|
}
|
2012-06-13 13:49:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// End of controller.php
|