<?php
require_once $_SERVER["DOCUMENT_ROOT"]."/".FOLDER."/classes/controller.class.php";
require_once $_SERVER["DOCUMENT_ROOT"]."/".FOLDER."/classes/database.class.php";
require_once $_SERVER["DOCUMENT_ROOT"]."/".FOLDER."/classes/activerecord.class.php";
require_once $_SERVER["DOCUMENT_ROOT"]."/".FOLDER."/classes/util.class.php";
require_once $_SERVER["DOCUMENT_ROOT"]."/".FOLDER."/classes/authentication.class.php";
require_once $_SERVER["DOCUMENT_ROOT"]."/".FOLDER."/model/user.class.php";
class TaskDescription extends Controller {
var $db;
var $auth;
var $task;
var $task_id;
function init() {
// database connection
$this->db = new Database(DATABASE_NAME, USER_NAME, PASSWORD);
// authentication
$this->auth = new Authentication($this->db);
if (!$this->auth->isLogged())
$this->redirect("login.php");
// current user
$this->current_user = new User($this->db, $this->auth->getUserId());
// messages
$this->loadMessages("messages/generic", $this->current_user->getLanguage());
$this->loadMessages("messages/task_description", $this->current_user->getLanguage());;
// default parameters
$this->loadParams("task_id");
$this->task_id = $this->getParam("task_id");
}
function onGet() {
$this->task = new ActiveRecord($this->db, "task", $this->task_id);
}
function getTitle() {
return $this->task->get("title");
}
function getProject() {
$p = new ActiveRecord($this->db, "project", $this->task->get("project_id"));
return $p->get("title");
}
function getCreatedBy() {
$u = new ActiveRecord($this->db, "user", $this->task->get("created_by_user_id"));
return $u->get("username");
}
function getAssignedTo() {
$u = new ActiveRecord($this->db, "user", $this->task->get("assigned_to_user_id"));
return $u->get("username");
}
function getPriority() {
return $this->task->get("priority");
}
function getStatus() {
return $this->task->get("status");
}
function getDescription() {
return $this->task->get("description");
}
function getAttachedFile() {
return $this->task->get("attached_file");
}
function getLoginName() {
$user_id = $this->auth->getUserId();
$t = new ActiveRecord($this->db, "user", $user_id);
return $t->get("username");
}
}
?>