Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('report_model');
     $this->load->model('resource_model');
     $this->load->model('batch_model');
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('pincode_model');
     $this->load->model('profile_model');
     $this->load->model('register_model');
     $this->load->model('sendemail_model');
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('user_model');
     $this->load->model('payment_model');
     $this->load->model('resource_model');
     $this->load->model('batch_model');
     $this->load->model('register_model');
     $this->load->model('pincode_model');
     $this->load->model('sendemail_model');
     $this->load->model('coupon_model');
 }
Пример #4
0
 /**
  * Adjust the $_GET['q'] variable to the proper normal path.
  */
 public static function adjust_q()
 {
     if (isset($_GET['q']) && is_string($_GET['q'])) {
         $qo = $qn = rtrim($_GET['q'], '/');
         if (method_exists('Common_Controller', 'menu_init')) {
             $menu = Common_Controller::menu_init();
             foreach ($menu as $key => $val) {
                 $qn = preg_replace($key, $val, $qo);
                 if ($qn != $qo) {
                     break;
                 }
             }
         }
         $_GET['q'] = simphp_request_path($qn);
     }
 }
Пример #5
0
 public function __construct()
 {
     parent::__construct();
     $user_role = $this->session->userdata('user_role');
     if ($user_role != 7 && $user_role != 3) {
         log_message('debug', 'not student');
         redirect('/previlege_error');
     }
     if ($this->session->userdata('user_id')) {
         if ($this->session->userdata('user_status') == 3) {
             log_message('debug', '************ ASM Controller ***************');
             log_message('debug', '| This User Had Not Done Payment');
             log_message('debug', '*******************************************');
             redirect('/associate/payment');
         }
     }
 }
Пример #6
0
 /**
  * Dispatch request to Controller
  * 
  */
 public function dispatch(Request $request = NULL, Response $response = NULL)
 {
     $request = isset($request) ? $request : new Request();
     $response = isset($response) ? $response : new Response();
     // Import common module
     $flag = import('common/*');
     // Adjust $_GET['q']
     $request->adjust_q();
     // Call possible hooks
     if (method_exists('Common_Controller', 'on_shutdown')) {
         register_shutdown_function(array('Common_Controller', 'on_shutdown'), $request, $response);
     }
     if (method_exists('Common_Controller', 'on_dispatch_before')) {
         Common_Controller::on_dispatch_before($request, $response);
     }
     $module = '';
     $action = '';
     $q = $request->q();
     if ('' == $q) {
         $q = 'default' . $this->qsep . 'index';
     }
     $qarr = explode($this->qsep, $q);
     if (count($qarr) > 0) {
         $module = strtolower($qarr[0]);
         $action = isset($qarr[1]) ? strtolower($qarr[1]) : 'index';
         $moddir = $this->modRootDir() . $module;
         if (is_dir($moddir)) {
             $ctlname = ucfirst($module) . '_Controller';
             $modfile = $moddir . '/' . $ctlname . '.php';
             if (file_exists($modfile)) {
                 // import all class under "$this->modroot/$module/*"
                 import($module, $this->modroot);
                 current_module($module);
                 //save current module
                 // find controller action and dispatch
                 $ctrl = new $ctlname();
                 $menu = $ctrl->menu();
                 //hook menu
                 if (count($menu)) {
                     foreach ($menu as $key => $val) {
                         if (self::qMatchPattern($key, $q)) {
                             $action = $val;
                             break;
                         }
                     }
                 }
                 // dispatch
                 if ('' != $action && $ctrl->action_exists($action)) {
                     // hook init
                     $ctrl->init($action, $request, $response);
                     // dispatch action
                     $ctrl->{$action}($request, $response);
                     // tigger dispatch after hook
                     if (method_exists('Common_Controller', 'on_dispatch_after')) {
                         Common_Controller::on_dispatch_after($request, $response);
                     }
                     exit;
                 }
             }
         }
     }
     throw new NotFoundException();
 }