]> git.mjollnir.org Git - moodle.git/commitdiff
Smarter links for the templates tab
authormoodler <moodler>
Sat, 25 Mar 2006 14:56:27 +0000 (14:56 +0000)
committermoodler <moodler>
Sat, 25 Mar 2006 14:56:27 +0000 (14:56 +0000)
mod/data/tabs.php

index b97edb7c4940746891c971b7d47056bf0dc426cc..32f570aa31b205fc37287167809c556f67e739aa 100755 (executable)
         $row[] = new tabobject('add', $CFG->wwwroot.'/mod/data/add.php?d='.$data->id, get_string('add','data'), '', true);
     }
     if (isteacher($course->id)) {
-        $row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&amp;mode=singletemplate', get_string('templates','data'));
+        if ($currenttab == 'browse') {
+            if (get_user_preferences('data_perpage') == 1) {
+                $defaultemplate = 'singletemplate';
+            } else {
+                $defaultemplate = 'listtemplate';
+            }
+        } else if ($currenttab == 'add') {
+            $defaultemplate = 'addtemplate';
+        } else {
+            $defaultemplate = 'singletemplate';
+        }
+
+        $row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&amp;mode='.$defaultemplate, get_string('templates','data'));
         $row[] = new tabobject('fields', $CFG->wwwroot.'/mod/data/field.php?d='.$data->id, get_string('fields','data'), '', true);
     }