/** * Uklada novy/editovany projekt do DB a presmerovava na nastaveni prav * * @param array $formData Data z formulare * @param int $id ID editovaneho zaznamu * @return int ID ukladaneho zaznamu */ public function save($formData, $id = null) { $data = array('name' => $formData['name'], 'description' => empty($formData['description']) ? null : $formData['description'], 'iduser' => $formData['iduser'], 'idcompany' => empty($formData['idcompany']) ? null : $formData['idcompany'], 'img' => $formData['img'], 'idaccount' => $this->_dbTable->getAccountId(), 'status' => 'active'); $lastInsertId = $this->_dbTable->save($data, $id); $this->_dbTable->stream(Model_Stream::TYP_PROJECT, Model_Stream::AKCE_CREATED, $formData['name'], $lastInsertId); return $lastInsertId; }
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; }
/** * 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; }