Skip to content

Commit

Permalink
MDL-38040 Clean core from CRLFs
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Feb 15, 2013
1 parent 1dd6835 commit 9e7e1b1
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 96 deletions.
92 changes: 46 additions & 46 deletions blocks/html/backup/moodle1/lib.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
<?php

/**
* Provides support for the conversion of moodle1 backup to the moodle2 format
*
* @package block_html
* @copyright 2012 Paul Nicholls
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* Block conversion handler for html
*/
class moodle1_block_html_handler extends moodle1_block_handler {
private $fileman = null;
protected function convert_configdata(array $olddata) {
$instanceid = $olddata['id'];
$contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
$configdata = unserialize(base64_decode($olddata['configdata']));

// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'block_html');

// convert course files embedded in the block content
$this->fileman->filearea = 'content';
$this->fileman->itemid = 0;
$configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
$configdata->format = FORMAT_HTML;

return base64_encode(serialize($configdata));
}

protected function write_inforef_xml($newdata, $data) {
$this->open_xml_writer("course/blocks/{$data['name']}_{$data['id']}/inforef.xml");
$this->xmlwriter->begin_tag('inforef');
$this->xmlwriter->begin_tag('fileref');
foreach ($this->fileman->get_fileids() as $fileid) {
$this->write_xml('file', array('id' => $fileid));
}
$this->xmlwriter->end_tag('fileref');
$this->xmlwriter->end_tag('inforef');
$this->close_xml_writer();
}
}
<?php

/**
* Provides support for the conversion of moodle1 backup to the moodle2 format
*
* @package block_html
* @copyright 2012 Paul Nicholls
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* Block conversion handler for html
*/
class moodle1_block_html_handler extends moodle1_block_handler {
private $fileman = null;
protected function convert_configdata(array $olddata) {
$instanceid = $olddata['id'];
$contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
$configdata = unserialize(base64_decode($olddata['configdata']));

// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'block_html');

// convert course files embedded in the block content
$this->fileman->filearea = 'content';
$this->fileman->itemid = 0;
$configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
$configdata->format = FORMAT_HTML;

return base64_encode(serialize($configdata));
}

protected function write_inforef_xml($newdata, $data) {
$this->open_xml_writer("course/blocks/{$data['name']}_{$data['id']}/inforef.xml");
$this->xmlwriter->begin_tag('inforef');
$this->xmlwriter->begin_tag('fileref');
foreach ($this->fileman->get_fileids() as $fileid) {
$this->write_xml('file', array('id' => $fileid));
}
$this->xmlwriter->end_tag('fileref');
$this->xmlwriter->end_tag('inforef');
$this->close_xml_writer();
}
}
68 changes: 34 additions & 34 deletions blocks/rss_client/backup/moodle1/lib.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?php

/**
* Provides support for the conversion of moodle1 backup to the moodle2 format
*
* @package block_rss_client
* @copyright 2012 Paul Nicholls
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* Block conversion handler for rss_client
*/
class moodle1_block_rss_client_handler extends moodle1_block_handler {
public function process_block(array $data) {
parent::process_block($data);
$instanceid = $data['id'];
$contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $data['id']);

// Moodle 1.9 backups do not include sufficient data to restore feeds, so we need an empty shell rss_client.xml
// for the restore process to find
$this->open_xml_writer("course/blocks/{$data['name']}_{$instanceid}/rss_client.xml");
$this->xmlwriter->begin_tag('block', array('id' => $instanceid, 'contextid' => $contextid, 'blockname' => 'rss_client'));
$this->xmlwriter->begin_tag('rss_client', array('id' => $instanceid));
$this->xmlwriter->full_tag('feeds', '');
$this->xmlwriter->end_tag('rss_client');
$this->xmlwriter->end_tag('block');
$this->close_xml_writer();

return $data;
}
}
<?php

