Show_Ticket starts to work :)
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
fca8eb1ced
commit
5c623e0bd3
7 changed files with 64 additions and 8 deletions
|
@ -8,7 +8,25 @@ class Gui_Elements{
|
||||||
foreach($inputList as $element){
|
foreach($inputList as $element){
|
||||||
$j = 0;
|
$j = 0;
|
||||||
foreach($funcArray as $function){
|
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++;
|
$j++;
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
|
|
@ -12,7 +12,19 @@ class Ticket{
|
||||||
|
|
||||||
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
////////////////////////////////////////////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.
|
* 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->set($ticket_id, $content_id, $author);
|
||||||
$ticket_reply->create();
|
$ticket_reply->create();
|
||||||
|
|
||||||
|
return $ticket_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Ticket_Content{
|
||||||
|
|
||||||
|
|
||||||
public function getTContentId(){
|
public function getTContentId(){
|
||||||
return $this->tContentId;
|
return nl2br($this->tContentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,29 @@ class Ticket_Reply{
|
||||||
return $instance;
|
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////////////////////////////////////////////////////
|
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function __construct($db_data) {
|
public function __construct($db_data) {
|
||||||
|
@ -26,9 +49,9 @@ class Ticket_Reply{
|
||||||
|
|
||||||
//Set ticket_reply object
|
//Set ticket_reply object
|
||||||
public function set($t,$c,$a){
|
public function set($t,$c,$a){
|
||||||
$this->ticket = $t;
|
$this->setTicket($t);
|
||||||
$this->content = $c;
|
$this->setContent($c);
|
||||||
$this->author = $a;
|
$this->setAuthor($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//create ticket by writing private data to DB.
|
//create ticket by writing private data to DB.
|
||||||
|
|
|
@ -20,6 +20,7 @@ name = "Name"
|
||||||
email = "Email"
|
email = "Email"
|
||||||
action = "Action"
|
action = "Action"
|
||||||
|
|
||||||
|
[show_ticket]
|
||||||
[show_user]
|
[show_user]
|
||||||
|
|
||||||
[createticket]
|
[createticket]
|
||||||
|
|
|
@ -21,7 +21,7 @@ email = "Email"
|
||||||
action = "Action"
|
action = "Action"
|
||||||
|
|
||||||
[createticket]
|
[createticket]
|
||||||
|
[show_ticket]
|
||||||
[show_user]
|
[show_user]
|
||||||
|
|
||||||
[error]
|
[error]
|
||||||
|
|
Loading…
Reference in a new issue