Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

2.1 (2014-05-22) - Panos Paralakis - Fixed WYSIWYG settings editors and added missing renderer file and logic
2.0 (2014-05-22) - Moodle 2.6 release, support for Adobe Connect 9 added
1.2 (2012-10-29) - Backup / restore functionality included, fixes made to enable single host Adobe Connect accounts
1.1 (2012-08-21) - Portuguese/Brazilian translation provided by Herbert de Carvalho
Expand Down
48 changes: 24 additions & 24 deletions editattendees.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
// Check if we are waitlisting or booking
//if ($session->datetimeknown) {
// $status = WEBINAR_STATUS_BOOKED;
//}
//}
//else {
$status = WEBINAR_STATUS_WAITLISTED;
//}
Expand All @@ -84,7 +84,7 @@
else {
//Sign up user to this webinar through Adobe Connect API call
signup_meeting($webinar, $session, $user);

//Send registration email to user
send_email_signup($webinar, $session, $cm, $user);
}
Expand Down Expand Up @@ -115,12 +115,12 @@

// Update attendees
webinar_update_attendees($session);

$user = $DB->get_record('user', array('id' => $removeuser));

//Unregister this user from this webinar through Adobe Connect API call
cancelsignup_meeting($webinar, $session, $user);

//Send cancel registration email to user
send_email_cancelsignup($webinar, $session, $cm, $user);
}
Expand All @@ -140,7 +140,7 @@
$navigation = build_navigation($navlinks);
/*print_header_simple($pagetitle, '', $navigation, '', '', true,
update_module_button($cm->id, $course->id, $strwebinar), navmenu($course, $cm));*/

$PAGE->set_pagetype('webinar');
$PAGE->set_title($webinar->name);
$PAGE->set_heading($webinar->name);
Expand Down Expand Up @@ -171,24 +171,24 @@

/// All non-signed up system users

$availableusers = $DB->get_recordset_sql('SELECT u.id, u.firstname, u.lastname, u.email
FROM '.$CFG->prefix.'user u, '.$CFG->prefix.'enrol e, '.$CFG->prefix.'user_enrolments ue
WHERE
$availableusers = $DB->get_recordset_sql('SELECT u.id, u.firstname, u.lastname, u.email
FROM '.$CFG->prefix.'user u, '.$CFG->prefix.'enrol e, '.$CFG->prefix.'user_enrolments ue
WHERE
e.courseid = '.$course->id.'
AND
ue.enrolid = e.id
AND
u.id = ue.userid
ORDER BY u.lastname ASC, u.firstname ASC');
AND
ue.enrolid = e.id
AND
u.id = ue.userid
ORDER BY u.lastname ASC, u.firstname ASC');

$availablecount = $DB->get_recordset_sql('SELECT COUNT(u.id) AS avusers
FROM '.$CFG->prefix.'user u, '.$CFG->prefix.'enrol e, '.$CFG->prefix.'user_enrolments ue
WHERE
FROM '.$CFG->prefix.'user u, '.$CFG->prefix.'enrol e, '.$CFG->prefix.'user_enrolments ue
WHERE
e.courseid = '.$course->id.'
AND
ue.enrolid = e.id
AND
u.id = ue.userid');
AND
ue.enrolid = e.id
AND
u.id = ue.userid');

foreach ($availablecount as $ac) {
$potential_users = $ac->avusers;
Expand Down Expand Up @@ -237,13 +237,13 @@
if ($na_rs = $DB->get_recordset_sql($nonattendees_sql)) {
foreach ($na_rs as $record) {
$data[] = $record->firstname . ' ' . $record->lastname;

$data[] = $record->email;
//$data[] = get_string('status_'.webinar_get_status($user->statuscode), 'webinar');

$table->data[] = $data;
}

$na_rs->close();
}

Expand Down
129 changes: 127 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,42 @@ function webinar_add_instance($webinar) {
global $DB;

$webinar->timemodified = time();
$cmid = $webinar->coursemodule;
$context = context_module::instance($cmid);

webinar_fix_settings($webinar);
if ($webinar->id = $DB->insert_record('webinar', $webinar)) {
webinar_grade_item_update($webinar);
}

if (!empty($webinar->description['itemid'])) {

$draftitemid = file_get_submitted_draft_itemid('description');

$file = file_save_draft_area_files($draftitemid, $context->id, 'mod_webinar', 'description', $webinar->id, webinar_get_editor_options($context), $webinar->description['text']);

$text = file_rewrite_pluginfile_urls($file, 'pluginfile.php',
$context->id, 'mod_webinar', 'description', $webinar->id);

$webinar->description = $text;

$DB->update_record('webinar', $webinar);
}

if (!empty($webinar->agenda['itemid'])) {

$draftitemid = file_get_submitted_draft_itemid('itemid');

$file = file_save_draft_area_files($draftitemid, $context->id, 'mod_webinar', 'agenda', $webinar->id, webinar_get_editor_options($context), $webinar->agenda['text']);

$text = file_rewrite_pluginfile_urls($file, 'pluginfile.php',
$context->id, 'mod_webinar', 'agenda', $webinar->id);

$webinar->agenda = $text;

$DB->update_record('webinar', $webinar);
}

return $webinar->id;
}

Expand All @@ -269,18 +300,53 @@ function webinar_add_instance($webinar) {
* form in mod.html) this function will update an existing instance
* with new data.
*/
function webinar_update_instance($webinar) {
function webinar_update_instance($webinar, $mform = null) {
global $DB;

$webinar->id = $webinar->instance;

$cmid = $webinar->coursemodule;
$context = context_module::instance($cmid);

webinar_fix_settings($webinar);
if ($return = $DB->update_record('webinar', $webinar)) {
webinar_grade_item_update($webinar);
}

if (is_array($webinar->description) && $webinar->description['itemid']!='') {

$draftitemid = file_get_submitted_draft_itemid('description');

$file = file_save_draft_area_files($draftitemid, $context->id, 'mod_webinar', 'description', $webinar->id, webinar_get_editor_options($context), $webinar->description['text']);

$text = file_rewrite_pluginfile_urls($file, 'pluginfile.php',
$context->id, 'mod_webinar', 'description', $webinar->id);

$webinar->description = $text;

$DB->update_record('webinar', $webinar);

}

if (is_array($webinar->agenda) && $webinar->agenda['itemid']!='') {

$draftitemid = file_get_submitted_draft_itemid('itemid');

$file = file_save_draft_area_files($draftitemid, $context->id, 'mod_webinar', 'agenda', $webinar->id, webinar_get_editor_options($context), $webinar->agenda['text']);

$text = file_rewrite_pluginfile_urls($file, 'pluginfile.php',
$context->id, 'mod_webinar', 'agenda', $webinar->id);

$webinar->agenda = $text;

$DB->update_record('webinar', $webinar);
}


return $return;
}


/**
* Given an ID of an instance of this module, this function will
* permanently delete the instance and any data that depends on it.
Expand Down Expand Up @@ -709,7 +775,7 @@ function webinar_email_substitutions($msg, $webinarname, $reminderperiod, $user,
$msg = str_replace($placeholder, $data, $msg);
}

$msg = str_replace('£','�',$msg);
$msg = str_replace('£','�',$msg);

return $msg;
}
Expand Down Expand Up @@ -802,6 +868,7 @@ function webinar_get_sessions($webinarid, $location='')

$fromclause = "FROM {$CFG->prefix}webinar_sessions s";
$locationwhere = '';

if (!empty($location)) {
$fromclause = "FROM {$CFG->prefix}webinar_session_data d
JOIN {$CFG->prefix}webinar_sessions s ON s.id = d.sessionid";
Expand Down Expand Up @@ -3666,4 +3733,62 @@ function webinar_supports($feature) {
case FEATURE_BACKUP_MOODLE2: return true;
default: return null;
}
}

function webinar_get_editor_options($context) {

return array('subdirs'=>false,
'maxfiles'=>EDITOR_UNLIMITED_FILES,
'trusttext'=>false,
'forcehttps' => false,
'context'=>$context,
'maxbytes' => 0,
'changeformat' => 0,
'noclean' => false);
}

function webinar_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
// Check the contextlevel is as expected - if your plugin is a block, this becomes CONTEXT_BLOCK, etc.
if ($context->contextlevel != CONTEXT_MODULE) {
return false;
}

// Make sure the filearea is one of those used by the plugin.
if ($filearea !== 'description' && $filearea !== 'agenda') {
return false;
}

// Make sure the user is logged in and has access to the module (plugins that are not course modules should leave out the 'cm' part).
require_login($course, true, $cm);

// Check the relevant capabilities - these may vary depending on the filearea being accessed.
if (!has_capability('mod/webinar:view', $context)) {
return false;
}

// Leave this line out if you set the itemid to null in make_pluginfile_url (set $itemid to 0 instead).
$itemid = array_shift($args); // The first item in the $args array.

// Use the itemid to retrieve any relevant data records and perform any security checks to see if the
// user really does have access to the file in question.

// Extract the filename / filepath from the $args array.
$filename = array_pop($args); // The last item in the $args array.
if (!$args) {
$filepath = '/'; // $args is empty => the path is '/'
} else {
$filepath = '/'.implode('/', $args).'/'; // $args contains elements of the filepath
}

// Retrieve the file from the Files API.
$fs = get_file_storage();
$file = $fs->get_file($context->id, 'mod_webinar', $filearea, $itemid, $filepath, $filename);
if (!$file) {
return false; // The file does not exist.
}

// We can now send the file back to the browser - in this case with a cache lifetime of 1 day and no filtering.
// From Moodle 2.3, use send_stored_file instead.
send_file($file, $filename);

}
Loading