public function updateAction() { if ($this->request->isPost()) { $coordinationsUid = $this->request->hasPost('uid') ? $this->request->getPost('uid') : 0; $coordination = Coordinations::findFirstByUid($coordinationsUid); if ($coordination) { $coordination->assign(array('tstamp' => time(), 'title' => $this->request->hasPost('title') ? $this->request->getPost('title') : '', 'description' => $this->request->hasPost('description') ? $this->request->getPost('description') : '', 'icon' => $this->request->hasPost('icon') ? $this->request->getPost('icon') : '')); if (!$coordination->update()) { $this->flashSession->error($medium->getMessages()); } else { $this->flashSession->success($this->translate('successUpdate')); } } } else { $coordinationsUid = $this->dispatcher->getParam("uid") ? $this->dispatcher->getParam("uid") : 0; $coordination = Coordinations::findFirstByUid($coordinationsUid); $projectsArray = array(); foreach ($coordination->getProjects() as $project) { $projectsArray[] = $project->uid; } $projects = Projects::find(array('conditions' => 'deleted=0 AND hidden =0 AND usergroup =?1', 'bind' => array(1 => $coordination->usergroup))); $usergroup = Usergroups::findFirstByUid($coordination->usergroup); $this->view->setVar('coordination', $coordination); $this->view->setVar('usergroup', $usergroup); $this->view->setVar('projects', $projects); $this->view->setVar('projectsarray', $projectsArray); } }
public function indexAction() { $currentyear = $this->littlehelpers->getCurrentYear(); $coordinations = Coordinations::find(array("conditions" => "deleted=0 AND hidden=0 AND usergroup = ?1 AND tstamp >= ?2 AND tstamp <= ?3", "bind" => array(1 => $this->session->get('auth')['usergroup'], 2 => $currentyear[0], 3 => $currentyear[1]), "order" => "tstamp DESC")); $this->view->setVar('coordinations', $coordinations); }