public function indexAction() { $contract = Contractruntime::findFirst(array("conditions" => "deleted=0 AND hidden=0 AND usergroup = ?1 AND active =1 AND (enddate > ?2 OR enddate = 0)", "bind" => array(1 => $this->session->get('auth')['usergroup'], 2 => time()))); if ($contract) { $projects = Projects::find(array('conditions' => 'deleted=0 AND hidden =0 AND usergroup =?1 AND crdate > ?2', 'bind' => array(1 => $this->session->get('auth')['usergroup'], 2 => $contract->startdate), 'columns' => "count(uid) AS count,projecttype", 'group' => 'projecttype')); $projectCount = array(); foreach ($projects as $project) { $projectCount[$project->projecttype] = $project->count; } $budget = $contract->getBudget(); $specs = $budget->getBudgetcount(); $specscount = array(); foreach ($specs as $spec) { $title = $spec->getProjecttype()->title; $specscount[$spec->uid_foreign] = array('amount' => $spec->amount, 'title' => $title); } $this->view->setVar('projectcount', $projectCount); $this->view->setVar('contract', $contract); $this->view->setVar('specscount', $specscount); } else { $this->view->setVar('projectcount', $projectCount = array()); $this->view->setVar('contract', $contract = array()); $this->view->setVar('specscount', $specscount = array()); } }
/** * @return \Phalcon\Http\ResponseInterface */ public function overviewAction() { /*$runningJobs=$this->getRunningJobs(); $this->view->setVar('runningJobs',$runningJobs);*/ $contract = \reportingtool\Models\Contractruntime::findFirst(array("conditions" => "deleted=0 AND hidden=0 AND usergroup = ?1 AND active =1 AND (enddate > ?2 OR enddate = 0)", "bind" => array(1 => $this->session->get('auth')['usergroup'], 2 => time()))); if ($contract) { $projects = \reportingtool\Models\Projects::find(array('conditions' => 'deleted=0 AND hidden =0 AND usergroup =?1 AND crdate > ?2', 'bind' => array(1 => $this->session->get('auth')['usergroup'], 2 => $contract->startdate))); $projectCount = array(); $projectPrepCount = array(); $projectArr = array(); foreach ($projects as $project) { if (!empty($project->getProjectstate())) { if ($project->getProjectstate()->statetype >= 2) { if (isset($projectCount[$project->projecttype])) { $projectCount[$project->projecttype] = $projectCount[$project->projecttype] + 1; } else { $projectCount[$project->projecttype] = 1; } } else { if (isset($projectPrepCount[$project->projecttype])) { $projectPrepCount[$project->projecttype] = $projectPrepCount[$project->projecttype] + 1; } else { $projectPrepCount[$project->projecttype] = 1; } } } $projectArr[$project->projecttype][] = $project; } $budget = $contract->getBudget(); $specs = $budget->getBudgetcount(); $specscount = array(); foreach ($specs as $spec) { $projecttype = $spec->getProjecttype(); if ($projecttype->deleted == 0 && $projecttype->hidden == 0) { $title = $projecttype->title; $specscount[$spec->uid_foreign] = array('amount' => $spec->amount, 'title' => $title); } } $lastProject = \reportingtool\Models\Projects::findFirst(array('conditions' => 'deleted=0 AND hidden =0 AND usergroup =?1 AND crdate > ?2', 'bind' => array(1 => $this->session->get('auth')['usergroup'], 2 => $contract->startdate), 'order' => 'tstamp DESC')); $lastClipping = \reportingtool\Models\Clippings::findFirst(array('conditions' => 'deleted=0 AND hidden =0 AND usergroup =?1 AND crdate > ?2', 'bind' => array(1 => $this->session->get('auth')['usergroup'], 2 => $contract->startdate), 'order' => 'tstamp DESC')); $this->view->setVar('projects', $projectArr); $this->view->setVar('projectprepcount', $projectPrepCount); $this->view->setVar('projectcount', $projectCount); $this->view->setVar('contract', $contract); $this->view->setVar('specscount', $specscount); $this->view->setVar('lastupdate', $lastClipping->crdate > $lastProject->crdate ? date('d.m.Y', $lastClipping->crdate) : date('d.m.Y', $lastProject->crdate)); } else { $this->view->setVar('projectprepcount', $projectPrepCount = array()); $this->view->setVar('projectcount', $projectCount = array()); $this->view->setVar('contract', $contract = array()); $this->view->setVar('specscount', $specscount = array()); } }
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); }
public function deleteAction() { if ($this->request->isPost()) { $element = Contractruntime::findFirstByUid($this->request->getPost('uid')); $element->deleted = 1; $element->save(); } }