Skip to content

Commit 9c90e3f

Browse files
committed
1.0.2
1 parent ca3b789 commit 9c90e3f

21 files changed

Lines changed: 631 additions & 627 deletions

Config/routes.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
<?php
2-
Router::connect('/support', array('controller' => 'ticket', 'action' => 'index', 'plugin' => 'support'));
2+
Router::connect('/admin/support', array('controller' => 'Ticket', 'action' => 'index', 'plugin' => 'Support', 'admin' => true));
3+
Router::connect('/support/ajax_clos', array('controller' => 'Ticket', 'action' => 'ajax_clos', 'plugin' => 'Support', 'admin' => false));
4+
Router::connect('/admin/support/ajax_closa', array('controller' => 'Ticket', 'action' => 'ajax_closa', 'plugin' => 'Support', 'admin' => true));
5+
Router::connect('/admin/support/ticket/*', array('controller' => 'Ticket', 'action' => 'ticket', 'plugin' => 'Support', 'admin' => true));
6+
Router::connect('/admin/support/ajax_replya', array('controller' => 'Ticket', 'action' => 'ajax_replya', 'plugin' => 'Support', 'admin' => true));
7+
Router::connect('/support', array('controller' => 'Ticket', 'action' => 'index', 'plugin' => 'Support'));
8+
Router::connect('/support/ajax_create', array('controller' => 'Ticket', 'action' => 'ajax_create', 'plugin' => 'Support', 'admin' => false));
9+
Router::connect('/support/ticket/ajax_reply', array('controller' => 'Ticket', 'action' => 'ajax_reply', 'plugin' => 'Support', 'admin' => false));
10+
Router::connect('/support/create', array('controller' => 'Ticket', 'action' => 'create', 'plugin' => 'Support'));
11+
Router::connect('/support/ticket/*', array('controller' => 'Ticket', 'action' => 'ticket', 'plugin' => 'Support'));
12+

Controller/SupportAppController.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

Controller/TicketController.php

Lines changed: 244 additions & 120 deletions
Large diffs are not rendered by default.

Model/ReplyTicket.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
<?php
22
App::uses('CakeEvent', 'Event');
33

4-
class ReplyTicket extends SupportAppModel {
4+
class ReplyTicket extends AppModel {
55

6-
public function afterSave($created, $options = array()) {
7-
if($created) {
8-
// nouvel enregistrement
9-
$this->getEventManager()->dispatch(new CakeEvent('afterReplyToTicket', $this));
10-
}
11-
}
12-
13-
public function afterDelete($cascade = true) {
14-
$this->getEventManager()->dispatch(new CakeEvent('afterDeleteReply', $this));
15-
}
6+
public $useTable = "support__reply_tickets";
167

178
}

Model/SupportAppModel.php

Lines changed: 0 additions & 4 deletions
This file was deleted.

Model/Ticket.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
<?php
22
App::uses('CakeEvent', 'Event');
33

4-
class Ticket extends SupportAppModel {
4+
class Ticket extends AppModel {
55

6-
public function afterSave($created, $options = array()) {
7-
if($created) {
8-
// nouvel enregistrement
9-
$this->getEventManager()->dispatch(new CakeEvent('afterAddTicket', $this));
10-
} else {
11-
// on édite, donc il reviens résolu
12-
$this->getEventManager()->dispatch(new CakeEvent('afterResolveTicket', $this));
13-
}
14-
}
15-
16-
public function afterDelete($cascade = true) {
17-
$this->getEventManager()->dispatch(new CakeEvent('afterDeleteTicket', $this));
18-
}
6+
public $useTable = "support__tickets";
197

208
}

SQL/schema.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@ public function before($event = array()) {
88
public function after($event = array()) {
99
}
1010

11-
public $support__reply_tickets = array(
11+
public $support__reply_tickets = array(
1212
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 20, 'unsigned' => false, 'key' => 'primary'),
1313
'ticket_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 20, 'unsigned' => false),
1414
'reply' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
15-
'author' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
16-
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
15+
'author' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 20, 'unsigned' => false,),
16+
'created' => array('type' => 'string', 'length' => 50, 'null' => false, 'default' => null),
17+
'type' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 11, 'unsigned' => false),
1718
'indexes' => array(
1819
'PRIMARY' => array('column' => 'id', 'unique' => 1)
1920
),
2021
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB')
2122
);
22-
public $support__tickets = array(
23+
24+
public $support__tickets = array(
2325
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 20, 'unsigned' => false, 'key' => 'primary'),
24-
'title' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
25-
'content' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
26-
'author' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
27-
'private' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 1, 'unsigned' => false),
26+
'subject' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
27+
'author' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 20, 'unsigned' => false,),
2828
'state' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 1, 'unsigned' => false),
29-
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
29+
'created' => array('type' => 'string', 'length' => 50, 'null' => false, 'default' => null),
30+
'reponse_text' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'),
3031
'indexes' => array(
3132
'PRIMARY' => array('column' => 'id', 'unique' => 1)
3233
),

