@@ -7,7 +7,7 @@ |
||
7 | 7 | api_get_setting('cas_activate') == 'true' && |
8 | 8 | $_user['auth_source'] == CAS_AUTH_SOURCE |
9 | 9 | ) { |
10 | - $_template['show_message'] = true; |
|
10 | + $_template['show_message'] = true; |
|
11 | 11 | // the link URL |
12 | 12 | $link_url = "#"; |
13 | 13 | if (!empty($plugin_info['settings']['ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url'])) { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | //the plugin title |
13 | -$plugin_info['title'] = 'Enable or disable logout button'; |
|
13 | +$plugin_info['title'] = 'Enable or disable logout button'; |
|
14 | 14 | |
15 | 15 | //the comments that go with the plugin |
16 | 16 | $plugin_info['comment'] = "If you use some other authentication than local Chamilo authentication, you may have to disable the Chamilo logout button and give users information about your SSO logout."; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | $form->addElement("html", "<div class='normal-message'>Fill the text boxes below to overwrite the default values used in this plugin</div>"); |
24 | 24 | $form->addElement('text', 'eaclbb_form_link_url', 'Page to load when clicking on the logout button'); |
25 | 25 | $form->addElement('text', 'eaclbb_form_link_infobulle', 'Tooltip text for the logout button (displayed on mouseover)'); |
26 | -$form->addElement('checkbox', 'eaclbb_form_link_image', "Display the logout button disabled (black and white)", "", array('checked' => true)); |
|
27 | -$form->addElement('checkbox', 'eaclbb_form_alert_onoff', "Display an alert when clicking on the logout button", "", array('checked' => true)); |
|
26 | +$form->addElement('checkbox', 'eaclbb_form_link_image', "Display the logout button disabled (black and white)", "", array('checked' => true)); |
|
27 | +$form->addElement('checkbox', 'eaclbb_form_alert_onoff', "Display an alert when clicking on the logout button", "", array('checked' => true)); |
|
28 | 28 | $form->addElement('text', 'eaclbb_form_alert_text', "Text displayed in the alert box when clickng on the logout button (if checkbox above has been checked)."); |
29 | 29 | |
30 | 30 | $form->addButtonSave(get_lang('Save'), 'submit_button'); |
@@ -44,4 +44,4 @@ discard block |
||
44 | 44 | $plugin_info['settings_form'] = $form; |
45 | 45 | |
46 | 46 | // Set the templates that are going to be used |
47 | -$plugin_info['templates'] = array('template.tpl'); |
|
47 | +$plugin_info['templates'] = array('template.tpl'); |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__ . '/../../vendor/autoload.php'; |
|
4 | -if (file_exists(__DIR__ . '/config.vm.php')) { |
|
3 | +require __DIR__.'/../../vendor/autoload.php'; |
|
4 | +if (file_exists(__DIR__.'/config.vm.php')) { |
|
5 | 5 | |
6 | - require_once dirname(__FILE__) . '/config.php'; |
|
6 | + require_once dirname(__FILE__).'/config.php'; |
|
7 | 7 | |
8 | - require __DIR__ . '/lib/vm/AbstractVM.php'; |
|
9 | - require __DIR__ . '/lib/vm/VMInterface.php'; |
|
10 | - require __DIR__ . '/lib/vm/DigitalOceanVM.php'; |
|
11 | - require __DIR__ . '/lib/VM.php'; |
|
8 | + require __DIR__.'/lib/vm/AbstractVM.php'; |
|
9 | + require __DIR__.'/lib/vm/VMInterface.php'; |
|
10 | + require __DIR__.'/lib/vm/DigitalOceanVM.php'; |
|
11 | + require __DIR__.'/lib/VM.php'; |
|
12 | 12 | |
13 | - $config = require __DIR__ . '/config.vm.php'; |
|
13 | + $config = require __DIR__.'/config.vm.php'; |
|
14 | 14 | |
15 | 15 | $vm = new VM($config); |
16 | 16 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (empty($activeSessions)) { |
22 | 22 | $vm->runCron(); |
23 | 23 | } else { |
24 | - echo "Can't run cron active sessions found: " . $activeSessions; |
|
24 | + echo "Can't run cron active sessions found: ".$activeSessions; |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | } |
@@ -55,25 +55,25 @@ discard block |
||
55 | 55 | */ |
56 | 56 | // BASE CONFIGS - set these for your BBB server in config.php and they will |
57 | 57 | // simply flow in here via the constants: |
58 | - $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | - $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
58 | + $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | + $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | 60 | } |
61 | 61 | |
62 | - private function _processXmlResponse($url){ |
|
62 | + private function _processXmlResponse($url) { |
|
63 | 63 | /* |
64 | 64 | A private utility method used by other public methods to process XML responses. |
65 | 65 | */ |
66 | 66 | if (extension_loaded('curl')) { |
67 | - $ch = curl_init() or die ( curl_error($ch) ); |
|
67 | + $ch = curl_init() or die (curl_error($ch)); |
|
68 | 68 | $timeout = 10; |
69 | - curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | - curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | - curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | - $data = curl_exec( $ch ); |
|
74 | - curl_close( $ch ); |
|
75 | - |
|
76 | - if($data) |
|
69 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
71 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
72 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | + $data = curl_exec($ch); |
|
74 | + curl_close($ch); |
|
75 | + |
|
76 | + if ($data) |
|
77 | 77 | return (new SimpleXMLElement($data)); |
78 | 78 | else |
79 | 79 | return false; |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | '&duration='.urlencode($creationParams['duration']); |
138 | 138 | //'&meta_category='.urlencode($creationParams['meta_category']); |
139 | 139 | $welcomeMessage = $creationParams['welcomeMsg']; |
140 | - if(trim($welcomeMessage)) |
|
140 | + if (trim($welcomeMessage)) |
|
141 | 141 | $params .= '&welcome='.urlencode($welcomeMessage); |
142 | 142 | // Return the complete URL: |
143 | - return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
143 | + return ($creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | public function createMeetingWithXmlResponseArray($creationParams) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
166 | 166 | |
167 | 167 | if ($xml) { |
168 | - if($xml->meetingID) |
|
168 | + if ($xml->meetingID) |
|
169 | 169 | return array( |
170 | 170 | 'returncode' => $xml->returncode, |
171 | 171 | 'message' => $xml->message, |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
284 | 284 | */ |
285 | 285 | $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
286 | - if($xml) { |
|
286 | + if ($xml) { |
|
287 | 287 | return array( |
288 | 288 | 'returncode' => $xml->returncode, |
289 | 289 | 'running' => $xml->running // -- Returns true/false. |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | and then handle the results that we get in the XML response. |
311 | 311 | */ |
312 | 312 | $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
313 | - if($xml) { |
|
313 | + if ($xml) { |
|
314 | 314 | // If we don't get a success code, stop processing and return just the returncode: |
315 | 315 | if ($xml->returncode != 'SUCCESS') { |
316 | 316 | $result = array( |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | ); |
380 | 380 | */ |
381 | 381 | $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
382 | - if($xml) { |
|
382 | + if ($xml) { |
|
383 | 383 | // If we don't get a success code or messageKey, find out why: |
384 | 384 | if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
385 | 385 | $result = array( |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | probably be required in user code when 'recording' is set to true. |
455 | 455 | */ |
456 | 456 | $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
457 | - if($xml) { |
|
457 | + if ($xml) { |
|
458 | 458 | // If we don't get a success code or messageKey, find out why: |
459 | 459 | if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
460 | 460 | $result = array( |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | ); |
525 | 525 | */ |
526 | 526 | $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
527 | - if($xml) { |
|
527 | + if ($xml) { |
|
528 | 528 | return array( |
529 | 529 | 'returncode' => $xml->returncode, |
530 | 530 | 'published' => $xml->published // -- Returns true/false. |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | */ |
558 | 558 | |
559 | 559 | $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
560 | - if($xml) { |
|
560 | + if ($xml) { |
|
561 | 561 | return array( |
562 | 562 | 'returncode' => $xml->returncode, |
563 | 563 | 'deleted' => $xml->deleted // -- Returns true/false. |
@@ -73,10 +73,11 @@ discard block |
||
73 | 73 | $data = curl_exec( $ch ); |
74 | 74 | curl_close( $ch ); |
75 | 75 | |
76 | - if($data) |
|
77 | - return (new SimpleXMLElement($data)); |
|
78 | - else |
|
79 | - return false; |
|
76 | + if($data) { |
|
77 | + return (new SimpleXMLElement($data)); |
|
78 | + } else { |
|
79 | + return false; |
|
80 | + } |
|
80 | 81 | } |
81 | 82 | return (simplexml_load_file($url)); |
82 | 83 | } |
@@ -85,11 +86,9 @@ discard block |
||
85 | 86 | /* Process required params and throw errors if we don't get values */ |
86 | 87 | if ((isset($param)) && ($param != '')) { |
87 | 88 | return $param; |
88 | - } |
|
89 | - elseif (!isset($param)) { |
|
89 | + } elseif (!isset($param)) { |
|
90 | 90 | throw new Exception('Missing parameter.'); |
91 | - } |
|
92 | - else { |
|
91 | + } else { |
|
93 | 92 | throw new Exception(''.$param.' is required.'); |
94 | 93 | } |
95 | 94 | } |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | /* Don't know if we'll use this one, but let's build it in case. */ |
100 | 99 | if ((isset($param)) && ($param != '')) { |
101 | 100 | return $param; |
102 | - } |
|
103 | - else { |
|
101 | + } else { |
|
104 | 102 | $param = ''; |
105 | 103 | return $param; |
106 | 104 | } |
@@ -137,8 +135,9 @@ discard block |
||
137 | 135 | '&duration='.urlencode($creationParams['duration']); |
138 | 136 | //'&meta_category='.urlencode($creationParams['meta_category']); |
139 | 137 | $welcomeMessage = $creationParams['welcomeMsg']; |
140 | - if(trim($welcomeMessage)) |
|
141 | - $params .= '&welcome='.urlencode($welcomeMessage); |
|
138 | + if(trim($welcomeMessage)) { |
|
139 | + $params .= '&welcome='.urlencode($welcomeMessage); |
|
140 | + } |
|
142 | 141 | // Return the complete URL: |
143 | 142 | return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
144 | 143 | } |
@@ -165,8 +164,8 @@ discard block |
||
165 | 164 | $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
166 | 165 | |
167 | 166 | if ($xml) { |
168 | - if($xml->meetingID) |
|
169 | - return array( |
|
167 | + if($xml->meetingID) { |
|
168 | + return array( |
|
170 | 169 | 'returncode' => $xml->returncode, |
171 | 170 | 'message' => $xml->message, |
172 | 171 | 'messageKey' => $xml->messageKey, |
@@ -176,14 +175,14 @@ discard block |
||
176 | 175 | 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, |
177 | 176 | 'createTime' => $xml->createTime |
178 | 177 | ); |
179 | - else |
|
180 | - return array( |
|
178 | + } else { |
|
179 | + return array( |
|
181 | 180 | 'returncode' => $xml->returncode, |
182 | 181 | 'message' => $xml->message, |
183 | 182 | 'messageKey' => $xml->messageKey |
184 | 183 | ); |
185 | - } |
|
186 | - else { |
|
184 | + } |
|
185 | + } else { |
|
187 | 186 | return null; |
188 | 187 | } |
189 | 188 | } |
@@ -253,8 +252,7 @@ discard block |
||
253 | 252 | 'message' => $xml->message, |
254 | 253 | 'messageKey' => $xml->messageKey |
255 | 254 | ); |
256 | - } |
|
257 | - else { |
|
255 | + } else { |
|
258 | 256 | return null; |
259 | 257 | } |
260 | 258 | |
@@ -288,8 +286,7 @@ discard block |
||
288 | 286 | 'returncode' => $xml->returncode, |
289 | 287 | 'running' => $xml->running // -- Returns true/false. |
290 | 288 | ); |
291 | - } |
|
292 | - else { |
|
289 | + } else { |
|
293 | 290 | return null; |
294 | 291 | } |
295 | 292 | |
@@ -317,8 +314,7 @@ discard block |
||
317 | 314 | 'returncode' => $xml->returncode |
318 | 315 | ); |
319 | 316 | return $result; |
320 | - } |
|
321 | - elseif ($xml->messageKey == 'noMeetings') { |
|
317 | + } elseif ($xml->messageKey == 'noMeetings') { |
|
322 | 318 | /* No meetings on server, so return just this info: */ |
323 | 319 | $result = array( |
324 | 320 | 'returncode' => $xml->returncode, |
@@ -326,8 +322,7 @@ discard block |
||
326 | 322 | 'message' => $xml->message |
327 | 323 | ); |
328 | 324 | return $result; |
329 | - } |
|
330 | - else { |
|
325 | + } else { |
|
331 | 326 | // In this case, we have success and meetings. First return general response: |
332 | 327 | $result = array( |
333 | 328 | 'returncode' => $xml->returncode, |
@@ -348,8 +343,7 @@ discard block |
||
348 | 343 | } |
349 | 344 | return $result; |
350 | 345 | } |
351 | - } |
|
352 | - else { |
|
346 | + } else { |
|
353 | 347 | return null; |
354 | 348 | } |
355 | 349 | |
@@ -388,8 +382,7 @@ discard block |
||
388 | 382 | 'message' => $xml->message |
389 | 383 | ); |
390 | 384 | return $result; |
391 | - } |
|
392 | - else { |
|
385 | + } else { |
|
393 | 386 | // In this case, we have success and meeting info: |
394 | 387 | $result = array( |
395 | 388 | 'returncode' => $xml->returncode, |
@@ -418,8 +411,7 @@ discard block |
||
418 | 411 | } |
419 | 412 | return $result; |
420 | 413 | } |
421 | - } |
|
422 | - else { |
|
414 | + } else { |
|
423 | 415 | return null; |
424 | 416 | } |
425 | 417 | |
@@ -463,8 +455,7 @@ discard block |
||
463 | 455 | 'message' => $xml->message |
464 | 456 | ); |
465 | 457 | return $result; |
466 | - } |
|
467 | - else { |
|
458 | + } else { |
|
468 | 459 | // In this case, we have success and recording info: |
469 | 460 | $result = array( |
470 | 461 | 'returncode' => $xml->returncode, |
@@ -495,8 +486,7 @@ discard block |
||
495 | 486 | } |
496 | 487 | return $result; |
497 | 488 | } |
498 | - } |
|
499 | - else { |
|
489 | + } else { |
|
500 | 490 | return null; |
501 | 491 | } |
502 | 492 | } |
@@ -529,8 +519,7 @@ discard block |
||
529 | 519 | 'returncode' => $xml->returncode, |
530 | 520 | 'published' => $xml->published // -- Returns true/false. |
531 | 521 | ); |
532 | - } |
|
533 | - else { |
|
522 | + } else { |
|
534 | 523 | return null; |
535 | 524 | } |
536 | 525 | |
@@ -562,8 +551,7 @@ discard block |
||
562 | 551 | 'returncode' => $xml->returncode, |
563 | 552 | 'deleted' => $xml->deleted // -- Returns true/false. |
564 | 553 | ); |
565 | - } |
|
566 | - else { |
|
554 | + } else { |
|
567 | 555 | return null; |
568 | 556 | } |
569 | 557 |
@@ -44,107 +44,107 @@ discard block |
||
44 | 44 | |
45 | 45 | class BigBlueButtonBN { |
46 | 46 | |
47 | - private $_securitySalt; |
|
48 | - private $_bbbServerBaseUrl; |
|
47 | + private $_securitySalt; |
|
48 | + private $_bbbServerBaseUrl; |
|
49 | 49 | |
50 | - /* ___________ General Methods for the BigBlueButton Class __________ */ |
|
50 | + /* ___________ General Methods for the BigBlueButton Class __________ */ |
|
51 | 51 | |
52 | - function __construct() { |
|
53 | - /* |
|
52 | + function __construct() { |
|
53 | + /* |
|
54 | 54 | Establish just our basic elements in the constructor: |
55 | 55 | */ |
56 | - // BASE CONFIGS - set these for your BBB server in config.php and they will |
|
57 | - // simply flow in here via the constants: |
|
58 | - $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | - $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | - } |
|
61 | - |
|
62 | - private function _processXmlResponse($url){ |
|
63 | - /* |
|
56 | + // BASE CONFIGS - set these for your BBB server in config.php and they will |
|
57 | + // simply flow in here via the constants: |
|
58 | + $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | + $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | + } |
|
61 | + |
|
62 | + private function _processXmlResponse($url){ |
|
63 | + /* |
|
64 | 64 | A private utility method used by other public methods to process XML responses. |
65 | 65 | */ |
66 | - if (extension_loaded('curl')) { |
|
67 | - $ch = curl_init() or die ( curl_error($ch) ); |
|
68 | - $timeout = 10; |
|
69 | - curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | - curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | - curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | - $data = curl_exec( $ch ); |
|
74 | - curl_close( $ch ); |
|
75 | - |
|
76 | - if($data) |
|
77 | - return (new SimpleXMLElement($data)); |
|
78 | - else |
|
79 | - return false; |
|
80 | - } |
|
81 | - return (simplexml_load_file($url)); |
|
82 | - } |
|
83 | - |
|
84 | - private function _requiredParam($param) { |
|
85 | - /* Process required params and throw errors if we don't get values */ |
|
86 | - if ((isset($param)) && ($param != '')) { |
|
87 | - return $param; |
|
88 | - } |
|
89 | - elseif (!isset($param)) { |
|
90 | - throw new Exception('Missing parameter.'); |
|
91 | - } |
|
92 | - else { |
|
93 | - throw new Exception(''.$param.' is required.'); |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - private function _optionalParam($param) { |
|
98 | - /* Pass most optional params through as set value, or set to '' */ |
|
99 | - /* Don't know if we'll use this one, but let's build it in case. */ |
|
100 | - if ((isset($param)) && ($param != '')) { |
|
101 | - return $param; |
|
102 | - } |
|
103 | - else { |
|
104 | - $param = ''; |
|
105 | - return $param; |
|
106 | - } |
|
107 | - } |
|
108 | - |
|
109 | - /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
|
110 | - /* The methods in the following section support the following categories of the BBB API: |
|
66 | + if (extension_loaded('curl')) { |
|
67 | + $ch = curl_init() or die ( curl_error($ch) ); |
|
68 | + $timeout = 10; |
|
69 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | + curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | + $data = curl_exec( $ch ); |
|
74 | + curl_close( $ch ); |
|
75 | + |
|
76 | + if($data) |
|
77 | + return (new SimpleXMLElement($data)); |
|
78 | + else |
|
79 | + return false; |
|
80 | + } |
|
81 | + return (simplexml_load_file($url)); |
|
82 | + } |
|
83 | + |
|
84 | + private function _requiredParam($param) { |
|
85 | + /* Process required params and throw errors if we don't get values */ |
|
86 | + if ((isset($param)) && ($param != '')) { |
|
87 | + return $param; |
|
88 | + } |
|
89 | + elseif (!isset($param)) { |
|
90 | + throw new Exception('Missing parameter.'); |
|
91 | + } |
|
92 | + else { |
|
93 | + throw new Exception(''.$param.' is required.'); |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + private function _optionalParam($param) { |
|
98 | + /* Pass most optional params through as set value, or set to '' */ |
|
99 | + /* Don't know if we'll use this one, but let's build it in case. */ |
|
100 | + if ((isset($param)) && ($param != '')) { |
|
101 | + return $param; |
|
102 | + } |
|
103 | + else { |
|
104 | + $param = ''; |
|
105 | + return $param; |
|
106 | + } |
|
107 | + } |
|
108 | + |
|
109 | + /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
|
110 | + /* The methods in the following section support the following categories of the BBB API: |
|
111 | 111 | -- create |
112 | 112 | -- join |
113 | 113 | -- end |
114 | 114 | */ |
115 | 115 | |
116 | - public function getCreateMeetingUrl($creationParams) { |
|
117 | - /* |
|
116 | + public function getCreateMeetingUrl($creationParams) { |
|
117 | + /* |
|
118 | 118 | USAGE: |
119 | 119 | (see $creationParams array in createMeetingArray method.) |
120 | 120 | */ |
121 | - $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); |
|
122 | - $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); |
|
123 | - // Set up the basic creation URL: |
|
124 | - $creationUrl = $this->_bbbServerBaseUrl."api/create?"; |
|
125 | - // Add params: |
|
126 | - $params = |
|
127 | - 'name='.urlencode($this->_meetingName). |
|
128 | - '&meetingID='.urlencode($this->_meetingId). |
|
129 | - '&attendeePW='.urlencode($creationParams['attendeePw']). |
|
130 | - '&moderatorPW='.urlencode($creationParams['moderatorPw']). |
|
131 | - '&dialNumber='.urlencode($creationParams['dialNumber']). |
|
132 | - '&voiceBridge='.urlencode($creationParams['voiceBridge']). |
|
133 | - '&webVoice='.urlencode($creationParams['webVoice']). |
|
134 | - '&logoutURL='.urlencode($creationParams['logoutUrl']). |
|
135 | - '&maxParticipants='.urlencode($creationParams['maxParticipants']). |
|
136 | - '&record='.urlencode($creationParams['record']). |
|
137 | - '&duration='.urlencode($creationParams['duration']); |
|
138 | - //'&meta_category='.urlencode($creationParams['meta_category']); |
|
139 | - $welcomeMessage = $creationParams['welcomeMsg']; |
|
140 | - if(trim($welcomeMessage)) |
|
141 | - $params .= '&welcome='.urlencode($welcomeMessage); |
|
142 | - // Return the complete URL: |
|
143 | - return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
144 | - } |
|
145 | - |
|
146 | - public function createMeetingWithXmlResponseArray($creationParams) { |
|
147 | - /* |
|
121 | + $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); |
|
122 | + $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); |
|
123 | + // Set up the basic creation URL: |
|
124 | + $creationUrl = $this->_bbbServerBaseUrl."api/create?"; |
|
125 | + // Add params: |
|
126 | + $params = |
|
127 | + 'name='.urlencode($this->_meetingName). |
|
128 | + '&meetingID='.urlencode($this->_meetingId). |
|
129 | + '&attendeePW='.urlencode($creationParams['attendeePw']). |
|
130 | + '&moderatorPW='.urlencode($creationParams['moderatorPw']). |
|
131 | + '&dialNumber='.urlencode($creationParams['dialNumber']). |
|
132 | + '&voiceBridge='.urlencode($creationParams['voiceBridge']). |
|
133 | + '&webVoice='.urlencode($creationParams['webVoice']). |
|
134 | + '&logoutURL='.urlencode($creationParams['logoutUrl']). |
|
135 | + '&maxParticipants='.urlencode($creationParams['maxParticipants']). |
|
136 | + '&record='.urlencode($creationParams['record']). |
|
137 | + '&duration='.urlencode($creationParams['duration']); |
|
138 | + //'&meta_category='.urlencode($creationParams['meta_category']); |
|
139 | + $welcomeMessage = $creationParams['welcomeMsg']; |
|
140 | + if(trim($welcomeMessage)) |
|
141 | + $params .= '&welcome='.urlencode($welcomeMessage); |
|
142 | + // Return the complete URL: |
|
143 | + return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
144 | + } |
|
145 | + |
|
146 | + public function createMeetingWithXmlResponseArray($creationParams) { |
|
147 | + /* |
|
148 | 148 | USAGE: |
149 | 149 | $creationParams = array( |
150 | 150 | 'name' => 'Meeting Name', -- A name for the meeting (or username) |
@@ -162,34 +162,34 @@ discard block |
||
162 | 162 | 'meta_category' => '', -- Use to pass additional info to BBB server. See API docs to enable. |
163 | 163 | ); |
164 | 164 | */ |
165 | - $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
|
165 | + $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
|
166 | 166 | |
167 | 167 | if ($xml) { |
168 | - if($xml->meetingID) |
|
169 | - return array( |
|
170 | - 'returncode' => $xml->returncode->__toString(), |
|
171 | - 'message' => $xml->message->__toString(), |
|
172 | - 'messageKey' => $xml->messageKey->__toString(), |
|
173 | - 'meetingId' => $xml->meetingID->__toString(), |
|
174 | - 'attendeePw' => $xml->attendeePW->__toString(), |
|
175 | - 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
176 | - 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
177 | - 'createTime' => $xml->createTime->__toString() |
|
178 | - ); |
|
179 | - else |
|
180 | - return array( |
|
181 | - 'returncode' => $xml->returncode->__toString(), |
|
182 | - 'message' => $xml->message->__toString(), |
|
183 | - 'messageKey' => $xml->messageKey->__toString() |
|
184 | - ); |
|
185 | - } |
|
186 | - else { |
|
187 | - return null; |
|
188 | - } |
|
189 | - } |
|
190 | - |
|
191 | - public function getJoinMeetingURL($joinParams) { |
|
192 | - /* |
|
168 | + if($xml->meetingID) |
|
169 | + return array( |
|
170 | + 'returncode' => $xml->returncode->__toString(), |
|
171 | + 'message' => $xml->message->__toString(), |
|
172 | + 'messageKey' => $xml->messageKey->__toString(), |
|
173 | + 'meetingId' => $xml->meetingID->__toString(), |
|
174 | + 'attendeePw' => $xml->attendeePW->__toString(), |
|
175 | + 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
176 | + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
177 | + 'createTime' => $xml->createTime->__toString() |
|
178 | + ); |
|
179 | + else |
|
180 | + return array( |
|
181 | + 'returncode' => $xml->returncode->__toString(), |
|
182 | + 'message' => $xml->message->__toString(), |
|
183 | + 'messageKey' => $xml->messageKey->__toString() |
|
184 | + ); |
|
185 | + } |
|
186 | + else { |
|
187 | + return null; |
|
188 | + } |
|
189 | + } |
|
190 | + |
|
191 | + public function getJoinMeetingURL($joinParams) { |
|
192 | + /* |
|
193 | 193 | NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API |
194 | 194 | doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL |
195 | 195 | that's returned from this method and simply send your users off to that URL in your code. |
@@ -203,249 +203,249 @@ discard block |
||
203 | 203 | 'webVoiceConf' => '' -- OPTIONAL - string |
204 | 204 | ); |
205 | 205 | */ |
206 | - $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); |
|
207 | - $this->_username = $this->_requiredParam($joinParams['username']); |
|
208 | - $this->_password = $this->_requiredParam($joinParams['password']); |
|
209 | - // Establish the basic join URL: |
|
210 | - $joinUrl = $this->_bbbServerBaseUrl."api/join?"; |
|
211 | - // Add parameters to the URL: |
|
212 | - $params = |
|
213 | - 'meetingID='.urlencode($this->_meetingId). |
|
214 | - '&fullName='.urlencode($this->_username). |
|
215 | - '&password='.urlencode($this->_password). |
|
216 | - '&userID='.urlencode($joinParams['userID']). |
|
217 | - '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); |
|
218 | - // Only use createTime if we really want to use it. If it's '', then don't pass it: |
|
219 | - if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { |
|
220 | - $params .= '&createTime='.urlencode($joinParams['createTime']); |
|
221 | - } |
|
222 | - // Return the URL: |
|
223 | - return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); |
|
224 | - } |
|
225 | - |
|
226 | - public function getEndMeetingURL($endParams) { |
|
227 | - /* USAGE: |
|
206 | + $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); |
|
207 | + $this->_username = $this->_requiredParam($joinParams['username']); |
|
208 | + $this->_password = $this->_requiredParam($joinParams['password']); |
|
209 | + // Establish the basic join URL: |
|
210 | + $joinUrl = $this->_bbbServerBaseUrl."api/join?"; |
|
211 | + // Add parameters to the URL: |
|
212 | + $params = |
|
213 | + 'meetingID='.urlencode($this->_meetingId). |
|
214 | + '&fullName='.urlencode($this->_username). |
|
215 | + '&password='.urlencode($this->_password). |
|
216 | + '&userID='.urlencode($joinParams['userID']). |
|
217 | + '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); |
|
218 | + // Only use createTime if we really want to use it. If it's '', then don't pass it: |
|
219 | + if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { |
|
220 | + $params .= '&createTime='.urlencode($joinParams['createTime']); |
|
221 | + } |
|
222 | + // Return the URL: |
|
223 | + return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); |
|
224 | + } |
|
225 | + |
|
226 | + public function getEndMeetingURL($endParams) { |
|
227 | + /* USAGE: |
|
228 | 228 | $endParams = array ( |
229 | 229 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
230 | 230 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
231 | 231 | ); |
232 | 232 | */ |
233 | - $this->_meetingId = $this->_requiredParam($endParams['meetingId']); |
|
234 | - $this->_password = $this->_requiredParam($endParams['password']); |
|
235 | - $endUrl = $this->_bbbServerBaseUrl."api/end?"; |
|
236 | - $params = |
|
237 | - 'meetingID='.urlencode($this->_meetingId). |
|
238 | - '&password='.urlencode($this->_password); |
|
239 | - return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); |
|
240 | - } |
|
241 | - |
|
242 | - public function endMeetingWithXmlResponseArray($endParams) { |
|
243 | - /* USAGE: |
|
233 | + $this->_meetingId = $this->_requiredParam($endParams['meetingId']); |
|
234 | + $this->_password = $this->_requiredParam($endParams['password']); |
|
235 | + $endUrl = $this->_bbbServerBaseUrl."api/end?"; |
|
236 | + $params = |
|
237 | + 'meetingID='.urlencode($this->_meetingId). |
|
238 | + '&password='.urlencode($this->_password); |
|
239 | + return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); |
|
240 | + } |
|
241 | + |
|
242 | + public function endMeetingWithXmlResponseArray($endParams) { |
|
243 | + /* USAGE: |
|
244 | 244 | $endParams = array ( |
245 | 245 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
246 | 246 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
247 | 247 | ); |
248 | 248 | */ |
249 | - $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); |
|
250 | - if ($xml) { |
|
251 | - return array( |
|
252 | - 'returncode' => $xml->returncode->__toString(), |
|
253 | - 'message' => $xml->message->__toString(), |
|
254 | - 'messageKey' => $xml->messageKey->__toString() |
|
255 | - ); |
|
256 | - } |
|
257 | - else { |
|
258 | - return null; |
|
259 | - } |
|
260 | - |
|
261 | - } |
|
262 | - |
|
263 | - /* __________________ BBB MONITORING METHODS _________________ */ |
|
264 | - /* The methods in the following section support the following categories of the BBB API: |
|
249 | + $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); |
|
250 | + if ($xml) { |
|
251 | + return array( |
|
252 | + 'returncode' => $xml->returncode->__toString(), |
|
253 | + 'message' => $xml->message->__toString(), |
|
254 | + 'messageKey' => $xml->messageKey->__toString() |
|
255 | + ); |
|
256 | + } |
|
257 | + else { |
|
258 | + return null; |
|
259 | + } |
|
260 | + |
|
261 | + } |
|
262 | + |
|
263 | + /* __________________ BBB MONITORING METHODS _________________ */ |
|
264 | + /* The methods in the following section support the following categories of the BBB API: |
|
265 | 265 | -- isMeetingRunning |
266 | 266 | -- getMeetings |
267 | 267 | -- getMeetingInfo |
268 | 268 | */ |
269 | 269 | |
270 | - public function getIsMeetingRunningUrl($meetingId) { |
|
271 | - /* USAGE: |
|
270 | + public function getIsMeetingRunningUrl($meetingId) { |
|
271 | + /* USAGE: |
|
272 | 272 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
273 | 273 | */ |
274 | - $this->_meetingId = $this->_requiredParam($meetingId); |
|
275 | - $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; |
|
276 | - $params = |
|
277 | - 'meetingID='.urlencode($this->_meetingId); |
|
278 | - return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); |
|
279 | - } |
|
280 | - |
|
281 | - public function isMeetingRunningWithXmlResponseArray($meetingId) { |
|
282 | - /* USAGE: |
|
274 | + $this->_meetingId = $this->_requiredParam($meetingId); |
|
275 | + $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; |
|
276 | + $params = |
|
277 | + 'meetingID='.urlencode($this->_meetingId); |
|
278 | + return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); |
|
279 | + } |
|
280 | + |
|
281 | + public function isMeetingRunningWithXmlResponseArray($meetingId) { |
|
282 | + /* USAGE: |
|
283 | 283 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
284 | 284 | */ |
285 | - $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
|
286 | - if($xml) { |
|
287 | - return array( |
|
288 | - 'returncode' => $xml->returncode->__toString(), |
|
289 | - 'running' => $xml->running->__toString() // -- Returns true/false. |
|
290 | - ); |
|
291 | - } |
|
292 | - else { |
|
293 | - return null; |
|
294 | - } |
|
295 | - |
|
296 | - } |
|
297 | - |
|
298 | - public function getGetMeetingsUrl() { |
|
299 | - /* Simply formulate the getMeetings URL |
|
285 | + $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
|
286 | + if($xml) { |
|
287 | + return array( |
|
288 | + 'returncode' => $xml->returncode->__toString(), |
|
289 | + 'running' => $xml->running->__toString() // -- Returns true/false. |
|
290 | + ); |
|
291 | + } |
|
292 | + else { |
|
293 | + return null; |
|
294 | + } |
|
295 | + |
|
296 | + } |
|
297 | + |
|
298 | + public function getGetMeetingsUrl() { |
|
299 | + /* Simply formulate the getMeetings URL |
|
300 | 300 | We do this in a separate function so we have the option to just get this |
301 | 301 | URL and print it if we want for some reason. |
302 | 302 | */ |
303 | - $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); |
|
304 | - return $getMeetingsUrl; |
|
305 | - } |
|
303 | + $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); |
|
304 | + return $getMeetingsUrl; |
|
305 | + } |
|
306 | 306 | |
307 | - public function getMeetingsWithXmlResponseArray() { |
|
308 | - /* USAGE: |
|
307 | + public function getMeetingsWithXmlResponseArray() { |
|
308 | + /* USAGE: |
|
309 | 309 | We don't need to pass any parameters with this one, so we just send the query URL off to BBB |
310 | 310 | and then handle the results that we get in the XML response. |
311 | 311 | */ |
312 | - $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
|
313 | - if($xml) { |
|
314 | - // If we don't get a success code, stop processing and return just the returncode: |
|
315 | - if ($xml->returncode != 'SUCCESS') { |
|
316 | - $result = array( |
|
317 | - 'returncode' => $xml->returncode->__toString() |
|
318 | - ); |
|
319 | - return $result; |
|
320 | - } |
|
321 | - elseif ($xml->messageKey == 'noMeetings') { |
|
322 | - /* No meetings on server, so return just this info: */ |
|
323 | - $result = array( |
|
324 | - 'returncode' => $xml->returncode->__toString(), |
|
325 | - 'messageKey' => $xml->messageKey->__toString(), |
|
326 | - 'message' => $xml->message->__toString() |
|
327 | - ); |
|
328 | - return $result; |
|
329 | - } |
|
330 | - else { |
|
331 | - // In this case, we have success and meetings. First return general response: |
|
332 | - $result = array( |
|
333 | - 'returncode' => $xml->returncode->__toString(), |
|
334 | - 'messageKey' => $xml->messageKey->__toString(), |
|
335 | - 'message' => $xml->message->__toString() |
|
336 | - ); |
|
337 | - // Then interate through meeting results and return them as part of the array: |
|
338 | - foreach ($xml->meetings->meeting as $m) { |
|
339 | - $result[] = array( |
|
340 | - 'meetingId' => $m->meetingID->__toString(), |
|
341 | - 'meetingName' => $m->meetingName->__toString(), |
|
342 | - 'createTime' => $m->createTime->__toString(), |
|
343 | - 'attendeePw' => $m->attendeePW->__toString(), |
|
344 | - 'moderatorPw' => $m->moderatorPW->__toString(), |
|
345 | - 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(), |
|
346 | - 'running' => $m->running->__toString() |
|
347 | - ); |
|
348 | - } |
|
349 | - return $result; |
|
350 | - } |
|
351 | - } |
|
352 | - else { |
|
353 | - return null; |
|
354 | - } |
|
355 | - |
|
356 | - } |
|
357 | - |
|
358 | - public function getMeetingInfoUrl($infoParams) { |
|
359 | - /* USAGE: |
|
312 | + $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
|
313 | + if($xml) { |
|
314 | + // If we don't get a success code, stop processing and return just the returncode: |
|
315 | + if ($xml->returncode != 'SUCCESS') { |
|
316 | + $result = array( |
|
317 | + 'returncode' => $xml->returncode->__toString() |
|
318 | + ); |
|
319 | + return $result; |
|
320 | + } |
|
321 | + elseif ($xml->messageKey == 'noMeetings') { |
|
322 | + /* No meetings on server, so return just this info: */ |
|
323 | + $result = array( |
|
324 | + 'returncode' => $xml->returncode->__toString(), |
|
325 | + 'messageKey' => $xml->messageKey->__toString(), |
|
326 | + 'message' => $xml->message->__toString() |
|
327 | + ); |
|
328 | + return $result; |
|
329 | + } |
|
330 | + else { |
|
331 | + // In this case, we have success and meetings. First return general response: |
|
332 | + $result = array( |
|
333 | + 'returncode' => $xml->returncode->__toString(), |
|
334 | + 'messageKey' => $xml->messageKey->__toString(), |
|
335 | + 'message' => $xml->message->__toString() |
|
336 | + ); |
|
337 | + // Then interate through meeting results and return them as part of the array: |
|
338 | + foreach ($xml->meetings->meeting as $m) { |
|
339 | + $result[] = array( |
|
340 | + 'meetingId' => $m->meetingID->__toString(), |
|
341 | + 'meetingName' => $m->meetingName->__toString(), |
|
342 | + 'createTime' => $m->createTime->__toString(), |
|
343 | + 'attendeePw' => $m->attendeePW->__toString(), |
|
344 | + 'moderatorPw' => $m->moderatorPW->__toString(), |
|
345 | + 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(), |
|
346 | + 'running' => $m->running->__toString() |
|
347 | + ); |
|
348 | + } |
|
349 | + return $result; |
|
350 | + } |
|
351 | + } |
|
352 | + else { |
|
353 | + return null; |
|
354 | + } |
|
355 | + |
|
356 | + } |
|
357 | + |
|
358 | + public function getMeetingInfoUrl($infoParams) { |
|
359 | + /* USAGE: |
|
360 | 360 | $infoParams = array( |
361 | 361 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
362 | 362 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
363 | 363 | ); |
364 | 364 | */ |
365 | - $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); |
|
366 | - $this->_password = $this->_requiredParam($infoParams['password']); |
|
367 | - $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; |
|
368 | - $params = |
|
369 | - 'meetingID='.urlencode($this->_meetingId). |
|
370 | - '&password='.urlencode($this->_password); |
|
371 | - return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); |
|
372 | - } |
|
373 | - |
|
374 | - public function getMeetingInfoWithXmlResponseArray($infoParams) { |
|
375 | - /* USAGE: |
|
365 | + $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); |
|
366 | + $this->_password = $this->_requiredParam($infoParams['password']); |
|
367 | + $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; |
|
368 | + $params = |
|
369 | + 'meetingID='.urlencode($this->_meetingId). |
|
370 | + '&password='.urlencode($this->_password); |
|
371 | + return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); |
|
372 | + } |
|
373 | + |
|
374 | + public function getMeetingInfoWithXmlResponseArray($infoParams) { |
|
375 | + /* USAGE: |
|
376 | 376 | $infoParams = array( |
377 | 377 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
378 | 378 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
379 | 379 | ); |
380 | 380 | */ |
381 | - $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
|
382 | - if($xml) { |
|
383 | - // If we don't get a success code or messageKey, find out why: |
|
384 | - if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
385 | - $result = array( |
|
386 | - 'returncode' => $xml->returncode->__toString(), |
|
387 | - 'messageKey' => $xml->messageKey->__toString(), |
|
388 | - 'message' => $xml->message->__toString() |
|
389 | - ); |
|
390 | - return $result; |
|
391 | - } |
|
392 | - else { |
|
393 | - // In this case, we have success and meeting info: |
|
394 | - $result = array( |
|
395 | - 'returncode' => $xml->returncode->__toString(), |
|
396 | - 'meetingName' => $xml->meetingName->__toString(), |
|
397 | - 'meetingId' => $xml->meetingID->__toString(), |
|
398 | - 'createTime' => $xml->createTime->__toString(), |
|
399 | - 'voiceBridge' => $xml->voiceBridge->__toString(), |
|
400 | - 'attendeePw' => $xml->attendeePW->__toString(), |
|
401 | - 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
402 | - 'running' => $xml->running->__toString(), |
|
403 | - 'recording' => $xml->recording->__toString(), |
|
404 | - 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
405 | - 'startTime' => $xml->startTime->__toString(), |
|
406 | - 'endTime' => $xml->endTime->__toString(), |
|
407 | - 'participantCount' => $xml->participantCount->__toString(), |
|
408 | - 'maxUsers' => $xml->maxUsers->__toString(), |
|
409 | - 'moderatorCount' => $xml->moderatorCount->__toString(), |
|
410 | - ); |
|
411 | - // Then interate through attendee results and return them as part of the array: |
|
412 | - foreach ($xml->attendees->attendee as $a) { |
|
413 | - $result[] = array( |
|
414 | - 'userId' => $a->userID->__toString(), |
|
415 | - 'fullName' => $a->fullName->__toString(), |
|
416 | - 'role' => $a->role->__toString() |
|
417 | - ); |
|
418 | - } |
|
419 | - return $result; |
|
420 | - } |
|
421 | - } |
|
422 | - else { |
|
423 | - return null; |
|
424 | - } |
|
425 | - |
|
426 | - } |
|
427 | - |
|
428 | - /* __________________ BBB RECORDING METHODS _________________ */ |
|
429 | - /* The methods in the following section support the following categories of the BBB API: |
|
381 | + $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
|
382 | + if($xml) { |
|
383 | + // If we don't get a success code or messageKey, find out why: |
|
384 | + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
385 | + $result = array( |
|
386 | + 'returncode' => $xml->returncode->__toString(), |
|
387 | + 'messageKey' => $xml->messageKey->__toString(), |
|
388 | + 'message' => $xml->message->__toString() |
|
389 | + ); |
|
390 | + return $result; |
|
391 | + } |
|
392 | + else { |
|
393 | + // In this case, we have success and meeting info: |
|
394 | + $result = array( |
|
395 | + 'returncode' => $xml->returncode->__toString(), |
|
396 | + 'meetingName' => $xml->meetingName->__toString(), |
|
397 | + 'meetingId' => $xml->meetingID->__toString(), |
|
398 | + 'createTime' => $xml->createTime->__toString(), |
|
399 | + 'voiceBridge' => $xml->voiceBridge->__toString(), |
|
400 | + 'attendeePw' => $xml->attendeePW->__toString(), |
|
401 | + 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
402 | + 'running' => $xml->running->__toString(), |
|
403 | + 'recording' => $xml->recording->__toString(), |
|
404 | + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
405 | + 'startTime' => $xml->startTime->__toString(), |
|
406 | + 'endTime' => $xml->endTime->__toString(), |
|
407 | + 'participantCount' => $xml->participantCount->__toString(), |
|
408 | + 'maxUsers' => $xml->maxUsers->__toString(), |
|
409 | + 'moderatorCount' => $xml->moderatorCount->__toString(), |
|
410 | + ); |
|
411 | + // Then interate through attendee results and return them as part of the array: |
|
412 | + foreach ($xml->attendees->attendee as $a) { |
|
413 | + $result[] = array( |
|
414 | + 'userId' => $a->userID->__toString(), |
|
415 | + 'fullName' => $a->fullName->__toString(), |
|
416 | + 'role' => $a->role->__toString() |
|
417 | + ); |
|
418 | + } |
|
419 | + return $result; |
|
420 | + } |
|
421 | + } |
|
422 | + else { |
|
423 | + return null; |
|
424 | + } |
|
425 | + |
|
426 | + } |
|
427 | + |
|
428 | + /* __________________ BBB RECORDING METHODS _________________ */ |
|
429 | + /* The methods in the following section support the following categories of the BBB API: |
|
430 | 430 | -- getRecordings |
431 | 431 | -- publishRecordings |
432 | 432 | -- deleteRecordings |
433 | 433 | */ |
434 | 434 | |
435 | - public function getRecordingsUrl($recordingParams) { |
|
436 | - /* USAGE: |
|
435 | + public function getRecordingsUrl($recordingParams) { |
|
436 | + /* USAGE: |
|
437 | 437 | $recordingParams = array( |
438 | 438 | 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids |
439 | 439 | ); |
440 | 440 | */ |
441 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; |
|
442 | - $params = 'meetingID='.urlencode($recordingParams['meetingId']); |
|
443 | - return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); |
|
441 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; |
|
442 | + $params = 'meetingID='.urlencode($recordingParams['meetingId']); |
|
443 | + return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); |
|
444 | 444 | |
445 | - } |
|
445 | + } |
|
446 | 446 | |
447 | - public function getRecordingsWithXmlResponseArray($recordingParams) { |
|
448 | - /* USAGE: |
|
447 | + public function getRecordingsWithXmlResponseArray($recordingParams) { |
|
448 | + /* USAGE: |
|
449 | 449 | $recordingParams = array( |
450 | 450 | 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids |
451 | 451 | ); |
@@ -453,121 +453,121 @@ discard block |
||
453 | 453 | when creating a meeting, it will kick users out after the duration. Should |
454 | 454 | probably be required in user code when 'recording' is set to true. |
455 | 455 | */ |
456 | - $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
|
457 | - if($xml) { |
|
458 | - // If we don't get a success code or messageKey, find out why: |
|
459 | - if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
460 | - $result = array( |
|
461 | - 'returncode' => $xml->returncode->__toString(), |
|
462 | - 'messageKey' => $xml->messageKey->__toString(), |
|
463 | - 'message' => $xml->message->__toString() |
|
464 | - ); |
|
465 | - return $result; |
|
466 | - } |
|
467 | - else { |
|
468 | - // In this case, we have success and recording info: |
|
469 | - $result = array( |
|
470 | - 'returncode' => $xml->returncode->__toString(), |
|
471 | - 'messageKey' => $xml->messageKey->__toString(), |
|
472 | - 'message' => $xml->message->__toString() |
|
473 | - ); |
|
474 | - |
|
475 | - foreach ($xml->recordings->recording as $r) { |
|
476 | - $result[] = array( |
|
477 | - 'recordId' => $r->recordID->__toString(), |
|
478 | - 'meetingId' => $r->meetingID->__toString(), |
|
479 | - 'name' => $r->name->__toString(), |
|
480 | - 'published' => $r->published->__toString(), |
|
481 | - 'startTime' => $r->startTime->__toString(), |
|
482 | - 'endTime' => $r->endTime->__toString(), |
|
483 | - 'playbackFormatType' => $r->playback->format->type->__toString(), |
|
484 | - 'playbackFormatUrl' => $r->playback->format->url->__toString(), |
|
485 | - 'playbackFormatLength' => $r->playback->format->length->__toString(), |
|
486 | - 'metadataTitle' => $r->metadata->title->__toString(), |
|
487 | - 'metadataSubject' => $r->metadata->subject->__toString(), |
|
488 | - 'metadataDescription' => $r->metadata->description->__toString(), |
|
489 | - 'metadataCreator' => $r->metadata->creator->__toString(), |
|
490 | - 'metadataContributor' => $r->metadata->contributor->__toString(), |
|
491 | - 'metadataLanguage' => $r->metadata->language->__toString(), |
|
492 | - // Add more here as needed for your app depending on your |
|
493 | - // use of metadata when creating recordings. |
|
494 | - ); |
|
495 | - } |
|
496 | - return $result; |
|
497 | - } |
|
498 | - } |
|
499 | - else { |
|
500 | - return null; |
|
501 | - } |
|
502 | - } |
|
503 | - |
|
504 | - public function getPublishRecordingsUrl($recordingParams) { |
|
505 | - /* USAGE: |
|
456 | + $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
|
457 | + if($xml) { |
|
458 | + // If we don't get a success code or messageKey, find out why: |
|
459 | + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
460 | + $result = array( |
|
461 | + 'returncode' => $xml->returncode->__toString(), |
|
462 | + 'messageKey' => $xml->messageKey->__toString(), |
|
463 | + 'message' => $xml->message->__toString() |
|
464 | + ); |
|
465 | + return $result; |
|
466 | + } |
|
467 | + else { |
|
468 | + // In this case, we have success and recording info: |
|
469 | + $result = array( |
|
470 | + 'returncode' => $xml->returncode->__toString(), |
|
471 | + 'messageKey' => $xml->messageKey->__toString(), |
|
472 | + 'message' => $xml->message->__toString() |
|
473 | + ); |
|
474 | + |
|
475 | + foreach ($xml->recordings->recording as $r) { |
|
476 | + $result[] = array( |
|
477 | + 'recordId' => $r->recordID->__toString(), |
|
478 | + 'meetingId' => $r->meetingID->__toString(), |
|
479 | + 'name' => $r->name->__toString(), |
|
480 | + 'published' => $r->published->__toString(), |
|
481 | + 'startTime' => $r->startTime->__toString(), |
|
482 | + 'endTime' => $r->endTime->__toString(), |
|
483 | + 'playbackFormatType' => $r->playback->format->type->__toString(), |
|
484 | + 'playbackFormatUrl' => $r->playback->format->url->__toString(), |
|
485 | + 'playbackFormatLength' => $r->playback->format->length->__toString(), |
|
486 | + 'metadataTitle' => $r->metadata->title->__toString(), |
|
487 | + 'metadataSubject' => $r->metadata->subject->__toString(), |
|
488 | + 'metadataDescription' => $r->metadata->description->__toString(), |
|
489 | + 'metadataCreator' => $r->metadata->creator->__toString(), |
|
490 | + 'metadataContributor' => $r->metadata->contributor->__toString(), |
|
491 | + 'metadataLanguage' => $r->metadata->language->__toString(), |
|
492 | + // Add more here as needed for your app depending on your |
|
493 | + // use of metadata when creating recordings. |
|
494 | + ); |
|
495 | + } |
|
496 | + return $result; |
|
497 | + } |
|
498 | + } |
|
499 | + else { |
|
500 | + return null; |
|
501 | + } |
|
502 | + } |
|
503 | + |
|
504 | + public function getPublishRecordingsUrl($recordingParams) { |
|
505 | + /* USAGE: |
|
506 | 506 | $recordingParams = array( |
507 | 507 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
508 | 508 | 'publish' => 'true', -- REQUIRED - boolean: true/false |
509 | 509 | ); |
510 | 510 | */ |
511 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; |
|
512 | - $params = |
|
513 | - 'recordID='.urlencode($recordingParams['recordId']). |
|
514 | - '&publish='.urlencode($recordingParams['publish']); |
|
515 | - return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); |
|
511 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; |
|
512 | + $params = |
|
513 | + 'recordID='.urlencode($recordingParams['recordId']). |
|
514 | + '&publish='.urlencode($recordingParams['publish']); |
|
515 | + return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); |
|
516 | 516 | |
517 | - } |
|
517 | + } |
|
518 | 518 | |
519 | - public function publishRecordingsWithXmlResponseArray($recordingParams) { |
|
520 | - /* USAGE: |
|
519 | + public function publishRecordingsWithXmlResponseArray($recordingParams) { |
|
520 | + /* USAGE: |
|
521 | 521 | $recordingParams = array( |
522 | 522 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
523 | 523 | 'publish' => 'true', -- REQUIRED - boolean: true/false |
524 | 524 | ); |
525 | 525 | */ |
526 | - $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
|
527 | - if($xml) { |
|
528 | - return array( |
|
529 | - 'returncode' => $xml->returncode->__toString(), |
|
530 | - 'published' => $xml->published->__toString() // -- Returns true/false. |
|
531 | - ); |
|
532 | - } |
|
533 | - else { |
|
534 | - return null; |
|
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - } |
|
539 | - |
|
540 | - public function getDeleteRecordingsUrl($recordingParams) { |
|
541 | - /* USAGE: |
|
526 | + $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
|
527 | + if($xml) { |
|
528 | + return array( |
|
529 | + 'returncode' => $xml->returncode->__toString(), |
|
530 | + 'published' => $xml->published->__toString() // -- Returns true/false. |
|
531 | + ); |
|
532 | + } |
|
533 | + else { |
|
534 | + return null; |
|
535 | + } |
|
536 | + |
|
537 | + |
|
538 | + } |
|
539 | + |
|
540 | + public function getDeleteRecordingsUrl($recordingParams) { |
|
541 | + /* USAGE: |
|
542 | 542 | $recordingParams = array( |
543 | 543 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
544 | 544 | ); |
545 | 545 | */ |
546 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; |
|
547 | - $params = |
|
548 | - 'recordID='.urlencode($recordingParams['recordId']); |
|
549 | - return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); |
|
550 | - } |
|
551 | - |
|
552 | - public function deleteRecordingsWithXmlResponseArray($recordingParams) { |
|
553 | - /* USAGE: |
|
546 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; |
|
547 | + $params = |
|
548 | + 'recordID='.urlencode($recordingParams['recordId']); |
|
549 | + return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); |
|
550 | + } |
|
551 | + |
|
552 | + public function deleteRecordingsWithXmlResponseArray($recordingParams) { |
|
553 | + /* USAGE: |
|
554 | 554 | $recordingParams = array( |
555 | 555 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
556 | 556 | ); |
557 | 557 | */ |
558 | 558 | |
559 | - $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
|
560 | - if($xml) { |
|
561 | - return array( |
|
562 | - 'returncode' => $xml->returncode->__toString(), |
|
563 | - 'deleted' => $xml->deleted->__toString() // -- Returns true/false. |
|
564 | - ); |
|
565 | - } |
|
566 | - else { |
|
567 | - return null; |
|
568 | - } |
|
569 | - |
|
570 | - } |
|
559 | + $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
|
560 | + if($xml) { |
|
561 | + return array( |
|
562 | + 'returncode' => $xml->returncode->__toString(), |
|
563 | + 'deleted' => $xml->deleted->__toString() // -- Returns true/false. |
|
564 | + ); |
|
565 | + } |
|
566 | + else { |
|
567 | + return null; |
|
568 | + } |
|
569 | + |
|
570 | + } |
|
571 | 571 | |
572 | 572 | |
573 | 573 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | foreach ($vmList as $vm) { |
72 | 72 | if (isset($vm['enabled']) && $vm['enabled'] == true) { |
73 | - $className = $vm['name'] . 'VM'; |
|
73 | + $className = $vm['name'].'VM'; |
|
74 | 74 | |
75 | 75 | return new $className($vm); |
76 | 76 | break; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | break; |
101 | 101 | } |
102 | 102 | } else { |
103 | - throw new \Exception(" Id " . $this->vmId . " doesn't exists."); |
|
103 | + throw new \Exception(" Id ".$this->vmId." doesn't exists."); |
|
104 | 104 | } |
105 | 105 | } catch (Exception $e) { |
106 | 106 | die($e->getMessage()); |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | |
119 | 119 | $powerOff = $droplets->powerOff($this->vmId); |
120 | 120 | |
121 | - $this->addMessage('Power off droplet #' . $this->vmId); |
|
121 | + $this->addMessage('Power off droplet #'.$this->vmId); |
|
122 | 122 | |
123 | 123 | $this->waitForEvent($powerOff->event_id); |
124 | 124 | |
125 | - $this->addMessage('Current status: ' . $dropletInfo->droplet->status); |
|
125 | + $this->addMessage('Current status: '.$dropletInfo->droplet->status); |
|
126 | 126 | |
127 | 127 | $resizeDroplet = $droplets->resize( |
128 | 128 | $this->vmId, |
129 | 129 | array('size_id' => intval($sizeId)) |
130 | 130 | ); |
131 | - $this->addMessage('Resize droplet to size id: ' . $sizeId); |
|
131 | + $this->addMessage('Resize droplet to size id: '.$sizeId); |
|
132 | 132 | $this->waitForEvent($resizeDroplet->event_id); |
133 | 133 | |
134 | 134 | $powerOn = $droplets->powerOn($this->vmId); |
135 | 135 | $this->waitForEvent($powerOn->event_id); |
136 | - $this->addMessage('Power on droplet #' . $this->vmId); |
|
136 | + $this->addMessage('Power on droplet #'.$this->vmId); |
|
137 | 137 | |
138 | 138 | } |
139 | 139 |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | $content = $this->get_content_html(); |
64 | 64 | $html = ' |
65 | 65 | <div class="panel panel-default" id="intro"> |
66 | - <div class="panel-heading">' . get_lang('CoursesInformation') . ' |
|
66 | + <div class="panel-heading">' . get_lang('CoursesInformation').' |
|
67 | 67 | <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\'' . addslashes( |
68 | 68 | api_htmlentities( |
69 | 69 | get_lang('ConfirmYourChoice'), |
70 | 70 | ENT_QUOTES, |
71 | 71 | $charset |
72 | 72 | ) |
73 | - ) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '"> |
|
73 | + ).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
|
74 | 74 | <em class="fa fa-times"></em> |
75 | 75 | </a></div> |
76 | 76 | </div> |
77 | 77 | <div class="panel-body"> |
78 | - ' . $content . ' |
|
78 | + ' . $content.' |
|
79 | 79 | </div> |
80 | 80 | </div> |
81 | 81 | '; |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | { |
94 | 94 | $course_data = $this->get_course_information_data(); |
95 | 95 | //$content = '<div style="margin:10px;">'; |
96 | - $content = '<h4>' . get_lang( |
|
96 | + $content = '<h4>'.get_lang( |
|
97 | 97 | 'YourCourseList' |
98 | - ) . '</h4>'; |
|
98 | + ).'</h4>'; |
|
99 | 99 | $data_table = null; |
100 | 100 | if (!empty($course_data)) { |
101 | 101 | $data_table .= '<table class="data_table" width:"95%">'; |
102 | 102 | $data_table .= '<tr> |
103 | - <th>' . get_lang('CourseTitle') . '</th> |
|
104 | - <th width="20%">' . get_lang('NbStudents') . '</th> |
|
105 | - <th width="20%">' . get_lang('AvgTimeSpentInTheCourse') . '</th> |
|
106 | - <th width="20%">' . get_lang('ThematicAdvance') . '</th> |
|
103 | + <th>' . get_lang('CourseTitle').'</th> |
|
104 | + <th width="20%">' . get_lang('NbStudents').'</th> |
|
105 | + <th width="20%">' . get_lang('AvgTimeSpentInTheCourse').'</th> |
|
106 | + <th width="20%">' . get_lang('ThematicAdvance').'</th> |
|
107 | 107 | </tr>'; |
108 | 108 | $i = 1; |
109 | 109 | foreach ($course_data as $course) { |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | } else { |
113 | 113 | $class_tr = 'row_even'; |
114 | 114 | } |
115 | - $data_table .= '<tr class="' . $class_tr . '">'; |
|
115 | + $data_table .= '<tr class="'.$class_tr.'">'; |
|
116 | 116 | if (!isset($course[2])) { |
117 | 117 | $course[2] = '0:00:00'; |
118 | 118 | } |
119 | 119 | foreach ($course as $cell) { |
120 | - $data_table .= '<td align="right">' . $cell . '</td>'; |
|
120 | + $data_table .= '<td align="right">'.$cell.'</td>'; |
|
121 | 121 | } |
122 | 122 | $data_table .= '</tr>'; |
123 | 123 | $i++; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | $content .= $data_table; |
130 | 130 | if (!empty($course_data)) { |
131 | - $content .= '<div style="text-align:right;margin-top:10px;"><a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?follow">' . get_lang('SeeMore') . '</a></div>'; |
|
131 | + $content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/course.php?follow">'.get_lang('SeeMore').'</a></div>'; |
|
132 | 132 | } |
133 | 133 | //$content .= '</div>'; |
134 | 134 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | // students directly subscribed to the course |
165 | 165 | $sql = "SELECT user_id FROM $tbl_course_user as course_rel_user |
166 | - WHERE course_rel_user.status=" . STUDENT . " AND course_rel_user.c_id='$courseId'"; |
|
166 | + WHERE course_rel_user.status=".STUDENT." AND course_rel_user.c_id='$courseId'"; |
|
167 | 167 | $rs = Database::query($sql); |
168 | 168 | $users = array(); |
169 | 169 | while ($row = Database::fetch_array($rs)) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | ); |
183 | 183 | |
184 | 184 | if (!empty($tematic_advance)) { |
185 | - $tematic_advance_progress = '<a title="' . get_lang('GoToThematicAdvance') . '" href="' . api_get_path(WEB_CODE_PATH) . 'course_progress/index.php?cidReq=' . $course_code . '&action=thematic_details">' . $tematic_advance . '%</a>'; |
|
185 | + $tematic_advance_progress = '<a title="'.get_lang('GoToThematicAdvance').'" href="'.api_get_path(WEB_CODE_PATH).'course_progress/index.php?cidReq='.$course_code.'&action=thematic_details">'.$tematic_advance.'%</a>'; |
|
186 | 186 | } else { |
187 | 187 | $tematic_advance_progress = '0%'; |
188 | 188 | } |
@@ -22,40 +22,40 @@ discard block |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | private $user_id; |
25 | - private $students; |
|
26 | - private $path; |
|
27 | - private $permission = array(DRH); |
|
25 | + private $students; |
|
26 | + private $path; |
|
27 | + private $permission = array(DRH); |
|
28 | 28 | |
29 | - /** |
|
30 | - * Constructor |
|
31 | - */ |
|
29 | + /** |
|
30 | + * Constructor |
|
31 | + */ |
|
32 | 32 | public function __construct ($user_id) |
33 | 33 | { |
34 | - $this->user_id = $user_id; |
|
35 | - $this->path = 'block_student_graph'; |
|
36 | - if ($this->is_block_visible_for_user($user_id)) { |
|
37 | - /*if (api_is_platform_admin()) { |
|
34 | + $this->user_id = $user_id; |
|
35 | + $this->path = 'block_student_graph'; |
|
36 | + if ($this->is_block_visible_for_user($user_id)) { |
|
37 | + /*if (api_is_platform_admin()) { |
|
38 | 38 | $this->students = UserManager::get_user_list(array('status' => STUDENT)); |
39 | 39 | } else if (api_is_drh()) {*/ |
40 | - $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT); |
|
41 | - //} |
|
42 | - } |
|
40 | + $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT); |
|
41 | + //} |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * This method check if a user is allowed to see the block inside dashboard interface |
|
47 | - * @param int User id |
|
48 | - * @return bool Is block visible for user |
|
49 | - */ |
|
46 | + * This method check if a user is allowed to see the block inside dashboard interface |
|
47 | + * @param int User id |
|
48 | + * @return bool Is block visible for user |
|
49 | + */ |
|
50 | 50 | public function is_block_visible_for_user($user_id) |
51 | 51 | { |
52 | - $user_info = api_get_user_info($user_id); |
|
53 | - $user_status = $user_info['status']; |
|
54 | - $is_block_visible_for_user = false; |
|
55 | - if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
56 | - $is_block_visible_for_user = true; |
|
57 | - } |
|
58 | - return $is_block_visible_for_user; |
|
52 | + $user_info = api_get_user_info($user_id); |
|
53 | + $user_status = $user_info['status']; |
|
54 | + $is_block_visible_for_user = false; |
|
55 | + if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
56 | + $is_block_visible_for_user = true; |
|
57 | + } |
|
58 | + return $is_block_visible_for_user; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | public function get_block() |
68 | 68 | { |
69 | 69 | |
70 | - global $charset; |
|
71 | - $column = 1; |
|
72 | - $data = array(); |
|
73 | - $students_attendance_graph = $this->get_students_attendance_graph(); |
|
70 | + global $charset; |
|
71 | + $column = 1; |
|
72 | + $data = array(); |
|
73 | + $students_attendance_graph = $this->get_students_attendance_graph(); |
|
74 | 74 | |
75 | - $html = '<div class="panel panel-default" id="intro"> |
|
75 | + $html = '<div class="panel panel-default" id="intro"> |
|
76 | 76 | <div class="panel-heading"> |
77 | 77 | '.get_lang('StudentsInformationsGraph').' |
78 | 78 | <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
@@ -84,51 +84,51 @@ discard block |
||
84 | 84 | '.$students_attendance_graph.' |
85 | 85 | </div> |
86 | 86 | </div>'; |
87 | - $data['column'] = $column; |
|
88 | - $data['content_html'] = $html; |
|
89 | - return $data; |
|
87 | + $data['column'] = $column; |
|
88 | + $data['content_html'] = $html; |
|
89 | + return $data; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * This method return a graph containing information about students evaluation, |
|
93 | + * This method return a graph containing information about students evaluation, |
|
94 | 94 | * it's used inside get_block method for showing it inside dashboard interface |
95 | - * @return string img html |
|
96 | - */ |
|
95 | + * @return string img html |
|
96 | + */ |
|
97 | 97 | public function get_students_attendance_graph() |
98 | 98 | { |
99 | 99 | |
100 | - $students = $this->students; |
|
101 | - $attendance = new Attendance(); |
|
102 | - |
|
103 | - // get data |
|
104 | - $attendances_faults_avg = array(); |
|
105 | - if (is_array($students) && count($students) > 0) { |
|
106 | - foreach ($students as $student) { |
|
107 | - $student_id = $student['user_id']; |
|
108 | - //$student_info = api_get_user_info($student_id); |
|
109 | - // get average of faults in attendances by student |
|
110 | - $results_faults_avg = $attendance->get_faults_average_inside_courses($student_id); |
|
111 | - |
|
112 | - if (!empty($results_faults_avg)) { |
|
113 | - $attendances_faults_avg[$student['lastname']] = $results_faults_avg['porcent']; |
|
114 | - } else { |
|
115 | - $attendances_faults_avg[$student['lastname']] = 0; |
|
116 | - } |
|
117 | - } |
|
118 | - } |
|
100 | + $students = $this->students; |
|
101 | + $attendance = new Attendance(); |
|
102 | + |
|
103 | + // get data |
|
104 | + $attendances_faults_avg = array(); |
|
105 | + if (is_array($students) && count($students) > 0) { |
|
106 | + foreach ($students as $student) { |
|
107 | + $student_id = $student['user_id']; |
|
108 | + //$student_info = api_get_user_info($student_id); |
|
109 | + // get average of faults in attendances by student |
|
110 | + $results_faults_avg = $attendance->get_faults_average_inside_courses($student_id); |
|
111 | + |
|
112 | + if (!empty($results_faults_avg)) { |
|
113 | + $attendances_faults_avg[$student['lastname']] = $results_faults_avg['porcent']; |
|
114 | + } else { |
|
115 | + $attendances_faults_avg[$student['lastname']] = 0; |
|
116 | + } |
|
117 | + } |
|
118 | + } |
|
119 | 119 | |
120 | - arsort($attendances_faults_avg); |
|
121 | - $usernames = array_keys($attendances_faults_avg); |
|
120 | + arsort($attendances_faults_avg); |
|
121 | + $usernames = array_keys($attendances_faults_avg); |
|
122 | 122 | |
123 | - $faults = array(); |
|
124 | - foreach ($usernames as $username) { |
|
125 | - $faults[] = $attendances_faults_avg[$username]; |
|
126 | - } |
|
123 | + $faults = array(); |
|
124 | + foreach ($usernames as $username) { |
|
125 | + $faults[] = $attendances_faults_avg[$username]; |
|
126 | + } |
|
127 | 127 | |
128 | - $graph = ''; |
|
129 | - $img_file = ''; |
|
128 | + $graph = ''; |
|
129 | + $img_file = ''; |
|
130 | 130 | |
131 | - if (is_array($usernames) && count($usernames) > 0) { |
|
131 | + if (is_array($usernames) && count($usernames) > 0) { |
|
132 | 132 | |
133 | 133 | // Defining data |
134 | 134 | $dataSet = new pData(); |
@@ -233,19 +233,19 @@ discard block |
||
233 | 233 | $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
234 | 234 | } |
235 | 235 | $graph = '<img src="' . $imgPath . '" >'; |
236 | - } else { |
|
237 | - $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>'; |
|
238 | - } |
|
236 | + } else { |
|
237 | + $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>'; |
|
238 | + } |
|
239 | 239 | |
240 | - return $graph; |
|
241 | - } |
|
240 | + return $graph; |
|
241 | + } |
|
242 | 242 | |
243 | 243 | /** |
244 | - * Get number of students |
|
245 | - * @return int |
|
246 | - */ |
|
247 | - function get_number_of_students() |
|
244 | + * Get number of students |
|
245 | + * @return int |
|
246 | + */ |
|
247 | + function get_number_of_students() |
|
248 | 248 | { |
249 | - return count($this->students); |
|
250 | - } |
|
249 | + return count($this->students); |
|
250 | + } |
|
251 | 251 | } |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Constructor |
31 | 31 | */ |
32 | - public function __construct ($user_id) |
|
32 | + public function __construct($user_id) |
|
33 | 33 | { |
34 | - $this->user_id = $user_id; |
|
35 | - $this->path = 'block_student_graph'; |
|
34 | + $this->user_id = $user_id; |
|
35 | + $this->path = 'block_student_graph'; |
|
36 | 36 | if ($this->is_block_visible_for_user($user_id)) { |
37 | 37 | /*if (api_is_platform_admin()) { |
38 | 38 | $this->students = UserManager::get_user_list(array('status' => STUDENT)); |
39 | 39 | } else if (api_is_drh()) {*/ |
40 | - $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT); |
|
40 | + $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT); |
|
41 | 41 | //} |
42 | 42 | } |
43 | 43 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $html = '<div class="panel panel-default" id="intro"> |
76 | 76 | <div class="panel-heading"> |
77 | 77 | '.get_lang('StudentsInformationsGraph').' |
78 | - <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
|
78 | + <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
|
79 | 79 | <em class="fa fa-times"></em> |
80 | 80 | </a></div> |
81 | 81 | </div> |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
156 | 156 | $chartHash = $myCache->getHash($dataSet); |
157 | 157 | if ($myCache->isInCache($chartHash)) { |
158 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
158 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
159 | 159 | $myCache->saveFromCache($chartHash, $imgPath); |
160 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
160 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
161 | 161 | } else { |
162 | 162 | |
163 | 163 | $maxCounts = max(count($usernames), count($faults)); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | /* Set the default font */ |
183 | 183 | $myPicture->setFontProperties( |
184 | 184 | array( |
185 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
185 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
186 | 186 | 'FontSize' => 10 |
187 | 187 | ) |
188 | 188 | ); |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | |
229 | 229 | /* Write and save into cache */ |
230 | 230 | $myCache->writeToCache($chartHash, $myPicture); |
231 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
231 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
232 | 232 | $myCache->saveFromCache($chartHash, $imgPath); |
233 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
233 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
234 | 234 | } |
235 | - $graph = '<img src="' . $imgPath . '" >'; |
|
235 | + $graph = '<img src="'.$imgPath.'" >'; |
|
236 | 236 | } else { |
237 | - $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>'; |
|
237 | + $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8').'</p>'; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | return $graph; |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Controller |
29 | 29 | */ |
30 | - public function __construct ($user_id) |
|
30 | + public function __construct($user_id) |
|
31 | 31 | { |
32 | - $this->user_id = $user_id; |
|
33 | - $this->path = 'block_teacher'; |
|
32 | + $this->user_id = $user_id; |
|
33 | + $this->path = 'block_teacher'; |
|
34 | 34 | if ($this->is_block_visible_for_user($user_id)) { |
35 | 35 | $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); |
36 | 36 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | <div class="panel panel-default" id="intro"> |
70 | 70 | <div class="panel-heading"> |
71 | 71 | '.get_lang('TeachersInformationsList').' |
72 | - <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
|
72 | + <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
|
73 | 73 | <em class="fa fa-times"></em> |
74 | 74 | </a></div> |
75 | 75 | </div> |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | |
113 | 113 | $teacher_id = $teacher['user_id']; |
114 | 114 | $firstname = $teacher['firstname']; |
115 | - $lastname = $teacher['lastname']; |
|
116 | - $username = $teacher['username']; |
|
115 | + $lastname = $teacher['lastname']; |
|
116 | + $username = $teacher['username']; |
|
117 | 117 | |
118 | 118 | $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id)); |
119 | 119 | $last_connection = Tracking :: get_last_connection_date($teacher_id); |
120 | 120 | |
121 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
121 | + if ($i % 2 == 0) $class_tr = 'row_odd'; |
|
122 | 122 | else $class_tr = 'row_even'; |
123 | 123 | |
124 | 124 | $teachers_table .= ' |
125 | 125 | <tr class="'.$class_tr.'"> |
126 | - <td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td> |
|
126 | + <td>'.api_get_person_name($firstname, $lastname).' ('.$username.')</td> |
|
127 | 127 | <td align="right">'.$time_on_platform.'</td> |
128 | 128 | <td align="right">'.$last_connection.'</td> |
129 | 129 | </tr> |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $teachers_table = null; |
156 | 156 | if (count($teachers) > 0) { |
157 | 157 | $a_last_week = get_last_week(); |
158 | - $last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); |
|
158 | + $last_week = date('Y-m-d', $a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); |
|
159 | 159 | |
160 | 160 | $teachers_table .= '<table class="data_table" width:"95%">'; |
161 | 161 | $teachers_table .= ' |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | $teacher_id = $teacher['user_id']; |
172 | 172 | $firstname = $teacher['firstname']; |
173 | 173 | $lastname = $teacher['lastname']; |
174 | - $username = $teacher['username']; |
|
175 | - $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id,true)); |
|
174 | + $username = $teacher['username']; |
|
175 | + $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id, true)); |
|
176 | 176 | |
177 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
177 | + if ($i % 2 == 0) $class_tr = 'row_odd'; |
|
178 | 178 | else $class_tr = 'row_even'; |
179 | 179 | $teachers_table .= '<tr class="'.$class_tr.'"> |
180 | - <td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td> |
|
180 | + <td>'.api_get_person_name($firstname, $lastname).' ('.$username.')</td> |
|
181 | 181 | <td align="right">'.$time_on_platform.'</td> |
182 | 182 | </tr>'; |
183 | 183 |
@@ -118,8 +118,11 @@ discard block |
||
118 | 118 | $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id)); |
119 | 119 | $last_connection = Tracking :: get_last_connection_date($teacher_id); |
120 | 120 | |
121 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
122 | - else $class_tr = 'row_even'; |
|
121 | + if ($i%2 == 0) { |
|
122 | + $class_tr = 'row_odd'; |
|
123 | + } else { |
|
124 | + $class_tr = 'row_even'; |
|
125 | + } |
|
123 | 126 | |
124 | 127 | $teachers_table .= ' |
125 | 128 | <tr class="'.$class_tr.'"> |
@@ -174,8 +177,11 @@ discard block |
||
174 | 177 | $username = $teacher['username']; |
175 | 178 | $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id,true)); |
176 | 179 | |
177 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
178 | - else $class_tr = 'row_even'; |
|
180 | + if ($i%2 == 0) { |
|
181 | + $class_tr = 'row_odd'; |
|
182 | + } else { |
|
183 | + $class_tr = 'row_even'; |
|
184 | + } |
|
179 | 185 | $teachers_table .= '<tr class="'.$class_tr.'"> |
180 | 186 | <td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td> |
181 | 187 | <td align="right">'.$time_on_platform.'</td> |
@@ -24,32 +24,32 @@ discard block |
||
24 | 24 | private $path; |
25 | 25 | private $permission = array(DRH); |
26 | 26 | |
27 | - /** |
|
28 | - * Controller |
|
29 | - */ |
|
27 | + /** |
|
28 | + * Controller |
|
29 | + */ |
|
30 | 30 | public function __construct ($user_id) |
31 | 31 | { |
32 | - $this->user_id = $user_id; |
|
33 | - $this->path = 'block_teacher'; |
|
34 | - if ($this->is_block_visible_for_user($user_id)) { |
|
35 | - $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); |
|
36 | - } |
|
32 | + $this->user_id = $user_id; |
|
33 | + $this->path = 'block_teacher'; |
|
34 | + if ($this->is_block_visible_for_user($user_id)) { |
|
35 | + $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | - * This method check if a user is allowed to see the block inside dashboard interface |
|
41 | - * @param int User id |
|
42 | - * @return bool Is block visible for user |
|
43 | - */ |
|
40 | + * This method check if a user is allowed to see the block inside dashboard interface |
|
41 | + * @param int User id |
|
42 | + * @return bool Is block visible for user |
|
43 | + */ |
|
44 | 44 | public function is_block_visible_for_user($user_id) |
45 | 45 | { |
46 | - $user_info = api_get_user_info($user_id); |
|
47 | - $user_status = $user_info['status']; |
|
48 | - $is_block_visible_for_user = false; |
|
49 | - if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
50 | - $is_block_visible_for_user = true; |
|
51 | - } |
|
52 | - return $is_block_visible_for_user; |
|
46 | + $user_info = api_get_user_info($user_id); |
|
47 | + $user_status = $user_info['status']; |
|
48 | + $is_block_visible_for_user = false; |
|
49 | + if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
50 | + $is_block_visible_for_user = true; |
|
51 | + } |
|
52 | + return $is_block_visible_for_user; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | public function get_block() |
61 | 61 | { |
62 | 62 | |
63 | - global $charset; |
|
64 | - $column = 1; |
|
65 | - $data = array(); |
|
66 | - $teacher_content_html = $this->get_teachers_content_html_for_drh(); |
|
63 | + global $charset; |
|
64 | + $column = 1; |
|
65 | + $data = array(); |
|
66 | + $teacher_content_html = $this->get_teachers_content_html_for_drh(); |
|
67 | 67 | |
68 | - $html = ' |
|
68 | + $html = ' |
|
69 | 69 | <div class="panel panel-default" id="intro"> |
70 | 70 | <div class="panel-heading"> |
71 | 71 | '.get_lang('TeachersInformationsList').' |
@@ -79,27 +79,27 @@ discard block |
||
79 | 79 | </div> |
80 | 80 | '; |
81 | 81 | |
82 | - $data['column'] = $column; |
|
83 | - $data['content_html'] = $html; |
|
82 | + $data['column'] = $column; |
|
83 | + $data['content_html'] = $html; |
|
84 | 84 | |
85 | - return $data; |
|
85 | + return $data; |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * This method return a content html, it's used inside get_block method for showing it inside dashboard interface |
|
91 | - * @return string content html |
|
92 | - */ |
|
90 | + * This method return a content html, it's used inside get_block method for showing it inside dashboard interface |
|
91 | + * @return string content html |
|
92 | + */ |
|
93 | 93 | public function get_teachers_content_html_for_platform_admin() |
94 | 94 | { |
95 | - $teachers = $this->teachers; |
|
96 | - //$content = '<div style="margin:10px;">'; |
|
97 | - $content = '<h4>'.get_lang('YourTeachers').'</h4>'; |
|
95 | + $teachers = $this->teachers; |
|
96 | + //$content = '<div style="margin:10px;">'; |
|
97 | + $content = '<h4>'.get_lang('YourTeachers').'</h4>'; |
|
98 | 98 | |
99 | 99 | $teachers_table = null; |
100 | - if (count($teachers) > 0) { |
|
101 | - $teachers_table .= '<table class="data_table" width:"95%">'; |
|
102 | - $teachers_table .= ' |
|
100 | + if (count($teachers) > 0) { |
|
101 | + $teachers_table .= '<table class="data_table" width:"95%">'; |
|
102 | + $teachers_table .= ' |
|
103 | 103 | <tr> |
104 | 104 | <th>'.get_lang('User').'</th> |
105 | 105 | <th>'.get_lang('TimeSpentOnThePlatform').'</th> |
@@ -107,103 +107,103 @@ discard block |
||
107 | 107 | </tr> |
108 | 108 | '; |
109 | 109 | |
110 | - $i = 1; |
|
111 | - foreach ($teachers as $teacher) { |
|
110 | + $i = 1; |
|
111 | + foreach ($teachers as $teacher) { |
|
112 | 112 | |
113 | - $teacher_id = $teacher['user_id']; |
|
114 | - $firstname = $teacher['firstname']; |
|
115 | - $lastname = $teacher['lastname']; |
|
116 | - $username = $teacher['username']; |
|
113 | + $teacher_id = $teacher['user_id']; |
|
114 | + $firstname = $teacher['firstname']; |
|
115 | + $lastname = $teacher['lastname']; |
|
116 | + $username = $teacher['username']; |
|
117 | 117 | |
118 | - $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id)); |
|
119 | - $last_connection = Tracking :: get_last_connection_date($teacher_id); |
|
118 | + $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id)); |
|
119 | + $last_connection = Tracking :: get_last_connection_date($teacher_id); |
|
120 | 120 | |
121 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
122 | - else $class_tr = 'row_even'; |
|
121 | + if ($i%2 == 0) $class_tr = 'row_odd'; |
|
122 | + else $class_tr = 'row_even'; |
|
123 | 123 | |
124 | - $teachers_table .= ' |
|
124 | + $teachers_table .= ' |
|
125 | 125 | <tr class="'.$class_tr.'"> |
126 | 126 | <td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td> |
127 | 127 | <td align="right">'.$time_on_platform.'</td> |
128 | 128 | <td align="right">'.$last_connection.'</td> |
129 | 129 | </tr> |
130 | 130 | '; |
131 | - $i++; |
|
132 | - } |
|
133 | - $teachers_table .= '</table>'; |
|
134 | - } else { |
|
135 | - $teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers'); |
|
136 | - } |
|
131 | + $i++; |
|
132 | + } |
|
133 | + $teachers_table .= '</table>'; |
|
134 | + } else { |
|
135 | + $teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers'); |
|
136 | + } |
|
137 | 137 | |
138 | - $content .= $teachers_table; |
|
138 | + $content .= $teachers_table; |
|
139 | 139 | |
140 | - if (count($teachers) > 0) { |
|
141 | - $content .= '<div style="text-align:right;margin-top:10px;"> |
|
140 | + if (count($teachers) > 0) { |
|
141 | + $content .= '<div style="text-align:right;margin-top:10px;"> |
|
142 | 142 | <a href="'.api_get_path(WEB_CODE_PATH).'mySpace/index.php?view=admin">'.get_lang('SeeMore').'</a></div>'; |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - //$content .= '</div>'; |
|
145 | + //$content .= '</div>'; |
|
146 | 146 | |
147 | - return $content; |
|
148 | - } |
|
147 | + return $content; |
|
148 | + } |
|
149 | 149 | |
150 | - public function get_teachers_content_html_for_drh() |
|
150 | + public function get_teachers_content_html_for_drh() |
|
151 | 151 | { |
152 | - $teachers = $this->teachers; |
|
153 | - //$content = '<div style="margin:10px;">'; |
|
154 | - $content = '<h4>'.get_lang('YourTeachers').'</h4>'; |
|
152 | + $teachers = $this->teachers; |
|
153 | + //$content = '<div style="margin:10px;">'; |
|
154 | + $content = '<h4>'.get_lang('YourTeachers').'</h4>'; |
|
155 | 155 | $teachers_table = null; |
156 | - if (count($teachers) > 0) { |
|
157 | - $a_last_week = get_last_week(); |
|
158 | - $last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); |
|
156 | + if (count($teachers) > 0) { |
|
157 | + $a_last_week = get_last_week(); |
|
158 | + $last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); |
|
159 | 159 | |
160 | - $teachers_table .= '<table class="data_table" width:"95%">'; |
|
161 | - $teachers_table .= ' |
|
160 | + $teachers_table .= '<table class="data_table" width:"95%">'; |
|
161 | + $teachers_table .= ' |
|
162 | 162 | <tr> |
163 | 163 | <th>'.get_lang('User').'</th> |
164 | 164 | <th>'.get_lang('TimeSpentLastWeek').'<br />'.$last_week.'</th> |
165 | 165 | </tr> |
166 | 166 | '; |
167 | 167 | |
168 | - $i = 1; |
|
169 | - foreach ($teachers as $teacher) { |
|
168 | + $i = 1; |
|
169 | + foreach ($teachers as $teacher) { |
|
170 | 170 | |
171 | - $teacher_id = $teacher['user_id']; |
|
172 | - $firstname = $teacher['firstname']; |
|
173 | - $lastname = $teacher['lastname']; |
|
174 | - $username = $teacher['username']; |
|
175 | - $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id,true)); |
|
171 | + $teacher_id = $teacher['user_id']; |
|
172 | + $firstname = $teacher['firstname']; |
|
173 | + $lastname = $teacher['lastname']; |
|
174 | + $username = $teacher['username']; |
|
175 | + $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($teacher_id,true)); |
|
176 | 176 | |
177 | - if ($i%2 == 0) $class_tr = 'row_odd'; |
|
178 | - else $class_tr = 'row_even'; |
|
179 | - $teachers_table .= '<tr class="'.$class_tr.'"> |
|
177 | + if ($i%2 == 0) $class_tr = 'row_odd'; |
|
178 | + else $class_tr = 'row_even'; |
|
179 | + $teachers_table .= '<tr class="'.$class_tr.'"> |
|
180 | 180 | <td>'.api_get_person_name($firstname,$lastname).' ('.$username.')</td> |
181 | 181 | <td align="right">'.$time_on_platform.'</td> |
182 | 182 | </tr>'; |
183 | 183 | |
184 | - $i++; |
|
185 | - } |
|
186 | - $teachers_table .= '</table>'; |
|
187 | - } else { |
|
188 | - $teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers'); |
|
189 | - } |
|
184 | + $i++; |
|
185 | + } |
|
186 | + $teachers_table .= '</table>'; |
|
187 | + } else { |
|
188 | + $teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers'); |
|
189 | + } |
|
190 | 190 | |
191 | - $content .= $teachers_table; |
|
191 | + $content .= $teachers_table; |
|
192 | 192 | |
193 | - if (count($teachers) > 0) { |
|
194 | - $content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/teachers.php">'.get_lang('SeeMore').'</a></div>'; |
|
195 | - } |
|
196 | - //$content .= '</div>'; |
|
193 | + if (count($teachers) > 0) { |
|
194 | + $content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/teachers.php">'.get_lang('SeeMore').'</a></div>'; |
|
195 | + } |
|
196 | + //$content .= '</div>'; |
|
197 | 197 | |
198 | - return $content; |
|
199 | - } |
|
198 | + return $content; |
|
199 | + } |
|
200 | 200 | |
201 | 201 | /** |
202 | - * Get number of teachers |
|
203 | - * @return int |
|
204 | - */ |
|
205 | - function get_number_of_teachers() |
|
202 | + * Get number of teachers |
|
203 | + * @return int |
|
204 | + */ |
|
205 | + function get_number_of_teachers() |
|
206 | 206 | { |
207 | - return count($this->teachers); |
|
208 | - } |
|
207 | + return count($this->teachers); |
|
208 | + } |
|
209 | 209 | } |