/**
* Provides support for the conversion of moodle1 backup to the moodle2 format
*
* @package block_rss_client
* @copyright 2012 Paul Nicholls
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* Block conversion handler for rss_client
*/
class moodle1_block_rss_client_handler extends moodle1_block_handler {
public function process_block(array $data) {
parent::process_block($data);
$instanceid = $data['id'];
$contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $data['id']);

// Moodle 1.9 backups do not include sufficient data to restore feeds, so we need an empty shell rss_client.xml
// for the restore process to find
$this->open_xml_writer("course/blocks/{$data['name']}_{$instanceid}/rss_client.xml");
$this->xmlwriter->begin_tag('block', array('id' => $instanceid, 'contextid' => $contextid, 'blockname' => 'rss_client'));
$this->xmlwriter->begin_tag('rss_client', array('id' => $instanceid));
$this->xmlwriter->full_tag('feeds', '');
$this->xmlwriter->end_tag('rss_client');
$this->xmlwriter->end_tag('block');
$this->close_xml_writer();

return $data;
}
}
4 changes: 2 additions & 2 deletions blog/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function definition() {
}

if (has_capability('moodle/blog:associatecourse', $context)) {
$mform->addElement('header', 'assochdr', get_string('associations', 'blog'));
$mform->addElement('advcheckbox', 'courseassoc', get_string('associatewithcourse', 'blog', $a), null, null, array(0, $contextid));
$mform->addElement('header', 'assochdr', get_string('associations', 'blog'));
$mform->addElement('advcheckbox', 'courseassoc', get_string('associatewithcourse', 'blog', $a), null, null, array(0, $contextid));
$mform->setDefault('courseassoc', $contextid);
}

Expand Down
6 changes: 3 additions & 3 deletions enrol/imsenterprise/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function __construct() {
* @return array Array of assignable values
*/
function get_imsnames($courseattr) {

$values = $this->imsnames;
if ($courseattr == 'summary') {

$values = $this->imsnames;
if ($courseattr == 'summary') {
$values = array_merge(array('ignore' => get_string('emptyattribute', 'enrol_imsenterprise')), $values);
}
return $values;
Expand Down
10 changes: 5 additions & 5 deletions mod/data/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
defined('MOODLE_INTERNAL') || die();

class mod_data_renderer extends plugin_renderer_base {

public function import_setting_mappings($datamodule, data_preset_importer $importer) {

$strblank = get_string('blank', 'data');
Expand All @@ -24,7 +24,7 @@ public function import_setting_mappings($datamodule, data_preset_importer $impor
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'action', 'value'=>'finishimport'));
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'d', 'value'=>$datamodule->id));

if ($importer instanceof data_preset_existing_importer) {
$html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'fullname', 'value'=>$importer->get_userid().'/'.$importer->get_directory()));
} else {
Expand Down Expand Up @@ -60,7 +60,7 @@ public function import_setting_mappings($datamodule, data_preset_importer $impor
} else {
$row[1] .= html_writer::tag('option', get_string('mapnewfield', 'data'), array('value'=>'-1', 'selected'=>'selected'));
}

$row[1] .= html_writer::end_tag('select');
$table->data[] = $row;
}
Expand All @@ -82,5 +82,5 @@ public function import_setting_mappings($datamodule, data_preset_importer $impor

return $html;
}
}

}
10 changes: 5 additions & 5 deletions mod/scorm/report/graphs/graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@

// Do this only if we have students to report
if(!$nostudents) {
// Construct the SQL
$select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
$select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid ';
$from = 'FROM {scorm_scoes_track} st ';
$where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?';
// Construct the SQL
$select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
$select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid ';
$from = 'FROM {scorm_scoes_track} st ';
$where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?';
$attempts = $DB->get_records_sql($select.$from.$where, $params);

foreach ($attempts as $attempt) {
Expand Down
2 changes: 1 addition & 1 deletion tag/coursetagslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

require_once $CFG->dirroot.'/tag/lib.php';
require_once $CFG->dirroot.'/tag/locallib.php';
require_once $CFG->dirroot.'/tag/locallib.php';

/**
* Returns an ordered array of tags associated with visible courses
Expand Down

0 comments on commit 9e7e1b1

Please sign in to comment.