/** * @throws ProjectIDMissingException * @throws ProjectSecurityAccessDeniedException */ public static function list_project_related_logs() { global $project_security; if ($_GET['project_id']) { if ($project_security->is_access(1, false) == true) { $template = new HTMLTemplate("project/log.html"); $template->set_var("get_array", serialize($_GET)); if ($project_security->is_access(3, false) == true) { $template->set_var("write", true); } else { $template->set_var("write", false); } $project_log_array = ProjectLog::list_entries_by_project_id($_GET['project_id']); $entry_count = count($project_log_array); $number_of_pages = ceil($entry_count / constant("PROJECT_LOG_ENTRIES_PER_PAGE")); $template->output(); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @see ProjectInterface::mark_as_reactivated() * @return bool */ public function mark_as_reactivated() { if ($this->project_id and $this->project) { $project_has_project_status_pk = ProjectHasProjectStatus_Access::list_entries_by_project_id($this->project_id); $project_has_project_status = new ProjectHasProjectStatus_Access($project_has_project_status_pk[count($project_has_project_status_pk) - 1]); if ($project_has_project_status->delete() == true) { $project_log = new ProjectLog(null); $project_log->create($this->project_id, "Project Reactivated", false, true); $project_log->link_status(0); return true; } else { return false; } } else { return false; } }
/** * @param string $get_array * @return string * @throws ProjectSetNextStatusException * @throws ProjectSecurityAccessDeniedException * @throws ProjectIDMissingException */ public static function proceed_project($get_array, $comment) { global $project_security; if ($get_array) { $_GET = unserialize($get_array); } if ($_GET['project_id']) { $project = new Project($_GET['project_id']); if ($project_security->is_access(3, false) == true) { if ($comment and $comment != "undefined") { $project_log = new ProjectLog(null); if ($project_log->create($_GET['project_id'], $comment) == null) { throw new ProjectSetNextStatusException(); } } $project->set_next_status(); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @see ProjectItemInterface::create_log_entry() * @return bool */ public function create_log_entry() { global $transaction; if ($this->project_id and $this->item_id) { $transaction_id = $transaction->begin(); if ($this->project_log_id) { $project_log_id = $this->project_log_id; } else { $project_log = new ProjectLog(null); if (($project_log_id = $project_log->create($this->project_id, null, false, false, md5(rand(0, 32768)))) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } $this->project_log_id = $project_log_id; } $project_log_has_item = new ProjectLogHasItem($project_log_id); if ($project_log_has_item->link_item($this->item_id) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } else { if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } } else { return false; } }
/** * @param integer $id * @return string * @throws ProjectLogIDMissingException * @throws ProjectSecurityAccessDeniedException */ public static function delete($id) { global $user; if (is_numeric($id)) { if ($user->is_admin()) { $project_log = new ProjectLog($id); $project_log->delete(); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectLogIDMissingException(); } }