See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
1 <?php 2 /////////////////////////////////////////////////////////////////////////// 3 // // 4 // NOTICE OF COPYRIGHT // 5 // // 6 // Moodle - Modular Object-Oriented Dynamic Learning Environment // 7 // http://moodle.org // 8 // // 9 // Copyright (C) 2005 Martin Dougiamas http://dougiamas.com // 10 // // 11 // This program is free software; you can redistribute it and/or modify // 12 // it under the terms of the GNU General Public License as published by // 13 // the Free Software Foundation; either version 2 of the License, or // 14 // (at your option) any later version. // 15 // // 16 // This program is distributed in the hope that it will be useful, // 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 19 // GNU General Public License for more details: // 20 // // 21 // http://www.gnu.org/copyleft/gpl.html // 22 // // 23 /////////////////////////////////////////////////////////////////////////// 24 25 // This file to be included so we can assume config.php has already been included. 26 // We also assume that $user, $course, $currenttab have been set 27 28 29 if (empty($currenttab) or empty($data) or empty($course)) { 30 throw new \moodle_exception('cannotcallscript'); 31 } 32 33 $context = context_module::instance($cm->id); 34 35 $row = array(); 36 37 $row[] = new tabobject('list', new moodle_url('/mod/data/view.php', array('d' => $data->id)), get_string('list','data')); 38 39 if (isset($record)) { 40 $row[] = new tabobject('single', new moodle_url('/mod/data/view.php', array('d' => $data->id, 'rid' => $record->id)), get_string('single','data')); 41 } else { 42 $row[] = new tabobject('single', new moodle_url('/mod/data/view.php', array('d' => $data->id, 'mode' => 'single')), get_string('single','data')); 43 } 44 45 // Add an advanced search tab. 46 $row[] = new tabobject('asearch', new moodle_url('/mod/data/view.php', array('d' => $data->id, 'mode' => 'asearch')), get_string('search', 'data')); 47 48 if (isloggedin()) { // just a perf shortcut 49 if (data_user_can_add_entry($data, $currentgroup, $groupmode, $context)) { // took out participation list here! 50 $addstring = empty($editentry) ? get_string('add', 'data') : get_string('editentry', 'data'); 51 $row[] = new tabobject('add', new moodle_url('/mod/data/edit.php', array('d' => $data->id)), $addstring); 52 } 53 if (has_capability(DATA_CAP_EXPORT, $context)) { 54 // The capability required to Export database records is centrally defined in 'lib.php' 55 // and should be weaker than those required to edit Templates, Fields and Presets. 56 $row[] = new tabobject('export', new moodle_url('/mod/data/export.php', array('d' => $data->id)), 57 get_string('export', 'data')); 58 } 59 if (has_capability('mod/data:managetemplates', $context)) { 60 if ($currenttab == 'list') { 61 $defaultemplate = 'listtemplate'; 62 } else if ($currenttab == 'add') { 63 $defaultemplate = 'addtemplate'; 64 } else if ($currenttab == 'asearch') { 65 $defaultemplate = 'asearchtemplate'; 66 } else { 67 $defaultemplate = 'singletemplate'; 68 } 69 70 $templatestab = new tabobject('templates', new moodle_url('/mod/data/templates.php', array('d' => $data->id, 'mode' => $defaultemplate)), 71 get_string('templates','data')); 72 $row[] = $templatestab; 73 $row[] = new tabobject('fields', new moodle_url('/mod/data/field.php', array('d' => $data->id)), 74 get_string('fields','data')); 75 $row[] = new tabobject('presets', new moodle_url('/mod/data/preset.php', array('d' => $data->id)), 76 get_string('presets', 'data')); 77 } 78 } 79 80 if ($currenttab == 'templates' and isset($mode) && isset($templatestab)) { 81 $templatestab->inactive = true; 82 $templatelist = array ('listtemplate', 'singletemplate', 'asearchtemplate', 'addtemplate', 'rsstemplate', 'csstemplate', 'jstemplate'); 83 84 $currenttab =''; 85 foreach ($templatelist as $template) { 86 $templatestab->subtree[] = new tabobject($template, new moodle_url('/mod/data/templates.php', array('d' => $data->id, 'mode' => $template)), get_string($template, 'data')); 87 if ($template == $mode) { 88 $currenttab = $template; 89 } 90 } 91 if ($currenttab == '') { 92 $currenttab = $mode = 'singletemplate'; 93 } 94 } 95 96 // Print out the tabs and continue! 97 echo $OUTPUT->tabtree($row, $currenttab); 98 99
title
Description
Body
title
Description
Body
title
Description
Body
title
Body