/
ticket.php
145 lines (128 loc) · 3.45 KB
/
ticket.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
/** ______________________________________________
* o O | |
* ((((( o < Generated with Cook Self Service V3.1.9 |
* ( o o ) |______________________________________________|
* --------oOOO-----(_)-----OOOo---------------------------------- www.j-cook.pro --- +
* @version 1
* @package OM Helpdesk
* @subpackage Tickets
* @copyright
* @author Marcin Krasucki - openmed.io - marcin.krasucki@at@intuigo.pl
* @license GNU GPL
*
* .oooO Oooo.
* ( ) ( )
* -------------\ (----) /----------------------------------------------------------- +
* \_) (_/
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* Omhelpdesk Ticket Controller
*
* @package Omhelpdesk
* @subpackage Ticket
*/
class OmhelpdeskCkControllerTicket extends OmhelpdeskClassControllerItem
{
/**
* The context for storing internal data, e.g. record.
*
* @var string
*/
protected $context = 'ticket';
/**
* The URL view item variable.
*
* @var string
*/
protected $view_item = 'ticket';
/**
* The URL view list variable.
*
* @var string
*/
protected $view_list = 'tickets';
/**
* Constructor
*
* @access public
* @param array $config An optional associative array of configuration settings.
*
* @return void
*/
public function __construct($config = array())
{
parent::__construct($config);
$app = JFactory::getApplication();
$this->registerTask('toggle_done', 'toggle');
}
/**
* Override method when the author allowed to delete own.
*
* @access protected
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key; default is id..
*
* @return boolean True on success
*/
protected function allowDelete($data = array(), $key = id)
{
return parent::allowDelete($data, $key, array(
'key_author' => 'created_by'
));
}
/**
* Override method when the author allowed to edit own.
*
* @access protected
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key; default is id..
*
* @return boolean True on success
*/
protected function allowEdit($data = array(), $key = id)
{
return parent::allowEdit($data, $key, array(
'key_author' => 'created_by'
));
}
/**
* Return the current layout.
*
* @access protected
* @param bool $default If true, return the default layout.
*
* @return string Requested layout or default layout
*/
protected function getLayout($default = null)
{
if ($default)
return '';
$jinput = JFactory::getApplication()->input;
return $jinput->get('layout', '', 'CMD');
}
/**
* Function that allows child controller access to model data after the data
* has been saved.
*
* @access protected
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
*
* @return void
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
parent::postSaveHook($model, $validData);
//Upload file : Attachment
self::updateFileField($model, 'attachment', array(
'extensions' => 'bmp|bmp|doc|gif|html|jpg|jpeg|pdf|png|rtf|tar.gz|tiff|txt|zip'
));
}
}
// Load the fork
OmhelpdeskHelper::loadFork(__FILE__);
// Fallback if no fork has been found
if (!class_exists('OmhelpdeskControllerTicket')){ class OmhelpdeskControllerTicket extends OmhelpdeskCkControllerTicket{} }