Show_Ticket starts to work :)

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-07-10 02:41:03 +02:00
parent fca8eb1ced
commit 5c623e0bd3
7 changed files with 64 additions and 8 deletions

View file

@ -8,7 +8,25 @@ class Gui_Elements{
foreach($inputList as $element){
$j = 0;
foreach($funcArray as $function){
$result[$i][$fieldArray[$j]] = $element->$function();
$fnames = explode('->', $function);
$intermediate_result = NULL;
foreach($fnames as $fname) {
if(substr($fname, -2) == "()") {
$fname = substr($fname, 0, strlen($fname)-2);
if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
} else {
$intermediate_result = $intermediate_result->$fname();
}
} else {
if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
} else {
$intermediate_result = $intermediate_result->$fname();
}
}
}
$result[$i][$fieldArray[$j]] = $intermediate_result;
$j++;
}
$i++;

View file

@ -12,7 +12,19 @@ class Ticket{
////////////////////////////////////////////Functions////////////////////////////////////////////////////
/*FUNCTION: getTicketTitlesOf()
/*FUNCTION: getEntireTicket
* return all ticket of the given author's id.
*
*/
public static function getEntireTicket($id, $db_data) {
$ticket = new Ticket($db_data);
$ticket->load_With_TId($id);
$reply_array = Ticket_Reply::getRepliesOfTicket($id,$db_data);
return Array('ticket_obj' => $ticket,'reply_array' => $reply_array);
}
/*FUNCTION: getTicketTitlesOf
* return all ticket of the given author's id.
*
*/
@ -58,6 +70,8 @@ class Ticket{
$ticket_reply->set($ticket_id, $content_id, $author);
$ticket_reply->create();
return $ticket_id;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////

View file

@ -58,7 +58,7 @@ class Ticket_Content{
public function getTContentId(){
return $this->tContentId;
return nl2br($this->tContentId);
}

View file

@ -17,6 +17,29 @@ class Ticket_Reply{
return $instance;
}
//return constructed element based on TCategoryId
public static function getRepliesOfTicket( $ticket_id, $db_data) {
$dbl = new DBLayer($db_data);
$statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id", array('id' => $ticket_id));
$row = $statement->fetchAll();
$result = Array();
foreach($row as $tReply){
$instanceReply = new self($db_data);
$instanceReply->setTReplyId($tReply['TReplyId']);
$instanceReply->setTimestamp($tReply['Timestamp']);
$instanceReply->set($tReply['Ticket'],$tReply['Content'],$tReply['Author']);
$instanceContent = new Ticket_Content($db_data);
$instanceContent->setTContentId($tReply['TContentId']);
$instanceContent->setContent($tReply['Content']);
$instanceReply->setContent($instanceContent);
$result[] = $instanceReply;
}
return $result;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct($db_data) {
@ -26,9 +49,9 @@ class Ticket_Reply{
//Set ticket_reply object
public function set($t,$c,$a){
$this->ticket = $t;
$this->content = $c;
$this->author = $a;
$this->setTicket($t);
$this->setContent($c);
$this->setAuthor($a);
}
//create ticket by writing private data to DB.

View file

@ -20,6 +20,7 @@ name = "Name"
email = "Email"
action = "Action"
[show_ticket]
[show_user]
[createticket]

View file

@ -21,7 +21,7 @@ email = "Email"
action = "Action"
[createticket]
[show_ticket]
[show_user]
[error]

View file

@ -37,7 +37,7 @@
<label class="control-label">Description</label>
<div class="controls">
<div class="input-prepend">
<textarea rows="12" class="span12" id="Content" name="Content"></textarea>
<textarea rows="12" class="span12" id="Content" name="Content"></textarea>
</div>
</div>
</div>