public function updateAction()
 {
     if ($this->request->isPost()) {
         $time = time();
         $usergroup = Usergroups::findFirstByUid($this->request->getPost('usergroup'));
         $filename = $this->littlehelpers->saveFile($this->request->getUploadedFiles(), $time, $usergroup);
         $clippingUid = $this->dispatcher->getParam("uid") ? $this->dispatcher->getParam("uid") : 0;
         $clipping = Clippings::findFirstByUid($clippingUid);
         $clipping->assign(array('pid' => $this->request->getPost('project'), 'cruser_id' => $this->session->get('auth')['uid'], 'usergroup' => $this->request->getPost('usergroup'), 'tstamp' => $this->littlehelpers->processDateOnly($this->request->getPost('tstamp')), 'crdate' => $time, 'title' => $this->request->getPost('title'), 'description' => $this->request->getPost('description'), 'clippingtype' => $this->request->getPost('clippingtype'), 'mediumuid' => $this->request->getPost('medium'), 'url' => $this->request->getPost('url'), 'filelink' => $filename));
         if (!$clipping->update()) {
             $this->flashSession->error($clipping->getMessages());
         } else {
             $this->response->redirect('backend/' . $this->view->language . '/clippings/');
             $this->flashSession->success($this->translate('successUpdate'));
             $this->view->disable();
         }
     } else {
         $clippingUid = $this->dispatcher->getParam("uid") ? $this->dispatcher->getParam("uid") : 0;
         $clipping = Clippings::findFirstByUid($clippingUid);
         $usergroup = Usergroups::findFirstByUid($clipping->usergroup);
         $projects = Projects::find(array('conditions' => 'deleted=0 AND usergroup =?1', 'bind' => array(1 => $usergroup->uid)));
         $medium = Medium::find(array('conditions' => 'deleted=0 AND hidden=0'));
         $this->view->setVar('medium', $medium);
         $this->view->setVar('usergroup', $usergroup);
         $this->view->setVar('projects', $projects);
         $this->view->setVar('clipping', $clipping);
     }
 }
 public function deleteAction()
 {
     if ($this->request->isPost()) {
         $element = Medium::findFirstByUid($this->request->getPost('uid'));
         $element->deleted = 1;
         $element->save();
     }
 }
 public function updateAction()
 {
     if ($this->request->isPost()) {
         $time = time();
         $usergroup = Usergroups::findFirstByUid($this->request->getPost('usergroup'));
         $mediacontactsUid = $this->dispatcher->getParam("uid") ? $this->dispatcher->getParam("uid") : 0;
         $mediacontacts = Mediacontacts::findFirstByUid($mediacontactsUid);
         $mediacontacts->assign(array('tstamp' => $time, 'crdate' => $time, 'cruser_id' => $this->session->get('auth')['uid'], 'usergroup' => $this->request->getPost('usergroup'), 'medium' => $this->request->getPost('medium'), 'title' => $this->request->getPost('title'), 'description' => $this->request->getPost('description'), 'starttime' => $this->littlehelpers->processDate($this->request->getPost('starttime')), 'endtime' => $this->littlehelpers->processDate($this->request->getPost('endtime'))));
         if (!$mediacontacts->update()) {
             $this->flashSession->error($mediacontacts->getMessages());
         } else {
             $this->flashSession->success($this->translate('successUpdate'));
         }
     } else {
         $mediacontactsUid = $this->dispatcher->getParam("uid") ? $this->dispatcher->getParam("uid") : 0;
         $mediacontacts = Mediacontacts::findFirstByUid($mediacontactsUid);
         $usergroup = Usergroups::findFirstByUid($mediacontacts->usergroup);
     }
     $medium = Medium::find(array('conditions' => 'deleted=0 AND hidden=0'));
     $this->view->setVar('usergroup', $usergroup);
     $this->view->setVar('mediacontact', $mediacontacts);
     $this->view->setVar('medium', $medium);
 }