@@ -15,9 +15,9 @@ |
||
15 | 15 | // table definitions |
16 | 16 | $track_user_table = Database::get_main_table(TABLE_MAIN_USER); |
17 | 17 | if (isset($_user['user_id']) && $_user['user_id'] != '') { |
18 | - $_user['user_id'] = intval($_user['user_id']); |
|
19 | - $sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='DENIED' where (user_id = ".$_user['user_id'].")"; |
|
20 | - $result = Database::query($sql); |
|
18 | + $_user['user_id'] = intval($_user['user_id']); |
|
19 | + $sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='DENIED' where (user_id = ".$_user['user_id'].")"; |
|
20 | + $result = Database::query($sql); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | Display::display_header(); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | //the plugin title |
13 | -$plugin_info['title'] = 'Hide/Unhide the Login/Password default form'; |
|
13 | +$plugin_info['title'] = 'Hide/Unhide the Login/Password default form'; |
|
14 | 14 | |
15 | 15 | //the comments that go with the plugin |
16 | 16 | $plugin_info['comment'] = "If you use another way of authentication than local, you may want to hide the Login/Password default Form to avoid users mistakes. This plugin replace the Login/Password form with a text that unhide the Login/Password form if you click on it."; |
@@ -31,4 +31,4 @@ discard block |
||
31 | 31 | $plugin_info['settings_form'] = $form; |
32 | 32 | |
33 | 33 | //set the templates that are going to be used |
34 | -$plugin_info['templates'] = array('template.tpl'); |
|
34 | +$plugin_info['templates'] = array('template.tpl'); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $data = $hook->getEventData(); |
30 | 30 | |
31 | 31 | $drupalDomain = CreateDrupalUser::create()->get('drupal_domain'); |
32 | - $drupalDomain = rtrim($drupalDomain, '/') . '/'; |
|
32 | + $drupalDomain = rtrim($drupalDomain, '/').'/'; |
|
33 | 33 | |
34 | 34 | if ($data['type'] === HOOK_EVENT_TYPE_POST) { |
35 | 35 | $return = $data['return']; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ); |
51 | 51 | |
52 | 52 | $options = array( |
53 | - 'location' => $drupalDomain . 'sites/all/modules/chamilo/soap.php?wsdl', |
|
53 | + 'location' => $drupalDomain.'sites/all/modules/chamilo/soap.php?wsdl', |
|
54 | 54 | 'uri' => $drupalDomain |
55 | 55 | ); |
56 | 56 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $form = new FormValidator('form'); |
36 | 36 | |
37 | - $renderer =& $form->defaultRenderer(); |
|
37 | + $renderer = & $form->defaultRenderer(); |
|
38 | 38 | $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
39 | 39 | $renderersetCustomElementTemplate->setCustomElementTemplate('<tr><td>{element}</td></tr>'); |
40 | 40 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $form2 = new FormValidator('form'); |
55 | 55 | |
56 | 56 | if (!empty($option2) && !empty($urlOption2)) { |
57 | - $renderer =& $form2->defaultRenderer(); |
|
57 | + $renderer = & $form2->defaultRenderer(); |
|
58 | 58 | $renderer->setHeaderTemplate(''); |
59 | 59 | $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
60 | 60 | $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>'); |
@@ -41,9 +41,9 @@ |
||
41 | 41 | $defaults['option1_url'] = api_get_plugin_setting('before_login', 'option1_url'); |
42 | 42 | $defaults['option2_url'] = api_get_plugin_setting('before_login', 'option2_url'); |
43 | 43 | |
44 | -$plugin_info['templates'] = array('template.tpl'); |
|
44 | +$plugin_info['templates'] = array('template.tpl'); |
|
45 | 45 | if (file_exists(__DIR__.'/custom.template.tpl')) { |
46 | - $plugin_info['templates'] = array( 'custom.template.tpl'); |
|
46 | + $plugin_info['templates'] = array('custom.template.tpl'); |
|
47 | 47 | } |
48 | 48 | $form->setDefaults($defaults); |
49 | 49 |
@@ -24,13 +24,13 @@ |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | //the plugin title |
27 | -$plugin_info['title']='PENS'; |
|
27 | +$plugin_info['title'] = 'PENS'; |
|
28 | 28 | //the comments that go with the plugin |
29 | -$plugin_info['comment']="PENS implementation for Chamilo"; |
|
29 | +$plugin_info['comment'] = "PENS implementation for Chamilo"; |
|
30 | 30 | //the locations where this plugin can be shown |
31 | -$plugin_info['location']=array(); |
|
31 | +$plugin_info['location'] = array(); |
|
32 | 32 | //the plugin version |
33 | -$plugin_info['version']='1.1'; |
|
33 | +$plugin_info['version'] = '1.1'; |
|
34 | 34 | //the plugin author |
35 | -$plugin_info['author']='Guillaume Viguier-Just, Yannick Warnier'; |
|
35 | +$plugin_info['author'] = 'Guillaume Viguier-Just, Yannick Warnier'; |
|
36 | 36 | $plugin_info = PENSPlugin::create()->get_info(); |
37 | 37 | \ No newline at end of file |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | * along with chamilo-pens. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | */ |
18 | 18 | |
19 | - /** |
|
20 | - * ChamiloPens |
|
21 | - * |
|
22 | - * This file provides the ChamiloPens class |
|
23 | - * |
|
24 | - * @author Guillaume Viguier-Just <[email protected]> |
|
25 | - * @licence http://www.gnu.org/licenses/gpl.txt |
|
26 | - */ |
|
19 | + /** |
|
20 | + * ChamiloPens |
|
21 | + * |
|
22 | + * This file provides the ChamiloPens class |
|
23 | + * |
|
24 | + * @author Guillaume Viguier-Just <[email protected]> |
|
25 | + * @licence http://www.gnu.org/licenses/gpl.txt |
|
26 | + */ |
|
27 | 27 | |
28 | 28 | require_once __DIR__ . '/../../main/inc/global.inc.php'; |
29 | 29 | require_once __DIR__ . '/lib/pens.php'; |
@@ -37,212 +37,212 @@ discard block |
||
37 | 37 | * @licence http://www.gnu.org/licenses/gpl.txt |
38 | 38 | */ |
39 | 39 | class ChamiloPens extends Plugin { |
40 | - /** |
|
41 | - * Database table to be used |
|
42 | - */ |
|
43 | - const TABLE_NAME = "plugin_pens"; |
|
44 | - |
|
45 | - /** |
|
46 | - * Id of the object |
|
47 | - * @var int |
|
48 | - */ |
|
49 | - protected $_id = null; |
|
50 | - |
|
51 | - /** |
|
52 | - * PENS Version to be used. Currently, the only valid value is 1.0.0. Required. |
|
53 | - * @var string |
|
54 | - */ |
|
55 | - protected $_pens_version = null; |
|
56 | - |
|
57 | - /** |
|
58 | - * Package type being used. The only valid values are aicc-pkg, scorm-pif, ims-qti. Required |
|
59 | - * @var string |
|
60 | - */ |
|
61 | - protected $_package_type = null; |
|
62 | - |
|
63 | - /** |
|
64 | - * Package type version. Required |
|
65 | - * @var string |
|
66 | - */ |
|
67 | - protected $_package_type_version = null; |
|
68 | - |
|
69 | - /** |
|
70 | - * Package format. The only valid values are zip, url, jar, war and xml. Required |
|
71 | - * @var string |
|
72 | - */ |
|
73 | - protected $_package_format = null; |
|
74 | - |
|
75 | - /** |
|
76 | - * Package id. Requires a valid URI according to RFC 2396. Required |
|
77 | - * @var string |
|
78 | - */ |
|
79 | - protected $_package_id = null; |
|
80 | - |
|
81 | - /** |
|
82 | - * Name or ID for client submitting the content package to the target system. Required. |
|
83 | - * @var string |
|
84 | - */ |
|
85 | - protected $_client = null; |
|
86 | - |
|
87 | - /** |
|
88 | - * Unstructured character string that may be used to transfer vendor-specific data such as processing hints or deployment information. Optional. |
|
89 | - * @var string |
|
90 | - */ |
|
91 | - protected $_vendor_data = null; |
|
92 | - |
|
93 | - /** |
|
94 | - * Package name |
|
95 | - * @var string |
|
96 | - */ |
|
97 | - protected $_package_name = null; |
|
98 | - |
|
99 | - /** |
|
100 | - * Date of creation |
|
101 | - * @var DateTime |
|
102 | - */ |
|
103 | - protected $_created_at = null; |
|
104 | - |
|
105 | - /** |
|
106 | - * Update date |
|
107 | - * @var DateTime |
|
108 | - */ |
|
109 | - protected $_updated_at = null; |
|
110 | - |
|
111 | - /** |
|
112 | - * Constructor. Takes a PENSRequest as an argument |
|
113 | - * |
|
114 | - * @param PENSRequest Request |
|
115 | - */ |
|
116 | - public function __construct($request) { |
|
117 | - if($request instanceof PENSRequest) { |
|
118 | - $this->_id = 0; |
|
119 | - $this->_pens_version = $request->getPensVersion(); |
|
120 | - $this->_package_type = $request->getPackageType(); |
|
121 | - $this->_package_type_version = $request->getPackageTypeVersion(); |
|
122 | - $this->_package_format = $request->getPackageFormat(); |
|
123 | - $this->_package_id = $request->getPackageId(); |
|
124 | - $this->_client = $request->getClient(); |
|
125 | - $this->_vendor_data = $request->getVendorData(); |
|
126 | - $this->_package_name = $request->getFilename(); |
|
127 | - } else if(is_array($request)) { |
|
128 | - $this->_id = $request['id']; |
|
129 | - $this->_pens_version = $request['pens_version']; |
|
130 | - $this->_package_type = $request['package_type']; |
|
131 | - $this->_package_type_version = $request['package_type_version']; |
|
132 | - $this->_package_format = $request['package_format']; |
|
133 | - $this->_package_id = $request['package_id']; |
|
134 | - $this->_client = $request['client']; |
|
135 | - $this->_vendor_data = $request['vendor_data']; |
|
136 | - $this->_package_name = $request['package_name']; |
|
137 | - $this->_created_at = new DateTime($request['created_at'], new DateTimeZone('UTC')); |
|
138 | - if(!empty($request['updated_at'])) { |
|
139 | - $this->_updated_at = new DateTime($request['updated_at'], new DateTimeZone('UTC')); |
|
140 | - } |
|
141 | - } |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * Saves the object in the DB |
|
146 | - */ |
|
147 | - public function save() { |
|
148 | - $clean_package_type_version = Database::escape_string($this->_package_type_version); |
|
149 | - $clean_package_id = Database::escape_string($this->_package_id); |
|
150 | - $clean_client = Database::escape_string($this->_client); |
|
151 | - $clean_vendor_data = Database::escape_string($this->_vendor_data); |
|
152 | - $created_at = api_get_utc_datetime(); |
|
153 | - $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
|
154 | - $sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (" . |
|
155 | - "'". $this->_pens_version. "', " . |
|
156 | - "'".$this->_package_type. "', " . |
|
157 | - "'".$clean_package_type_version. "', " . |
|
158 | - "'".$this->_package_format. "', " . |
|
159 | - "'".$clean_package_id. "', " . |
|
160 | - "'".$clean_client."', " . |
|
161 | - "'".$clean_vendor_data."', " . |
|
162 | - "'".$this->_package_name."', " . |
|
163 | - "'".$created_at."') ON DUPLICATE KEY UPDATE " . |
|
164 | - "pens_version = VALUES(pens_version), ". |
|
165 | - "package_type = VALUES(package_type), ". |
|
166 | - "package_type_version = VALUES(package_type_version), ". |
|
167 | - "package_format = VALUES(package_format), ". |
|
168 | - "client = VALUES(client), ". |
|
169 | - "vendor_data = VALUES(vendor_data), ". |
|
170 | - "package_name = VALUES(package_name), ". |
|
171 | - "updated_at = '".$created_at."';"; |
|
172 | - Database::query($sql_query); |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Returns a ChamiloPens object, based on package id |
|
177 | - * |
|
178 | - * @param string Package id |
|
179 | - */ |
|
180 | - public static function findByPackageId($package_id) { |
|
181 | - $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
|
182 | - $sql_query = "SELECT * FROM $table WHERE package_id = '".$package_id."';"; |
|
183 | - $results = Database::query($sql_query); |
|
184 | - $number = Database::num_rows($results); |
|
185 | - if($number == 1) { |
|
186 | - $obj = Database::fetch_assoc($results); |
|
187 | - return new ChamiloPens($obj); |
|
188 | - } else { |
|
189 | - return null; |
|
190 | - } |
|
191 | - } |
|
192 | - |
|
193 | - /** |
|
194 | - * Returns an array of all the objects of the DB |
|
195 | - * |
|
196 | - * @return array Array of ChamiloPens objects |
|
197 | - */ |
|
198 | - public static function findAll() { |
|
199 | - $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
|
200 | - $sql_query = "SELECT * FROM $table ORDER BY created_at;"; |
|
201 | - $results = Database::query($sql_query); |
|
202 | - $return = array(); |
|
203 | - while($assoc = Database::fetch_assoc($results)) { |
|
204 | - $return[] = new ChamiloPens($assoc); |
|
205 | - } |
|
206 | - return $return; |
|
207 | - } |
|
208 | - |
|
209 | - public function getId() { |
|
210 | - return $this->_id; |
|
211 | - } |
|
212 | - |
|
213 | - public function getPensVersion() { |
|
214 | - return $this->_pens_version; |
|
215 | - } |
|
216 | - |
|
217 | - public function getPackageType() { |
|
218 | - return $this->_package_type; |
|
219 | - } |
|
220 | - |
|
221 | - public function getPackageTypeVersion() { |
|
222 | - return $this->_package_type_version; |
|
223 | - } |
|
224 | - |
|
225 | - public function getPackageFormat() { |
|
226 | - return $this->_package_format; |
|
227 | - } |
|
228 | - |
|
229 | - public function getPackageId() { |
|
230 | - return $this->_package_id; |
|
231 | - } |
|
232 | - |
|
233 | - public function getClient() { |
|
234 | - return $this->_client; |
|
235 | - } |
|
236 | - |
|
237 | - public function getVendorData() { |
|
238 | - return $this->_vendor_data; |
|
239 | - } |
|
240 | - |
|
241 | - public function getPackageName() { |
|
242 | - return $this->_package_name; |
|
243 | - } |
|
244 | - |
|
245 | - public function getCreatedAt() { |
|
246 | - return $this->_created_at; |
|
247 | - } |
|
40 | + /** |
|
41 | + * Database table to be used |
|
42 | + */ |
|
43 | + const TABLE_NAME = "plugin_pens"; |
|
44 | + |
|
45 | + /** |
|
46 | + * Id of the object |
|
47 | + * @var int |
|
48 | + */ |
|
49 | + protected $_id = null; |
|
50 | + |
|
51 | + /** |
|
52 | + * PENS Version to be used. Currently, the only valid value is 1.0.0. Required. |
|
53 | + * @var string |
|
54 | + */ |
|
55 | + protected $_pens_version = null; |
|
56 | + |
|
57 | + /** |
|
58 | + * Package type being used. The only valid values are aicc-pkg, scorm-pif, ims-qti. Required |
|
59 | + * @var string |
|
60 | + */ |
|
61 | + protected $_package_type = null; |
|
62 | + |
|
63 | + /** |
|
64 | + * Package type version. Required |
|
65 | + * @var string |
|
66 | + */ |
|
67 | + protected $_package_type_version = null; |
|
68 | + |
|
69 | + /** |
|
70 | + * Package format. The only valid values are zip, url, jar, war and xml. Required |
|
71 | + * @var string |
|
72 | + */ |
|
73 | + protected $_package_format = null; |
|
74 | + |
|
75 | + /** |
|
76 | + * Package id. Requires a valid URI according to RFC 2396. Required |
|
77 | + * @var string |
|
78 | + */ |
|
79 | + protected $_package_id = null; |
|
80 | + |
|
81 | + /** |
|
82 | + * Name or ID for client submitting the content package to the target system. Required. |
|
83 | + * @var string |
|
84 | + */ |
|
85 | + protected $_client = null; |
|
86 | + |
|
87 | + /** |
|
88 | + * Unstructured character string that may be used to transfer vendor-specific data such as processing hints or deployment information. Optional. |
|
89 | + * @var string |
|
90 | + */ |
|
91 | + protected $_vendor_data = null; |
|
92 | + |
|
93 | + /** |
|
94 | + * Package name |
|
95 | + * @var string |
|
96 | + */ |
|
97 | + protected $_package_name = null; |
|
98 | + |
|
99 | + /** |
|
100 | + * Date of creation |
|
101 | + * @var DateTime |
|
102 | + */ |
|
103 | + protected $_created_at = null; |
|
104 | + |
|
105 | + /** |
|
106 | + * Update date |
|
107 | + * @var DateTime |
|
108 | + */ |
|
109 | + protected $_updated_at = null; |
|
110 | + |
|
111 | + /** |
|
112 | + * Constructor. Takes a PENSRequest as an argument |
|
113 | + * |
|
114 | + * @param PENSRequest Request |
|
115 | + */ |
|
116 | + public function __construct($request) { |
|
117 | + if($request instanceof PENSRequest) { |
|
118 | + $this->_id = 0; |
|
119 | + $this->_pens_version = $request->getPensVersion(); |
|
120 | + $this->_package_type = $request->getPackageType(); |
|
121 | + $this->_package_type_version = $request->getPackageTypeVersion(); |
|
122 | + $this->_package_format = $request->getPackageFormat(); |
|
123 | + $this->_package_id = $request->getPackageId(); |
|
124 | + $this->_client = $request->getClient(); |
|
125 | + $this->_vendor_data = $request->getVendorData(); |
|
126 | + $this->_package_name = $request->getFilename(); |
|
127 | + } else if(is_array($request)) { |
|
128 | + $this->_id = $request['id']; |
|
129 | + $this->_pens_version = $request['pens_version']; |
|
130 | + $this->_package_type = $request['package_type']; |
|
131 | + $this->_package_type_version = $request['package_type_version']; |
|
132 | + $this->_package_format = $request['package_format']; |
|
133 | + $this->_package_id = $request['package_id']; |
|
134 | + $this->_client = $request['client']; |
|
135 | + $this->_vendor_data = $request['vendor_data']; |
|
136 | + $this->_package_name = $request['package_name']; |
|
137 | + $this->_created_at = new DateTime($request['created_at'], new DateTimeZone('UTC')); |
|
138 | + if(!empty($request['updated_at'])) { |
|
139 | + $this->_updated_at = new DateTime($request['updated_at'], new DateTimeZone('UTC')); |
|
140 | + } |
|
141 | + } |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * Saves the object in the DB |
|
146 | + */ |
|
147 | + public function save() { |
|
148 | + $clean_package_type_version = Database::escape_string($this->_package_type_version); |
|
149 | + $clean_package_id = Database::escape_string($this->_package_id); |
|
150 | + $clean_client = Database::escape_string($this->_client); |
|
151 | + $clean_vendor_data = Database::escape_string($this->_vendor_data); |
|
152 | + $created_at = api_get_utc_datetime(); |
|
153 | + $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
|
154 | + $sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (" . |
|
155 | + "'". $this->_pens_version. "', " . |
|
156 | + "'".$this->_package_type. "', " . |
|
157 | + "'".$clean_package_type_version. "', " . |
|
158 | + "'".$this->_package_format. "', " . |
|
159 | + "'".$clean_package_id. "', " . |
|
160 | + "'".$clean_client."', " . |
|
161 | + "'".$clean_vendor_data."', " . |
|
162 | + "'".$this->_package_name."', " . |
|
163 | + "'".$created_at."') ON DUPLICATE KEY UPDATE " . |
|
164 | + "pens_version = VALUES(pens_version), ". |
|
165 | + "package_type = VALUES(package_type), ". |
|
166 | + "package_type_version = VALUES(package_type_version), ". |
|
167 | + "package_format = VALUES(package_format), ". |
|
168 | + "client = VALUES(client), ". |
|
169 | + "vendor_data = VALUES(vendor_data), ". |
|
170 | + "package_name = VALUES(package_name), ". |
|
171 | + "updated_at = '".$created_at."';"; |
|
172 | + Database::query($sql_query); |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Returns a ChamiloPens object, based on package id |
|
177 | + * |
|
178 | + * @param string Package id |
|
179 | + */ |
|
180 | + public static function findByPackageId($package_id) { |
|
181 | + $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
|
182 | + $sql_query = "SELECT * FROM $table WHERE package_id = '".$package_id."';"; |
|
183 | + $results = Database::query($sql_query); |
|
184 | + $number = Database::num_rows($results); |
|
185 | + if($number == 1) { |
|
186 | + $obj = Database::fetch_assoc($results); |
|
187 | + return new ChamiloPens($obj); |
|
188 | + } else { |
|
189 | + return null; |
|
190 | + } |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * Returns an array of all the objects of the DB |
|
195 | + * |
|
196 | + * @return array Array of ChamiloPens objects |
|
197 | + */ |
|
198 | + public static function findAll() { |
|
199 | + $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
|
200 | + $sql_query = "SELECT * FROM $table ORDER BY created_at;"; |
|
201 | + $results = Database::query($sql_query); |
|
202 | + $return = array(); |
|
203 | + while($assoc = Database::fetch_assoc($results)) { |
|
204 | + $return[] = new ChamiloPens($assoc); |
|
205 | + } |
|
206 | + return $return; |
|
207 | + } |
|
208 | + |
|
209 | + public function getId() { |
|
210 | + return $this->_id; |
|
211 | + } |
|
212 | + |
|
213 | + public function getPensVersion() { |
|
214 | + return $this->_pens_version; |
|
215 | + } |
|
216 | + |
|
217 | + public function getPackageType() { |
|
218 | + return $this->_package_type; |
|
219 | + } |
|
220 | + |
|
221 | + public function getPackageTypeVersion() { |
|
222 | + return $this->_package_type_version; |
|
223 | + } |
|
224 | + |
|
225 | + public function getPackageFormat() { |
|
226 | + return $this->_package_format; |
|
227 | + } |
|
228 | + |
|
229 | + public function getPackageId() { |
|
230 | + return $this->_package_id; |
|
231 | + } |
|
232 | + |
|
233 | + public function getClient() { |
|
234 | + return $this->_client; |
|
235 | + } |
|
236 | + |
|
237 | + public function getVendorData() { |
|
238 | + return $this->_vendor_data; |
|
239 | + } |
|
240 | + |
|
241 | + public function getPackageName() { |
|
242 | + return $this->_package_name; |
|
243 | + } |
|
244 | + |
|
245 | + public function getCreatedAt() { |
|
246 | + return $this->_created_at; |
|
247 | + } |
|
248 | 248 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @licence http://www.gnu.org/licenses/gpl.txt |
26 | 26 | */ |
27 | 27 | |
28 | -require_once __DIR__ . '/../../main/inc/global.inc.php'; |
|
29 | -require_once __DIR__ . '/lib/pens.php'; |
|
28 | +require_once __DIR__.'/../../main/inc/global.inc.php'; |
|
29 | +require_once __DIR__.'/lib/pens.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * ChamiloPens |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param PENSRequest Request |
115 | 115 | */ |
116 | 116 | public function __construct($request) { |
117 | - if($request instanceof PENSRequest) { |
|
117 | + if ($request instanceof PENSRequest) { |
|
118 | 118 | $this->_id = 0; |
119 | 119 | $this->_pens_version = $request->getPensVersion(); |
120 | 120 | $this->_package_type = $request->getPackageType(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->_client = $request->getClient(); |
125 | 125 | $this->_vendor_data = $request->getVendorData(); |
126 | 126 | $this->_package_name = $request->getFilename(); |
127 | - } else if(is_array($request)) { |
|
127 | + } else if (is_array($request)) { |
|
128 | 128 | $this->_id = $request['id']; |
129 | 129 | $this->_pens_version = $request['pens_version']; |
130 | 130 | $this->_package_type = $request['package_type']; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->_vendor_data = $request['vendor_data']; |
136 | 136 | $this->_package_name = $request['package_name']; |
137 | 137 | $this->_created_at = new DateTime($request['created_at'], new DateTimeZone('UTC')); |
138 | - if(!empty($request['updated_at'])) { |
|
138 | + if (!empty($request['updated_at'])) { |
|
139 | 139 | $this->_updated_at = new DateTime($request['updated_at'], new DateTimeZone('UTC')); |
140 | 140 | } |
141 | 141 | } |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $clean_vendor_data = Database::escape_string($this->_vendor_data); |
152 | 152 | $created_at = api_get_utc_datetime(); |
153 | 153 | $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
154 | - $sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (" . |
|
155 | - "'". $this->_pens_version. "', " . |
|
156 | - "'".$this->_package_type. "', " . |
|
157 | - "'".$clean_package_type_version. "', " . |
|
158 | - "'".$this->_package_format. "', " . |
|
159 | - "'".$clean_package_id. "', " . |
|
160 | - "'".$clean_client."', " . |
|
161 | - "'".$clean_vendor_data."', " . |
|
162 | - "'".$this->_package_name."', " . |
|
163 | - "'".$created_at."') ON DUPLICATE KEY UPDATE " . |
|
154 | + $sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (". |
|
155 | + "'".$this->_pens_version."', ". |
|
156 | + "'".$this->_package_type."', ". |
|
157 | + "'".$clean_package_type_version."', ". |
|
158 | + "'".$this->_package_format."', ". |
|
159 | + "'".$clean_package_id."', ". |
|
160 | + "'".$clean_client."', ". |
|
161 | + "'".$clean_vendor_data."', ". |
|
162 | + "'".$this->_package_name."', ". |
|
163 | + "'".$created_at."') ON DUPLICATE KEY UPDATE ". |
|
164 | 164 | "pens_version = VALUES(pens_version), ". |
165 | 165 | "package_type = VALUES(package_type), ". |
166 | 166 | "package_type_version = VALUES(package_type_version), ". |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $sql_query = "SELECT * FROM $table WHERE package_id = '".$package_id."';"; |
183 | 183 | $results = Database::query($sql_query); |
184 | 184 | $number = Database::num_rows($results); |
185 | - if($number == 1) { |
|
185 | + if ($number == 1) { |
|
186 | 186 | $obj = Database::fetch_assoc($results); |
187 | 187 | return new ChamiloPens($obj); |
188 | 188 | } else { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $sql_query = "SELECT * FROM $table ORDER BY created_at;"; |
201 | 201 | $results = Database::query($sql_query); |
202 | 202 | $return = array(); |
203 | - while($assoc = Database::fetch_assoc($results)) { |
|
203 | + while ($assoc = Database::fetch_assoc($results)) { |
|
204 | 204 | $return[] = new ChamiloPens($assoc); |
205 | 205 | } |
206 | 206 | return $return; |
@@ -24,19 +24,19 @@ |
||
24 | 24 | * @licence http://www.gnu.org/licenses/gpl.txt |
25 | 25 | */ |
26 | 26 | |
27 | -require_once __DIR__ . '/../../main/inc/global.inc.php'; |
|
28 | -require_once __DIR__ . '/lib/pens.php'; |
|
29 | -require_once __DIR__ . '/chamilo_pens.php'; |
|
27 | +require_once __DIR__.'/../../main/inc/global.inc.php'; |
|
28 | +require_once __DIR__.'/lib/pens.php'; |
|
29 | +require_once __DIR__.'/chamilo_pens.php'; |
|
30 | 30 | |
31 | 31 | class ChamiloPackageHandler extends PENSPackageHandler { |
32 | 32 | public function processPackage($request, $path_to_package) { |
33 | 33 | $server = PENSServer::singleton(); |
34 | 34 | // Moves the package to archive/pens |
35 | - $path_to_archives = api_get_path(SYS_ARCHIVE_PATH) . 'pens'; |
|
36 | - if(!is_dir($path_to_archives)) { |
|
35 | + $path_to_archives = api_get_path(SYS_ARCHIVE_PATH).'pens'; |
|
36 | + if (!is_dir($path_to_archives)) { |
|
37 | 37 | mkdir($path_to_archives, 0777, true); |
38 | 38 | } |
39 | - rename($path_to_package, $path_to_archives . '/' . $request->getFilename()); |
|
39 | + rename($path_to_package, $path_to_archives.'/'.$request->getFilename()); |
|
40 | 40 | // Insert the request in the database |
41 | 41 | $chamilo_pens = new ChamiloPens($request); |
42 | 42 | $chamilo_pens->save(); |
@@ -29,19 +29,19 @@ |
||
29 | 29 | require_once __DIR__ . '/chamilo_pens.php'; |
30 | 30 | |
31 | 31 | class ChamiloPackageHandler extends PENSPackageHandler { |
32 | - public function processPackage($request, $path_to_package) { |
|
33 | - $server = PENSServer::singleton(); |
|
34 | - // Moves the package to archive/pens |
|
35 | - $path_to_archives = api_get_path(SYS_ARCHIVE_PATH) . 'pens'; |
|
36 | - if(!is_dir($path_to_archives)) { |
|
37 | - mkdir($path_to_archives, 0777, true); |
|
38 | - } |
|
39 | - rename($path_to_package, $path_to_archives . '/' . $request->getFilename()); |
|
40 | - // Insert the request in the database |
|
41 | - $chamilo_pens = new ChamiloPens($request); |
|
42 | - $chamilo_pens->save(); |
|
43 | - $server->sendAlert($request, new PENSResponse(0, 'Package successfully processed')); |
|
44 | - } |
|
32 | + public function processPackage($request, $path_to_package) { |
|
33 | + $server = PENSServer::singleton(); |
|
34 | + // Moves the package to archive/pens |
|
35 | + $path_to_archives = api_get_path(SYS_ARCHIVE_PATH) . 'pens'; |
|
36 | + if(!is_dir($path_to_archives)) { |
|
37 | + mkdir($path_to_archives, 0777, true); |
|
38 | + } |
|
39 | + rename($path_to_package, $path_to_archives . '/' . $request->getFilename()); |
|
40 | + // Insert the request in the database |
|
41 | + $chamilo_pens = new ChamiloPens($request); |
|
42 | + $chamilo_pens->save(); |
|
43 | + $server->sendAlert($request, new PENSResponse(0, 'Package successfully processed')); |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $handler = new ChamiloPackageHandler(); |
@@ -40,9 +40,9 @@ |
||
40 | 40 | |
41 | 41 | class PENSRequestAlert extends PENSRequest { |
42 | 42 | |
43 | - public function __construct($arguments) { |
|
44 | - parent::__construct($arguments); |
|
45 | - $this->setCommand("alert"); |
|
46 | - } |
|
43 | + public function __construct($arguments) { |
|
44 | + parent::__construct($arguments); |
|
45 | + $this->setCommand("alert"); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @licence http://www.gnu.org/licenses/gpl.txt |
27 | 27 | */ |
28 | 28 | |
29 | -require_once __DIR__ . '/pens_request.php'; |
|
29 | +require_once __DIR__.'/pens_request.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * PENSRequestReceipt |