Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * prints the tabbed bar
  19   *
  20   * @author Andreas Grabs
  21   * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  22   * @package mod_feedback
  23   */
  24  defined('MOODLE_INTERNAL') OR die('not allowed');
  25  
  26  $tabs = array();
  27  $row  = array();
  28  $inactive = array();
  29  $activated = array();
  30  
  31  //some pages deliver the cmid instead the id
  32  if (isset($cmid) AND intval($cmid) AND $cmid > 0) {
  33      $usedid = $cmid;
  34  } else {
  35      $usedid = $id;
  36  }
  37  
  38  $context = context_module::instance($usedid);
  39  
  40  $courseid = optional_param('courseid', false, PARAM_INT);
  41  // $current_tab = $SESSION->feedback->current_tab;
  42  if (!isset($current_tab)) {
  43      $current_tab = '';
  44  }
  45  
  46  $viewurl = new moodle_url('/mod/feedback/view.php', array('id' => $usedid));
  47  $row[] = new tabobject('view', $viewurl->out(), get_string('overview', 'feedback'));
  48  $urlparams = ['id' => $usedid];
  49  if ($feedback->course == SITEID && $courseid) {
  50      $urlparams['courseid'] = $courseid;
  51  }
  52  
  53  if (has_capability('mod/feedback:edititems', $context)) {
  54      $editurl = new moodle_url('/mod/feedback/edit.php', $urlparams + ['do_show' => 'edit']);
  55      $row[] = new tabobject('edit', $editurl->out(), get_string('edit_items', 'feedback'));
  56  
  57      $templateurl = new moodle_url('/mod/feedback/edit.php', $urlparams + ['do_show' => 'templates']);
  58      $row[] = new tabobject('templates', $templateurl->out(), get_string('templates', 'feedback'));
  59  }
  60  
  61  if ($feedback->course == SITEID && has_capability('mod/feedback:mapcourse', $context)) {
  62      $mapurl = new moodle_url('/mod/feedback/mapcourse.php', $urlparams);
  63      $row[] = new tabobject('mapcourse', $mapurl->out(), get_string('mappedcourses', 'feedback'));
  64  }
  65  
  66  if (has_capability('mod/feedback:viewreports', $context)) {
  67      if ($feedback->course == SITEID) {
  68          $analysisurl = new moodle_url('/mod/feedback/analysis_course.php', $urlparams);
  69      } else {
  70          $analysisurl = new moodle_url('/mod/feedback/analysis.php', $urlparams);
  71      }
  72      $row[] = new tabobject('analysis', $analysisurl->out(), get_string('analysis', 'feedback'));
  73  
  74      $reporturl = new moodle_url('/mod/feedback/show_entries.php', $urlparams);
  75      $row[] = new tabobject('showentries',
  76                              $reporturl->out(),
  77                              get_string('show_entries', 'feedback'));
  78  
  79      if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO AND $feedback->course != SITEID) {
  80          $nonrespondenturl = new moodle_url('/mod/feedback/show_nonrespondents.php', $urlparams);
  81          $row[] = new tabobject('nonrespondents',
  82                                  $nonrespondenturl->out(),
  83                                  get_string('show_nonrespondents', 'feedback'));
  84      }
  85  }
  86  
  87  if (count($row) > 1) {
  88      $tabs[] = $row;
  89  
  90      print_tabs($tabs, $current_tab, $inactive, $activated);
  91  }
  92