public function view($id = null) { if (is_int($id)) { parent::view($id); } $this->data->set('pageTitle', strip_tags($this->BlogPost->headline)); $this->AppMetaTags->keywords->fromArray($this->SEOKeywords->extract($this->BlogPost->get('text'))); // save comments if ($this->CommentForm->ok() && $this->request->get('md5') == $this->CommentForm->md5Secret) { $this->CommentForm->toModel($this->Comment); if ($this->Comment->hasField('ip')) { $this->Comment->set('ip', ip2long($this->request->host)); } $this->Comment->foreign_id = $this->BlogPost->id; $this->Comment->set('model', 'BlogPost'); if ($this->UserLogin->loggedin()) { $this->Comment->User = $this->UserLogin->User; } if (!$this->Comment->save()) { $this->CommentForm->errors = $this->Comment->validationErrors; } else { // send comment notification to all admins $this->ViewMailer->send(Registry::get('AdminEmail'), 'commentAdminNotification', __('Neuer Kommentar'), array('Comment' => $this->Comment)); if (isset($this->ActionCache)) { $this->ActionCache->clear($this->name, $this->action); $this->ActionCache->clear($this->name, 'index'); } $this->redirect($this->BlogPost->detailPageUri() . '#Comments'); } } return true; }
public function view($id = null) { if ($id === 1) { $this->set('title_for_layout', 'Home'); } $this->conditions = $this->Acl->conditions(array('contain' => array('DashboardSlot' => array('Widget')))); parent::view($id); }
public function view($id = null) { if (!$id) { $this->Redirect->flash('no_id', array('action' => 'index')); } // load the level $this->Event->id = $id; if ($stackId = $this->Event->field('stack_id')) { $this->_setLevel('stack', $stackId); } elseif ($milestoneId = $this->Event->field('milestone_id')) { $this->_setLevel('milestone', $milestoneId); } elseif ($workspaceId = $this->Event->field('workspace_id')) { $this->_setLevel('stack', $workspaceId); } parent::view($id); }
public function view($id = null, $download = null) { if (!$id) { $this->Redirect->flash('no_id', array('action' => 'index')); } if ($download === 'download') { $this->__download($id); } else { $this->conditions = array('contain' => array('ActiveVersion' => array('User' => array('fields' => array('id', 'name'))), 'User', 'UploadVersion' => array('User' => array('fields' => array('id', 'name'))))); } parent::view($id); // load the level if ($stackId = $this->Upload->field('stack_id')) { $this->_setLevel('stack', $stackId); } elseif ($milestoneId = $this->Upload->field('milestone_id')) { $this->_setLevel('milestone', $milestoneId); } elseif ($workspaceId = $this->Upload->field('workspace_id')) { $this->_setLevel('stack', $workspaceId); } }
public function view($id = null) { if (!$id) { $this->Redirect->flash('no_id', array('action' => 'index')); } $this->conditions = array('contain' => array('AssignedTo', 'TaskGroup', 'Comment' => array('User' => array('fields' => array('id', 'name')), 'order' => array('id' => 'ASC')))); // load the level if ($stackId = $this->Task->field('stack_id')) { $this->_setLevel('stack', $stackId); } elseif ($milestoneId = $this->Task->field('milestone_id')) { $this->_setLevel('milestone', $milestoneId); } elseif ($workspaceId = $this->Task->field('workspace_id')) { $this->_setLevel('stack', $workspaceId); } parent::view($id); }
function view($id = null) { $this->pageTitle = 'My Account'; $user = $this->get_CurrentUser(); $conditions = 'Order.member_id = ' . $user['Member']['id']; $fields = 'Order.id,Order.created,Order.total'; $recursive = 0; if ($this->Roles->authorize(array(RolesComponent::SUPPLIER), false)) { $conditions = 'Order.id IN (SELECT i.order_id FROM orders_items i WHERE i.supplier_id = ' . $user['Supplier']['id'] . ')'; $this->pageTitle = __('ACTIVITY_BRAND', true) . ' ' . __('SUPPLIER_BRANDS', true); } if (!empty($id)) { $conditions .= ' AND Order.id = ' . $id; $fields .= ',Order.cc_trans_id,Order.cc_type,Order.cc_name,Order.cc_expire,Order.add_1,Order.add_2,Order.add_city,Order.add_state,Order.add_zip,Order.add_country'; $recursive = 1; $conditions_items = null; // Limit supplier detail view to their Activities if ($this->Roles->authorize(array(RolesComponent::SUPPLIER), false)) { $conditions_items = 'Items.supplier_id = ' . $user['Supplier']['id']; } $this->Order->hasMany['Items']['conditions'] = $conditions_items; } // Get order data $orders = $this->Order->find('all', array('conditions' => $conditions, 'fields' => $fields, 'order' => 'Order.created DESC', 'recursive' => $recursive)); $this->set('orders', $orders); // Get all member data for the view parent::view($this->Member, $user['Member']['id']); }
function viewActivity(&$id = null) { parent::view($this->Activity, $id); // Walk result and determine if Transactions are allowed $a = array($this->data); array_walk($a, array('AppController', 'set_RuntimeActivityParams')); $this->data = $a[0]; if (!empty($this->params['named']['dt'])) { $this->data['Activity']['dt_selected'] = $this->params['named']['dt']; } return $this->data; }
/** * undocumented * * @author Joshua Davey * @param array $request */ public static function control($request) { // because we allow controllers to be grouped into sub folders we need to recognize this when // someone tries to access them. For example if someone wants to access the 'admin/index' controller // they should be able to just type in 'admin' because 'index' is the default controller in that // group of controllers. To make this possible we check to see if a directory exists that is named // the same as the controller being called and then append the default controller name to the end // so 'admin' becomes 'admin/index' if the admin directory exists. // note: there is a consequence for this feature which means if you have a directory named 'admin' // you can't have a controller named 'Controller_Admin' if (is_dir('application/controllers/' . ucfirst($request['_controller']))) { $request['_controller'] .= '/' . 'index'; } // set controller's class $controllerClassNodes = explode('/', $request['_controller']); foreach ($controllerClassNodes as &$node) { $node = Inflector::camelize($node); } $controllerClassNodes[count($controllerClassNodes) - 1] = ucfirst($controllerClassNodes[count($controllerClassNodes) - 1]); // set controller class $controllerClass = implode('\\', $controllerClassNodes) . 'Controller'; try { $controller = new $controllerClass(); } catch (Exception\AutoloadFail $e) { if (is_dir(self::$pathToProject . 'application/views/' . $request['_controller'])) { $view = $request['_controller'] . '/' . $request['_action']; $request['_controller'] = 'app'; $controller = new \AppController(); $controller->view($view); } elseif (is_file(self::$pathToProject . 'application/views/' . $request['_controller'] . '/' . $request['_action'] . '.' . $request['_format'])) { $view = $request['_controller']; $request['_action'] = $request['_controller']; $request['_controller'] = 'app'; $controller = new \AppController(); $controller->view($view); } else { // no controller or view found = critical error. //header("HTTP/1.1 404 Not Found"); Exception::handle($e, array('message' => 'Missing Controller <strong>' . $controllerClass . "</strong> \n Create File: <strong>application/controllers/" . str_replace('_', DS, $controllerClass) . ".php</strong> \n <code><?php \n class {$controllerClass} extends AppController {\n\n public function " . Inflector::camelize(lcfirst($request['_action'])) . "Action() {\n \n }\n\n }</code>")); return; } } try { // process request $response = $controller->process($request); // delete controller unset($controller); // return response return $response; } catch (controller\exception\MissingAction $e) { //header("HTTP/1.1 404 Not Found"); Exception::handle($e); return; } catch (controller\exception\MissingView $e) { header("HTTP/1.1 404 Not Found"); Exception::handle($e); return; } }
public function view($id = null) { $this->setRelated(); parent::view($id); }
public function view($id = null) { AppController::view($id); $this->set('zeitzonenliste', timezone_identifiers_list()); }