mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-11672, hide hidden assignment descriptions from calendar
This commit is contained in:
parent
5779b901e8
commit
dc6cb74efd
3 changed files with 52 additions and 1 deletions
|
@ -419,6 +419,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
|
||||||
if($events !== false) {
|
if($events !== false) {
|
||||||
|
|
||||||
foreach($events as $event) {
|
foreach($events as $event) {
|
||||||
|
|
||||||
if(!empty($event->modulename)) {
|
if(!empty($event->modulename)) {
|
||||||
$mod = get_coursemodule_from_instance($event->modulename, $event->instance);
|
$mod = get_coursemodule_from_instance($event->modulename, $event->instance);
|
||||||
if (!groups_course_module_visible($mod)) {
|
if (!groups_course_module_visible($mod)) {
|
||||||
|
@ -426,6 +427,30 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($event->modulename == 'assignment'){
|
||||||
|
if(!calendar_edit_event_allowed($event)){ // cannot manage entries, eg. student
|
||||||
|
if(!$assignment = get_record('assignment','id',$event->instance)){
|
||||||
|
// error("assignment ID was incorrect");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// assign assignment to assignment object to use hidden_is_hidden method
|
||||||
|
require_once($CFG->dirroot.'/mod/assignment/lib.php');
|
||||||
|
|
||||||
|
if (!file_exists($CFG->dirroot.'/mod/assignment/type/'.$assignment->assignmenttype.'/assignment.class.php')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
require_once ($CFG->dirroot.'/mod/assignment/type/'.$assignment->assignmenttype.'/assignment.class.php');
|
||||||
|
|
||||||
|
$assignmentclass = 'assignment_'.$assignment->assignmenttype;
|
||||||
|
$assignmentinstance = new $assignmentclass($mod->id,$assignment);
|
||||||
|
|
||||||
|
if ($assignmentinstance->description_is_hidden()){//force not to show description before availability
|
||||||
|
$event->description = get_string('notavailableyet', 'assignment');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($processed >= $display->maxevents) {
|
if($processed >= $display->maxevents) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ class assignment_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$graded_date = $grade->dategraded;
|
$graded_date = $grade->dategraded;
|
||||||
$graded_by = $grade->usermodified;
|
$graded_by = $grade->usermodified;
|
||||||
|
|
||||||
/// We need the teacher info
|
/// We need the teacher info
|
||||||
$teacher = get_record('user', 'id', $graded_by);
|
$teacher = get_record('user', 'id', $graded_by);
|
||||||
|
@ -1729,6 +1729,22 @@ class assignment_base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return true if is set description is hidden till available date
|
||||||
|
*
|
||||||
|
* This is needed by calendar so that hidden descriptions do not
|
||||||
|
* come up in upcoming events.
|
||||||
|
*
|
||||||
|
* Check that description is hidden till available date
|
||||||
|
* By default return false
|
||||||
|
* Assignments types should implement this method if needed
|
||||||
|
* @return boolen
|
||||||
|
*/
|
||||||
|
function description_is_hidden() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an outline of the user's interaction with the assignment
|
* Return an outline of the user's interaction with the assignment
|
||||||
*
|
*
|
||||||
|
|
|
@ -205,6 +205,16 @@ class assignment_upload extends assignment_base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return true if var3 == hide description till available day
|
||||||
|
*
|
||||||
|
*@return boolean
|
||||||
|
*/
|
||||||
|
function description_is_hidden() {
|
||||||
|
return ($this->assignment->var3 && (time() <= $this->assignment->timeavailable));
|
||||||
|
}
|
||||||
|
|
||||||
function custom_feedbackform($submission, $return=false) {
|
function custom_feedbackform($submission, $return=false) {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue