mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
replying on a ticket is now possible though still have to fix the username being shown.
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
4afb0b912e
commit
0b72b5cd67
6 changed files with 74 additions and 19 deletions
|
@ -57,18 +57,7 @@ class Ticket{
|
|||
$ticket->set($title,0,0,$category,$author);
|
||||
$ticket->create();
|
||||
$ticket_id = $ticket->getTId();
|
||||
|
||||
|
||||
$ticket_content = new Ticket_Content();
|
||||
$ticket_content->setContent($content);
|
||||
$ticket_content->create();
|
||||
$content_id = $ticket_content->getTContentId();
|
||||
|
||||
|
||||
$ticket_reply = new Ticket_Reply();
|
||||
$ticket_reply->set($ticket_id, $content_id, $author);
|
||||
$ticket_reply->create();
|
||||
|
||||
Ticket_Reply::createReply($content, $author, $ticket_id);
|
||||
return $ticket_id;
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,17 @@ class Ticket_Reply{
|
|||
return $result;
|
||||
}
|
||||
|
||||
public static function createReply($content, $author, $ticket_id){
|
||||
$ticket_content = new Ticket_Content();
|
||||
$ticket_content->setContent($content);
|
||||
$ticket_content->create();
|
||||
$content_id = $ticket_content->getTContentId();
|
||||
|
||||
$ticket_reply = new Ticket_Reply();
|
||||
$ticket_reply->set($ticket_id, $content_id, $author);
|
||||
$ticket_reply->create();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////Methods////////////////////////////////////////////////////
|
||||
|
||||
public function __construct() {
|
||||
|
|
|
@ -21,6 +21,12 @@ email = "Email"
|
|||
action = "Action"
|
||||
|
||||
[show_ticket]
|
||||
t_title = "Ticket"
|
||||
title = "Title"
|
||||
t_reply = "Reply on ticket"
|
||||
t_fill = "Fill in your reply"
|
||||
t_send = "Send reply"
|
||||
|
||||
[show_user]
|
||||
|
||||
[createticket]
|
||||
|
|
|
@ -20,10 +20,18 @@ name = "Nom"
|
|||
email = "Email"
|
||||
action = "Action"
|
||||
|
||||
[createticket]
|
||||
[show_ticket]
|
||||
t_title = "Billet"
|
||||
title = "Titre"
|
||||
t_reply = "Repondre a billet"
|
||||
t_fill = "Remplissez votre reponse"
|
||||
t_send = "Envoyer la reponse"
|
||||
|
||||
[show_user]
|
||||
|
||||
[createticket]
|
||||
|
||||
|
||||
[error]
|
||||
title404 = "Pas<br/>trouvez!"
|
||||
title403 = "Interdit!"
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
function reply_on_ticket(){
|
||||
|
||||
//if logged in
|
||||
if(WebUsers::isLoggedIn() && isset($_POST['ticket_id'])){
|
||||
|
||||
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$target_ticket = new Ticket();
|
||||
$target_ticket->load_With_TId($ticket_id);
|
||||
|
||||
if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){
|
||||
|
||||
try{
|
||||
|
||||
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
|
||||
$author = $_SESSION['ticket_user']->getTUserId();
|
||||
Ticket_Reply::createReply($content, $author, $ticket_id);
|
||||
header("Location: index.php?page=show_ticket&id=".$ticket_id);
|
||||
exit;
|
||||
|
||||
}catch (PDOException $e) {
|
||||
//ERROR: LIB DB is not online!
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
}else{
|
||||
//ERROR: No access!
|
||||
$_SESSION['error_code'] = "403";
|
||||
header("Location: index.php?page=error");
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
//ERROR: not logged in!
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<div class="row-fluid sortable ui-sortable">
|
||||
<div class="box span12">
|
||||
<div class="box-header well" data-original-title="">
|
||||
<h2><i class="icon-tag"></i> Ticket [ID#{$ticket_tId}] </h2>
|
||||
<h2><i class="icon-tag"></i> {$t_title}[ID#{$ticket_tId}] </h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
|
||||
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
<legend>Title: {$ticket_title} </legend>
|
||||
<legend>{$title}: {$ticket_title} </legend>
|
||||
<table class="table table-striped" >
|
||||
<tbody>
|
||||
{foreach from=$ticket_replies item=reply}
|
||||
|
@ -24,20 +24,21 @@
|
|||
<tr>
|
||||
<td>
|
||||
<form id="reply" class="form-vertical" method="post" action="index.php">
|
||||
<legend>Reply on the ticket:</legend>
|
||||
<legend>{$t_reply}:</legend>
|
||||
<div class="control-group">
|
||||
<label class="control-label">Fill in your reply</label>
|
||||
<label class="control-label">{$t_fill}</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<textarea rows="6" class="span12" id="Content" name="Content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="function" value="ticket_reply">
|
||||
<input type="hidden" name="function" value="reply_on_ticket">
|
||||
<input type="hidden" name="ticket_id" value="{$ticket_id}">
|
||||
<div class="control-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
<button type="submit" class="btn btn-primary" >Send Reply</button>
|
||||
<button type="submit" class="btn btn-primary" >{$t_send}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue