Skip to content

Commit

Permalink
v2.2-beta: Applied some changes for phpdocumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico committed Oct 19, 2017
1 parent 0ef9daf commit 13882cf
Show file tree
Hide file tree
Showing 9 changed files with 3,180 additions and 1,263 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ config.php
deploy*
vendor*
moodle-plugin-ci/
output*
13 changes: 11 additions & 2 deletions backup/moodle2/backup_bigbluebuttonbn_activity_task.class.php
Expand Up @@ -15,6 +15,8 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Class for backup BigBlueButtonBN.
*
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
* @copyright 2010-2017 Blindside Networks Inc
Expand All @@ -26,20 +28,23 @@
require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/backup_bigbluebuttonbn_stepslib.php');

/**
* bigbluebuttonbn backup task that provides all the settings and steps to perform one
* complete backup of the activity.
* Backup task that provides all the settings and steps to perform one complete backup of the activity.
*/
class backup_bigbluebuttonbn_activity_task extends backup_activity_task
{
/**
* Define (add) particular settings this activity can have.
*
* @return void
*/
protected function define_my_settings() {
// No particular settings for this activity.
}

/**
* Define (add) particular steps this activity can have.
*
* @return void
*/
protected function define_my_steps() {
// Choice only has one structure step.
Expand All @@ -49,6 +54,10 @@ protected function define_my_steps() {
/**
* Code the transformations to perform in the activity in
* order to get transportable (encoded) links.
*
* @param string $content
*
* @return string
*/
public static function encode_content_links($content) {
global $CFG;
Expand Down
21 changes: 12 additions & 9 deletions backup/moodle2/backup_bigbluebuttonbn_stepslib.php
Expand Up @@ -15,6 +15,8 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Class for the structure used for backup BigBlueButtonBN.
*
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
* @copyright 2010-2017 Blindside Networks Inc
Expand All @@ -26,21 +28,22 @@
/**
* Define all the backup steps that will be used by the backup_bigbluebuttonbn_activity_task.
*/

/**
* Define the complete bigbluebuttonbn structure for backup, with file and id annotations.
*/
class backup_bigbluebuttonbn_activity_structure_step extends backup_activity_structure_step
{
/**
* Define the complete bigbluebuttonbn structure for backup, with file and id annotations.
*
* @return object
*/
protected function define_structure() {

// Define each element separated.
$bigbluebuttonbn = new backup_nested_element('bigbluebuttonbn', array('id'), array(
'course', 'name', 'intro', 'introformat', 'meetingid',
'moderatorpass', 'viewerpass', 'wait', 'record', 'tagging',
'welcome', 'voicebridge', 'openingtime', 'closingtime',
'timecreated', 'timemodified', 'presentation', 'participants',
'userlimit', ));
'type', 'course', 'name', 'intro', 'introformat', 'meetingid',
'moderatorpass', 'viewerpass', 'wait', 'record', 'welcome',
'voicebridge', 'openingtime', 'closingtime', 'timecreated',
'timemodified', 'presentation', 'participants', 'userlimit',
'recordings_html', 'recordings_deleted', 'recordings_imported'));

$logs = new backup_nested_element('logs');

Expand Down
37 changes: 23 additions & 14 deletions backup/moodle2/restore_bigbluebuttonbn_activity_task.class.php
Expand Up @@ -15,6 +15,8 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Class for restore BigBlueButtonBN.
*
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
* @copyright 2010-2017 Blindside Networks Inc
Expand All @@ -26,68 +28,75 @@
require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/restore_bigbluebuttonbn_stepslib.php');

/**
* bigbluebuttonbn restore task that provides all the settings and steps to perform one
* complete restore of the activity.
* Restore task that provides all the settings and steps to perform one complete restore of the activity.
*/
class restore_bigbluebuttonbn_activity_task extends restore_activity_task
{
/**
* Define (add) particular settings this activity can have.
*
* @return void
*/
protected function define_my_settings() {
// No particular settings for this activity.
}

/**
* Define (add) particular steps this activity can have.
*
* @return void
*/
protected function define_my_steps() {
// BigBlueButtonBN only has one structure step.
$this->add_step(new restore_bigbluebuttonbn_activity_structure_step('bigbluebuttonbn_structure', 'bigbluebuttonbn.xml'));
}

/**
* Define the contents in the activity that must be
* processed by the link decoder.
* Define the contents in the activity that must be processed by the link decoder.
*
* @return array
*/
public static function define_decode_contents() {
$contents = array();

$contents[] = new restore_decode_content('bigbluebuttonbn', array('intro'), 'bigbluebuttonbn');
$contents[] = new restore_decode_content('bigbluebuttonbn_logs', array('log'), 'bigbluebuttonbn_logs');

return $contents;
}

/**
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder.
* Define the decoding rules for links belonging to the activity to be executed by the link decoder.
*
* @return array
*/
public static function define_decode_rules() {
$rules = array();

$rules[] = new restore_decode_rule('BIGBLUEBUTTONBNVIEWBYID', '/mod/bigbluebuttonbn/view.php?id=$1', 'course_module');
$rules[] = new restore_decode_rule('BIGBLUEBUTTONBNINDEX', '/mod/bigbluebuttonbn/index.php?id=$1', 'course');

return $rules;
}

/**
* Define the restoring rules for logs belonging to the activity to be executed by the link decoder.
*
* @return array
*/
public static function define_restore_log_rules() {
$rules = array();

$rules[] = new restore_log_rule('bigbluebuttonbn', 'add', 'view.php?id={course_module}', '{bigbluebuttonbn}');
$rules[] = new restore_log_rule('bigbluebuttonbn', 'update', 'view.php?id={course_module}', '{bigbluebuttonbn}');
$rules[] = new restore_log_rule('bigbluebuttonbn', 'view', 'view.php?id={course_module}', '{bigbluebuttonbn}');
$rules[] = new restore_log_rule('bigbluebuttonbn', 'report', 'report.php?id={course_module}', '{bigbluebuttonbn}');

return $rules;
}

/**
* Define the restoring rules for course associated to the activity to be executed by the link decoder.
*
* @return array
*/
public static function define_restore_log_rules_for_course() {
$rules = array();

$rules[] = new restore_log_rule('bigbluebuttonbn', 'view all', 'index.php?id={course}', null);

return $rules;
}
}
32 changes: 21 additions & 11 deletions backup/moodle2/restore_bigbluebuttonbn_stepslib.php
Expand Up @@ -15,6 +15,8 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Class for the structure used for restore BigBlueButtonBN.
*
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com)
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
* @copyright 2010-2017 Blindside Networks Inc
Expand All @@ -26,52 +28,60 @@
/**
* Define all the restore steps that will be used by the restore_url_activity_task.
*/

/**
* Structure step to restore one bigbluebuttonbn activity.
*/
class restore_bigbluebuttonbn_activity_structure_step extends restore_activity_structure_step
{
/**
* Structure step to restore one bigbluebuttonbn activity.
*
* @return array
*/
protected function define_structure() {
$paths = array();

$paths[] = new restore_path_element('bigbluebuttonbn', '/activity/bigbluebuttonbn');
$paths[] = new restore_path_element('bigbluebuttonbn_logs', '/activity/bigbluebuttonbn/logs/log');

// Return the paths wrapped into standard activity structure.
return $this->prepare_activity_structure($paths);
}

/**
* @param data
* @return array
*/
protected function process_bigbluebuttonbn($data) {
global $DB;

$data = (object) $data;
$data->course = $this->get_courseid();

$data->timemodified = $this->apply_date_offset($data->timemodified);

// Insert the bigbluebuttonbn record.
$newitemid = $DB->insert_record('bigbluebuttonbn', $data);
// Immediately after inserting "activity" record, call this.
$this->apply_activity_instance($newitemid);
}

/**
*
* @param data
* @return array
*/
protected function process_bigbluebuttonbn_logs($data) {
global $DB;

$data = (object) $data;
// Apply modifications.
$data->courseid = $this->get_mappingid('course', $data->courseid);
$data->bigbluebuttonbnid = $this->get_new_parentid('bigbluebuttonbn');
$data->userid = $this->get_mappingid('user', $data->userid);
$data->timecreated = $this->apply_date_offset($data->timecreated);

// Insert the bigbluebuttonbn_logs record.
$newitemid = $DB->insert_record('bigbluebuttonbn_logs', $data);
// Immediately after inserting associated record, call this.
$this->set_mapping('bigbluebuttonbn_logs', $data->id, $newitemid);
}

/**
* Actions to be executed after the restore is completed
*
* @return array
*/
protected function after_execute() {
// Add bigbluebuttonbn related files, no need to match by itemname (just internally handled context).
$this->add_related_files('mod_bigbluebuttonbn', 'intro', null);
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -12,6 +12,7 @@
"friendsofphp/php-cs-fixer": "~1.10",
"phpmd/phpmd": "@stable",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"jakub-onderka/php-console-highlighter": "^0.3.2"
"jakub-onderka/php-console-highlighter": "^0.3.2",
"phpdocumentor/phpdocumentor": "2.*"
}
}

0 comments on commit 13882cf

Please sign in to comment.