mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
NEW FEATURE: Activity Link allows the teacher to display a link to another activity, which is in the same course,
at the end of the Lesson.
This commit is contained in:
parent
6db0b948cc
commit
114f47a79e
7 changed files with 71 additions and 1 deletions
|
@ -212,6 +212,10 @@ function lesson_upgrade($oldversion) {
|
|||
table_column('lesson', '', 'mediaheight', 'int', '10', 'unsigned', '100', 'not null', 'mediafile');
|
||||
table_column('lesson', '', 'mediawidth', 'int', '10', 'unsigned', '650', 'not null', 'mediafile');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005110200) {
|
||||
table_column('lesson', '', 'activitylink', 'int', '10', 'unsigned', '0', 'not null', 'tree');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ CREATE TABLE `prefix_lesson` (
|
|||
`maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`retake` int(3) unsigned NOT NULL default '1',
|
||||
`tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`activitylink` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`mediafile` varchar(255) NOT NULL default '',
|
||||
`mediaheight` INT(10) UNSIGNED NOT NULL DEFAULT '100',
|
||||
`mediawidth` INT(10) UNSIGNED NOT NULL DEFAULT '650',
|
||||
|
|
|
@ -294,6 +294,10 @@ function lesson_upgrade($oldversion) {
|
|||
table_column('lesson', '', 'mediawidth', 'INT', '10', 'unsigned', '650', 'not null', 'mediafile');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005110200) {
|
||||
table_column('lesson', '', 'activitylink', 'INT', '10', 'unsigned', '0', 'not null', 'tree');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ CREATE TABLE prefix_lesson (
|
|||
maxtime INT8 NOT NULL DEFAULT '0',
|
||||
retake INT NOT NULL default '1',
|
||||
tree INT NOT NULL DEFAULT '0',
|
||||
activitylink INT8 NOT NULL default '0',
|
||||
mediafile varchar(255) NOT NULL default '',
|
||||
mediaheight INT NOT NULL DEFAULT '100',
|
||||
mediawidth INT NOT NULL DEFAULT '650',
|
||||
|
|
|
@ -129,6 +129,9 @@ if ($form->mode == "add") {
|
|||
$form->completed = $conditions->completed;
|
||||
$form->gradebetterthan = $conditions->gradebetterthan;
|
||||
}
|
||||
if (!isset($form->activitylink)) {
|
||||
$form->activitylink = 0;
|
||||
}
|
||||
|
||||
$form->deleteattempts = "";
|
||||
|
||||
|
@ -536,6 +539,51 @@ if ($form->mode == "add") {
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("activitylink", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
// get the modules
|
||||
$mods = get_course_mods($form->course);
|
||||
$modinstances = array();
|
||||
foreach ($mods as $mod) {
|
||||
if ($mod->instance == $form->instance) { // don't add this lesson
|
||||
continue;
|
||||
}
|
||||
// get the module name and then store it in a new array
|
||||
if ($module = get_coursemodule_from_instance($mod->modname, $mod->instance, $form->course)) {
|
||||
$modinstances[$mod->modname][$module->id] = $module->name;
|
||||
}
|
||||
}
|
||||
ksort($modinstances); // sort by module name
|
||||
|
||||
// print out a select dropdown with optgroups
|
||||
echo '<select id="menuactivitylink" name="activitylink">';
|
||||
if ($form->activitylink == 0) {
|
||||
echo '<option selected="selected" value="0">'.get_string('none')."</option>\n";
|
||||
} else {
|
||||
echo '<option value="0">'.get_string('none')."</option>\n";
|
||||
}
|
||||
foreach ($modinstances as $module => $instances) {
|
||||
echo '<optgroup label="'.get_string('modulename', $module).'">'."\n";
|
||||
|
||||
asort($instances);
|
||||
foreach ($instances as $modid => $instance) {
|
||||
if ($form->activitylink == $modid) { // check for being selected
|
||||
echo '<option selected="selected" value="'.$modid.'">'.$instance."</option>\n";
|
||||
} else {
|
||||
echo '<option value="'.$modid.'">'.$instance."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
|
||||
helpbutton("activitylink", get_string("activitylink", "lesson"), "lesson");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><b><?php print_string("mediafile", "lesson"); ?>:</b></td>
|
||||
<td>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2005102800; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2005110200; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->requires = 2005021600; // Requires this Moodle version
|
||||
$module->cron = 0; // Period for cron to check this module (secs)
|
||||
|
||||
|
|
|
@ -1216,6 +1216,18 @@
|
|||
} elseif ($lesson->modattempts && isteacher($course->id)) {
|
||||
echo "<p align=\"center\">".get_string("modattemptsnoteacher", "lesson")."</p>";
|
||||
}
|
||||
|
||||
if ($lesson->activitylink) {
|
||||
if ($module = get_record('course_modules', 'id', $lesson->activitylink)) {
|
||||
if ($modname = get_field('modules', 'name', 'id', $module->module))
|
||||
if ($instance = get_record($modname, 'id', $module->instance)) {
|
||||
echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\">".
|
||||
"<a href=\"$CFG->wwwroot/mod/$modname/view.php?id=$instance->id\">".
|
||||
get_string('activitylinkname', 'lesson', $instance->name)."</a></div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a></div>\n"; // Back to the menu (course view).
|
||||
echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"../../grade/index.php?id=$course->id\">".get_string("viewgrades", "lesson")."</a></div>\n"; //view grades
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue