Skip to content

Commit

Permalink
Feature #4289: Code checked by Moodle codechecker and errors and warn…
Browse files Browse the repository at this point in the history
…ings reduced to a minimum
  • Loading branch information
Thomas Niedermaier committed Jul 19, 2017
1 parent 9e08879 commit e3a5518
Show file tree
Hide file tree
Showing 97 changed files with 2,438 additions and 1,821 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CHANGELOG
=========
3.3.0 (2017-07-16)
3.3.0 (2017-07-19)
------------------

* Moodle 3.3 compatible version
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion amd/build/adddayslot.min.js
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 44 additions & 40 deletions amd/src/adddayslot.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,66 @@
*/


define(['jquery', 'core/log'], function($, log) {
define(
['jquery', 'core/log'], function($, log) {

/**
/**
* @constructor
* @alias module:mod_datalynx/adddayslot
*/
var Adddayslot = function() {
var Adddayslot = function() {

this.totalslots = 0;
this.displayallslots = 0;
this.totalslots = 0;
this.displayallslots = 0;

};
};

var instance = new Adddayslot();
var instance = new Adddayslot();

instance.init = function(param) { // Parameter 'param' contains the parameter values!
instance.init = function(param) { // Parameter 'param' contains the parameter values!

instance.totalslots = param.totalslots;
instance.displayallslots = param.displayallslots;
instance.totalslots = param.totalslots;
instance.displayallslots = param.displayallslots;

log.info(instance.totalslots, "totalslots");
log.info(instance.displayallslots, "displayallslots");
log.info(instance.totalslots, "totalslots");
log.info(instance.displayallslots, "displayallslots");

if(instance.displayallslots == 0) {
if (instance.displayallslots == 0) {

for(var i = instance.totalslots - 1; i > 0; i--) {
if($('#id_newslots_' + String(i) + '_day').val() == -1) {
$( "#id_newslots_" + String(i) + "_day" ).closest( ".form-group.row.fitem" ).hide(); // boost
$( "#fgroup_id_slotgroup" + String(i)).hide(); // clean
} else {
break;
for(var i = instance.totalslots - 1; i > 0; i--) {
if ($('#id_newslots_' + String(i) + '_day').val() == -1) {
$("#id_newslots_" + String(i) + "_day").closest(".form-group.row.fitem").hide(); // Boost-theme.
$("#fgroup_id_slotgroup" + String(i)).hide(); // Clean-theme.
} else {
break;
}
}
}
if(i < instance.totalslots - 1) {
$('#id_addday').hide();
}

$('[id^=id_newslots_]').change(function () {
var id = $(this).attr("id");
var nextindex = parseInt(id.split("_")[2]) + 1;
$( "#id_newslots_" + String(nextindex) + "_day" ).closest( ".form-group.row.fitem" ).show(); // boost
$( "#fgroup_id_slotgroup" + String(nextindex)).show(); // clean
if(nextindex == instance.totalslots) {
$('#id_addday').show();
if (i < instance.totalslots - 1) {
$('#id_addday').hide();
}
});

}
$('[id^=id_newslots_]').change(
function () {
var id = $(this).attr("id");
var nextindex = parseInt(id.split("_")[2]) + 1;
$("#id_newslots_" + String(nextindex) + "_day").closest(".form-group.row.fitem").show(); // Boost-theme.
$("#fgroup_id_slotgroup" + String(nextindex)).show(); // Clean-theme.
if (nextindex == instance.totalslots) {
$('#id_addday').show();
}
}
);

if( $( "#id_now" ).prop( "checked") == true) {
$('[name^=availablefrom]').prop("disabled", true);
$('#id_availablefrom_timeunit').prop("disabled", true);
}
}

if ($("#id_now").prop("checked") == true) {
$('[name^=availablefrom]').prop("disabled", true);
$('#id_availablefrom_timeunit').prop("disabled", true);
}

};
};

return instance;
return instance;

});
}
);
22 changes: 12 additions & 10 deletions backup/moodle2/backup_organizer_activity_task.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,25 @@
/**
* backup/moodle2/backup_organizer_activity_task.class.php
*
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once($CFG->dirroot
. '/mod/organizer/backup/moodle2/backup_organizer_stepslib.php'); // Because it exists (must).
defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot . '/mod/organizer/backup/moodle2/backup_organizer_stepslib.php'); // Because it exists (must).

/**
* organizer backup task that provides all the settings and steps to perform one
* complete backup of the activity
*/
class backup_organizer_activity_task extends backup_activity_task {
class backup_organizer_activity_task extends backup_activity_task
{

/**
* Define (add) particular settings this activity can have
Expand Down
49 changes: 30 additions & 19 deletions backup/moodle2/backup_organizer_stepslib.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,55 @@
/**
* backup/moodle2/backup_organizer_stepslib.php
*
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

/**
* Define all the backup steps that will be used by the backup_organizer_activity_task
*/

/**
* Define the complete organizer structure for backup, with file and id annotations
*/
class backup_organizer_activity_structure_step extends backup_activity_structure_step {
class backup_organizer_activity_structure_step extends backup_activity_structure_step
{

protected function define_structure() {
// Define each element separated.
$organizer = new backup_nested_element('organizer', array('id'),
array('course', 'name', 'intro', 'introformat', 'timemodified', 'isgrouporganizer', 'emailteachers',
'allowregistrationsfromdate', 'duedate', 'relativedeadline', 'grade', 'visibility', 'queue'));
$organizer = new backup_nested_element(
'organizer', array('id'),
array('course', 'name', 'intro', 'introformat', 'timemodified', 'isgrouporganizer', 'emailteachers',
'allowregistrationsfromdate', 'duedate', 'relativedeadline', 'grade', 'visibility', 'queue')
);

$slots = new backup_nested_element('slots');
$slot = new backup_nested_element('slot', array('id'),
array('organizerid', 'starttime', 'duration', 'location', 'locationlink', 'maxparticipants',
$slot = new backup_nested_element(
'slot', array('id'),
array('organizerid', 'starttime', 'duration', 'location', 'locationlink', 'maxparticipants',
'teacherid', 'visibility', 'availablefrom', 'timemodified', 'notificationtime', 'comments',
'teachervisible', 'eventid', 'notified'));
'teachervisible', 'eventid', 'notified')
);

$appointments = new backup_nested_element('appointments');
$appointment = new backup_nested_element('appointment', array('id'),
array('slotid', 'userid', 'groupid', 'applicantid', 'registrationtime', 'attended', 'grade',
'feedback', 'comments', 'eventid', 'notified', 'allownewappointments'));
$appointment = new backup_nested_element(
'appointment', array('id'),
array('slotid', 'userid', 'groupid', 'applicantid', 'registrationtime', 'attended', 'grade',
'feedback', 'comments', 'eventid', 'notified', 'allownewappointments')
);

$queues = new backup_nested_element('queues');
$queue = new backup_nested_element('queue', array('id'),
array('slotid', 'userid', 'groupid', 'applicantid', 'eventid', 'notified'));
$queue = new backup_nested_element(
'queue', array('id'),
array('slotid', 'userid', 'groupid', 'applicantid', 'eventid', 'notified')
);

// Build the tree.
$organizer->add_child($slots);
Expand Down
17 changes: 9 additions & 8 deletions backup/moodle2/restore_organizer_activity_task.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
/**
* backup/moodle2/restore_organizer_activity_task.class.php
*
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();
Expand All @@ -34,7 +34,8 @@
* organizer restore task that provides all the settings and steps to perform one
* complete restore of the activity
*/
class restore_organizer_activity_task extends restore_activity_task {
class restore_organizer_activity_task extends restore_activity_task
{

/**
* Define (add) particular settings this activity can have
Expand Down
25 changes: 15 additions & 10 deletions backup/moodle2/restore_organizer_stepslib.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,26 @@
/**
* backup/moodle2/restore_organizer_stepslib.php
*
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @author Ivan Šakić
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

/**
* Define all the restore steps that will be used by the restore_organizer_activity_task
*/

/**
* Structure step to restore one organizer activity
*/
class restore_organizer_activity_structure_step extends restore_activity_structure_step {
class restore_organizer_activity_structure_step extends restore_activity_structure_step
{

protected function define_structure() {
$paths = array();
Expand All @@ -42,8 +45,10 @@ protected function define_structure() {
$userinfo = $this->get_setting_value('userinfo');
if ($userinfo) {
$paths[] = new restore_path_element('slot', '/activity/organizer/slots/slot');
$paths[] = new restore_path_element('appointment',
'/activity/organizer/slots/slot/appointments/appointment');
$paths[] = new restore_path_element(
'appointment',
'/activity/organizer/slots/slot/appointments/appointment'
);
}

return $this->prepare_activity_structure($paths);
Expand Down
17 changes: 9 additions & 8 deletions classes/event/appointment_added.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
/**
* event/appointment_added.php
*
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Andreas Windbichler
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_organizer\event;
defined('MOODLE_INTERNAL') || die();
/**
* The appointment_added event class.
**/
class appointment_added extends \core\event\base {
class appointment_added extends \core\event\base
{
protected function init() {
$this->data['crud'] = 'c'; // Options: c(reate), r(ead), u(pdate), d(elete).
$this->data['crud'] = 'c'; // Options: c (reate), r (ead), u (pdate), d (elete).
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'organizer_slot_appointments';
}
Expand Down
17 changes: 9 additions & 8 deletions classes/event/appointment_assigned.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
/**
* event/appointment_assigned.php
*
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Thomas Niedermaier (thomas.niedermaier@meduniwien.ac.at)
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_organizer
* @author Andreas Hruska (andreas.hruska@tuwien.ac.at)
* @author Katarzyna Potocka (katarzyna.potocka@tuwien.ac.at)
* @author Thomas Niedermaier (thomas.niedermaier@meduniwien.ac.at)
* @copyright 2014 Academic Moodle Cooperation {@link http://www.academic-moodle-cooperation.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_organizer\event;
defined('MOODLE_INTERNAL') || die();
/**
* The appointment_assigned event class.
**/
class appointment_assigned extends \core\event\base {
class appointment_assigned extends \core\event\base
{
protected function init() {
$this->data['crud'] = 'u'; // Options: c(reate), r(ead), u(pdate), d(elete).
$this->data['crud'] = 'u'; // Options: c (reate), r (ead), u (pdate), d (elete).
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'organizer_slot_appointments';
}
Expand Down
Loading

0 comments on commit e3a5518

Please sign in to comment.