|
@@ 126-143 (lines=18) @@
|
| 123 |
|
* @param object $bigbluebuttonbn An object from the form in mod_form.php |
| 124 |
|
* @return int The id of the newly inserted bigbluebuttonbn record |
| 125 |
|
*/ |
| 126 |
|
function bigbluebuttonbn_add_instance($bigbluebuttonbn) { |
| 127 |
|
global $DB; |
| 128 |
|
// Excecute preprocess. |
| 129 |
|
bigbluebuttonbn_process_pre_save($bigbluebuttonbn); |
| 130 |
|
// Pre-set initial values. |
| 131 |
|
$bigbluebuttonbn->presentation = bigbluebuttonbn_get_media_file($bigbluebuttonbn); |
| 132 |
|
// Insert a record. |
| 133 |
|
$bigbluebuttonbn->id = $DB->insert_record('bigbluebuttonbn', $bigbluebuttonbn); |
| 134 |
|
// Encode meetingid. |
| 135 |
|
$bigbluebuttonbn->meetingid = bigbluebuttonbn_unique_meetingid_seed(); |
| 136 |
|
// Set the meetingid column in the bigbluebuttonbn table. |
| 137 |
|
$DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn->meetingid, array('id' => $bigbluebuttonbn->id)); |
| 138 |
|
// Log insert action. |
| 139 |
|
bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_ADD); |
| 140 |
|
// Complete the process. |
| 141 |
|
bigbluebuttonbn_process_post_save($bigbluebuttonbn); |
| 142 |
|
return $bigbluebuttonbn->id; |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
/** |
| 146 |
|
* Given an object containing all the necessary data, |
|
@@ 153-169 (lines=17) @@
|
| 150 |
|
* @param object $bigbluebuttonbn An object from the form in mod_form.php |
| 151 |
|
* @return bool Success/Fail |
| 152 |
|
*/ |
| 153 |
|
function bigbluebuttonbn_update_instance($bigbluebuttonbn) { |
| 154 |
|
global $DB; |
| 155 |
|
// Excecute preprocess. |
| 156 |
|
bigbluebuttonbn_process_pre_save($bigbluebuttonbn); |
| 157 |
|
// Pre-set initial values. |
| 158 |
|
$bigbluebuttonbn->id = $bigbluebuttonbn->instance; |
| 159 |
|
$bigbluebuttonbn->presentation = bigbluebuttonbn_get_media_file($bigbluebuttonbn); |
| 160 |
|
// Update a record. |
| 161 |
|
$DB->update_record('bigbluebuttonbn', $bigbluebuttonbn); |
| 162 |
|
// Get the meetingid column in the bigbluebuttonbn table. |
| 163 |
|
$bigbluebuttonbn->meetingid = (string)$DB->get_field('bigbluebuttonbn', 'meetingid', array('id' => $bigbluebuttonbn->id)); |
| 164 |
|
// Log update action. |
| 165 |
|
bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_EDIT); |
| 166 |
|
// Complete the process. |
| 167 |
|
bigbluebuttonbn_process_post_save($bigbluebuttonbn); |
| 168 |
|
return true; |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
/** |
| 172 |
|
* Given an ID of an instance of this module, |