Controller.php
Go to the documentation of this file.00001 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 class Controller extends CI_Base {
00031
00032 var $_ci_scaffolding = FALSE;
00033 var $_ci_scaff_table = FALSE;
00034
00035
00036
00037
00038
00039
00040 function Controller()
00041 {
00042 parent::CI_Base();
00043 $this->_ci_initialize();
00044 log_message('debug', "Controller Class Initialized");
00045 }
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 function _ci_initialize()
00059 {
00060
00061
00062
00063 $classes = array(
00064 'config' => 'Config',
00065 'input' => 'Input',
00066 'benchmark' => 'Benchmark',
00067 'uri' => 'URI',
00068 'output' => 'Output',
00069 'lang' => 'Language',
00070 'router' => 'Router'
00071 );
00072
00073 foreach ($classes as $var => $class)
00074 {
00075 $this->$var =& load_class($class);
00076 }
00077
00078
00079
00080 if (floor(phpversion()) >= 5)
00081 {
00082 $this->load =& load_class('Loader');
00083 $this->load->_ci_autoloader();
00084 }
00085 else
00086 {
00087 $this->_ci_autoloader();
00088
00089
00090 foreach (array_keys(get_object_vars($this)) as $attribute)
00091 {
00092 if (is_object($this->$attribute))
00093 {
00094 $this->load->$attribute =& $this->$attribute;
00095 }
00096 }
00097 }
00098 }
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 function _ci_scaffolding()
00109 {
00110 if ($this->_ci_scaffolding === FALSE OR $this->_ci_scaff_table === FALSE)
00111 {
00112 show_404('Scaffolding unavailable');
00113 }
00114
00115 $method = ( ! in_array($this->uri->segment(3), array('add', 'insert', 'edit', 'update', 'view', 'delete', 'do_delete'), TRUE)) ? 'view' : $this->uri->segment(3);
00116
00117 require_once(BASEPATH.'scaffolding/Scaffolding'.EXT);
00118 $scaff = new Scaffolding($this->_ci_scaff_table);
00119 $scaff->$method();
00120 }
00121
00122
00123 }
00124
00125
00126
00127