コード例 #1
0
 public function deleteAction()
 {
     if ($this->request->isPost()) {
         $element = Projecttypes::findFirstByUid($this->request->getPost('uid'));
         $element->deleted = 1;
         $element->save();
     }
 }
コード例 #2
0
 public function indexAction()
 {
     if ($this->request->isPost() && !$this->request->getQuery('statusinfo')) {
         $result = $this->getData();
         $output = json_encode($result, true);
         die($output);
     } elseif ($this->request->isPost() && $this->request->getQuery('statusinfo') == 1) {
         $result = $this->getStatusInfo();
         $output = json_encode($result, true);
         die($output);
     }
     $currentyear = $this->littlehelpers->getCurrentYear();
     $projects = Projects::find(array("conditions" => "deleted=0 AND hidden=0 AND usergroup = ?1 AND starttime >= ?2 AND starttime <= ?3", "bind" => array(1 => $this->session->get('auth')['usergroup'], 2 => $currentyear[0], 3 => $currentyear[1]), "order" => "crdate DESC"));
     $topics = array();
     $projectTypeCount = array();
     $projectTypeInprocessCount = array();
     foreach ($projects as $project) {
         $topics[] = $project->topic;
         if ($project->getProjectstate()->statetype >= 2) {
             $projectTopicCount[$project->projecttype] = isset($projectTopicCount[$project->projecttype]) ? $projectTopicCount[$project->projecttype] + 1 : 1;
         } else {
             $projectTypeInprocessCount[$project->projecttype] = isset($projectTypeInprocessCount[$project->projecttype]) ? $projectTypeInprocessCount[$project->projecttype] + 1 : 1;
         }
     }
     $topics = array_unique($topics);
     if ($this->dispatcher->getParam('uid')) {
         $contractruntime = \reportingtool\Models\Contractruntime::findFirst(array('conditions' => 'deleted=0 AND hidden =0 AND usergroup = ?1 AND active =1', 'bind' => array(1 => $this->session->get('auth')['usergroup'])));
         $budget = $contractruntime->getBudget();
         $specs = $budget->getBudgetcount(array('conditions' => 'uid_foreign = :projecttype:', 'bind' => array('projecttype' => $this->dispatcher->getParam('uid'))));
         foreach ($specs as $spec) {
             $this->view->setVar('soll', $spec->amount);
         }
         $projecttype = Projecttypes::findFirstByUid($this->dispatcher->getParam('uid'));
         $this->view->setVar('ist', isset($projectTopicCount[$this->dispatcher->getParam('uid')]) ? $projectTopicCount[$this->dispatcher->getParam('uid')] : 0);
         $this->view->setVar('inprocess', isset($projectTypeInprocessCount[$this->dispatcher->getParam('uid')]) ? $projectTypeInprocessCount[$this->dispatcher->getParam('uid')] : 0);
         $this->view->setVar('projecttype', $projecttype->title);
     }
     $this->view->setVar('preselected', $this->dispatcher->getParam('uid'));
     $this->view->setVar('path', $this->path);
     $this->view->setVar('projects', $projects);
     $this->view->setVar('topics', $topics);
 }