@@ 220-237 (lines=18) @@ | ||
217 | * @param object $bigbluebuttonbn An object from the form in mod_form.php |
|
218 | * @return int The id of the newly inserted bigbluebuttonbn record |
|
219 | */ |
|
220 | function bigbluebuttonbn_add_instance($bigbluebuttonbn) { |
|
221 | global $DB; |
|
222 | // Excecute preprocess. |
|
223 | bigbluebuttonbn_process_pre_save($bigbluebuttonbn); |
|
224 | // Pre-set initial values. |
|
225 | $bigbluebuttonbn->presentation = bigbluebuttonbn_get_media_file($bigbluebuttonbn); |
|
226 | // Insert a record. |
|
227 | $bigbluebuttonbn->id = $DB->insert_record('bigbluebuttonbn', $bigbluebuttonbn); |
|
228 | // Encode meetingid. |
|
229 | $bigbluebuttonbn->meetingid = bigbluebuttonbn_unique_meetingid_seed(); |
|
230 | // Set the meetingid column in the bigbluebuttonbn table. |
|
231 | $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn->meetingid, array('id' => $bigbluebuttonbn->id)); |
|
232 | // Log insert action. |
|
233 | bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_ADD); |
|
234 | // Complete the process. |
|
235 | bigbluebuttonbn_process_post_save($bigbluebuttonbn); |
|
236 | return $bigbluebuttonbn->id; |
|
237 | } |
|
238 | ||
239 | /** |
|
240 | * Given an object containing all the necessary data, |
|
@@ 247-263 (lines=17) @@ | ||
244 | * @param object $bigbluebuttonbn An object from the form in mod_form.php |
|
245 | * @return bool Success/Fail |
|
246 | */ |
|
247 | function bigbluebuttonbn_update_instance($bigbluebuttonbn) { |
|
248 | global $DB; |
|
249 | // Excecute preprocess. |
|
250 | bigbluebuttonbn_process_pre_save($bigbluebuttonbn); |
|
251 | // Pre-set initial values. |
|
252 | $bigbluebuttonbn->id = $bigbluebuttonbn->instance; |
|
253 | $bigbluebuttonbn->presentation = bigbluebuttonbn_get_media_file($bigbluebuttonbn); |
|
254 | // Update a record. |
|
255 | $DB->update_record('bigbluebuttonbn', $bigbluebuttonbn); |
|
256 | // Get the meetingid column in the bigbluebuttonbn table. |
|
257 | $bigbluebuttonbn->meetingid = (string)$DB->get_field('bigbluebuttonbn', 'meetingid', array('id' => $bigbluebuttonbn->id)); |
|
258 | // Log update action. |
|
259 | bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_EDIT); |
|
260 | // Complete the process. |
|
261 | bigbluebuttonbn_process_post_save($bigbluebuttonbn); |
|
262 | return true; |
|
263 | } |
|
264 | ||
265 | /** |
|
266 | * Given an ID of an instance of this module, |