Support_update.php

Lines changed: 0 additions & 111 deletions
This file was deleted.

View/Ticket/admin_index.ctp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
<?php
3+
App::import('Controller', 'TicketController');
4+
$TicketSupport = new TicketController();
5+
?>
6+
<section class="content">
7+
<div class="col-md-12">
8+
<div class="box">
9+
<div class="box-header with-border">
10+
<h3 class="box-title"><?= $title_for_layout; ?></h3>
11+
</div>
12+
<div class="box-body">
13+
<table class="table">
14+
<thead>
15+
<tr>
16+
<th><?= $Lang->get('SUPPORT__SUBJECT') ?></th>
17+
<th><?= $Lang->get('SUPPORT__AUTHOR') ?></th>
18+
<th><?= $Lang->get('SUPPORT__STATE_TITLE') ?></th>
19+
<th><?= $Lang->get('SUPPORT__CREATED') ?></th>
20+
<th><?= $Lang->get('SUPPORT__ACTIONS') ?></th>
21+
</tr>
22+
</thead>
23+
<tbody>
24+
<?php foreach($tickets as $ticket): ?>
25+
<tr>
26+
<td><?= $ticket['Ticket']['subject']; ?></td>
27+
<td><?= $TicketSupport->getUser('pseudo', $ticket['Ticket']['author']); ?></td>
28+
<td>
29+
<?php
30+
switch($ticket['Ticket']['state'])
31+
{
32+
case '0':
33+
echo '<div class="label label-warning">'.$Lang->get('SUPPORT__STATE_1').'</div>';
34+
break;
35+
case '1':
36+
echo '<div class="label label-info">'.$Lang->get('SUPPORT__STATE_0').'</div>';
37+
break;
38+
case '2':
39+
echo '<div class="label label-success">'.$Lang->get('SUPPORT__STATE_2').'</div>';
40+
break;
41+
}
42+
?>
43+
</td>
44+
<td><?= date('d m Y', $ticket['Ticket']['created']); ?></td>
45+
<td>
46+
<?php if($ticket['Ticket']['state'] == 0 || $ticket['Ticket']['state'] == 1){ ?>
47+
<form method="post" class="form-horizontal" data-ajax="true" data-redirect-url="?" action="<?= $this->Html->url(array('controller' => 'Ticket', 'action' => 'ajax_closa')) ?>">
48+
<a class="btn btn-primary" href="<?= $this->Html->url(array('plugin' => null, 'admin' => true, 'controller' => 'support', 'action' => 'ticket', $ticket['Ticket']['id'])); ?>">Voir</a>
49+
<input type="hidden" name="idTicket" value="<?= $ticket['Ticket']['id']; ?>">
50+
<button type="submit" class="btn btn-success" href="#"><?= $Lang->get('SUPPORT__CLOSE') ?></button>
51+
</form>
52+
<?php }else{ ?>
53+
<a class="btn btn-primary" href="<?= $this->Html->url(array('plugin' => null, 'admin' => true, 'controller' => 'support', 'action' => 'ticket', $ticket['Ticket']['id'])); ?>">Voir</a>
54+
<?php }?>
55+
</td>
56+
</tr>
57+
<?php endforeach; ?>
58+
</tbody>
59+
</table>
60+
</div>
61+
</div>
62+
</div>
63+
<div class="clearfix"></div>
64+
</section>

