function bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn) { $sender = get_admin(); // Prepare message $msg = new stdClass(); /// Build the message_body $msg->activity_type = ""; $msg->activity_title = $bigbluebuttonbn->name; $message_text = get_string('email_body_recording', 'bigbluebuttonbn', $msg); bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text); }
/** * Runs any processes that must be run * after a bigbluebuttonbn insert/update * * @global object * @param object $bigbluebuttonbn BigBlueButtonBN form data * @return void **/ function bigbluebuttonbn_process_post_save(&$bigbluebuttonbn) { global $DB, $CFG, $USER; // Now that an id was assigned, generate and set the meetingid property based on // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities) if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) { $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret()); $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id)); $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn'); } else { $action = get_string('mod_form_field_notification_msg_modified', 'bigbluebuttonbn'); } // Add evento to the calendar when if openingtime is set if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) { $event = new stdClass(); $event->name = $bigbluebuttonbn->name; $event->courseid = $bigbluebuttonbn->course; $event->groupid = 0; $event->userid = 0; $event->modulename = 'bigbluebuttonbn'; $event->instance = $bigbluebuttonbn->id; $event->timestart = $bigbluebuttonbn->openingtime; if ($bigbluebuttonbn->closingtime) { $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime; } else { $event->durationtime = 0; } if ($event->id = $DB->get_field('event', 'id', array('modulename' => 'bigbluebuttonbn', 'instance' => $bigbluebuttonbn->id))) { $calendarevent = calendar_event::load($event->id); $calendarevent->update($event); } else { calendar_event::create($event); } } else { $DB->delete_records('event', array('modulename' => 'bigbluebuttonbn', 'instance' => $bigbluebuttonbn->id)); } if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) { // Prepare message $msg = new stdClass(); /// Build the message_body $msg->action = $action; $msg->activity_type = ""; $msg->activity_title = $bigbluebuttonbn->name; /// Add the meeting details to the message_body $msg->action = ucfirst($action); $msg->activity_description = ""; if (!empty($bigbluebuttonbn->intro)) { $msg->activity_description = trim($bigbluebuttonbn->intro); } $msg->activity_openingtime = ""; if ($bigbluebuttonbn->openingtime) { $date = new stdClass(); $date->day = calendar_day_representation($bigbluebuttonbn->openingtime); $date->time = calendar_time_representation($bigbluebuttonbn->openingtime); $msg->activity_openingtime = get_string('email_date', 'bigbluebuttonbn', $date); } $msg->activity_closingtime = ""; if ($bigbluebuttonbn->closingtime) { $date = new stdClass(); $date->day = calendar_day_representation($bigbluebuttonbn->closingtime); $date->time = calendar_time_representation($bigbluebuttonbn->closingtime); $msg->activity_closingtime = get_string('email_date', 'bigbluebuttonbn', $date); } $msg->activity_owner = fullname($USER); $message_text = get_string('email_body_notification', 'bigbluebuttonbn', $msg); // Send notification to all users enrolled bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text); } }