* @param <type> $preg * @param <type> $module * @param <type> $func * @return <type> */ function rewrite($preg, $module, $func) { if (!$this->rewrite) { preg_match_all($preg, $_SERVER['REQUEST_URI'], $rt); if (isset($rt['0']['0']) && $rt['0']['0'] != '') { if (isset($rt['1'])) { $args = $rt['1']; } $this->module = $module; $this->function = $func; if (!empty($args)) { $this->parms = array_merge($args, $this->parms); } $this->rewrite = true; } } return $this->rewrite; } } /** * Running */ $app = Import::controller(); $app->App = Import::model(); $re = Import::route(); call_user_func_array(array($app, 'action'), $re->load());
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Import the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Import::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }