<?php
require BASEPATH.'core/Controller.php';
include_once 'WebContext.php';
class BaseController extends CI_Controller {
var $webContext;
function __construct() {
parent::__construct();
date_default_timezone_set('Asia/Ulaanbaatar');
$this->webContext = new WebContext();
}
function ip() {
return $this->input->ip_address();
}
function user() {
return $this->webContext->getCurrentUser();
}
}
?>
BorooController.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
interface IInterface0
{
}
interface IInterface1 extends IInterface0
{
}
class boroo extends BaseController implements IInterface1 {
function __construct() {
parent::__construct();
$clss = class_parents($this);
foreach($clss as $cls)
{
if (substr($cls,0,3) == 'CI_')
if(is_subclass_of($this, 'BaseController') && is_subclass_of($this, 'CI_Controller'))
echo $cls.' is yes<br>';
}
}
public function hello()
{
global $RTR;
global $RTR;
$expire = (7 * 24 * 60 * 60);
$this->input->set_cookie("time", time(), $expire);
$time = $this->input->cookie('time');
$dstr = date('Y-m-d H:i:s', $time);
$data['message'] = 'Date is '.$dstr.', IP is '.$this->ip();
$this->load->view($RTR->fetch_directory().$RTR->fetch_class().'/hello',$data);
}
}
No comments:
Post a Comment