@@ -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"> |
@@ -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 |
@@ -8,19 +8,19 @@ |
||
8 | 8 | */ |
9 | 9 | class DataForm extends FormValidator |
10 | 10 | { |
11 | - const TYPE_IMPORT = 1; |
|
12 | - const TYPE_EXPORT = 2; |
|
13 | - const TYPE_EXPORT_PDF = 3; |
|
11 | + const TYPE_IMPORT = 1; |
|
12 | + const TYPE_EXPORT = 2; |
|
13 | + const TYPE_EXPORT_PDF = 3; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Builds a form containing form items based on a given parameter |
|
17 | - * @param int form_type 1=import, 2=export |
|
18 | - * @param obj cat_obj the category object |
|
19 | - * @param obj res_obj the result object |
|
20 | - * @param string form name |
|
21 | - * @param method |
|
22 | - * @param action |
|
23 | - */ |
|
15 | + /** |
|
16 | + * Builds a form containing form items based on a given parameter |
|
17 | + * @param int form_type 1=import, 2=export |
|
18 | + * @param obj cat_obj the category object |
|
19 | + * @param obj res_obj the result object |
|
20 | + * @param string form name |
|
21 | + * @param method |
|
22 | + * @param action |
|
23 | + */ |
|
24 | 24 | public function __construct($form_type, $form_name, $method = 'post', $action = null, $target = '', $locked_status) |
25 | 25 | { |
26 | 26 | parent:: __construct($form_name, $method, $action, $target); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $htmlHeadXtra[] = '<style> |
71 | 71 | body { background: none;} |
72 | 72 | </style>'; |
73 | - Display::display_reduced_header(); |
|
73 | + Display::display_reduced_header(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $message = Session::read('attempt_remaining'); |
@@ -20,140 +20,140 @@ discard block |
||
20 | 20 | { |
21 | 21 | public $js_id; |
22 | 22 | public $answer; |
23 | - /** |
|
24 | - * Returns the HTML + JS flow corresponding to one question |
|
25 | - * |
|
26 | - * @param int $questionId The question ID |
|
27 | - * @param bool $standalone (ie including XML tag, DTD declaration, etc) |
|
28 | - * @param int $js_id The JavaScript ID for this question. |
|
29 | - * Due to the nature of interactions, we must have a natural sequence for |
|
30 | - * questions in the generated JavaScript. |
|
31 | - * @param integer $js_id |
|
23 | + /** |
|
24 | + * Returns the HTML + JS flow corresponding to one question |
|
25 | + * |
|
26 | + * @param int $questionId The question ID |
|
27 | + * @param bool $standalone (ie including XML tag, DTD declaration, etc) |
|
28 | + * @param int $js_id The JavaScript ID for this question. |
|
29 | + * Due to the nature of interactions, we must have a natural sequence for |
|
30 | + * questions in the generated JavaScript. |
|
31 | + * @param integer $js_id |
|
32 | 32 | * @return string|array |
33 | - */ |
|
34 | - public static function export_question($questionId, $standalone = true, $js_id) |
|
35 | - { |
|
36 | - $question = new ScormQuestion(); |
|
37 | - $qst = $question->read($questionId); |
|
38 | - if (!$qst) { |
|
39 | - return ''; |
|
40 | - } |
|
41 | - $question->id = $qst->id; |
|
42 | - $question->js_id = $js_id; |
|
43 | - $question->type = $qst->type; |
|
44 | - $question->question = $qst->question; |
|
45 | - $question->description = $qst->description; |
|
46 | - $question->weighting=$qst->weighting; |
|
47 | - $question->position=$qst->position; |
|
48 | - $question->picture=$qst->picture; |
|
49 | - $assessmentItem = new ScormAssessmentItem($question, $standalone); |
|
50 | - |
|
51 | - return $assessmentItem->export(); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Include the correct answer class and create answer |
|
56 | - */ |
|
57 | - public function setAnswer() |
|
58 | - { |
|
59 | - switch ($this->type) { |
|
60 | - case MCUA: |
|
61 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
62 | - $this->answer->questionJSId = $this->js_id; |
|
63 | - break; |
|
64 | - case MCMA: |
|
65 | - case GLOBAL_MULTIPLE_ANSWER: |
|
66 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
67 | - $this->answer->questionJSId = $this->js_id; |
|
68 | - break; |
|
69 | - case TF: |
|
70 | - $this->answer = new ScormAnswerTrueFalse($this->id); |
|
71 | - $this->answer->questionJSId = $this->js_id; |
|
72 | - break; |
|
73 | - case FIB: |
|
74 | - $this->answer = new ScormAnswerFillInBlanks($this->id); |
|
75 | - $this->answer->questionJSId = $this->js_id; |
|
76 | - break; |
|
77 | - case MATCHING: |
|
78 | - case MATCHING_DRAGGABLE: |
|
79 | - case DRAGGABLE: |
|
80 | - $this->answer = new ScormAnswerMatching($this->id); |
|
81 | - $this->answer->questionJSId = $this->js_id; |
|
82 | - break; |
|
83 | - case ORAL_EXPRESSION: |
|
84 | - case FREE_ANSWER: |
|
85 | - $this->answer = new ScormAnswerFree($this->id); |
|
86 | - $this->answer->questionJSId = $this->js_id; |
|
87 | - break; |
|
88 | - case HOT_SPOT: |
|
89 | - $this->answer = new ScormAnswerHotspot($this->id); |
|
90 | - $this->answer->questionJSId = $this->js_id; |
|
91 | - break; |
|
92 | - case MULTIPLE_ANSWER_COMBINATION: |
|
93 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
94 | - $this->answer->questionJSId = $this->js_id; |
|
95 | - break; |
|
96 | - case HOT_SPOT_ORDER: |
|
97 | - $this->answer = new ScormAnswerHotspot($this->id); |
|
98 | - $this->answer->questionJSId = $this->js_id; |
|
99 | - break; |
|
100 | - case HOT_SPOT_DELINEATION: |
|
101 | - $this->answer = new ScormAnswerHotspot($this->id); |
|
102 | - $this->answer->questionJSId = $this->js_id; |
|
103 | - break; |
|
104 | - // not supported |
|
105 | - case UNIQUE_ANSWER_NO_OPTION: |
|
106 | - case MULTIPLE_ANSWER_TRUE_FALSE: |
|
107 | - case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
|
108 | - case UNIQUE_ANSWER_IMAGE: |
|
109 | - case CALCULATED_ANSWER: |
|
110 | - $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
111 | - $this->answer->questionJSId = $this->js_id; |
|
112 | - break; |
|
113 | - default: |
|
114 | - $this->answer = new stdClass(); |
|
115 | - $this->answer->questionJSId = $this->js_id; |
|
116 | - break; |
|
117 | - } |
|
118 | - |
|
119 | - return true; |
|
120 | - } |
|
121 | - |
|
122 | - function export() |
|
123 | - { |
|
124 | - $html = $this->getQuestionHTML(); |
|
125 | - $js = $this->getQuestionJS(); |
|
126 | - |
|
127 | - if (is_object($this->answer) && $this->answer instanceof Answer) { |
|
128 | - list($js2, $html2) = $this->answer->export(); |
|
129 | - $js .= $js2; |
|
130 | - $html .= $html2; |
|
131 | - } else { |
|
132 | - throw new \Exception('Question not supported. Exercise: '.$this->selectTitle()); |
|
133 | - } |
|
134 | - |
|
135 | - return array($js, $html); |
|
136 | - } |
|
137 | - |
|
138 | - function createAnswersForm($form) |
|
139 | - { |
|
140 | - return true; |
|
141 | - } |
|
142 | - |
|
143 | - function processAnswersCreation($form) |
|
144 | - { |
|
145 | - return true; |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Returns an HTML-formatted question |
|
150 | - */ |
|
151 | - function getQuestionHTML() |
|
152 | - { |
|
33 | + */ |
|
34 | + public static function export_question($questionId, $standalone = true, $js_id) |
|
35 | + { |
|
36 | + $question = new ScormQuestion(); |
|
37 | + $qst = $question->read($questionId); |
|
38 | + if (!$qst) { |
|
39 | + return ''; |
|
40 | + } |
|
41 | + $question->id = $qst->id; |
|
42 | + $question->js_id = $js_id; |
|
43 | + $question->type = $qst->type; |
|
44 | + $question->question = $qst->question; |
|
45 | + $question->description = $qst->description; |
|
46 | + $question->weighting=$qst->weighting; |
|
47 | + $question->position=$qst->position; |
|
48 | + $question->picture=$qst->picture; |
|
49 | + $assessmentItem = new ScormAssessmentItem($question, $standalone); |
|
50 | + |
|
51 | + return $assessmentItem->export(); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Include the correct answer class and create answer |
|
56 | + */ |
|
57 | + public function setAnswer() |
|
58 | + { |
|
59 | + switch ($this->type) { |
|
60 | + case MCUA: |
|
61 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
62 | + $this->answer->questionJSId = $this->js_id; |
|
63 | + break; |
|
64 | + case MCMA: |
|
65 | + case GLOBAL_MULTIPLE_ANSWER: |
|
66 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
67 | + $this->answer->questionJSId = $this->js_id; |
|
68 | + break; |
|
69 | + case TF: |
|
70 | + $this->answer = new ScormAnswerTrueFalse($this->id); |
|
71 | + $this->answer->questionJSId = $this->js_id; |
|
72 | + break; |
|
73 | + case FIB: |
|
74 | + $this->answer = new ScormAnswerFillInBlanks($this->id); |
|
75 | + $this->answer->questionJSId = $this->js_id; |
|
76 | + break; |
|
77 | + case MATCHING: |
|
78 | + case MATCHING_DRAGGABLE: |
|
79 | + case DRAGGABLE: |
|
80 | + $this->answer = new ScormAnswerMatching($this->id); |
|
81 | + $this->answer->questionJSId = $this->js_id; |
|
82 | + break; |
|
83 | + case ORAL_EXPRESSION: |
|
84 | + case FREE_ANSWER: |
|
85 | + $this->answer = new ScormAnswerFree($this->id); |
|
86 | + $this->answer->questionJSId = $this->js_id; |
|
87 | + break; |
|
88 | + case HOT_SPOT: |
|
89 | + $this->answer = new ScormAnswerHotspot($this->id); |
|
90 | + $this->answer->questionJSId = $this->js_id; |
|
91 | + break; |
|
92 | + case MULTIPLE_ANSWER_COMBINATION: |
|
93 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
94 | + $this->answer->questionJSId = $this->js_id; |
|
95 | + break; |
|
96 | + case HOT_SPOT_ORDER: |
|
97 | + $this->answer = new ScormAnswerHotspot($this->id); |
|
98 | + $this->answer->questionJSId = $this->js_id; |
|
99 | + break; |
|
100 | + case HOT_SPOT_DELINEATION: |
|
101 | + $this->answer = new ScormAnswerHotspot($this->id); |
|
102 | + $this->answer->questionJSId = $this->js_id; |
|
103 | + break; |
|
104 | + // not supported |
|
105 | + case UNIQUE_ANSWER_NO_OPTION: |
|
106 | + case MULTIPLE_ANSWER_TRUE_FALSE: |
|
107 | + case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
|
108 | + case UNIQUE_ANSWER_IMAGE: |
|
109 | + case CALCULATED_ANSWER: |
|
110 | + $this->answer = new ScormAnswerMultipleChoice($this->id); |
|
111 | + $this->answer->questionJSId = $this->js_id; |
|
112 | + break; |
|
113 | + default: |
|
114 | + $this->answer = new stdClass(); |
|
115 | + $this->answer->questionJSId = $this->js_id; |
|
116 | + break; |
|
117 | + } |
|
118 | + |
|
119 | + return true; |
|
120 | + } |
|
121 | + |
|
122 | + function export() |
|
123 | + { |
|
124 | + $html = $this->getQuestionHTML(); |
|
125 | + $js = $this->getQuestionJS(); |
|
126 | + |
|
127 | + if (is_object($this->answer) && $this->answer instanceof Answer) { |
|
128 | + list($js2, $html2) = $this->answer->export(); |
|
129 | + $js .= $js2; |
|
130 | + $html .= $html2; |
|
131 | + } else { |
|
132 | + throw new \Exception('Question not supported. Exercise: '.$this->selectTitle()); |
|
133 | + } |
|
134 | + |
|
135 | + return array($js, $html); |
|
136 | + } |
|
137 | + |
|
138 | + function createAnswersForm($form) |
|
139 | + { |
|
140 | + return true; |
|
141 | + } |
|
142 | + |
|
143 | + function processAnswersCreation($form) |
|
144 | + { |
|
145 | + return true; |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Returns an HTML-formatted question |
|
150 | + */ |
|
151 | + function getQuestionHTML() |
|
152 | + { |
|
153 | 153 | $title = $this->selectTitle(); |
154 | 154 | $description = $this->selectDescription(); |
155 | - $cols = 2; |
|
156 | - $s = '<tr> |
|
155 | + $cols = 2; |
|
156 | + $s = '<tr> |
|
157 | 157 | <td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;"> |
158 | 158 | '.$title.' |
159 | 159 | </td> |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | <i>'.$description.'</i> |
164 | 164 | </td> |
165 | 165 | </tr>'; |
166 | - return $s; |
|
167 | - } |
|
166 | + return $s; |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * Return the JavaScript code bound to the question |
|
171 | - */ |
|
172 | - public function getQuestionJS() |
|
173 | - { |
|
174 | - $weight = $this->selectWeighting(); |
|
175 | - $js = 'questions.push('.$this->js_id.');'."\n"; |
|
169 | + /** |
|
170 | + * Return the JavaScript code bound to the question |
|
171 | + */ |
|
172 | + public function getQuestionJS() |
|
173 | + { |
|
174 | + $weight = $this->selectWeighting(); |
|
175 | + $js = 'questions.push('.$this->js_id.');'."\n"; |
|
176 | 176 | |
177 | 177 | switch ($this->type) { |
178 | 178 | case ORAL_EXPRESSION: |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $script .= file_get_contents(api_get_path(LIBRARY_PATH) . 'wami-recorder/gui.js'); |
182 | 182 | $js .= $script;*/ |
183 | 183 | break; |
184 | - case HOT_SPOT: |
|
184 | + case HOT_SPOT: |
|
185 | 185 | //put the max score to 0 to avoid discounting the points of |
186 | 186 | //non-exported quiz types in the SCORM |
187 | 187 | $weight = 0; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | } |
190 | 190 | $js .= 'questions_score_max['.$this->js_id.'] = '.$weight.";"; |
191 | 191 | |
192 | - return $js; |
|
193 | - } |
|
192 | + return $js; |
|
193 | + } |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -200,29 +200,29 @@ discard block |
||
200 | 200 | */ |
201 | 201 | class ScormAnswerMultipleChoice extends Answer |
202 | 202 | { |
203 | - /** |
|
204 | - * Return HTML code for possible answers |
|
205 | - */ |
|
206 | - function export() |
|
207 | - { |
|
208 | - $js = ''; |
|
209 | - $html = '<tr><td colspan="2"><table width="100%">'; |
|
210 | - $type = $this->getQuestionType(); |
|
211 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'; |
|
212 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'; |
|
203 | + /** |
|
204 | + * Return HTML code for possible answers |
|
205 | + */ |
|
206 | + function export() |
|
207 | + { |
|
208 | + $js = ''; |
|
209 | + $html = '<tr><td colspan="2"><table width="100%">'; |
|
210 | + $type = $this->getQuestionType(); |
|
211 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'; |
|
212 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'; |
|
213 | 213 | |
214 | 214 | $jstmpw .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'; |
215 | 215 | |
216 | - //not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM |
|
217 | - //if ($type == MCMA || $type == MULTIPLE_ANSWER_COMBINATION ) { |
|
218 | - if ($type == MCMA) { |
|
216 | + //not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM |
|
217 | + //if ($type == MCMA || $type == MULTIPLE_ANSWER_COMBINATION ) { |
|
218 | + if ($type == MCMA) { |
|
219 | 219 | $id = 1; |
220 | - $jstmp = ''; |
|
221 | - $jstmpc = ''; |
|
220 | + $jstmp = ''; |
|
221 | + $jstmpc = ''; |
|
222 | 222 | foreach ($this->answer as $i => $answer) { |
223 | - $identifier = 'question_'.$this->questionJSId.'_multiple_'.$i; |
|
224 | - $html .= |
|
225 | - '<tr> |
|
223 | + $identifier = 'question_'.$this->questionJSId.'_multiple_'.$i; |
|
224 | + $html .= |
|
225 | + '<tr> |
|
226 | 226 | <td align="center" width="5%"> |
227 | 227 | <input name="'.$identifier.'" id="'.$identifier.'" value="'.$i.'" type="checkbox" /> |
228 | 228 | </td> |
@@ -231,19 +231,19 @@ discard block |
||
231 | 231 | </td> |
232 | 232 | </tr>'; |
233 | 233 | |
234 | - $jstmp .= $i.','; |
|
234 | + $jstmp .= $i.','; |
|
235 | 235 | if ($this->correct[$i]) { |
236 | 236 | $jstmpc .= $i.','; |
237 | 237 | } |
238 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";"; |
|
238 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";"; |
|
239 | 239 | $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].';'; |
240 | - $id++; |
|
241 | - } |
|
242 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
240 | + $id++; |
|
241 | + } |
|
242 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
243 | 243 | $js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n"; |
244 | - $js .= $jstmpw; |
|
245 | - } elseif ($type == MULTIPLE_ANSWER_COMBINATION) { |
|
246 | - $js = ''; |
|
244 | + $js .= $jstmpw; |
|
245 | + } elseif ($type == MULTIPLE_ANSWER_COMBINATION) { |
|
246 | + $js = ''; |
|
247 | 247 | $id = 1; |
248 | 248 | $jstmp = ''; |
249 | 249 | $jstmpc = ''; |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'; |
271 | 271 | $js .= 'questions_types['.$this->questionJSId.'] = "exact";'; |
272 | 272 | $js .= $jstmpw; |
273 | - } else { |
|
274 | - $id = 1; |
|
275 | - $jstmp = ''; |
|
276 | - $jstmpc = ''; |
|
273 | + } else { |
|
274 | + $id = 1; |
|
275 | + $jstmp = ''; |
|
276 | + $jstmpc = ''; |
|
277 | 277 | foreach ($this->answer as $i => $answer) { |
278 | 278 | $identifier = 'question_'.$this->questionJSId.'_unique_'.$i; |
279 | - $identifier_name = 'question_'.$this->questionJSId.'_unique_answer'; |
|
280 | - $html .= |
|
281 | - '<tr> |
|
279 | + $identifier_name = 'question_'.$this->questionJSId.'_unique_answer'; |
|
280 | + $html .= |
|
281 | + '<tr> |
|
282 | 282 | <td align="center" width="5%"> |
283 | 283 | <input name="'.$identifier_name.'" id="'.$identifier.'" value="'.$i.'" type="checkbox"/> |
284 | 284 | </td> |
@@ -286,22 +286,22 @@ discard block |
||
286 | 286 | <label for="'.$identifier.'">' . Security::remove_XSS($this->answer[$i]) . '</label> |
287 | 287 | </td> |
288 | 288 | </tr>'; |
289 | - $jstmp .= $i.','; |
|
289 | + $jstmp .= $i.','; |
|
290 | 290 | if ($this->correct[$i]) { |
291 | 291 | $jstmpc .= $i; |
292 | 292 | } |
293 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";"; |
|
293 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$this->weighting[$i].";"; |
|
294 | 294 | $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].';'; |
295 | - $id++; |
|
296 | - } |
|
297 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'; |
|
298 | - $js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';'; |
|
299 | - $js .= $jstmpw; |
|
300 | - } |
|
301 | - $html .= '</table></td></tr>'; |
|
302 | - |
|
303 | - return array($js, $html); |
|
304 | - } |
|
295 | + $id++; |
|
296 | + } |
|
297 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'; |
|
298 | + $js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';'; |
|
299 | + $js .= $jstmpw; |
|
300 | + } |
|
301 | + $html .= '</table></td></tr>'; |
|
302 | + |
|
303 | + return array($js, $html); |
|
304 | + } |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -310,21 +310,21 @@ discard block |
||
310 | 310 | */ |
311 | 311 | class ScormAnswerTrueFalse extends Answer |
312 | 312 | { |
313 | - /** |
|
314 | - * Return the XML flow for the possible answers. |
|
315 | - * That's one <response_lid>, containing several <flow_label> |
|
316 | - * |
|
317 | - * @author Amand Tihon <[email protected]> |
|
318 | - */ |
|
319 | - function export() |
|
320 | - { |
|
321 | - $js = ''; |
|
322 | - $html = '<tr><td colspan="2"><table width="100%">'; |
|
323 | - $identifier = 'question_'.$this->questionJSId.'_tf'; |
|
324 | - $identifier_true = $identifier.'_true'; |
|
325 | - $identifier_false = $identifier.'_false'; |
|
326 | - $html .= |
|
327 | - '<tr> |
|
313 | + /** |
|
314 | + * Return the XML flow for the possible answers. |
|
315 | + * That's one <response_lid>, containing several <flow_label> |
|
316 | + * |
|
317 | + * @author Amand Tihon <[email protected]> |
|
318 | + */ |
|
319 | + function export() |
|
320 | + { |
|
321 | + $js = ''; |
|
322 | + $html = '<tr><td colspan="2"><table width="100%">'; |
|
323 | + $identifier = 'question_'.$this->questionJSId.'_tf'; |
|
324 | + $identifier_true = $identifier.'_true'; |
|
325 | + $identifier_false = $identifier.'_false'; |
|
326 | + $html .= |
|
327 | + '<tr> |
|
328 | 328 | <td align="center" width="5%"> |
329 | 329 | <input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" /> |
330 | 330 | </td> |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | <label for="'.$identifier_true.'">' . get_lang('True') . '</label> |
333 | 333 | </td> |
334 | 334 | </tr>'; |
335 | - $html .= |
|
336 | - '<tr> |
|
335 | + $html .= |
|
336 | + '<tr> |
|
337 | 337 | <td align="center" width="5%"> |
338 | 338 | <input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" /> |
339 | 339 | </td> |
@@ -341,20 +341,20 @@ discard block |
||
341 | 341 | <label for="'.$identifier_false.'">' . get_lang('False') . '</label> |
342 | 342 | </td> |
343 | 343 | </tr></table></td></tr>'; |
344 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n"; |
|
345 | - $js .= 'questions_types['.$this->questionJSId.'] = \'tf\';'."\n"; |
|
346 | - if ($this->response === 'TRUE') { |
|
347 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n"; |
|
348 | - } else { |
|
349 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n"; |
|
350 | - } |
|
351 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
352 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
353 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = '.$this->weighting[1].";\n"; |
|
354 | - $js .= $jstmpw; |
|
355 | - |
|
356 | - return array($js, $html); |
|
357 | - } |
|
344 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n"; |
|
345 | + $js .= 'questions_types['.$this->questionJSId.'] = \'tf\';'."\n"; |
|
346 | + if ($this->response === 'TRUE') { |
|
347 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n"; |
|
348 | + } else { |
|
349 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n"; |
|
350 | + } |
|
351 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
352 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
353 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = '.$this->weighting[1].";\n"; |
|
354 | + $js .= $jstmpw; |
|
355 | + |
|
356 | + return array($js, $html); |
|
357 | + } |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -363,76 +363,76 @@ discard block |
||
363 | 363 | */ |
364 | 364 | class ScormAnswerFillInBlanks extends Answer |
365 | 365 | { |
366 | - /** |
|
367 | - * Export the text with missing words. |
|
368 | - * |
|
369 | - * As a side effect, it stores two lists in the class : |
|
370 | - * the missing words and their respective weightings. |
|
371 | - */ |
|
372 | - function export() |
|
373 | - { |
|
374 | - global $charset; |
|
375 | - $js = ''; |
|
376 | - $html = '<tr><td colspan="2"><table width="100%">'; |
|
377 | - // get all enclosed answers |
|
378 | - $blankList = array(); |
|
379 | - // build replacement |
|
380 | - $replacementList = array(); |
|
381 | - foreach ($this->answer as $i => $answer) { |
|
382 | - $blankList[] = '['.$answer.']'; |
|
383 | - } |
|
384 | - |
|
385 | - // splits text and weightings that are joined with the character '::' |
|
386 | - list($answer,$weight)=explode('::',$answer); |
|
387 | - $weights = explode(',',$weight); |
|
388 | - // because [] is parsed here we follow this procedure: |
|
389 | - // 1. find everything between the [ and ] tags |
|
390 | - $i=1; |
|
391 | - $jstmp = ''; |
|
392 | - $jstmpc = ''; |
|
393 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
394 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
395 | - $startlocations=api_strpos($answer,'['); |
|
396 | - $endlocations=api_strpos($answer,']'); |
|
397 | - while ($startlocations !== false && $endlocations !== false) { |
|
398 | - $texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1); |
|
399 | - $answer = api_substr_replace( |
|
366 | + /** |
|
367 | + * Export the text with missing words. |
|
368 | + * |
|
369 | + * As a side effect, it stores two lists in the class : |
|
370 | + * the missing words and their respective weightings. |
|
371 | + */ |
|
372 | + function export() |
|
373 | + { |
|
374 | + global $charset; |
|
375 | + $js = ''; |
|
376 | + $html = '<tr><td colspan="2"><table width="100%">'; |
|
377 | + // get all enclosed answers |
|
378 | + $blankList = array(); |
|
379 | + // build replacement |
|
380 | + $replacementList = array(); |
|
381 | + foreach ($this->answer as $i => $answer) { |
|
382 | + $blankList[] = '['.$answer.']'; |
|
383 | + } |
|
384 | + |
|
385 | + // splits text and weightings that are joined with the character '::' |
|
386 | + list($answer,$weight)=explode('::',$answer); |
|
387 | + $weights = explode(',',$weight); |
|
388 | + // because [] is parsed here we follow this procedure: |
|
389 | + // 1. find everything between the [ and ] tags |
|
390 | + $i=1; |
|
391 | + $jstmp = ''; |
|
392 | + $jstmpc = ''; |
|
393 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
394 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
395 | + $startlocations=api_strpos($answer,'['); |
|
396 | + $endlocations=api_strpos($answer,']'); |
|
397 | + while ($startlocations !== false && $endlocations !== false) { |
|
398 | + $texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1); |
|
399 | + $answer = api_substr_replace( |
|
400 | 400 | $answer, |
401 | 401 | '<input type="text" name="question_'.$this->questionJSId.'_fib_'.$i.'" id="question_'.$this->questionJSId.'_fib_'.$i.'" size="10" value="" />', |
402 | 402 | $startlocations, |
403 | 403 | ($endlocations-$startlocations)+1 |
404 | 404 | ); |
405 | 405 | $jstmp .= $i.','; |
406 | - if (!empty($texstring)) { |
|
407 | - $sub = api_substr($texstring, 1, -1); |
|
408 | - if (!empty($sub)) { |
|
409 | - $jstmpc .= "'" . api_htmlentities($sub, ENT_QUOTES, $charset) . "',"; |
|
410 | - } |
|
411 | - } |
|
406 | + if (!empty($texstring)) { |
|
407 | + $sub = api_substr($texstring, 1, -1); |
|
408 | + if (!empty($sub)) { |
|
409 | + $jstmpc .= "'" . api_htmlentities($sub, ENT_QUOTES, $charset) . "',"; |
|
410 | + } |
|
411 | + } |
|
412 | 412 | $my_weight = explode('@', $weights[$i - 1]); |
413 | 413 | if (count($my_weight) == 2) { |
414 | 414 | $weight_db = $my_weight[0]; |
415 | 415 | } else { |
416 | 416 | $weight_db = $my_weight[0]; |
417 | 417 | } |
418 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$weight_db.";\n"; |
|
419 | - $i++; |
|
420 | - $startlocations = api_strpos($answer, '['); |
|
421 | - $endlocations = api_strpos($answer, ']'); |
|
422 | - } |
|
418 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.']['.$i.'] = '.$weight_db.";\n"; |
|
419 | + $i++; |
|
420 | + $startlocations = api_strpos($answer, '['); |
|
421 | + $endlocations = api_strpos($answer, ']'); |
|
422 | + } |
|
423 | 423 | |
424 | - $html .= '<tr> |
|
424 | + $html .= '<tr> |
|
425 | 425 | <td> |
426 | 426 | '.$answer.' |
427 | 427 | </td> |
428 | 428 | </tr></table></td></tr>'; |
429 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n"; |
|
430 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n"; |
|
431 | - $js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n"; |
|
432 | - $js .= $jstmpw; |
|
429 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n"; |
|
430 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n"; |
|
431 | + $js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n"; |
|
432 | + $js .= $jstmpw; |
|
433 | 433 | |
434 | - return array($js,$html); |
|
435 | - } |
|
434 | + return array($js,$html); |
|
435 | + } |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -441,65 +441,65 @@ discard block |
||
441 | 441 | */ |
442 | 442 | class ScormAnswerMatching extends Answer |
443 | 443 | { |
444 | - /** |
|
445 | - * Export the question part as a matrix-choice, with only one possible answer per line. |
|
446 | - * @author Amand Tihon <[email protected]> |
|
447 | - */ |
|
448 | - function export() |
|
449 | - { |
|
450 | - $js = ''; |
|
451 | - $html = '<tr><td colspan="2"><table width="100%">'; |
|
452 | - // prepare list of right proposition to allow |
|
453 | - // - easiest display |
|
454 | - // - easiest randomisation if needed one day |
|
455 | - // (here I use array_values to change array keys from $code1 $code2 ... to 0 1 ...) |
|
456 | - |
|
457 | - // get max length of displayed array |
|
458 | - |
|
459 | - $nbrAnswers = $this->selectNbrAnswers(); |
|
460 | - $cpt1='A'; |
|
461 | - $cpt2=1; |
|
462 | - $Select = array(); |
|
463 | - $qId = $this->questionJSId; |
|
464 | - $s = ''; |
|
465 | - $jstmp = ''; |
|
466 | - $jstmpc = ''; |
|
467 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
468 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
469 | - |
|
470 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
471 | - $identifier = 'question_'.$qId.'_matching_'; |
|
472 | - $answer=$this->selectAnswer($answerId); |
|
473 | - $answerCorrect=$this->isCorrect($answerId); |
|
474 | - $weight=$this->selectWeighting($answerId); |
|
475 | - $jstmp .= $answerId.','; |
|
476 | - |
|
477 | - if (!$answerCorrect) { |
|
478 | - // options (A, B, C, ...) that will be put into the list-box |
|
479 | - $Select[$answerId]['Lettre']=$cpt1; |
|
480 | - // answers that will be shown at the right side |
|
481 | - $Select[$answerId]['Reponse'] = $answer; |
|
482 | - $cpt1++; |
|
483 | - } else { |
|
484 | - $s.='<tr>'; |
|
485 | - $s.='<td width="40%" valign="top"><b>'.$cpt2.'</b>. '.$answer."</td>"; |
|
486 | - $s.='<td width="20%" align="center"> <select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">'; |
|
487 | - $s.=' <option value="0">--</option>'; |
|
488 | - // fills the list-box |
|
444 | + /** |
|
445 | + * Export the question part as a matrix-choice, with only one possible answer per line. |
|
446 | + * @author Amand Tihon <[email protected]> |
|
447 | + */ |
|
448 | + function export() |
|
449 | + { |
|
450 | + $js = ''; |
|
451 | + $html = '<tr><td colspan="2"><table width="100%">'; |
|
452 | + // prepare list of right proposition to allow |
|
453 | + // - easiest display |
|
454 | + // - easiest randomisation if needed one day |
|
455 | + // (here I use array_values to change array keys from $code1 $code2 ... to 0 1 ...) |
|
456 | + |
|
457 | + // get max length of displayed array |
|
458 | + |
|
459 | + $nbrAnswers = $this->selectNbrAnswers(); |
|
460 | + $cpt1='A'; |
|
461 | + $cpt2=1; |
|
462 | + $Select = array(); |
|
463 | + $qId = $this->questionJSId; |
|
464 | + $s = ''; |
|
465 | + $jstmp = ''; |
|
466 | + $jstmpc = ''; |
|
467 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
468 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
469 | + |
|
470 | + for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
471 | + $identifier = 'question_'.$qId.'_matching_'; |
|
472 | + $answer=$this->selectAnswer($answerId); |
|
473 | + $answerCorrect=$this->isCorrect($answerId); |
|
474 | + $weight=$this->selectWeighting($answerId); |
|
475 | + $jstmp .= $answerId.','; |
|
476 | + |
|
477 | + if (!$answerCorrect) { |
|
478 | + // options (A, B, C, ...) that will be put into the list-box |
|
479 | + $Select[$answerId]['Lettre']=$cpt1; |
|
480 | + // answers that will be shown at the right side |
|
481 | + $Select[$answerId]['Reponse'] = $answer; |
|
482 | + $cpt1++; |
|
483 | + } else { |
|
484 | + $s.='<tr>'; |
|
485 | + $s.='<td width="40%" valign="top"><b>'.$cpt2.'</b>. '.$answer."</td>"; |
|
486 | + $s.='<td width="20%" align="center"> <select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">'; |
|
487 | + $s.=' <option value="0">--</option>'; |
|
488 | + // fills the list-box |
|
489 | 489 | foreach ($Select as $key => $val) { |
490 | 490 | $s .= '<option value="'.$key.'">'.$val['Lettre'].'</option>'; |
491 | 491 | } // end foreach() |
492 | 492 | |
493 | - $s.='</select> </td>'; |
|
494 | - $s.='<td width="40%" valign="top">'; |
|
493 | + $s.='</select> </td>'; |
|
494 | + $s.='<td width="40%" valign="top">'; |
|
495 | 495 | if (isset($Select[$cpt2])) { |
496 | 496 | $s .= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
497 | 497 | } else { |
498 | 498 | $s .= ' '; |
499 | 499 | } |
500 | - $s.="</td></tr>"; |
|
500 | + $s.="</td></tr>"; |
|
501 | 501 | |
502 | - $jstmpc .= '['.$answerCorrect.','.$cpt2.'],'; |
|
502 | + $jstmpc .= '['.$answerCorrect.','.$cpt2.'],'; |
|
503 | 503 | |
504 | 504 | $my_weight = explode('@', $weight); |
505 | 505 | if (count($my_weight) == 2) { |
@@ -507,32 +507,32 @@ discard block |
||
507 | 507 | } else { |
508 | 508 | $weight = $my_weight[0]; |
509 | 509 | } |
510 | - $jstmpw .= 'questions_answers_ponderation['.$qId.']['.$cpt2.'] = '.$weight.";\n"; |
|
511 | - $cpt2++; |
|
512 | - |
|
513 | - // if the left side of the "matching" has been completely shown |
|
514 | - if ($answerId == $nbrAnswers) { |
|
515 | - // if there remain answers to be shown on the right side |
|
516 | - while (isset($Select[$cpt2])) { |
|
517 | - $s.= '<tr>'; |
|
518 | - $s.= '<td width="60%" colspan="2"> </td>'; |
|
519 | - $s.= '<td width="40%" valign="top">'; |
|
520 | - $s.= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
521 | - $s.= "</td></tr>"; |
|
522 | - $cpt2++; |
|
523 | - } // end while() |
|
524 | - } // end if() |
|
525 | - } |
|
526 | - } |
|
527 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
528 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n"; |
|
529 | - $js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n"; |
|
530 | - $js .= $jstmpw; |
|
531 | - $html .= $s; |
|
532 | - $html .= '</table></td></tr>' . "\n"; |
|
533 | - |
|
534 | - return array($js, $html); |
|
535 | - } |
|
510 | + $jstmpw .= 'questions_answers_ponderation['.$qId.']['.$cpt2.'] = '.$weight.";\n"; |
|
511 | + $cpt2++; |
|
512 | + |
|
513 | + // if the left side of the "matching" has been completely shown |
|
514 | + if ($answerId == $nbrAnswers) { |
|
515 | + // if there remain answers to be shown on the right side |
|
516 | + while (isset($Select[$cpt2])) { |
|
517 | + $s.= '<tr>'; |
|
518 | + $s.= '<td width="60%" colspan="2"> </td>'; |
|
519 | + $s.= '<td width="40%" valign="top">'; |
|
520 | + $s.= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
521 | + $s.= "</td></tr>"; |
|
522 | + $cpt2++; |
|
523 | + } // end while() |
|
524 | + } // end if() |
|
525 | + } |
|
526 | + } |
|
527 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n"; |
|
528 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n"; |
|
529 | + $js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n"; |
|
530 | + $js .= $jstmpw; |
|
531 | + $html .= $s; |
|
532 | + $html .= '</table></td></tr>' . "\n"; |
|
533 | + |
|
534 | + return array($js, $html); |
|
535 | + } |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | /** |
@@ -541,19 +541,19 @@ discard block |
||
541 | 541 | */ |
542 | 542 | class ScormAnswerFree extends Answer |
543 | 543 | { |
544 | - /** |
|
545 | - * Export the text with missing words. |
|
546 | - * |
|
547 | - * As a side effect, it stores two lists in the class : |
|
548 | - * the missing words and their respective weightings. |
|
549 | - * |
|
550 | - */ |
|
551 | - function export() |
|
552 | - { |
|
553 | - $js = ''; |
|
544 | + /** |
|
545 | + * Export the text with missing words. |
|
546 | + * |
|
547 | + * As a side effect, it stores two lists in the class : |
|
548 | + * the missing words and their respective weightings. |
|
549 | + * |
|
550 | + */ |
|
551 | + function export() |
|
552 | + { |
|
553 | + $js = ''; |
|
554 | 554 | $identifier = 'question_'.$this->questionJSId.'_free'; |
555 | - // currently the free answers cannot be displayed, so ignore the textarea |
|
556 | - $html = '<tr><td colspan="2">'; |
|
555 | + // currently the free answers cannot be displayed, so ignore the textarea |
|
556 | + $html = '<tr><td colspan="2">'; |
|
557 | 557 | $type = $this->getQuestionType(); |
558 | 558 | |
559 | 559 | if ($type == ORAL_EXPRESSION) { |
@@ -565,21 +565,21 @@ discard block |
||
565 | 565 | $layout = $template->get_template('document/record_audio.tpl'); |
566 | 566 | $html .= $template->fetch($layout);*/ |
567 | 567 | |
568 | - $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
568 | + $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
569 | 569 | |
570 | 570 | return array($js, $html); |
571 | 571 | } |
572 | 572 | |
573 | 573 | $html .= '<textarea minlength="20" name="'.$identifier.'" id="'.$identifier.'" ></textarea>'; |
574 | 574 | $html .= '</td></tr>'; |
575 | - $js .= 'questions_answers['.$this->questionJSId.'] = new Array();'; |
|
576 | - $js .= 'questions_answers_correct['.$this->questionJSId.'] = "";'; |
|
577 | - $js .= 'questions_types['.$this->questionJSId.'] = \'free\';'; |
|
578 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = "0";'; |
|
579 | - $js .= $jstmpw; |
|
580 | - |
|
581 | - return array($js, $html); |
|
582 | - } |
|
575 | + $js .= 'questions_answers['.$this->questionJSId.'] = new Array();'; |
|
576 | + $js .= 'questions_answers_correct['.$this->questionJSId.'] = "";'; |
|
577 | + $js .= 'questions_types['.$this->questionJSId.'] = \'free\';'; |
|
578 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = "0";'; |
|
579 | + $js .= $jstmpw; |
|
580 | + |
|
581 | + return array($js, $html); |
|
582 | + } |
|
583 | 583 | } |
584 | 584 | /** |
585 | 585 | * This class handles the SCORM export of hotpot questions |
@@ -587,63 +587,63 @@ discard block |
||
587 | 587 | */ |
588 | 588 | class ScormAnswerHotspot extends Answer |
589 | 589 | { |
590 | - /** |
|
591 | - * Returns the javascript code that goes with HotSpot exercises |
|
592 | - * @return string The JavaScript code |
|
593 | - */ |
|
594 | - function get_js_header() |
|
595 | - { |
|
596 | - if ($this->standalone) { |
|
597 | - $header = '<script>'; |
|
598 | - $header .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
599 | - $header .= '</script>'; |
|
600 | - //because this header closes so many times the <script> tag, we have to reopen our own |
|
601 | - $header .= '<script>'; |
|
602 | - $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
603 | - $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
604 | - $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
605 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
606 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
607 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
608 | - $header .= $jstmpw; |
|
609 | - } else { |
|
610 | - $header = ''; |
|
611 | - $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
612 | - $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
613 | - $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
614 | - $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
615 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
616 | - $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'."\n"; |
|
617 | - $header .= $jstmpw; |
|
618 | - } |
|
619 | - |
|
620 | - return $header; |
|
621 | - } |
|
622 | - /** |
|
623 | - * Export the text with missing words. |
|
624 | - * |
|
625 | - * As a side effect, it stores two lists in the class : |
|
626 | - * the missing words and their respective weightings. |
|
627 | - * |
|
628 | - */ |
|
629 | - function export() |
|
630 | - { |
|
631 | - $js = $this->get_js_header(); |
|
632 | - $html = '<tr><td colspan="2"><table width="100%">'; |
|
633 | - // some javascript must be added for that kind of questions |
|
634 | - $html .= ''; |
|
635 | - |
|
636 | - // Get the answers, make a list |
|
637 | - $nbrAnswers=$this->selectNbrAnswers(); |
|
638 | - |
|
639 | - $answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>'; |
|
590 | + /** |
|
591 | + * Returns the javascript code that goes with HotSpot exercises |
|
592 | + * @return string The JavaScript code |
|
593 | + */ |
|
594 | + function get_js_header() |
|
595 | + { |
|
596 | + if ($this->standalone) { |
|
597 | + $header = '<script>'; |
|
598 | + $header .= file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
599 | + $header .= '</script>'; |
|
600 | + //because this header closes so many times the <script> tag, we have to reopen our own |
|
601 | + $header .= '<script>'; |
|
602 | + $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
603 | + $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
604 | + $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
605 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
606 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
607 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
|
608 | + $header .= $jstmpw; |
|
609 | + } else { |
|
610 | + $header = ''; |
|
611 | + $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
|
612 | + $header .= 'questions_answers_correct['.$this->questionJSId.'] = new Array();'."\n"; |
|
613 | + $header .= 'questions_types['.$this->questionJSId.'] = \'hotspot\';'."\n"; |
|
614 | + $jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n"; |
|
615 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
|
616 | + $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'."\n"; |
|
617 | + $header .= $jstmpw; |
|
618 | + } |
|
619 | + |
|
620 | + return $header; |
|
621 | + } |
|
622 | + /** |
|
623 | + * Export the text with missing words. |
|
624 | + * |
|
625 | + * As a side effect, it stores two lists in the class : |
|
626 | + * the missing words and their respective weightings. |
|
627 | + * |
|
628 | + */ |
|
629 | + function export() |
|
630 | + { |
|
631 | + $js = $this->get_js_header(); |
|
632 | + $html = '<tr><td colspan="2"><table width="100%">'; |
|
633 | + // some javascript must be added for that kind of questions |
|
634 | + $html .= ''; |
|
635 | + |
|
636 | + // Get the answers, make a list |
|
637 | + $nbrAnswers=$this->selectNbrAnswers(); |
|
638 | + |
|
639 | + $answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>'; |
|
640 | 640 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
641 | 641 | $answer_list .= '<li>'.$this->selectAnswer($answerId).'</li>'; |
642 | 642 | } |
643 | 643 | $answer_list .= '</ol></div>'; |
644 | - $canClick = true; |
|
645 | - $relPath = api_get_path(REL_PATH); |
|
646 | - $html .= <<<HTML |
|
644 | + $canClick = true; |
|
645 | + $relPath = api_get_path(REL_PATH); |
|
646 | + $html .= <<<HTML |
|
647 | 647 | <tr> |
648 | 648 | <td> |
649 | 649 | <div id="hotspot-{$this->questionJSId}"></div> |
@@ -663,13 +663,13 @@ discard block |
||
663 | 663 | </td> |
664 | 664 | <tr> |
665 | 665 | HTML; |
666 | - $html .= '</table></td></tr>'; |
|
666 | + $html .= '</table></td></tr>'; |
|
667 | 667 | |
668 | - // currently the free answers cannot be displayed, so ignore the textarea |
|
669 | - $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
668 | + // currently the free answers cannot be displayed, so ignore the textarea |
|
669 | + $html = '<tr><td colspan="2">'.get_lang('ThisItemIsNotExportable').'</td></tr>'; |
|
670 | 670 | |
671 | - return array($js, $html); |
|
672 | - } |
|
671 | + return array($js, $html); |
|
672 | + } |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | /** |
@@ -684,32 +684,32 @@ discard block |
||
684 | 684 | */ |
685 | 685 | class ScormAssessmentItem |
686 | 686 | { |
687 | - public $question; |
|
688 | - public $question_ident; |
|
689 | - public $answer; |
|
690 | - public $standalone; |
|
691 | - |
|
692 | - /** |
|
693 | - * Constructor. |
|
694 | - * |
|
695 | - * @param ScormQuestion $question The Question object we want to export. |
|
696 | - */ |
|
697 | - public function __construct($question, $standalone = false) |
|
698 | - { |
|
699 | - $this->question = $question; |
|
700 | - $this->question->setAnswer(); |
|
701 | - $this->questionIdent = "QST_" . $question->id ; |
|
702 | - $this->standalone = $standalone; |
|
703 | - } |
|
704 | - |
|
705 | - /** |
|
706 | - * Start the XML flow. |
|
707 | - * |
|
708 | - * This opens the <item> block, with correct attributes. |
|
709 | - * |
|
710 | - */ |
|
711 | - function start_page() |
|
712 | - { |
|
687 | + public $question; |
|
688 | + public $question_ident; |
|
689 | + public $answer; |
|
690 | + public $standalone; |
|
691 | + |
|
692 | + /** |
|
693 | + * Constructor. |
|
694 | + * |
|
695 | + * @param ScormQuestion $question The Question object we want to export. |
|
696 | + */ |
|
697 | + public function __construct($question, $standalone = false) |
|
698 | + { |
|
699 | + $this->question = $question; |
|
700 | + $this->question->setAnswer(); |
|
701 | + $this->questionIdent = "QST_" . $question->id ; |
|
702 | + $this->standalone = $standalone; |
|
703 | + } |
|
704 | + |
|
705 | + /** |
|
706 | + * Start the XML flow. |
|
707 | + * |
|
708 | + * This opens the <item> block, with correct attributes. |
|
709 | + * |
|
710 | + */ |
|
711 | + function start_page() |
|
712 | + { |
|
713 | 713 | $head = ''; |
714 | 714 | if ($this->standalone) { |
715 | 715 | $charset = 'UTF-8'; |
@@ -717,89 +717,89 @@ discard block |
||
717 | 717 | $head .= '<html>'; |
718 | 718 | } |
719 | 719 | |
720 | - return $head; |
|
721 | - } |
|
720 | + return $head; |
|
721 | + } |
|
722 | 722 | |
723 | - /** |
|
724 | - * End the XML flow, closing the </item> tag. |
|
725 | - * |
|
726 | - */ |
|
727 | - function end_page() |
|
723 | + /** |
|
724 | + * End the XML flow, closing the </item> tag. |
|
725 | + * |
|
726 | + */ |
|
727 | + function end_page() |
|
728 | + { |
|
729 | + if ($this->standalone) { |
|
730 | + return '</html>'; |
|
731 | + } |
|
732 | + |
|
733 | + return ''; |
|
734 | + } |
|
735 | + |
|
736 | + /** |
|
737 | + * Start document header |
|
738 | + */ |
|
739 | + function start_header() |
|
740 | + { |
|
741 | + if ($this->standalone) { |
|
742 | + return '<head>'; |
|
743 | + } |
|
744 | + |
|
745 | + return ''; |
|
746 | + } |
|
747 | + |
|
748 | + /** |
|
749 | + * Print CSS inclusion |
|
750 | + */ |
|
751 | + function css() |
|
752 | + { |
|
753 | + $css = ''; |
|
754 | + if ($this->standalone) { |
|
755 | + $css = '<style type="text/css" media="screen, projection">'; |
|
756 | + $css .= '/*<![CDATA[*/'."\n"; |
|
757 | + $css .= '/*]]>*/'."\n"; |
|
758 | + $css .= '</style>'."\n"; |
|
759 | + $css .= '<style type="text/css" media="print">'; |
|
760 | + $css .= '/*<![CDATA[*/'."\n"; |
|
761 | + $css .= '/*]]>*/'."\n"; |
|
762 | + $css .= '</style>'; |
|
763 | + } |
|
764 | + |
|
765 | + return $css; |
|
766 | + } |
|
767 | + |
|
768 | + /** |
|
769 | + * End document header |
|
770 | + */ |
|
771 | + function end_header() |
|
772 | + { |
|
773 | + if ($this->standalone) { |
|
774 | + return '</head>'; |
|
775 | + } |
|
776 | + |
|
777 | + return ''; |
|
778 | + } |
|
779 | + /** |
|
780 | + * Start the itemBody |
|
781 | + * |
|
782 | + */ |
|
783 | + function start_js() |
|
728 | 784 | { |
729 | - if ($this->standalone) { |
|
730 | - return '</html>'; |
|
731 | - } |
|
732 | - |
|
733 | - return ''; |
|
734 | - } |
|
735 | - |
|
736 | - /** |
|
737 | - * Start document header |
|
738 | - */ |
|
739 | - function start_header() |
|
740 | - { |
|
741 | - if ($this->standalone) { |
|
742 | - return '<head>'; |
|
743 | - } |
|
744 | - |
|
745 | - return ''; |
|
746 | - } |
|
747 | - |
|
748 | - /** |
|
749 | - * Print CSS inclusion |
|
750 | - */ |
|
751 | - function css() |
|
752 | - { |
|
753 | - $css = ''; |
|
754 | - if ($this->standalone) { |
|
755 | - $css = '<style type="text/css" media="screen, projection">'; |
|
756 | - $css .= '/*<![CDATA[*/'."\n"; |
|
757 | - $css .= '/*]]>*/'."\n"; |
|
758 | - $css .= '</style>'."\n"; |
|
759 | - $css .= '<style type="text/css" media="print">'; |
|
760 | - $css .= '/*<![CDATA[*/'."\n"; |
|
761 | - $css .= '/*]]>*/'."\n"; |
|
762 | - $css .= '</style>'; |
|
763 | - } |
|
764 | - |
|
765 | - return $css; |
|
766 | - } |
|
767 | - |
|
768 | - /** |
|
769 | - * End document header |
|
770 | - */ |
|
771 | - function end_header() |
|
772 | - { |
|
773 | - if ($this->standalone) { |
|
774 | - return '</head>'; |
|
775 | - } |
|
776 | - |
|
777 | - return ''; |
|
778 | - } |
|
779 | - /** |
|
780 | - * Start the itemBody |
|
781 | - * |
|
782 | - */ |
|
783 | - function start_js() |
|
784 | - { |
|
785 | 785 | $js = '<script type="text/javascript" src="assets/api_wrapper.js"></script>'; |
786 | - if ($this->standalone) { |
|
787 | - return '<script>'; |
|
788 | - } |
|
789 | - return $js; |
|
790 | - } |
|
791 | - |
|
792 | - /** |
|
793 | - * Common JS functions |
|
794 | - */ |
|
795 | - function common_js() |
|
796 | - { |
|
797 | - $js = 'var questions = new Array();'; |
|
798 | - $js .= 'var questions_answers = new Array();'; |
|
799 | - $js .= 'var questions_answers_correct = new Array();'; |
|
800 | - $js .= 'var questions_types = new Array();'; |
|
801 | - $js .= "\n" . |
|
802 | - '/** |
|
786 | + if ($this->standalone) { |
|
787 | + return '<script>'; |
|
788 | + } |
|
789 | + return $js; |
|
790 | + } |
|
791 | + |
|
792 | + /** |
|
793 | + * Common JS functions |
|
794 | + */ |
|
795 | + function common_js() |
|
796 | + { |
|
797 | + $js = 'var questions = new Array();'; |
|
798 | + $js .= 'var questions_answers = new Array();'; |
|
799 | + $js .= 'var questions_answers_correct = new Array();'; |
|
800 | + $js .= 'var questions_types = new Array();'; |
|
801 | + $js .= "\n" . |
|
802 | + '/** |
|
803 | 803 | * Assigns any event handler to any element |
804 | 804 | * @param object Element on which the event is added |
805 | 805 | * @param string Name of event |
@@ -834,79 +834,79 @@ discard block |
||
834 | 834 | addEvent(window,\'unload\',unloadPage,false); |
835 | 835 | }'."\n\n"; |
836 | 836 | |
837 | - $js .= ''; |
|
838 | - $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
837 | + $js .= ''; |
|
838 | + $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
839 | 839 | if ($this->standalone) { |
840 | 840 | return $js."\n"; |
841 | 841 | } |
842 | - return ''; |
|
843 | - } |
|
844 | - |
|
845 | - /** |
|
846 | - * End the itemBody part. |
|
847 | - * |
|
848 | - */ |
|
849 | - function end_js() |
|
850 | - { |
|
842 | + return ''; |
|
843 | + } |
|
844 | + |
|
845 | + /** |
|
846 | + * End the itemBody part. |
|
847 | + * |
|
848 | + */ |
|
849 | + function end_js() |
|
850 | + { |
|
851 | 851 | if ($this->standalone) { |
852 | 852 | return '</script>'; |
853 | 853 | } |
854 | 854 | |
855 | 855 | return ''; |
856 | - } |
|
857 | - |
|
858 | - /** |
|
859 | - * Start the itemBody |
|
860 | - * |
|
861 | - */ |
|
862 | - function start_body() |
|
863 | - { |
|
864 | - if ($this->standalone) { |
|
865 | - return '<body><form id="dokeos_scorm_form" method="post" action="">'; |
|
866 | - } |
|
867 | - |
|
868 | - return ''; |
|
869 | - } |
|
870 | - |
|
871 | - /** |
|
872 | - * End the itemBody part. |
|
873 | - * |
|
874 | - */ |
|
875 | - function end_body() |
|
876 | - { |
|
877 | - if ($this->standalone) { |
|
878 | - return '<br /><input class="btn" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>'; |
|
879 | - } |
|
880 | - |
|
881 | - return ''; |
|
882 | - } |
|
883 | - |
|
884 | - /** |
|
885 | - * Export the question as a SCORM Item. |
|
886 | - * This is a default behaviour, some classes may want to override this. |
|
887 | - * @return string|array A string, the XML flow for an Item. |
|
888 | - */ |
|
889 | - function export() |
|
890 | - { |
|
891 | - list($js, $html) = $this->question->export(); |
|
892 | - if ($this->standalone) { |
|
893 | - $res = $this->start_page() |
|
894 | - . $this->start_header() |
|
895 | - . $this->css() |
|
896 | - . $this->start_js() |
|
897 | - . $this->common_js() |
|
898 | - . $js |
|
899 | - . $this->end_js() |
|
900 | - . $this->end_header() |
|
901 | - . $this->start_body() |
|
856 | + } |
|
857 | + |
|
858 | + /** |
|
859 | + * Start the itemBody |
|
860 | + * |
|
861 | + */ |
|
862 | + function start_body() |
|
863 | + { |
|
864 | + if ($this->standalone) { |
|
865 | + return '<body><form id="dokeos_scorm_form" method="post" action="">'; |
|
866 | + } |
|
867 | + |
|
868 | + return ''; |
|
869 | + } |
|
870 | + |
|
871 | + /** |
|
872 | + * End the itemBody part. |
|
873 | + * |
|
874 | + */ |
|
875 | + function end_body() |
|
876 | + { |
|
877 | + if ($this->standalone) { |
|
878 | + return '<br /><input class="btn" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>'; |
|
879 | + } |
|
880 | + |
|
881 | + return ''; |
|
882 | + } |
|
883 | + |
|
884 | + /** |
|
885 | + * Export the question as a SCORM Item. |
|
886 | + * This is a default behaviour, some classes may want to override this. |
|
887 | + * @return string|array A string, the XML flow for an Item. |
|
888 | + */ |
|
889 | + function export() |
|
890 | + { |
|
891 | + list($js, $html) = $this->question->export(); |
|
892 | + if ($this->standalone) { |
|
893 | + $res = $this->start_page() |
|
894 | + . $this->start_header() |
|
895 | + . $this->css() |
|
896 | + . $this->start_js() |
|
897 | + . $this->common_js() |
|
898 | + . $js |
|
899 | + . $this->end_js() |
|
900 | + . $this->end_header() |
|
901 | + . $this->start_body() |
|
902 | 902 | . $html |
903 | - . $this->end_body() |
|
904 | - . $this->end_page(); |
|
905 | - return $res; |
|
906 | - } else { |
|
907 | - return array($js, $html); |
|
908 | - } |
|
909 | - } |
|
903 | + . $this->end_body() |
|
904 | + . $this->end_page(); |
|
905 | + return $res; |
|
906 | + } else { |
|
907 | + return array($js, $html); |
|
908 | + } |
|
909 | + } |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | /** |
@@ -923,103 +923,103 @@ discard block |
||
923 | 923 | */ |
924 | 924 | class ScormSection |
925 | 925 | { |
926 | - public $exercise; |
|
927 | - public $standalone; |
|
928 | - |
|
929 | - /** |
|
930 | - * Send a complete exercise in SCORM format, from its ID |
|
931 | - * |
|
932 | - * @param Exercise $exercise The exercise to export |
|
933 | - * @param boolean $standalone Wether it should include XML tag and DTD line. |
|
934 | - * @return string XML as a string, or an empty string if there's no exercise with given ID. |
|
935 | - */ |
|
936 | - public static function export_exercise_to_scorm(Exercise $exercise, $standalone = true) |
|
937 | - { |
|
938 | - $ims = new ScormSection($exercise); |
|
939 | - $xml = $ims->export($standalone); |
|
940 | - |
|
941 | - return $xml; |
|
942 | - } |
|
943 | - |
|
944 | - /** |
|
945 | - * Constructor. |
|
946 | - * @param Exercise $exe The Exercise instance to export |
|
947 | - * @author Amand Tihon <[email protected]> |
|
948 | - */ |
|
949 | - public function __construct($exe) |
|
950 | - { |
|
951 | - $this->exercise = $exe; |
|
952 | - } |
|
953 | - |
|
954 | - /** |
|
955 | - * Start the XML flow. |
|
956 | - * |
|
957 | - * This opens the <item> block, with correct attributes. |
|
958 | - * |
|
959 | - */ |
|
960 | - function start_page() |
|
961 | - { |
|
926 | + public $exercise; |
|
927 | + public $standalone; |
|
928 | + |
|
929 | + /** |
|
930 | + * Send a complete exercise in SCORM format, from its ID |
|
931 | + * |
|
932 | + * @param Exercise $exercise The exercise to export |
|
933 | + * @param boolean $standalone Wether it should include XML tag and DTD line. |
|
934 | + * @return string XML as a string, or an empty string if there's no exercise with given ID. |
|
935 | + */ |
|
936 | + public static function export_exercise_to_scorm(Exercise $exercise, $standalone = true) |
|
937 | + { |
|
938 | + $ims = new ScormSection($exercise); |
|
939 | + $xml = $ims->export($standalone); |
|
940 | + |
|
941 | + return $xml; |
|
942 | + } |
|
943 | + |
|
944 | + /** |
|
945 | + * Constructor. |
|
946 | + * @param Exercise $exe The Exercise instance to export |
|
947 | + * @author Amand Tihon <[email protected]> |
|
948 | + */ |
|
949 | + public function __construct($exe) |
|
950 | + { |
|
951 | + $this->exercise = $exe; |
|
952 | + } |
|
953 | + |
|
954 | + /** |
|
955 | + * Start the XML flow. |
|
956 | + * |
|
957 | + * This opens the <item> block, with correct attributes. |
|
958 | + * |
|
959 | + */ |
|
960 | + function start_page() |
|
961 | + { |
|
962 | 962 | $charset = 'UTF-8'; |
963 | - $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?><html>'; |
|
964 | - |
|
965 | - return $head; |
|
966 | - } |
|
967 | - |
|
968 | - /** |
|
969 | - * End the XML flow, closing the </item> tag. |
|
970 | - * |
|
971 | - */ |
|
972 | - function end_page() |
|
973 | - { |
|
974 | - return '</html>'; |
|
975 | - } |
|
976 | - |
|
977 | - /** |
|
978 | - * Start document header |
|
979 | - */ |
|
980 | - function start_header() |
|
981 | - { |
|
982 | - return '<head>'; |
|
983 | - } |
|
984 | - |
|
985 | - /** |
|
986 | - * Print CSS inclusion |
|
987 | - */ |
|
988 | - private function css() |
|
989 | - { |
|
990 | - return ''; |
|
991 | - } |
|
992 | - |
|
993 | - /** |
|
994 | - * End document header |
|
995 | - */ |
|
963 | + $head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?><html>'; |
|
964 | + |
|
965 | + return $head; |
|
966 | + } |
|
967 | + |
|
968 | + /** |
|
969 | + * End the XML flow, closing the </item> tag. |
|
970 | + * |
|
971 | + */ |
|
972 | + function end_page() |
|
973 | + { |
|
974 | + return '</html>'; |
|
975 | + } |
|
976 | + |
|
977 | + /** |
|
978 | + * Start document header |
|
979 | + */ |
|
980 | + function start_header() |
|
981 | + { |
|
982 | + return '<head>'; |
|
983 | + } |
|
984 | + |
|
985 | + /** |
|
986 | + * Print CSS inclusion |
|
987 | + */ |
|
988 | + private function css() |
|
989 | + { |
|
990 | + return ''; |
|
991 | + } |
|
992 | + |
|
993 | + /** |
|
994 | + * End document header |
|
995 | + */ |
|
996 | 996 | private function end_header() |
997 | - { |
|
998 | - return '</head>'; |
|
999 | - } |
|
1000 | - |
|
1001 | - /** |
|
1002 | - * Start the itemBody |
|
1003 | - * |
|
1004 | - */ |
|
997 | + { |
|
998 | + return '</head>'; |
|
999 | + } |
|
1000 | + |
|
1001 | + /** |
|
1002 | + * Start the itemBody |
|
1003 | + * |
|
1004 | + */ |
|
1005 | 1005 | private function start_js() |
1006 | - { |
|
1007 | - return '<script>'; |
|
1008 | - } |
|
1009 | - |
|
1010 | - /** |
|
1011 | - * Common JS functions |
|
1012 | - */ |
|
1013 | - public function common_js() |
|
1014 | - { |
|
1015 | - $js = file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
1016 | - |
|
1017 | - $js .= 'var questions = new Array();' . "\n"; |
|
1018 | - $js .= 'var questions_answers = new Array();' . "\n"; |
|
1019 | - $js .= 'var questions_answers_correct = new Array();' . "\n"; |
|
1020 | - $js .= 'var questions_types = new Array();' . "\n"; |
|
1021 | - $js .= "\n" . |
|
1022 | - '/** |
|
1006 | + { |
|
1007 | + return '<script>'; |
|
1008 | + } |
|
1009 | + |
|
1010 | + /** |
|
1011 | + * Common JS functions |
|
1012 | + */ |
|
1013 | + public function common_js() |
|
1014 | + { |
|
1015 | + $js = file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js'); |
|
1016 | + |
|
1017 | + $js .= 'var questions = new Array();' . "\n"; |
|
1018 | + $js .= 'var questions_answers = new Array();' . "\n"; |
|
1019 | + $js .= 'var questions_answers_correct = new Array();' . "\n"; |
|
1020 | + $js .= 'var questions_types = new Array();' . "\n"; |
|
1021 | + $js .= "\n" . |
|
1022 | + '/** |
|
1023 | 1023 | * Assigns any event handler to any element |
1024 | 1024 | * @param object Element on which the event is added |
1025 | 1025 | * @param string Name of event |
@@ -1061,76 +1061,76 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | '."\n"; |
1063 | 1063 | |
1064 | - $js .= ''; |
|
1065 | - $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
1066 | - return $js. "\n"; |
|
1067 | - } |
|
1064 | + $js .= ''; |
|
1065 | + $js .= 'addEvent(window,\'load\',addListeners,false);'."\n"; |
|
1066 | + return $js. "\n"; |
|
1067 | + } |
|
1068 | + |
|
1069 | + /** |
|
1070 | + * End the itemBody part. |
|
1071 | + * |
|
1072 | + */ |
|
1073 | + function end_js() |
|
1074 | + { |
|
1075 | + return '</script>'; |
|
1076 | + } |
|
1077 | + |
|
1078 | + /** |
|
1079 | + * Start the itemBody |
|
1080 | + * |
|
1081 | + */ |
|
1082 | + function start_body() |
|
1083 | + { |
|
1084 | + return '<body>'. |
|
1085 | + '<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>". |
|
1086 | + '<form id="dokeos_scorm_form" method="post" action="">'. |
|
1087 | + '<table width="100%">'; |
|
1088 | + } |
|
1089 | + |
|
1090 | + /** |
|
1091 | + * End the itemBody part. |
|
1092 | + * |
|
1093 | + */ |
|
1094 | + function end_body() |
|
1095 | + { |
|
1096 | + return '</table><br /><input class="btn btn-primary" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>'; |
|
1097 | + } |
|
1068 | 1098 | |
1069 | - /** |
|
1070 | - * End the itemBody part. |
|
1071 | - * |
|
1072 | - */ |
|
1073 | - function end_js() |
|
1099 | + /** |
|
1100 | + * Export the question as a SCORM Item. |
|
1101 | + * |
|
1102 | + * This is a default behaviour, some classes may want to override this. |
|
1103 | + * |
|
1104 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
1105 | + * @return string string, the XML flow for an Item. |
|
1106 | + */ |
|
1107 | + function export() |
|
1074 | 1108 | { |
1075 | - return '</script>'; |
|
1076 | - } |
|
1077 | - |
|
1078 | - /** |
|
1079 | - * Start the itemBody |
|
1080 | - * |
|
1081 | - */ |
|
1082 | - function start_body() |
|
1083 | - { |
|
1084 | - return '<body>'. |
|
1085 | - '<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>". |
|
1086 | - '<form id="dokeos_scorm_form" method="post" action="">'. |
|
1087 | - '<table width="100%">'; |
|
1088 | - } |
|
1089 | - |
|
1090 | - /** |
|
1091 | - * End the itemBody part. |
|
1092 | - * |
|
1093 | - */ |
|
1094 | - function end_body() |
|
1095 | - { |
|
1096 | - return '</table><br /><input class="btn btn-primary" type="button" id="dokeos_scorm_submit" name="dokeos_scorm_submit" value="OK" /></form></body>'; |
|
1097 | - } |
|
1098 | - |
|
1099 | - /** |
|
1100 | - * Export the question as a SCORM Item. |
|
1101 | - * |
|
1102 | - * This is a default behaviour, some classes may want to override this. |
|
1103 | - * |
|
1104 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
1105 | - * @return string string, the XML flow for an Item. |
|
1106 | - */ |
|
1107 | - function export() |
|
1108 | - { |
|
1109 | - global $charset; |
|
1110 | - |
|
1111 | - $head = ''; |
|
1112 | - if ($this->standalone) { |
|
1113 | - $head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n" |
|
1114 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"; |
|
1115 | - } |
|
1116 | - |
|
1117 | - list($js, $html) = $this->export_questions(); |
|
1118 | - $res = $this->start_page() |
|
1119 | - . $this->start_header() |
|
1120 | - . $this->css() |
|
1109 | + global $charset; |
|
1110 | + |
|
1111 | + $head = ''; |
|
1112 | + if ($this->standalone) { |
|
1113 | + $head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n" |
|
1114 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n"; |
|
1115 | + } |
|
1116 | + |
|
1117 | + list($js, $html) = $this->export_questions(); |
|
1118 | + $res = $this->start_page() |
|
1119 | + . $this->start_header() |
|
1120 | + . $this->css() |
|
1121 | 1121 | . $this->globalAssets() |
1122 | - . $this->start_js() |
|
1123 | - . $this->common_js() |
|
1124 | - . $js |
|
1125 | - . $this->end_js() |
|
1126 | - . $this->end_header() |
|
1127 | - . $this->start_body() |
|
1128 | - . $html |
|
1129 | - . $this->end_body() |
|
1130 | - . $this->end_page(); |
|
1131 | - |
|
1132 | - return $res; |
|
1133 | - } |
|
1122 | + . $this->start_js() |
|
1123 | + . $this->common_js() |
|
1124 | + . $js |
|
1125 | + . $this->end_js() |
|
1126 | + . $this->end_header() |
|
1127 | + . $this->start_body() |
|
1128 | + . $html |
|
1129 | + . $this->end_body() |
|
1130 | + . $this->end_page(); |
|
1131 | + |
|
1132 | + return $res; |
|
1133 | + } |
|
1134 | 1134 | |
1135 | 1135 | /** |
1136 | 1136 | * @return string |
@@ -1144,21 +1144,21 @@ discard block |
||
1144 | 1144 | return $assets; |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - /** |
|
1148 | - * Export the questions, as a succession of <items> |
|
1149 | - * @author Amand Tihon <[email protected]> |
|
1150 | - */ |
|
1151 | - function export_questions() |
|
1152 | - { |
|
1153 | - $js = $html = ""; |
|
1154 | - $js_id = 0; |
|
1155 | - foreach ($this->exercise->selectQuestionList() as $q) { |
|
1156 | - list($jstmp, $htmltmp)= ScormQuestion::export_question($q, false, $js_id); |
|
1157 | - $js .= $jstmp."\n"; |
|
1158 | - $html .= $htmltmp."\n"; |
|
1159 | - ++$js_id; |
|
1160 | - } |
|
1161 | - |
|
1162 | - return array($js, $html); |
|
1163 | - } |
|
1147 | + /** |
|
1148 | + * Export the questions, as a succession of <items> |
|
1149 | + * @author Amand Tihon <[email protected]> |
|
1150 | + */ |
|
1151 | + function export_questions() |
|
1152 | + { |
|
1153 | + $js = $html = ""; |
|
1154 | + $js_id = 0; |
|
1155 | + foreach ($this->exercise->selectQuestionList() as $q) { |
|
1156 | + list($jstmp, $htmltmp)= ScormQuestion::export_question($q, false, $js_id); |
|
1157 | + $js .= $jstmp."\n"; |
|
1158 | + $html .= $htmltmp."\n"; |
|
1159 | + ++$js_id; |
|
1160 | + } |
|
1161 | + |
|
1162 | + return array($js, $html); |
|
1163 | + } |
|
1164 | 1164 | } |
@@ -289,7 +289,7 @@ |
||
289 | 289 | echo '<div class="actions" >'; |
290 | 290 | echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php?project_id='.$projectId.'">' . |
291 | 291 | Display::return_icon('add.png', get_lang('Add'), '', '32') . |
292 | - '</a>'; |
|
292 | + '</a>'; |
|
293 | 293 | echo '</div>'; |
294 | 294 | } |
295 | 295 | } |