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