View/Ticket/admin_ticket.ctp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
App::import('Controller', 'TicketController');
3+
$TicketSupport = new TicketController();
4+
?>
5+
<?= $this->Html->css('Support.jquery.cleditor.css'); ?>
6+
<section class="content">
7+
<div class="container">
8+
<div class="row">
9+
<div class="col-sm-12">
10+
<?php if($ticket['Ticket']['state'] == 0 || $ticket['Ticket']['state'] == 1){ ?>
11+
<form method="post" class="form-horizontal" data-ajax="true" data-redirect-url="../" action="<?= $this->Html->url(array('controller' => 'Ticket', 'action' => 'ajax_closa')) ?>">
12+
<a class="btn btn-primary" href="<?= $this->Html->url(array('controller' => 'Ticket', 'admin' => true, 'action' => 'index')) ?>"><i class="fa fa-arrow-left"></i> <?= $Lang->get('SUPPORT_BACK_TO_LIST'); ?></a>
13+
<input type="hidden" name="idTicket" value="<?= $ticket['Ticket']['id']; ?>">
14+
<button class="btn btn-success" type="submit"><i class="fa fa-close"></i> <?= $Lang->get('SUPPORT__CLOSE'); ?></button>
15+
</form>
16+
<?php }else{ ?>
17+
<a class="btn btn-primary" href="<?= $this->Html->url(array('controller' => 'Ticket', 'admin' => true, 'action' => 'index')) ?>"><i class="fa fa-arrow-left"></i> <?= $Lang->get('SUPPORT_BACK_TO_LIST'); ?></a>
18+
<?php }?>
19+
<h2><?= $Lang->get('SUPPORT__PROBLEMQUESTION') ?> <?= $TicketSupport->getUser('pseudo', $ticket['Ticket']['author']); ?></h2>
20+
<hr style="border-top: 1px solid #dedede;">
21+
<div class="box">
22+
<div style="word-wrap: break-word;" class="box-body">
23+
<?= $ticket['Ticket']['reponse_text']; ?>
24+
</div>
25+
</div>
26+
</div>
27+
<div class="col-sm-12"><h2><?= $Lang->get('SUPPORT__ANSWER'); ?></h2><hr style="border-top: 1px solid #dedede;"></div>
28+
<?php foreach($answers as $answer): ?>
29+
<div class="col-sm-8 <?php if($answer['ReplyTicket']['type'] == 1){ ?>pull-right<?php }?>">
30+
<div class="box">
31+
<div class="box-header with-border">
32+
<h3 class="box-title">
33+
<?= $Lang->get('SUPPORT__ANSWERTO') ?> <?= $TicketSupport->getUser('pseudo', $answer['ReplyTicket']['author']); ?>
34+
</h3>
35+
</div>
36+
<div style="word-wrap: break-word;" class="box-body">
37+
<?= $answer['ReplyTicket']['reply']; ?>
38+
</div>
39+
</div>
40+
</div>
41+
<?php endforeach; ?>
42+
<div class="col-sm-12">
43+
<h2><?= $Lang->get('SUPPORT__REPLYTICKET') ?></h2>
44+
<hr style="border-top: 1px solid #dedede;">
45+
<div class="box">
46+
<div class="box-body">
47+
<?php if(!$ticket['Ticket']['state'] == 2){ ?>
48+
<form method="post" class="form-horizontal" data-ajax="true" data-redirect-url="../" action="<?= $this->Html->url(array('controller' => 'Ticket', 'action' => 'ajax_replya')) ?>">
49+
<input type="hidden" name="idTicket" value="<?= $ticket['Ticket']['id']; ?>">
50+
<textarea id="input" name="reponse_text"></textarea>
51+
<br>
52+
<button class="btn btn-primary" type="submit"><?= $Lang->get('SUPPORT__REPLY') ?></button>
53+
</form>
54+
<?php }else{ ?>
55+
<div class="alert alert-warning"><?= $Lang->get('SUPPORT__CLOSTICKETWARNING') ?></div>
56+
<?php }?>
57+
</div>
58+
</div>
59+
</div>
60+
</div>
61+
</div>
62+
</section>
63+
<?= $this->Html->script('Support.jquery.cleditor.min.js'); ?>
64+
<script>$(document).ready(function() { $("#input").cleditor(); }); </script>

0 commit comments

Comments
 (0)