@@ -544,17 +544,17 @@ discard block |
||
544 | 544 | if (isset($_REQUEST['activate_start_date_check']) && |
545 | 545 | $_REQUEST['activate_start_date_check'] == 1 |
546 | 546 | ) { |
547 | - $publicated_on = $_REQUEST['publicated_on']; |
|
547 | + $publicated_on = $_REQUEST['publicated_on']; |
|
548 | 548 | } else { |
549 | - $publicated_on = null; |
|
549 | + $publicated_on = null; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | if (isset($_REQUEST['activate_end_date_check']) && |
553 | 553 | $_REQUEST['activate_end_date_check'] == 1 |
554 | 554 | ) { |
555 | - $expired_on = $_REQUEST['expired_on']; |
|
555 | + $expired_on = $_REQUEST['expired_on']; |
|
556 | 556 | } else { |
557 | - $expired_on = null; |
|
557 | + $expired_on = null; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | $new_lp_id = learnpath::add_lp( |
@@ -958,9 +958,9 @@ discard block |
||
958 | 958 | $_SESSION['oLP']->setAccumulateScormTime($accumulateScormTime); |
959 | 959 | |
960 | 960 | if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) { |
961 | - $publicated_on = $_REQUEST['publicated_on']; |
|
961 | + $publicated_on = $_REQUEST['publicated_on']; |
|
962 | 962 | } else { |
963 | - $publicated_on = null; |
|
963 | + $publicated_on = null; |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) { |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | } elseif ($mode == 'embedded') { |
1179 | 1179 | $_SESSION['oLP']->mode = 'embedded'; |
1180 | 1180 | } elseif ($mode == 'embedframe') { |
1181 | - $_SESSION['oLP']->mode = 'embedframe'; |
|
1181 | + $_SESSION['oLP']->mode = 'embedframe'; |
|
1182 | 1182 | } elseif ($mode == 'impress') { |
1183 | 1183 | $_SESSION['oLP']->mode = 'impress'; |
1184 | 1184 | } |
@@ -1219,10 +1219,10 @@ discard block |
||
1219 | 1219 | require 'lp_list.php'; |
1220 | 1220 | break; |
1221 | 1221 | */ |
1222 | - case 'switch_attempt_mode': |
|
1223 | - if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } |
|
1224 | - $_SESSION['refresh'] = 1; |
|
1225 | - $_SESSION['oLP']->switch_attempt_mode(); |
|
1222 | + case 'switch_attempt_mode': |
|
1223 | + if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } |
|
1224 | + $_SESSION['refresh'] = 1; |
|
1225 | + $_SESSION['oLP']->switch_attempt_mode(); |
|
1226 | 1226 | require 'lp_list.php'; |
1227 | 1227 | break; |
1228 | 1228 | case 'switch_scorm_debug': |
@@ -178,8 +178,8 @@ |
||
178 | 178 | ); |
179 | 179 | $display_date = 'none'; |
180 | 180 | if (!empty($expired_on)) { |
181 | - $display_date = 'block'; |
|
182 | - $defaults['activate_end_date_check'] = 1; |
|
181 | + $display_date = 'block'; |
|
182 | + $defaults['activate_end_date_check'] = 1; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $form->addElement('html', '<div id="end_date_div" style="display:'.$display_date.';">'); |
@@ -17,56 +17,56 @@ discard block |
||
17 | 17 | $message = ''; |
18 | 18 | |
19 | 19 | if (isset($_POST['activeExtension'])) { |
20 | - switch ($_POST['extension_code']) { |
|
21 | - case 'ppt2lp': |
|
22 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
20 | + switch ($_POST['extension_code']) { |
|
21 | + case 'ppt2lp': |
|
22 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
23 | 23 | selected_value="true" |
24 | 24 | WHERE variable="service_ppt2lp" |
25 | 25 | AND subkey="active"'; |
26 | 26 | |
27 | - $rs = Database::query($sql); |
|
27 | + $rs = Database::query($sql); |
|
28 | 28 | |
29 | - if (Database::affected_rows($rs)>0){ |
|
30 | - $message = get_lang('ServiceActivated'); |
|
31 | - } |
|
29 | + if (Database::affected_rows($rs)>0){ |
|
30 | + $message = get_lang('ServiceActivated'); |
|
31 | + } |
|
32 | 32 | |
33 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
33 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
34 | 34 | selected_value="'.addslashes($_POST['host']).'" |
35 | 35 | WHERE variable="service_ppt2lp" |
36 | 36 | AND subkey="host"'; |
37 | - Database::query($sql); |
|
37 | + Database::query($sql); |
|
38 | 38 | |
39 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
39 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
40 | 40 | selected_value="'.addslashes($_POST['port']).'" |
41 | 41 | WHERE variable="service_ppt2lp" |
42 | 42 | AND subkey="port"'; |
43 | - Database::query($sql); |
|
43 | + Database::query($sql); |
|
44 | 44 | |
45 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
45 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
46 | 46 | selected_value="'.addslashes($_POST['ftp_password']).'" |
47 | 47 | WHERE variable="service_ppt2lp" |
48 | 48 | AND subkey="ftp_password"'; |
49 | - Database::query($sql); |
|
49 | + Database::query($sql); |
|
50 | 50 | |
51 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
51 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
52 | 52 | selected_value="'.addslashes($_POST['user']).'" |
53 | 53 | WHERE variable="service_ppt2lp" |
54 | 54 | AND subkey="user"'; |
55 | - Database::query($sql); |
|
55 | + Database::query($sql); |
|
56 | 56 | |
57 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
57 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
58 | 58 | selected_value="'.addslashes($_POST['path_to_lzx']).'" |
59 | 59 | WHERE variable="service_ppt2lp" |
60 | 60 | AND subkey="path_to_lzx"'; |
61 | - Database::query($sql); |
|
61 | + Database::query($sql); |
|
62 | 62 | |
63 | - $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
63 | + $sql = 'UPDATE '.$tbl_settings_current.' SET |
|
64 | 64 | selected_value="'.addslashes($_POST['size']).'" |
65 | 65 | WHERE variable="service_ppt2lp" |
66 | 66 | AND subkey="size"'; |
67 | - Database::query($sql); |
|
68 | - break; |
|
69 | - } |
|
67 | + Database::query($sql); |
|
68 | + break; |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $listActiveServices = array(); |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | |
78 | 78 | $rs = Database::query($sql); |
79 | 79 | while($row = Database::fetch_array($rs)){ |
80 | - $listActiveServices[] = $row['variable']; |
|
80 | + $listActiveServices[] = $row['variable']; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // javascript to handle accordion behaviour |
84 | 84 | $javascript_message = ''; |
85 | 85 | if(!empty($message)){ |
86 | - $javascript_message = ' |
|
86 | + $javascript_message = ' |
|
87 | 87 | document.getElementById("message").style.display = "block"; |
88 | 88 | var timer = setTimeout(hideMessage, 5000);'; |
89 | 89 | } |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | <div id="message" style="display: none"> |
137 | 137 | <?php |
138 | - if(!empty($message)) |
|
139 | - Display::display_normal_message($message) |
|
140 | - ?> |
|
138 | + if(!empty($message)) |
|
139 | + Display::display_normal_message($message) |
|
140 | + ?> |
|
141 | 141 | </div> |
142 | 142 | |
143 | 143 | <div id="content" align="center"> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | </div> |
201 | 201 | </div> |
202 | 202 | <?php |
203 | - /* |
|
203 | + /* |
|
204 | 204 | <!-- EPHORUS --> |
205 | 205 | <div id="main_ephorus"> |
206 | 206 | <div id="extension_header_ephorus" class="accordion_header"> |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | if (!isset($used_lang_vars)) { |
102 | - $used_lang_vars = array(); |
|
102 | + $used_lang_vars = array(); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // Caching results from some API functions, for speed. |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | static $text_direction = array(); |
289 | 289 | |
290 | 290 | if (empty($language)) { |
291 | - $language = api_get_interface_language(); |
|
291 | + $language = api_get_interface_language(); |
|
292 | 292 | } |
293 | 293 | if (!isset($text_direction[$language])) { |
294 | 294 | $text_direction[$language] = in_array(api_purify_language_id($language), |
@@ -1703,7 +1703,6 @@ discard block |
||
1703 | 1703 | |
1704 | 1704 | /** |
1705 | 1705 | * Return true a date is valid |
1706 | - |
|
1707 | 1706 | * @param string $date example: 2014-06-30 13:05:05 |
1708 | 1707 | * @param string $format example: "Y-m-d H:i:s" |
1709 | 1708 | * |
@@ -1973,15 +1972,15 @@ discard block |
||
1973 | 1972 | { |
1974 | 1973 | if ($showTime) { |
1975 | 1974 | if ($humanForm) { |
1976 | - return $date->format('j M Y H:i:s'); |
|
1975 | + return $date->format('j M Y H:i:s'); |
|
1977 | 1976 | } else { |
1978 | - return $date->format('Y-m-d H:i:s'); |
|
1977 | + return $date->format('Y-m-d H:i:s'); |
|
1979 | 1978 | } |
1980 | 1979 | } else { |
1981 | 1980 | if ($humanForm) { |
1982 | - return $date->format('j M Y'); |
|
1981 | + return $date->format('j M Y'); |
|
1983 | 1982 | } else { |
1984 | - return $date->format('Y-m-d'); |
|
1983 | + return $date->format('Y-m-d'); |
|
1985 | 1984 | } |
1986 | 1985 | } |
1987 | 1986 | } |
@@ -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 |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
256 | - * update user info about certificate |
|
257 | - * @param int $cat_id category id |
|
258 | - * @param int $user_id user id |
|
259 | - * @param string $path_certificate the path name of the certificate |
|
260 | - * @return void |
|
261 | - */ |
|
256 | + * update user info about certificate |
|
257 | + * @param int $cat_id category id |
|
258 | + * @param int $user_id user id |
|
259 | + * @param string $path_certificate the path name of the certificate |
|
260 | + * @return void |
|
261 | + */ |
|
262 | 262 | public function update_user_info_about_certificate( |
263 | 263 | $cat_id, |
264 | 264 | $user_id, |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
421 | - * Shows the student's certificate (HTML file) |
|
422 | - */ |
|
421 | + * Shows the student's certificate (HTML file) |
|
422 | + */ |
|
423 | 423 | public function show() |
424 | 424 | { |
425 | 425 | header('Content-Type: text/html; charset='. api_get_system_encoding()); |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!function_exists('mime_content_type')) { |
13 | 13 | |
14 | - /** |
|
15 | - * @param string $filename |
|
14 | + /** |
|
15 | + * @param string $filename |
|
16 | 16 | * @return string |
17 | - */ |
|
18 | - function mime_content_type($filename) { |
|
19 | - return DocumentManager::file_get_mime_type((string)$filename); |
|
20 | - } |
|
17 | + */ |
|
18 | + function mime_content_type($filename) { |
|
19 | + return DocumentManager::file_get_mime_type((string)$filename); |
|
20 | + } |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | case MCUA : |
36 | 36 | $answer = new AikenAnswerMultipleChoice($this->id); |
37 | - return $answer; |
|
37 | + return $answer; |
|
38 | 38 | default : |
39 | 39 | $answer = null; |
40 | 40 | break; |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | } |
44 | 44 | function createAnswersForm($form) |
45 | 45 | { |
46 | - return true; |
|
46 | + return true; |
|
47 | 47 | } |
48 | 48 | function processAnswersCreation($form) |
49 | 49 | { |
50 | - return true; |
|
50 | + return true; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 |
@@ -34,21 +34,21 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param Ims2Question $question Ims2Question object we want to export. |
36 | 36 | */ |
37 | - function __construct($question) |
|
38 | - { |
|
37 | + function __construct($question) |
|
38 | + { |
|
39 | 39 | $this->question = $question; |
40 | 40 | $this->answer = $this->question->setAnswer(); |
41 | 41 | $this->questionIdent = "QST_" . $question->id ; |
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Start the XML flow. |
|
46 | - * |
|
47 | - * This opens the <item> block, with correct attributes. |
|
48 | - * |
|
49 | - */ |
|
50 | - function start_item() |
|
51 | - { |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Start the XML flow. |
|
46 | + * |
|
47 | + * This opens the <item> block, with correct attributes. |
|
48 | + * |
|
49 | + */ |
|
50 | + function start_item() |
|
51 | + { |
|
52 | 52 | $string = '<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" |
53 | 53 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
54 | 54 | xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 imsqti_v2p1.xsd" |
@@ -56,55 +56,55 @@ discard block |
||
56 | 56 | title="'.htmlspecialchars(formatExerciseQtiTitle($this->question->selectTitle())).'">'."\n"; |
57 | 57 | |
58 | 58 | return $string; |
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * End the XML flow, closing the </item> tag. |
|
63 | - * |
|
64 | - */ |
|
65 | - function end_item() |
|
66 | - { |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * End the XML flow, closing the </item> tag. |
|
63 | + * |
|
64 | + */ |
|
65 | + function end_item() |
|
66 | + { |
|
67 | 67 | return "</assessmentItem>\n"; |
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Start the itemBody |
|
72 | - * |
|
73 | - */ |
|
74 | - function start_item_body() |
|
75 | - { |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Start the itemBody |
|
72 | + * |
|
73 | + */ |
|
74 | + function start_item_body() |
|
75 | + { |
|
76 | 76 | return ' <itemBody>' . "\n"; |
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * End the itemBody part. |
|
81 | - * |
|
82 | - */ |
|
83 | - function end_item_body() |
|
84 | - { |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * End the itemBody part. |
|
81 | + * |
|
82 | + */ |
|
83 | + function end_item_body() |
|
84 | + { |
|
85 | 85 | return " </itemBody>\n"; |
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * add the response processing template used. |
|
90 | - * |
|
91 | - */ |
|
92 | - |
|
93 | - function add_response_processing() |
|
94 | - { |
|
95 | - return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Export the question as an IMS/QTI Item. |
|
100 | - * |
|
101 | - * This is a default behaviour, some classes may want to override this. |
|
102 | - * |
|
103 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
104 | - * @return string string, the XML flow for an Item. |
|
105 | - */ |
|
106 | - function export($standalone = false) |
|
107 | - { |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * add the response processing template used. |
|
90 | + * |
|
91 | + */ |
|
92 | + |
|
93 | + function add_response_processing() |
|
94 | + { |
|
95 | + return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Export the question as an IMS/QTI Item. |
|
100 | + * |
|
101 | + * This is a default behaviour, some classes may want to override this. |
|
102 | + * |
|
103 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
104 | + * @return string string, the XML flow for an Item. |
|
105 | + */ |
|
106 | + function export($standalone = false) |
|
107 | + { |
|
108 | 108 | $head = $foot = ""; |
109 | 109 | |
110 | 110 | if ($standalone) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | .$foot; |
132 | 132 | |
133 | 133 | return $res; |
134 | - } |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | function export_presentation() |
195 | 195 | { |
196 | 196 | $out = "<presentation_material><flow_mat><material>\n" |
197 | - . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
198 | - . "</material></flow_mat></presentation_material>\n"; |
|
197 | + . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
198 | + . "</material></flow_mat></presentation_material>\n"; |
|
199 | 199 | return $out; |
200 | 200 | } |
201 | 201 | |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | $out = ''; |
210 | 210 | if ($n = $this->exercise->getShuffle()) { |
211 | 211 | $out.= "<selection_ordering>" |
212 | - . " <selection>\n" |
|
213 | - . " <selection_number>" . $n . "</selection_number>\n" |
|
214 | - . " </selection>\n" |
|
215 | - . ' <order order_type="Random" />' |
|
216 | - . "\n</selection_ordering>\n"; |
|
212 | + . " <selection>\n" |
|
213 | + . " <selection_number>" . $n . "</selection_number>\n" |
|
214 | + . " </selection>\n" |
|
215 | + . ' <order order_type="Random" />' |
|
216 | + . "\n</selection_ordering>\n"; |
|
217 | 217 | } else { |
218 | 218 | $out.= '<selection_ordering sequence_type="Normal">' . "\n" |
219 | - . " <selection />\n" |
|
220 | - . "</selection_ordering>\n"; |
|
219 | + . " <selection />\n" |
|
220 | + . "</selection_ordering>\n"; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $out; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | $out = ""; |
233 | 233 | foreach ($this->exercise->selectQuestionList() as $q) { |
234 | - $out .= export_question_qti($q, false); |
|
234 | + $out .= export_question_qti($q, false); |
|
235 | 235 | } |
236 | 236 | return $out; |
237 | 237 | } |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | $head = $foot = ""; |
249 | 249 | if ($standalone) { |
250 | 250 | $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n" |
251 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
252 | - . "<questestinterop>\n"; |
|
251 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
252 | + . "<questestinterop>\n"; |
|
253 | 253 | $foot = "</questestinterop>\n"; |
254 | 254 | } |
255 | 255 | $out = $head |
256 | - . $this->start_section() |
|
257 | - . $this->export_duration() |
|
258 | - . $this->export_presentation() |
|
259 | - . $this->export_ordering() |
|
260 | - . $this->export_questions() |
|
261 | - . $this->end_section() |
|
262 | - . $foot; |
|
256 | + . $this->start_section() |
|
257 | + . $this->export_duration() |
|
258 | + . $this->export_presentation() |
|
259 | + . $this->export_ordering() |
|
260 | + . $this->export_questions() |
|
261 | + . $this->end_section() |
|
262 | + . $foot; |
|
263 | 263 | |
264 | 264 | return $out; |
265 | 265 | } |
@@ -306,97 +306,97 @@ discard block |
||
306 | 306 | * @return ImsItem |
307 | 307 | * @author Anamd Tihon |
308 | 308 | */ |
309 | - function __construct($question) |
|
310 | - { |
|
309 | + function __construct($question) |
|
310 | + { |
|
311 | 311 | $this->question = $question; |
312 | 312 | $this->answer = $question->answer; |
313 | 313 | $this->questionIdent = "QST_" . $question->selectId() ; |
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * Start the XML flow. |
|
318 | - * |
|
319 | - * This opens the <item> block, with correct attributes. |
|
320 | - * |
|
321 | - * @author Amand Tihon <[email protected]> |
|
322 | - */ |
|
323 | - function start_item() |
|
324 | - { |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * Start the XML flow. |
|
318 | + * |
|
319 | + * This opens the <item> block, with correct attributes. |
|
320 | + * |
|
321 | + * @author Amand Tihon <[email protected]> |
|
322 | + */ |
|
323 | + function start_item() |
|
324 | + { |
|
325 | 325 | return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n"; |
326 | - } |
|
327 | - |
|
328 | - /** |
|
329 | - * End the XML flow, closing the </item> tag. |
|
330 | - * |
|
331 | - * @author Amand Tihon <[email protected]> |
|
332 | - */ |
|
333 | - function end_item() |
|
334 | - { |
|
326 | + } |
|
327 | + |
|
328 | + /** |
|
329 | + * End the XML flow, closing the </item> tag. |
|
330 | + * |
|
331 | + * @author Amand Tihon <[email protected]> |
|
332 | + */ |
|
333 | + function end_item() |
|
334 | + { |
|
335 | 335 | return "</item>\n"; |
336 | - } |
|
337 | - |
|
338 | - /** |
|
339 | - * Create the opening, with the question itself. |
|
340 | - * |
|
341 | - * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation(). |
|
342 | - * In between, the export_responses from the subclass should have been called. |
|
343 | - * |
|
344 | - * @author Amand Tihon <[email protected]> |
|
345 | - */ |
|
346 | - function start_presentation() |
|
347 | - { |
|
336 | + } |
|
337 | + |
|
338 | + /** |
|
339 | + * Create the opening, with the question itself. |
|
340 | + * |
|
341 | + * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation(). |
|
342 | + * In between, the export_responses from the subclass should have been called. |
|
343 | + * |
|
344 | + * @author Amand Tihon <[email protected]> |
|
345 | + */ |
|
346 | + function start_presentation() |
|
347 | + { |
|
348 | 348 | return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n" |
349 | - . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
350 | - } |
|
351 | - |
|
352 | - /** |
|
353 | - * End the </presentation> part, opened by export_header. |
|
354 | - * |
|
355 | - * @author Amand Tihon <[email protected]> |
|
356 | - */ |
|
357 | - function end_presentation() |
|
358 | - { |
|
349 | + . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
350 | + } |
|
351 | + |
|
352 | + /** |
|
353 | + * End the </presentation> part, opened by export_header. |
|
354 | + * |
|
355 | + * @author Amand Tihon <[email protected]> |
|
356 | + */ |
|
357 | + function end_presentation() |
|
358 | + { |
|
359 | 359 | return "</flow></presentation>\n"; |
360 | - } |
|
361 | - |
|
362 | - /** |
|
363 | - * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes. |
|
364 | - * |
|
365 | - * @author Amand Tihon <[email protected]> |
|
366 | - */ |
|
367 | - function start_processing() |
|
368 | - { |
|
360 | + } |
|
361 | + |
|
362 | + /** |
|
363 | + * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes. |
|
364 | + * |
|
365 | + * @author Amand Tihon <[email protected]> |
|
366 | + */ |
|
367 | + function start_processing() |
|
368 | + { |
|
369 | 369 | return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n"; |
370 | - } |
|
371 | - |
|
372 | - /** |
|
373 | - * End the response processing part. |
|
374 | - * |
|
375 | - * @author Amand Tihon <[email protected]> |
|
376 | - */ |
|
377 | - function end_processing() |
|
378 | - { |
|
370 | + } |
|
371 | + |
|
372 | + /** |
|
373 | + * End the response processing part. |
|
374 | + * |
|
375 | + * @author Amand Tihon <[email protected]> |
|
376 | + */ |
|
377 | + function end_processing() |
|
378 | + { |
|
379 | 379 | return "</resprocessing>\n"; |
380 | - } |
|
381 | - |
|
382 | - /** |
|
383 | - * Export the question as an IMS/QTI Item. |
|
384 | - * |
|
385 | - * This is a default behaviour, some classes may want to override this. |
|
386 | - * |
|
387 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
388 | - * @return string string, the XML flow for an Item. |
|
389 | - * @author Amand Tihon <[email protected]> |
|
390 | - */ |
|
391 | - function export($standalone = False) |
|
392 | - { |
|
380 | + } |
|
381 | + |
|
382 | + /** |
|
383 | + * Export the question as an IMS/QTI Item. |
|
384 | + * |
|
385 | + * This is a default behaviour, some classes may want to override this. |
|
386 | + * |
|
387 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
388 | + * @return string string, the XML flow for an Item. |
|
389 | + * @author Amand Tihon <[email protected]> |
|
390 | + */ |
|
391 | + function export($standalone = False) |
|
392 | + { |
|
393 | 393 | global $charset; |
394 | 394 | $head = $foot = ""; |
395 | 395 | |
396 | 396 | if ($standalone) { |
397 | 397 | $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n" |
398 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
399 | - . "<questestinterop>\n"; |
|
398 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
399 | + . "<questestinterop>\n"; |
|
400 | 400 | $foot = "</questestinterop>\n"; |
401 | 401 | } |
402 | 402 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | . $this->answer->imsExportFeedback($this->questionIdent) |
412 | 412 | . $this->end_item() |
413 | 413 | . $foot; |
414 | - } |
|
414 | + } |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | $question->type = $qst->type; |
451 | 451 | $question->question = $qst->question; |
452 | 452 | $question->description = $qst->description; |
453 | - $question->weighting=$qst->weighting; |
|
454 | - $question->position=$qst->position; |
|
455 | - $question->picture=$qst->picture; |
|
453 | + $question->weighting=$qst->weighting; |
|
454 | + $question->position=$qst->position; |
|
455 | + $question->picture=$qst->picture; |
|
456 | 456 | $ims = new ImsAssessmentItem($question); |
457 | 457 | |
458 | 458 | return $ims->export($standalone); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | public $new_destination; // id of the next question if feedback option is set to Directfeedback |
38 | 38 | public $course; //Course information |
39 | 39 | public $iid; |
40 | - public $questionJSId; |
|
41 | - public $standalone; |
|
40 | + public $questionJSId; |
|
41 | + public $standalone; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * constructor of the class |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | return []; |
160 | 160 | } |
161 | 161 | |
162 | - /** |
|
163 | - * returns all answer ids from this question Id |
|
164 | - * |
|
165 | - * @author Yoselyn Castillo |
|
166 | - * @return array - $id (answer ids) |
|
167 | - */ |
|
162 | + /** |
|
163 | + * returns all answer ids from this question Id |
|
164 | + * |
|
165 | + * @author Yoselyn Castillo |
|
166 | + * @return array - $id (answer ids) |
|
167 | + */ |
|
168 | 168 | public function selectAnswerId() |
169 | 169 | { |
170 | 170 | $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | return $id; |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Reads answer information from the data base ordered by parameter |
@@ -195,23 +195,23 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function readOrderedBy($field, $order='ASC') |
197 | 197 | { |
198 | - $field = Database::escape_string($field); |
|
199 | - if (empty($field)) { |
|
200 | - $field = 'position'; |
|
201 | - } |
|
198 | + $field = Database::escape_string($field); |
|
199 | + if (empty($field)) { |
|
200 | + $field = 'position'; |
|
201 | + } |
|
202 | 202 | |
203 | - if ($order != 'ASC' && $order!='DESC') { |
|
204 | - $order = 'ASC'; |
|
205 | - } |
|
203 | + if ($order != 'ASC' && $order!='DESC') { |
|
204 | + $order = 'ASC'; |
|
205 | + } |
|
206 | 206 | |
207 | - $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
208 | - $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
209 | - $questionId = intval($this->questionId); |
|
207 | + $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
208 | + $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
209 | + $questionId = intval($this->questionId); |
|
210 | 210 | |
211 | - $sql = "SELECT type FROM $TBL_QUIZ |
|
211 | + $sql = "SELECT type FROM $TBL_QUIZ |
|
212 | 212 | WHERE c_id = {$this->course_id} AND id = $questionId"; |
213 | - $result_question = Database::query($sql); |
|
214 | - $questionType = Database::fetch_array($result_question); |
|
213 | + $result_question = Database::query($sql); |
|
214 | + $questionType = Database::fetch_array($result_question); |
|
215 | 215 | |
216 | 216 | if ($questionType['type'] == DRAGGABLE) { |
217 | 217 | // Random is done by submit.js.tpl |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | return true; |
221 | 221 | } |
222 | 222 | |
223 | - $sql = "SELECT |
|
223 | + $sql = "SELECT |
|
224 | 224 | answer, |
225 | 225 | correct, |
226 | 226 | comment, |
@@ -236,16 +236,16 @@ discard block |
||
236 | 236 | c_id = {$this->course_id} AND |
237 | 237 | question_id='".$questionId."' |
238 | 238 | ORDER BY $field $order"; |
239 | - $result=Database::query($sql); |
|
240 | - |
|
241 | - $i = 1; |
|
242 | - // while a record is found |
|
243 | - $doubt_data = null; |
|
244 | - while ($object = Database::fetch_object($result)) { |
|
245 | - if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) { |
|
246 | - $doubt_data = $object; |
|
239 | + $result=Database::query($sql); |
|
240 | + |
|
241 | + $i = 1; |
|
242 | + // while a record is found |
|
243 | + $doubt_data = null; |
|
244 | + while ($object = Database::fetch_object($result)) { |
|
245 | + if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) { |
|
246 | + $doubt_data = $object; |
|
247 | 247 | continue; |
248 | - } |
|
248 | + } |
|
249 | 249 | $this->answer[$i] = $object->answer; |
250 | 250 | $this->correct[$i] = $object->correct; |
251 | 251 | $this->comment[$i] = $object->comment; |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | $this->autoId[$i] = $object->id_auto; |
258 | 258 | $this->iid[$i] = $object->iid; |
259 | 259 | $i++; |
260 | - } |
|
260 | + } |
|
261 | 261 | |
262 | - if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) { |
|
262 | + if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) { |
|
263 | 263 | $this->answer[$i] = $doubt_data->answer; |
264 | 264 | $this->correct[$i] = $doubt_data->correct; |
265 | 265 | $this->comment[$i] = $doubt_data->comment; |
@@ -271,88 +271,88 @@ discard block |
||
271 | 271 | $this->autoId[$i] = $doubt_data->id_auto; |
272 | 272 | $this->iid[$i] = $doubt_data->iid; |
273 | 273 | $i++; |
274 | - } |
|
274 | + } |
|
275 | 275 | $this->nbrAnswers = $i-1; |
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * returns the autoincrement id identificator |
|
280 | - * |
|
281 | - * @author Juan Carlos Ra�a |
|
282 | - * @return integer - answer num |
|
283 | - */ |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * returns the autoincrement id identificator |
|
280 | + * |
|
281 | + * @author Juan Carlos Ra�a |
|
282 | + * @return integer - answer num |
|
283 | + */ |
|
284 | 284 | public function selectAutoId($id) |
285 | 285 | { |
286 | - return isset($this->autoId[$id]) ? $this->autoId[$id] : 0; |
|
287 | - } |
|
288 | - |
|
289 | - /** |
|
290 | - * returns the number of answers in this question |
|
291 | - * |
|
292 | - * @author Olivier Brouckaert |
|
293 | - * @return integer - number of answers |
|
294 | - */ |
|
295 | - public function selectNbrAnswers() |
|
286 | + return isset($this->autoId[$id]) ? $this->autoId[$id] : 0; |
|
287 | + } |
|
288 | + |
|
289 | + /** |
|
290 | + * returns the number of answers in this question |
|
291 | + * |
|
292 | + * @author Olivier Brouckaert |
|
293 | + * @return integer - number of answers |
|
294 | + */ |
|
295 | + public function selectNbrAnswers() |
|
296 | 296 | { |
297 | - return $this->nbrAnswers; |
|
298 | - } |
|
299 | - |
|
300 | - /** |
|
301 | - * returns the question ID which the answers belong to |
|
302 | - * |
|
303 | - * @author Olivier Brouckaert |
|
304 | - * @return integer - the question ID |
|
305 | - */ |
|
306 | - public function selectQuestionId() |
|
297 | + return $this->nbrAnswers; |
|
298 | + } |
|
299 | + |
|
300 | + /** |
|
301 | + * returns the question ID which the answers belong to |
|
302 | + * |
|
303 | + * @author Olivier Brouckaert |
|
304 | + * @return integer - the question ID |
|
305 | + */ |
|
306 | + public function selectQuestionId() |
|
307 | 307 | { |
308 | - return $this->questionId; |
|
309 | - } |
|
310 | - |
|
311 | - /** |
|
312 | - * returns the question ID of the destination question |
|
313 | - * |
|
314 | - * @author Julio Montoya |
|
315 | - * @param integer $id |
|
316 | - * @return integer - the question ID |
|
317 | - */ |
|
318 | - public function selectDestination($id) |
|
308 | + return $this->questionId; |
|
309 | + } |
|
310 | + |
|
311 | + /** |
|
312 | + * returns the question ID of the destination question |
|
313 | + * |
|
314 | + * @author Julio Montoya |
|
315 | + * @param integer $id |
|
316 | + * @return integer - the question ID |
|
317 | + */ |
|
318 | + public function selectDestination($id) |
|
319 | 319 | { |
320 | - return isset($this->destination[$id]) ? $this->destination[$id] : null; |
|
321 | - } |
|
320 | + return isset($this->destination[$id]) ? $this->destination[$id] : null; |
|
321 | + } |
|
322 | 322 | |
323 | 323 | /** |
324 | - * returns the answer title |
|
325 | - * |
|
326 | - * @author Olivier Brouckaert |
|
327 | - * @param - integer $id - answer ID |
|
328 | - * @return string - answer title |
|
329 | - */ |
|
330 | - public function selectAnswer($id) |
|
331 | - { |
|
332 | - return isset($this->answer[$id]) ? $this->answer[$id] : null; |
|
333 | - } |
|
334 | - |
|
335 | - /** |
|
336 | - * return array answer by id else return a bool |
|
337 | - * @param integer $auto_id |
|
338 | - */ |
|
339 | - public function selectAnswerByAutoId($auto_id) |
|
340 | - { |
|
341 | - $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
342 | - |
|
343 | - $auto_id = intval($auto_id); |
|
344 | - $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER |
|
324 | + * returns the answer title |
|
325 | + * |
|
326 | + * @author Olivier Brouckaert |
|
327 | + * @param - integer $id - answer ID |
|
328 | + * @return string - answer title |
|
329 | + */ |
|
330 | + public function selectAnswer($id) |
|
331 | + { |
|
332 | + return isset($this->answer[$id]) ? $this->answer[$id] : null; |
|
333 | + } |
|
334 | + |
|
335 | + /** |
|
336 | + * return array answer by id else return a bool |
|
337 | + * @param integer $auto_id |
|
338 | + */ |
|
339 | + public function selectAnswerByAutoId($auto_id) |
|
340 | + { |
|
341 | + $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
342 | + |
|
343 | + $auto_id = intval($auto_id); |
|
344 | + $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER |
|
345 | 345 | WHERE c_id = {$this->course_id} AND id_auto='$auto_id'"; |
346 | - $rs = Database::query($sql); |
|
346 | + $rs = Database::query($sql); |
|
347 | 347 | |
348 | - if (Database::num_rows($rs) > 0) { |
|
349 | - $row = Database::fetch_array($rs, 'ASSOC'); |
|
348 | + if (Database::num_rows($rs) > 0) { |
|
349 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
350 | 350 | |
351 | - return $row; |
|
352 | - } |
|
351 | + return $row; |
|
352 | + } |
|
353 | 353 | |
354 | - return false; |
|
355 | - } |
|
354 | + return false; |
|
355 | + } |
|
356 | 356 | |
357 | 357 | /** |
358 | 358 | * returns the answer title from an answer's position |
@@ -361,18 +361,18 @@ discard block |
||
361 | 361 | * @param - integer $id - answer ID |
362 | 362 | * @return bool - answer title |
363 | 363 | */ |
364 | - public function selectAnswerIdByPosition($pos) |
|
365 | - { |
|
366 | - foreach ($this->position as $k => $v) { |
|
367 | - if ($v != $pos) { |
|
368 | - continue; |
|
369 | - } |
|
364 | + public function selectAnswerIdByPosition($pos) |
|
365 | + { |
|
366 | + foreach ($this->position as $k => $v) { |
|
367 | + if ($v != $pos) { |
|
368 | + continue; |
|
369 | + } |
|
370 | 370 | |
371 | - return $k; |
|
372 | - } |
|
371 | + return $k; |
|
372 | + } |
|
373 | 373 | |
374 | - return false; |
|
375 | - } |
|
374 | + return false; |
|
375 | + } |
|
376 | 376 | |
377 | 377 | /** |
378 | 378 | * Returns a list of answers |
@@ -381,18 +381,18 @@ discard block |
||
381 | 381 | * of (id, answer, comment, grade) and grade=weighting |
382 | 382 | */ |
383 | 383 | public function getAnswersList($decode = false) |
384 | - { |
|
385 | - $list = array(); |
|
386 | - for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
387 | - if (!empty($this->answer[$i])) { |
|
388 | - |
|
389 | - //Avoid problems when parsing elements with accents |
|
390 | - if ($decode) { |
|
391 | - $this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding()); |
|
392 | - $this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding()); |
|
393 | - } |
|
394 | - |
|
395 | - $list[] = array( |
|
384 | + { |
|
385 | + $list = array(); |
|
386 | + for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
387 | + if (!empty($this->answer[$i])) { |
|
388 | + |
|
389 | + //Avoid problems when parsing elements with accents |
|
390 | + if ($decode) { |
|
391 | + $this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding()); |
|
392 | + $this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding()); |
|
393 | + } |
|
394 | + |
|
395 | + $list[] = array( |
|
396 | 396 | 'id' => $i, |
397 | 397 | 'answer' => $this->answer[$i], |
398 | 398 | 'comment' => $this->comment[$i], |
@@ -401,137 +401,137 @@ discard block |
||
401 | 401 | 'hotspot_type' => $this->hotspot_type[$i], |
402 | 402 | 'correct' => $this->correct[$i], |
403 | 403 | 'destination' => $this->destination[$i] |
404 | - ); |
|
404 | + ); |
|
405 | + } |
|
405 | 406 | } |
406 | - } |
|
407 | 407 | |
408 | - return $list; |
|
409 | - } |
|
408 | + return $list; |
|
409 | + } |
|
410 | 410 | |
411 | - /** |
|
412 | - * Returns a list of grades |
|
413 | - * @author Yannick Warnier <[email protected]> |
|
414 | - * @return array List of grades where grade=weighting (?) |
|
415 | - */ |
|
411 | + /** |
|
412 | + * Returns a list of grades |
|
413 | + * @author Yannick Warnier <[email protected]> |
|
414 | + * @return array List of grades where grade=weighting (?) |
|
415 | + */ |
|
416 | 416 | public function getGradesList() |
417 | - { |
|
418 | - $list = array(); |
|
419 | - for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
420 | - if(!empty($this->answer[$i])){ |
|
421 | - $list[$i] = $this->weighting[$i]; |
|
422 | - } |
|
423 | - } |
|
424 | - return $list; |
|
425 | - } |
|
426 | - |
|
427 | - /** |
|
428 | - * Returns the question type |
|
429 | - * @author Yannick Warnier <[email protected]> |
|
430 | - * @return integer The type of the question this answer is bound to |
|
431 | - */ |
|
417 | + { |
|
418 | + $list = array(); |
|
419 | + for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
420 | + if(!empty($this->answer[$i])){ |
|
421 | + $list[$i] = $this->weighting[$i]; |
|
422 | + } |
|
423 | + } |
|
424 | + return $list; |
|
425 | + } |
|
426 | + |
|
427 | + /** |
|
428 | + * Returns the question type |
|
429 | + * @author Yannick Warnier <[email protected]> |
|
430 | + * @return integer The type of the question this answer is bound to |
|
431 | + */ |
|
432 | 432 | public function getQuestionType() |
433 | - { |
|
434 | - $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
435 | - $sql = "SELECT type FROM $TBL_QUESTIONS |
|
433 | + { |
|
434 | + $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
435 | + $sql = "SELECT type FROM $TBL_QUESTIONS |
|
436 | 436 | WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'"; |
437 | - $res = Database::query($sql); |
|
438 | - if (Database::num_rows($res)<=0){ |
|
439 | - return null; |
|
440 | - } |
|
441 | - $row = Database::fetch_array($res); |
|
442 | - |
|
443 | - return $row['type']; |
|
444 | - } |
|
445 | - |
|
446 | - |
|
447 | - /** |
|
448 | - * tells if answer is correct or not |
|
449 | - * |
|
450 | - * @author Olivier Brouckaert |
|
451 | - * @param - integer $id - answer ID |
|
452 | - * @return integer - 0 if bad answer, not 0 if good answer |
|
453 | - */ |
|
437 | + $res = Database::query($sql); |
|
438 | + if (Database::num_rows($res)<=0){ |
|
439 | + return null; |
|
440 | + } |
|
441 | + $row = Database::fetch_array($res); |
|
442 | + |
|
443 | + return $row['type']; |
|
444 | + } |
|
445 | + |
|
446 | + |
|
447 | + /** |
|
448 | + * tells if answer is correct or not |
|
449 | + * |
|
450 | + * @author Olivier Brouckaert |
|
451 | + * @param - integer $id - answer ID |
|
452 | + * @return integer - 0 if bad answer, not 0 if good answer |
|
453 | + */ |
|
454 | 454 | public function isCorrect($id) |
455 | - { |
|
456 | - return isset($this->correct[$id]) ? $this->correct[$id] : null; |
|
457 | - } |
|
458 | - |
|
459 | - /** |
|
460 | - * returns answer comment |
|
461 | - * |
|
462 | - * @author Olivier Brouckaert |
|
463 | - * @param - integer $id - answer ID |
|
464 | - * @return string - answer comment |
|
465 | - */ |
|
455 | + { |
|
456 | + return isset($this->correct[$id]) ? $this->correct[$id] : null; |
|
457 | + } |
|
458 | + |
|
459 | + /** |
|
460 | + * returns answer comment |
|
461 | + * |
|
462 | + * @author Olivier Brouckaert |
|
463 | + * @param - integer $id - answer ID |
|
464 | + * @return string - answer comment |
|
465 | + */ |
|
466 | 466 | public function selectComment($id) |
467 | - { |
|
467 | + { |
|
468 | 468 | return isset($this->comment[$id]) ? $this->comment[$id] : null; |
469 | - } |
|
470 | - |
|
471 | - /** |
|
472 | - * returns answer weighting |
|
473 | - * |
|
474 | - * @author Olivier Brouckaert |
|
475 | - * @param - integer $id - answer ID |
|
476 | - * @param integer $id |
|
477 | - * @return integer - answer weighting |
|
478 | - */ |
|
469 | + } |
|
470 | + |
|
471 | + /** |
|
472 | + * returns answer weighting |
|
473 | + * |
|
474 | + * @author Olivier Brouckaert |
|
475 | + * @param - integer $id - answer ID |
|
476 | + * @param integer $id |
|
477 | + * @return integer - answer weighting |
|
478 | + */ |
|
479 | 479 | public function selectWeighting($id) |
480 | - { |
|
481 | - return isset($this->weighting[$id]) ? $this->weighting[$id] : null; |
|
482 | - } |
|
483 | - |
|
484 | - /** |
|
485 | - * returns answer position |
|
486 | - * |
|
487 | - * @author Olivier Brouckaert |
|
488 | - * @param - integer $id - answer ID |
|
489 | - * @return integer - answer position |
|
490 | - */ |
|
491 | - function selectPosition($id) |
|
492 | - { |
|
493 | - return isset($this->position[$id]) ? $this->position[$id] : null; |
|
494 | - } |
|
495 | - |
|
496 | - /** |
|
497 | - * returns answer hotspot coordinates |
|
498 | - * |
|
499 | - * @author Olivier Brouckaert |
|
500 | - * @param integer Answer ID |
|
501 | - * @param integer $id |
|
502 | - * @return integer Answer position |
|
503 | - */ |
|
480 | + { |
|
481 | + return isset($this->weighting[$id]) ? $this->weighting[$id] : null; |
|
482 | + } |
|
483 | + |
|
484 | + /** |
|
485 | + * returns answer position |
|
486 | + * |
|
487 | + * @author Olivier Brouckaert |
|
488 | + * @param - integer $id - answer ID |
|
489 | + * @return integer - answer position |
|
490 | + */ |
|
491 | + function selectPosition($id) |
|
492 | + { |
|
493 | + return isset($this->position[$id]) ? $this->position[$id] : null; |
|
494 | + } |
|
495 | + |
|
496 | + /** |
|
497 | + * returns answer hotspot coordinates |
|
498 | + * |
|
499 | + * @author Olivier Brouckaert |
|
500 | + * @param integer Answer ID |
|
501 | + * @param integer $id |
|
502 | + * @return integer Answer position |
|
503 | + */ |
|
504 | 504 | public function selectHotspotCoordinates($id) |
505 | - { |
|
506 | - return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null; |
|
507 | - } |
|
508 | - |
|
509 | - /** |
|
510 | - * returns answer hotspot type |
|
511 | - * |
|
512 | - * @author Toon Keppens |
|
513 | - * @param integer Answer ID |
|
514 | - * @param integer $id |
|
515 | - * @return integer Answer position |
|
516 | - */ |
|
505 | + { |
|
506 | + return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null; |
|
507 | + } |
|
508 | + |
|
509 | + /** |
|
510 | + * returns answer hotspot type |
|
511 | + * |
|
512 | + * @author Toon Keppens |
|
513 | + * @param integer Answer ID |
|
514 | + * @param integer $id |
|
515 | + * @return integer Answer position |
|
516 | + */ |
|
517 | 517 | public function selectHotspotType($id) |
518 | - { |
|
519 | - return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null; |
|
520 | - } |
|
521 | - |
|
522 | - /** |
|
523 | - * Creates a new answer |
|
524 | - * |
|
525 | - * @author Olivier Brouckaert |
|
526 | - * @param string $answer answer title |
|
527 | - * @param integer $correct 0 if bad answer, not 0 if good answer |
|
528 | - * @param string $comment answer comment |
|
529 | - * @param integer $weighting answer weighting |
|
530 | - * @param integer $position answer position |
|
531 | - * @param array $new_hotspot_coordinates Coordinates for hotspot exercises (optional) |
|
532 | - * @param integer $new_hotspot_type Type for hotspot exercises (optional) |
|
518 | + { |
|
519 | + return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null; |
|
520 | + } |
|
521 | + |
|
522 | + /** |
|
523 | + * Creates a new answer |
|
524 | + * |
|
525 | + * @author Olivier Brouckaert |
|
526 | + * @param string $answer answer title |
|
527 | + * @param integer $correct 0 if bad answer, not 0 if good answer |
|
528 | + * @param string $comment answer comment |
|
529 | + * @param integer $weighting answer weighting |
|
530 | + * @param integer $position answer position |
|
531 | + * @param array $new_hotspot_coordinates Coordinates for hotspot exercises (optional) |
|
532 | + * @param integer $new_hotspot_type Type for hotspot exercises (optional) |
|
533 | 533 | * @param string $destination |
534 | - */ |
|
534 | + */ |
|
535 | 535 | public function createAnswer( |
536 | 536 | $answer, |
537 | 537 | $correct, |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $new_hotspot_type = null, |
543 | 543 | $destination = '' |
544 | 544 | ) { |
545 | - $this->new_nbrAnswers++; |
|
545 | + $this->new_nbrAnswers++; |
|
546 | 546 | $id = $this->new_nbrAnswers; |
547 | 547 | $this->new_answer[$id] = $answer; |
548 | 548 | $this->new_correct[$id] = $correct; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $this->new_hotspot_coordinates[$id] = $new_hotspot_coordinates; |
553 | 553 | $this->new_hotspot_type[$id] = $new_hotspot_type; |
554 | 554 | $this->new_destination[$id] = $destination; |
555 | - } |
|
555 | + } |
|
556 | 556 | |
557 | 557 | /** |
558 | 558 | * Updates an answer |
@@ -595,32 +595,32 @@ discard block |
||
595 | 595 | |
596 | 596 | $em->merge($quizAnswer); |
597 | 597 | $em->flush(); |
598 | - } |
|
598 | + } |
|
599 | 599 | |
600 | - /** |
|
601 | - * Records answers into the data base |
|
602 | - * |
|
603 | - * @author Olivier Brouckaert |
|
604 | - */ |
|
600 | + /** |
|
601 | + * Records answers into the data base |
|
602 | + * |
|
603 | + * @author Olivier Brouckaert |
|
604 | + */ |
|
605 | 605 | public function save() |
606 | 606 | { |
607 | - $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
607 | + $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
608 | 608 | $em = Database::getManager(); |
609 | - $questionId = intval($this->questionId); |
|
609 | + $questionId = intval($this->questionId); |
|
610 | 610 | |
611 | - $c_id = $this->course['real_id']; |
|
611 | + $c_id = $this->course['real_id']; |
|
612 | 612 | $correctList = []; |
613 | 613 | $answerList = []; |
614 | 614 | |
615 | - for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
616 | - $answer = $this->new_answer[$i]; |
|
617 | - $correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : ''; |
|
618 | - $comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : ''; |
|
619 | - $weighting = isset($this->new_weighting[$i]) ? $this->new_weighting[$i] : ''; |
|
620 | - $position = isset($this->new_position[$i]) ? $this->new_position[$i] : ''; |
|
621 | - $hotspot_coordinates = isset($this->new_hotspot_coordinates[$i]) ? $this->new_hotspot_coordinates[$i] : ''; |
|
622 | - $hotspot_type = isset($this->new_hotspot_type[$i]) ? $this->new_hotspot_type[$i] : ''; |
|
623 | - $destination = isset($this->new_destination[$i]) ? $this->new_destination[$i] : ''; |
|
615 | + for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
616 | + $answer = $this->new_answer[$i]; |
|
617 | + $correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : ''; |
|
618 | + $comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : ''; |
|
619 | + $weighting = isset($this->new_weighting[$i]) ? $this->new_weighting[$i] : ''; |
|
620 | + $position = isset($this->new_position[$i]) ? $this->new_position[$i] : ''; |
|
621 | + $hotspot_coordinates = isset($this->new_hotspot_coordinates[$i]) ? $this->new_hotspot_coordinates[$i] : ''; |
|
622 | + $hotspot_type = isset($this->new_hotspot_type[$i]) ? $this->new_hotspot_type[$i] : ''; |
|
623 | + $destination = isset($this->new_destination[$i]) ? $this->new_destination[$i] : ''; |
|
624 | 624 | $autoId = $this->selectAutoId($i); |
625 | 625 | $iid = isset($this->iid[$i]) ? $this->iid[$i] : 0; |
626 | 626 | |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | |
664 | 664 | $correctAnswerId = $answer->selectAnswerIdByPosition($correct); |
665 | 665 | |
666 | - // Continue to avoid matching question bug if $correctAnswerId returns false |
|
667 | - // See : https://support.chamilo.org/issues/8334 |
|
668 | - if ($questionType == MATCHING && !$correctAnswerId) { |
|
669 | - continue; |
|
670 | - } |
|
666 | + // Continue to avoid matching question bug if $correctAnswerId returns false |
|
667 | + // See : https://support.chamilo.org/issues/8334 |
|
668 | + if ($questionType == MATCHING && !$correctAnswerId) { |
|
669 | + continue; |
|
670 | + } |
|
671 | 671 | |
672 | 672 | $correctAnswerAutoId = $answer->selectAutoId($correct); |
673 | 673 | |
@@ -734,28 +734,28 @@ discard block |
||
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | - // moves $new_* arrays |
|
738 | - $this->answer = $this->new_answer; |
|
739 | - $this->correct = $this->new_correct; |
|
740 | - $this->comment = $this->new_comment; |
|
741 | - $this->weighting = $this->new_weighting; |
|
742 | - $this->position = $this->new_position; |
|
743 | - $this->hotspot_coordinates = $this->new_hotspot_coordinates; |
|
744 | - $this->hotspot_type = $this->new_hotspot_type; |
|
745 | - $this->nbrAnswers = $this->new_nbrAnswers; |
|
746 | - $this->destination = $this->new_destination; |
|
747 | - |
|
748 | - $this->cancel(); |
|
749 | - } |
|
750 | - |
|
751 | - /** |
|
752 | - * Duplicates answers by copying them into another question |
|
753 | - * |
|
754 | - * @author Olivier Brouckaert |
|
755 | - * @param int question id |
|
737 | + // moves $new_* arrays |
|
738 | + $this->answer = $this->new_answer; |
|
739 | + $this->correct = $this->new_correct; |
|
740 | + $this->comment = $this->new_comment; |
|
741 | + $this->weighting = $this->new_weighting; |
|
742 | + $this->position = $this->new_position; |
|
743 | + $this->hotspot_coordinates = $this->new_hotspot_coordinates; |
|
744 | + $this->hotspot_type = $this->new_hotspot_type; |
|
745 | + $this->nbrAnswers = $this->new_nbrAnswers; |
|
746 | + $this->destination = $this->new_destination; |
|
747 | + |
|
748 | + $this->cancel(); |
|
749 | + } |
|
750 | + |
|
751 | + /** |
|
752 | + * Duplicates answers by copying them into another question |
|
753 | + * |
|
754 | + * @author Olivier Brouckaert |
|
755 | + * @param int question id |
|
756 | 756 | * @param array destination course info (result of the function api_get_course_info() ) |
757 | 757 | * @param string $newQuestionId |
758 | - */ |
|
758 | + */ |
|
759 | 759 | public function duplicate($newQuestionId, $course_info = null) |
760 | 760 | { |
761 | 761 | if (empty($course_info)) { |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | |
776 | 776 | if (!empty($origin_options)) { |
777 | 777 | foreach ($origin_options as $item) { |
778 | - $new_option_list[] = $item['id']; |
|
778 | + $new_option_list[] = $item['id']; |
|
779 | 779 | } |
780 | 780 | } |
781 | 781 | |
@@ -789,12 +789,12 @@ discard block |
||
789 | 789 | } |
790 | 790 | } |
791 | 791 | |
792 | - // if at least one answer |
|
793 | - if ($this->nbrAnswers) { |
|
794 | - // inserts new answers into data base |
|
795 | - $c_id = $course_info['real_id']; |
|
792 | + // if at least one answer |
|
793 | + if ($this->nbrAnswers) { |
|
794 | + // inserts new answers into data base |
|
795 | + $c_id = $course_info['real_id']; |
|
796 | 796 | |
797 | - for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
797 | + for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
798 | 798 | if ($this->course['id'] != $course_info['id']) { |
799 | 799 | $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course( |
800 | 800 | $this->answer[$i], |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | ); |
809 | 809 | } |
810 | 810 | |
811 | - $correct = $this->correct[$i]; |
|
811 | + $correct = $this->correct[$i]; |
|
812 | 812 | |
813 | 813 | if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || |
814 | 814 | self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE |
@@ -840,9 +840,9 @@ discard block |
||
840 | 840 | |
841 | 841 | $em->merge($quizAnswer); |
842 | 842 | $em->flush(); |
843 | - } |
|
843 | + } |
|
844 | 844 | } |
845 | - } |
|
845 | + } |
|
846 | 846 | |
847 | 847 | /** |
848 | 848 | * Get the necessary JavaScript for some answers |
@@ -860,25 +860,25 @@ discard block |
||
860 | 860 | </script>"; |
861 | 861 | } |
862 | 862 | |
863 | - /** |
|
864 | - * Check if a answer is correct by an answer auto id |
|
865 | - * @param $needle int The answer auto id |
|
866 | - * @return bool |
|
867 | - */ |
|
868 | - public function isCorrectByAutoId($needle) |
|
869 | - { |
|
870 | - $key = 0; |
|
871 | - |
|
872 | - foreach ($this->autoId as $autoIdKey => $autoId) { |
|
873 | - if ($autoId == $needle) { |
|
874 | - $key = $autoIdKey; |
|
875 | - } |
|
876 | - } |
|
877 | - |
|
878 | - if (!$key) { |
|
879 | - return false; |
|
880 | - } |
|
881 | - |
|
882 | - return $this->isCorrect($key) ? true : false; |
|
883 | - } |
|
863 | + /** |
|
864 | + * Check if a answer is correct by an answer auto id |
|
865 | + * @param $needle int The answer auto id |
|
866 | + * @return bool |
|
867 | + */ |
|
868 | + public function isCorrectByAutoId($needle) |
|
869 | + { |
|
870 | + $key = 0; |
|
871 | + |
|
872 | + foreach ($this->autoId as $autoIdKey => $autoId) { |
|
873 | + if ($autoId == $needle) { |
|
874 | + $key = $autoIdKey; |
|
875 | + } |
|
876 | + } |
|
877 | + |
|
878 | + if (!$key) { |
|
879 | + return false; |
|
880 | + } |
|
881 | + |
|
882 | + return $this->isCorrect($key) ? true : false; |
|
883 | + } |
|
884 | 884 | } |