-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:AAU-P5-Moodle/moodle-2 into 10-home…
…work-teacher-feature-be-able-to-add-links-for-other-sources
- Loading branch information
Showing
447 changed files
with
203 additions
and
52,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Empty file.
59 changes: 0 additions & 59 deletions
59
server/moodle/admin/tool/mfa/factor/totp/extlib/OTPHP/composer.json
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
server/moodle/admin/tool/mfa/factor/totp/extlib/ParagonIE/ConstantTime/composer.json
This file was deleted.
Oops, something went wrong.
55 changes: 0 additions & 55 deletions
55
server/moodle/auth/cas/CAS/vendor/apereo/phpcas/composer.json
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,9 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Block definition class for the block_homeworkfeed plugin. | ||
* Block definition class for the block_homework plugin. | ||
* | ||
* @package block_homeworkfeed | ||
* @package block_homework | ||
* @copyright Year, You Name <[email protected]> | ||
* @author group 11 | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
|
@@ -26,11 +26,12 @@ | |
// Checks for Moodle environment | ||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
class block_homeworkfeed extends block_base { | ||
|
||
class block_homework extends block_base { | ||
|
||
//constructor for the block | ||
public function init() { | ||
$this->title = get_string('homeworkfeed', 'block_homeworkfeed'); | ||
$this->title = get_string('homework', 'block_homework'); | ||
} | ||
|
||
/** | ||
|
@@ -40,7 +41,7 @@ public function get_content() { | |
|
||
global $OUTPUT, $PAGE, $DB; | ||
|
||
$homeworks = $DB->get_records('Homework'); | ||
$homeworks = $DB->get_records('homework'); | ||
$data = []; | ||
|
||
if ($this->content !== null) { | ||
|
@@ -49,21 +50,25 @@ public function get_content() { | |
|
||
$this->content = new stdClass(); | ||
|
||
//If the current page is a course then remove unrelated homework | ||
if ($PAGE->pagetype == 'course-view-topics') { | ||
$homeworks = $this->filter_homework_content($PAGE->url, $homeworks); | ||
} | ||
|
||
foreach($homeworks as $homework) { | ||
$tmp = []; | ||
$tmp['name'] = $homework->name; | ||
$tmp['duedate'] = $homework->duedate; | ||
$tmp['description'] = $homework->description; | ||
$tmp['intro'] = strip_tags($homework->intro); | ||
$tmp['courseTitle'] = $DB->get_field('course', 'fullname', ['id' => $homework->course]); | ||
|
||
$files = []; | ||
|
||
//Get ids of homeworkfiles | ||
$fileids = []; | ||
$homeworkfiles = $DB->get_records('Files_homework', ['id'=>$homework->id]); | ||
$homeworkfiles = $DB->get_records('files_homework', ['files_id'=>$homework->id]); | ||
foreach ($homeworkfiles as $homeworkfile) { | ||
array_push($fileids, $homeworkfile->Files_id); | ||
array_push($fileids, $homeworkfile->files_id); | ||
} | ||
|
||
//Get file records | ||
|
@@ -103,22 +108,40 @@ public function get_content() { | |
array_push($data, $tmp); | ||
} | ||
|
||
|
||
// Render the content using a template and pass the homework data to it | ||
$this->content->text = $OUTPUT->render_from_template('block_homeworkfeed/data', ['data' => $data]); | ||
$this->content->text = $OUTPUT->render_from_template('block_homework/data', ['data' => $data]); | ||
|
||
// Include JavaScript functionality for scrolling behavior in the block | ||
$PAGE->requires->js_call_amd('block_homeworkfeed/scroll', 'init'); | ||
$PAGE->requires->js_call_amd('block_homework/scroll', 'init'); | ||
|
||
return $this->content; | ||
} | ||
|
||
public static function filter_homework_content($URL,$homeworks): array | ||
{ | ||
//Use a regex to remove everything but digits from the url | ||
$courseid = preg_replace('/\D/', '',$URL); | ||
$tmpHomeworks = []; | ||
|
||
//Check each homework to see if the course matches the id | ||
foreach ($homeworks as $homework) { | ||
if($courseid == $homework->course){ | ||
array_push($tmpHomeworks, $homework); | ||
} | ||
} | ||
return $tmpHomeworks; | ||
} | ||
|
||
|
||
/** | ||
* Specifies where this block can be displayed in Moodle | ||
*/ | ||
public function applicable_formats() { | ||
return [ | ||
'admin' => false, | ||
'site-index' => false, | ||
'course-view' => false, | ||
'course-view' => true, | ||
'mod' => false, | ||
'my' => true, | ||
]; | ||
|
8 changes: 4 additions & 4 deletions
8
.../moodle/blocks/homeworkfeed/db/access.php → server/moodle/blocks/homework/db/access.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<?php | ||
/** | ||
* Block definition class for the block_homeworkfeed plugin. | ||
* Block definition class for the block_homework plugin. | ||
* | ||
* @package block_homeworkfeed | ||
* @package block_homework | ||
* @copyright Year, You Name <[email protected]> | ||
* @author group 11 | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
$capabilities = [ | ||
'block/homeworkfeed:myaddinstance' => [ | ||
'block/homework:myaddinstance' => [ | ||
'captype' => 'write', | ||
'contextlevel' => CONTEXT_SYSTEM, | ||
'archetypes' => [ | ||
'user' => CAP_ALLOW | ||
], | ||
'clonepermissionsfrom' => 'moodle/my:manageblocks' | ||
], | ||
'block/homeworkfeed:addinstance' => [ | ||
'block/homework:addinstance' => [ | ||
'riskbitmask' => RISK_SPAM | RISK_XSS, | ||
'captype' => 'write', | ||
'contextlevel' => CONTEXT_BLOCK, | ||
|
Oops, something went wrong.