Skip to content

Commit b6569b4

Browse files
authored
Merge pull request #119 from learnweb/feature/topicmove
Feature/topicmove
2 parents ccd70e2 + 08968b1 commit b6569b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1678
-1065
lines changed

backup/moodle2/backup_moodleoverflow_activity_task.class.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,27 @@ public static function encode_content_links($content) {
6363
$base = preg_quote($CFG->wwwroot, '/');
6464

6565
// Link to the list of moodleoverflows.
66-
$search = '/(' . $base . '\/mod\/moodleoverflow\/index.php\?id\=)([0-9]+)/';
66+
$search = '/(' . $base . '\/mod\/moodleoverflow\/index.php\?id\=)([0-9]+)/';
6767
$content = preg_replace($search, '$@MOODLEOVERFLOWINDEX*$2@$', $content);
6868

6969
// Link to moodleoverflow view by moduleid.
70-
$search = '/(' . $base . '\/mod\/moodleoverflow\/view.php\?id\=)([0-9]+)/';
70+
$search = '/(' . $base . '\/mod\/moodleoverflow\/view.php\?id\=)([0-9]+)/';
7171
$content = preg_replace($search, '$@MOODLEOVERFLOWVIEWBYID*$2@$', $content);
7272

7373
// Link to moodleoverflow view by forumid.
74-
$search = "/(" . $base . "\/mod\/forum\/view.php\?f\=)([0-9]+)/";
74+
$search = "/(" . $base . "\/mod\/forum\/view.php\?f\=)([0-9]+)/";
7575
$content = preg_replace($search, '$@MOODLEOVERFLOWVIEWBYF*$2@$', $content);
7676

7777
// Link to moodleoverflow discussion with parent syntax.
78-
$search = "/(" . $base . "\/mod\/forum\/discuss.php\?d\=)([0-9]+)(?:\&|\&)parent\=([0-9]+)/";
78+
$search = "/(" . $base . "\/mod\/forum\/discuss.php\?d\=)([0-9]+)(?:\&|\&)parent\=([0-9]+)/";
7979
$content = preg_replace($search, '$@MOODLEOVERFLOWDISCUSSIONVIEWPARENT*$2*$3@$', $content);
8080

8181
// Link to moodleoverflow discussion with relative syntax.
82-
$search = "/(" . $base . "\/mod\/forum\/discuss.php\?d\=)([0-9]+)\#([0-9]+)/";
82+
$search = "/(" . $base . "\/mod\/forum\/discuss.php\?d\=)([0-9]+)\#([0-9]+)/";
8383
$content = preg_replace($search, '$@MOODLEOVERFLOWDISCUSSIONVIEWINSIDE*$2*$3@$', $content);
8484

8585
// Link to moodleoverflow discussion by discussionid.
86-
$search = "/(" . $base . "\/mod\/forum\/discuss.php\?d\=)([0-9]+)/";
86+
$search = "/(" . $base . "\/mod\/forum\/discuss.php\?d\=)([0-9]+)/";
8787
$content = preg_replace($search, '$@MOODLEOVERFLOWDISCUSSIONVIEW*$2@$', $content);
8888

8989
return $content;

backup/moodle2/backup_moodleoverflow_stepslib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function define_structure() {
5151

5252
// Define each element separated.
5353
$discussions = new backup_nested_element('discussions');
54-
$discussion = new backup_nested_element('discussion', array('id'), array(
54+
$discussion = new backup_nested_element('discussion', array('id'), array(
5555
'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart'));
5656

5757
$posts = new backup_nested_element('posts');

backup/moodle2/restore_moodleoverflow_activity_task.class.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ public static function define_decode_rules() {
9595

9696
/**
9797
* Define the restore log rules that will be applied
98-
* by the {@link restore_logs_processor} when restoring
98+
* by the {restore_logs_processor} when restoring
9999
* moodleoverflow logs. It must return one array
100-
* of {@link restore_log_rule} objects
100+
* of { restore_log_rule} objects
101101
*/
102102
public static function define_restore_log_rules() {
103103
$rules = array();
@@ -151,9 +151,9 @@ public static function define_restore_log_rules() {
151151

152152
/**
153153
* Define the restore log rules that will be applied
154-
* by the {@link restore_logs_processor} when restoring
154+
* by the { restore_logs_processor} when restoring
155155
* course logs. It must return one array
156-
* of {@link restore_log_rule} objects
156+
* of { restore_log_rule} objects
157157
*
158158
* Note this rules are applied when restoring course logs
159159
* by the restore final task, but are defined here at

backup/moodle2/restore_moodleoverflow_stepslib.php

+26-26
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class restore_moodleoverflow_activity_structure_step extends restore_activity_st
3636
/**
3737
* Defines structure of path elements to be processed during the restore.
3838
*
39-
* @return array of {@link restore_path_element}
39+
* @return array of {restore_path_element}
4040
*/
4141
protected function define_structure() {
4242

43-
$paths = array();
43+
$paths = array();
4444
$userinfo = $this->get_setting_value('userinfo');
4545

4646
$paths[] = new restore_path_element('moodleoverflow', '/activity/moodleoverflow');
@@ -73,7 +73,7 @@ protected function define_structure() {
7373
protected function process_moodleoverflow($data) {
7474
global $DB;
7575

76-
$data = (object) $data;
76+
$data = (object) $data;
7777
$data->course = $this->get_courseid();
7878

7979
if (empty($data->timecreated)) {
@@ -99,15 +99,15 @@ protected function process_moodleoverflow($data) {
9999
protected function process_moodleoverflow_discussion($data) {
100100
global $DB;
101101

102-
$data = (object) $data;
103-
$oldid = $data->id;
102+
$data = (object) $data;
103+
$oldid = $data->id;
104104
$data->course = $this->get_courseid();
105105

106106
$data->moodleoverflow = $this->get_new_parentid('moodleoverflow');
107-
$data->timemodified = $this->apply_date_offset($data->timemodified);
108-
$data->timestart = $this->apply_date_offset($data->timestart);
109-
$data->userid = $this->get_mappingid('user', $data->userid);
110-
$data->usermodified = $this->get_mappingid('user', $data->usermodified);
107+
$data->timemodified = $this->apply_date_offset($data->timemodified);
108+
$data->timestart = $this->apply_date_offset($data->timestart);
109+
$data->userid = $this->get_mappingid('user', $data->userid);
110+
$data->usermodified = $this->get_mappingid('user', $data->usermodified);
111111

112112
$newitemid = $DB->insert_record('moodleoverflow_discussions', $data);
113113
$this->set_mapping('moodleoverflow_discussion', $oldid, $newitemid);
@@ -121,13 +121,13 @@ protected function process_moodleoverflow_discussion($data) {
121121
protected function process_moodleoverflow_post($data) {
122122
global $DB;
123123

124-
$data = (object) $data;
124+
$data = (object) $data;
125125
$oldid = $data->id;
126126

127127
$data->discussion = $this->get_new_parentid('moodleoverflow_discussion');
128-
$data->created = $this->apply_date_offset($data->created);
129-
$data->modified = $this->apply_date_offset($data->modified);
130-
$data->userid = $this->get_mappingid('user', $data->userid);
128+
$data->created = $this->apply_date_offset($data->created);
129+
$data->modified = $this->apply_date_offset($data->modified);
130+
$data->userid = $this->get_mappingid('user', $data->userid);
131131
// If post has parent, map it (it has been already restored).
132132
if (!empty($data->parent)) {
133133
$data->parent = $this->get_mappingid('moodleoverflow_post', $data->parent);
@@ -150,12 +150,12 @@ protected function process_moodleoverflow_post($data) {
150150
protected function process_moodleoverflow_rating($data) {
151151
global $DB;
152152

153-
$data = (object) $data;
153+
$data = (object) $data;
154154
$oldid = $data->id;
155155

156-
$data->userid = $this->get_mappingid('user', $data->userid);
157-
$data->postid = $this->get_new_parentid('moodleoverflow_post');
158-
$data->discussionid = $this->get_new_parentid('moodleoverflow_discussion');
156+
$data->userid = $this->get_mappingid('user', $data->userid);
157+
$data->postid = $this->get_new_parentid('moodleoverflow_post');
158+
$data->discussionid = $this->get_new_parentid('moodleoverflow_discussion');
159159
$data->moodleoverflowid = $this->get_new_parentid('moodleoverflow');
160160

161161
$newitemid = $DB->insert_record('moodleoverflow_ratings', $data);
@@ -170,11 +170,11 @@ protected function process_moodleoverflow_rating($data) {
170170
protected function process_moodleoverflow_subscription($data) {
171171
global $DB;
172172

173-
$data = (object) $data;
173+
$data = (object) $data;
174174
$oldid = $data->id;
175175

176176
$data->moodleoverflow = $this->get_new_parentid('moodleoverflow');
177-
$data->userid = $this->get_mappingid('user', $data->userid);
177+
$data->userid = $this->get_mappingid('user', $data->userid);
178178

179179
$newitemid = $DB->insert_record('moodleoverflow_subscriptions', $data);
180180
$this->set_mapping('moodleoverflow_subscription', $oldid, $newitemid, true);
@@ -189,12 +189,12 @@ protected function process_moodleoverflow_subscription($data) {
189189
protected function process_moodleoverflow_discuss_sub($data) {
190190
global $DB;
191191

192-
$data = (object) $data;
192+
$data = (object) $data;
193193
$oldid = $data->id;
194194

195-
$data->discussion = $this->get_new_parentid('moodleoverflow_discussion');
195+
$data->discussion = $this->get_new_parentid('moodleoverflow_discussion');
196196
$data->moodleoverflow = $this->get_new_parentid('moodleoverflow');
197-
$data->userid = $this->get_mappingid('user', $data->userid);
197+
$data->userid = $this->get_mappingid('user', $data->userid);
198198

199199
$newitemid = $DB->insert_record('moodleoverflow_discuss_subs', $data);
200200
$this->set_mapping('moodleoverflow_discuss_sub', $oldid, $newitemid, true);
@@ -211,9 +211,9 @@ protected function process_moodleoverflow_read($data) {
211211
$data = (object) $data;
212212

213213
$data->moodleoverflowid = $this->get_new_parentid('moodleoverflow');
214-
$data->discussionid = $this->get_mappingid('moodleoverflow_discussion', $data->discussionid);
215-
$data->postid = $this->get_mappingid('moodleoverflow_post', $data->postid);
216-
$data->userid = $this->get_mappingid('user', $data->userid);
214+
$data->discussionid = $this->get_mappingid('moodleoverflow_discussion', $data->discussionid);
215+
$data->postid = $this->get_mappingid('moodleoverflow_post', $data->postid);
216+
$data->userid = $this->get_mappingid('user', $data->userid);
217217

218218
$DB->insert_record('moodleoverflow_read', $data);
219219
}
@@ -229,7 +229,7 @@ protected function process_moodleoverflow_track($data) {
229229
$data = (object) $data;
230230

231231
$data->moodleoverflowid = $this->get_new_parentid('moodleoverflow');
232-
$data->userid = $this->get_mappingid('user', $data->userid);
232+
$data->userid = $this->get_mappingid('user', $data->userid);
233233

234234
$DB->insert_record('moodleoverflow_tracking', $data);
235235
}

classes/event/discussion_created.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class discussion_created extends \core\event\base {
4444
* @return void
4545
*/
4646
protected function init() {
47-
$this->data['crud'] = 'c';
48-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
47+
$this->data['crud'] = 'c';
48+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
4949
$this->data['objecttable'] = 'moodleoverflow_discussions';
5050
}
5151

classes/event/discussion_deleted.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class discussion_deleted extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'd';
49-
$this->data['edulevel'] = self::LEVEL_OTHER;
48+
$this->data['crud'] = 'd';
49+
$this->data['edulevel'] = self::LEVEL_OTHER;
5050
$this->data['objecttable'] = 'moodleoverflow_discussions';
5151
}
5252

classes/event/discussion_subscription_created.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class discussion_subscription_created extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'c';
49-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
48+
$this->data['crud'] = 'c';
49+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
5050
$this->data['objecttable'] = 'moodleoverflow_discuss_subs';
5151
}
5252

classes/event/discussion_subscription_deleted.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class discussion_subscription_deleted extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'd';
49-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
48+
$this->data['crud'] = 'd';
49+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
5050
$this->data['objecttable'] = 'moodleoverflow_discuss_subs';
5151
}
5252

classes/event/discussion_viewed.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class discussion_viewed extends \core\event\base {
3939
* @return void
4040
*/
4141
protected function init() {
42-
$this->data['crud'] = 'r';
43-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
42+
$this->data['crud'] = 'r';
43+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
4444
$this->data['objecttable'] = 'moodleoverflow_discussions';
4545
}
4646

classes/event/post_created.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class post_created extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'c';
49-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
48+
$this->data['crud'] = 'c';
49+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
5050
$this->data['objecttable'] = 'moodleoverflow_posts';
5151
}
5252

classes/event/post_deleted.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class post_deleted extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'd';
49-
$this->data['edulevel'] = self::LEVEL_OTHER;
48+
$this->data['crud'] = 'd';
49+
$this->data['edulevel'] = self::LEVEL_OTHER;
5050
$this->data['objecttable'] = 'moodleoverflow_posts';
5151
}
5252

classes/event/post_updated.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class post_updated extends \core\event\base {
3838
* @return void
3939
*/
4040
protected function init() {
41-
$this->data['crud'] = 'u';
42-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
41+
$this->data['crud'] = 'u';
42+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
4343
$this->data['objecttable'] = 'moodleoverflow_posts';
4444
}
4545

classes/event/rating_created.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class rating_created extends \core\event\base {
3939
* @return void
4040
*/
4141
protected function init() {
42-
$this->data['crud'] = 'c';
43-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
42+
$this->data['crud'] = 'c';
43+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
4444
$this->data['objecttable'] = 'moodleoverflow_ratings';
4545
}
4646

classes/event/rating_deleted.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class rating_deleted extends \core\event\base {
3939
* @return void
4040
*/
4141
protected function init() {
42-
$this->data['crud'] = 'd';
43-
$this->data['edulevel'] = self::LEVEL_OTHER;
42+
$this->data['crud'] = 'd';
43+
$this->data['edulevel'] = self::LEVEL_OTHER;
4444
$this->data['objecttable'] = 'moodleoverflow_ratings';
4545
}
4646

classes/event/rating_updated.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class rating_updated extends \core\event\base {
3939
* @return void
4040
*/
4141
protected function init() {
42-
$this->data['crud'] = 'u';
43-
$this->data['edulevel'] = self::LEVEL_OTHER;
42+
$this->data['crud'] = 'u';
43+
$this->data['edulevel'] = self::LEVEL_OTHER;
4444
$this->data['objecttable'] = 'moodleoverflow_ratings';
4545
}
4646

classes/event/readtracking_disabled.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class readtracking_disabled extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'd';
48+
$this->data['crud'] = 'd';
4949
$this->data['edulevel'] = self::LEVEL_OTHER;
5050
}
5151

classes/event/readtracking_enabled.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class readtracking_enabled extends \core\event\base {
4545
* @return void
4646
*/
4747
protected function init() {
48-
$this->data['crud'] = 'c';
48+
$this->data['crud'] = 'c';
4949
$this->data['edulevel'] = self::LEVEL_OTHER;
5050
}
5151

classes/event/subscription_created.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class subscription_created extends \core\event\base {
4444
* @return void
4545
*/
4646
protected function init() {
47-
$this->data['crud'] = 'c';
48-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
47+
$this->data['crud'] = 'c';
48+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
4949
$this->data['objecttable'] = 'moodleoverflow_subscriptions';
5050
}
5151

classes/event/subscription_deleted.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class subscription_deleted extends \core\event\base {
4444
* @return void
4545
*/
4646
protected function init() {
47-
$this->data['crud'] = 'd';
48-
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
47+
$this->data['crud'] = 'd';
48+
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
4949
$this->data['objecttable'] = 'forum_subscriptions';
5050
}
5151

classes/observer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public static function role_assigned(\core\event\role_assigned $event) {
8787
$userid = $event->relateduserid;
8888

8989
// Retrieve all moodleoverflows in this course.
90-
$sql = "SELECT m.id, m.course as course, cm.id AS cmid, m.forcesubscribe
90+
$sql = "SELECT m.id, m.course as course, cm.id AS cmid, m.forcesubscribe
9191
FROM {moodleoverflow} m
9292
JOIN {course_modules} cm ON (cm.instance = m.id)
9393
JOIN {modules} mo ON (mo.id = cm.module)
9494
LEFT JOIN {moodleoverflow_subscriptions} ms ON (ms.moodleoverflow = m.id AND ms.userid = :userid)
9595
WHERE m.course = :courseid AND m.forcesubscribe = :initial AND mo.name = 'moodleoverflow' AND ms.id IS NULL";
96-
$params = array('courseid' => $context->instanceid,
96+
$params = array('courseid' => $context->instanceid,
9797
'userid' => $userid,
9898
'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE);
9999
$moodleoverflows = $DB->get_records_sql($sql, $params);

classes/output/email/renderer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function format_message_text($cm, $post) {
6363
'mod_moodleoverflow', 'post', $post->id);
6464

6565
// Initiate some options.
66-
$options = new \stdClass();
66+
$options = new \stdClass();
6767
$options->para = true;
6868

6969
// Return the message in html.

0 commit comments

Comments
 (0)