public function set($typ, $akce, $title, $link, $id = null) { $user = new Model_User(); $project = new Model_Project(); $idproject = is_null($project->getId()) ? $link : $project->getId(); $data = array('idaccount' => $this->_dbTable->getAccountId(), 'idproject' => $idproject, 'iduser' => $user->getUserId(), 'typ' => $typ, 'akce' => $akce, 'title' => $title, 'link' => (int) $link, 'datetime' => new Zend_Db_Expr('NOW()')); $lastInsertId = $this->_dbTable->save($data, $id); }
/** * Uklada novy/editovany ticket do DB * * @param array $formData Data z formulare * @param int $id ID editovaneho zaznamu * @return int ID ukladaneho zaznamu */ public function save($formData, $id = null) { $user = new Model_User(); $project = new Model_Project(); $data = array('idproject' => $project->getId(), 'iduser' => $user->getUserId(), 'idpriority' => empty($formData['idpriority']) ? null : $formData['idpriority'], 'idmilestone' => empty($formData['idmilestone']) ? null : $formData['idmilestone'], 'idtyp' => empty($formData['idtyp']) ? null : $formData['idtyp'], 'name' => $formData['name'], 'datetime' => new Zend_Db_Expr('NOW()'), 'description' => empty($formData['description']) ? null : $formData['description'], 'status' => $formData['status']); $lastInsertId = $this->_dbTable->save($data, $id); $this->_dbTable->stream(Model_Stream::TYP_TICKET, Model_Stream::AKCE_REPORTED, $formData['name'], $lastInsertId); return $lastInsertId; }
public function getProgressData($idproject) { $result = $this->_dbTable->getFullProgressData($idproject); $rowCount = count($result); $complete = array('resolved', 'complete', 'closed'); $narray = array(); foreach ($result as $data) { if (in_array($data['status'], $complete)) { $narray[] = $data['status']; } } $RowComplete = count($narray); $percentage = round(100 / $rowCount * $RowComplete); $progresslist = array('complete' => $RowComplete, 'tasks' => $rowCount, 'percentage' => $percentage); return $progresslist; }
/** * Uklada novy/editovany milnik do DB * * @param array $formData Data z formulare * @param int $id ID editovaneho zaznamu * @return int ID ukladaneho zaznamu */ public function save($formData, $id = null) { $user = new Model_User(); $project = new Model_Project(); $data = array('idproject' => $project->getId(), 'iduser' => $user->getUserId(), 'idpriority' => empty($formData['idpriority']) ? null : $formData['idpriority'], 'name' => $formData['name'], 'datetime' => $formData['datetime'], 'description' => empty($formData['description']) ? null : $formData['description'], 'status' => $formData['status'], 'parent' => empty($formData['parent']) ? null : $formData['parent']); $lastInsertId = $this->_dbTable->save($data, $id); $this->_dbTable->stream(Model_Stream::TYP_MILESTONE, Model_Stream::AKCE_CREATED, $formData['name'], $lastInsertId); return $lastInsertId; }
/** * Zjistuje ID a nazev uctu z DB * * @param string $account Ucet * @return int */ private function getData($account) { $where = array('url' => $account); $data = $this->_dbTable->getRow($where, array('idaccount', 'name')); return $data; }