public function processAction(Model $model, $controller) { if (CakeSession::check('Auth.User') == false) { $controller->redirect($controller->Auth->loginAction); } $model->controller = $controller; $controller->autoRender = false; $params = $controller->request->params; $action = 'index'; $plugin = $params['plugin']; if (!empty($params['pass'])) { $action = array_shift($params['pass']); } $model->action = $action; $controller->set('action', $action); $module = $controller->action; $model->beforeAction(); $result = call_user_func_array(array($model, $action), $params['pass']); $model->afterAction(); if (!is_null($plugin)) { //$name = $plugin . '/' . $name; } if ($model->render === 'auto') { if ($action == 'add' || $action == 'edit') { $controller->render('../Elements/templates/edit'); } else { if ($action == 'view') { $controller->render('../Elements/templates/view'); } } } else { if ($model->render === true) { $controller->render($module . '/' . $action); } else { if ($model->render === 'override') { $controller->render($model->render_override); } else { if ($model->render !== false) { $controller->render($module . '/' . $model->render); } } } } return $result; }