Search moodle.org's
Developer Documentation


  • Bug fixes for general core bugs in 2.8.x ended 9 November 2015 (12 months).
  • Bug fixes for security issues in 2.8.x ended 9 May 2016 (18 months).
  • minimum PHP 5.4.4 (always use latest PHP 5.4.x or 5.5.x on Windows - http://windows.php.net/download/), PHP 7 is NOT supported
  • Differences Between: [Versions 28 and 30] [Versions 28 and 31] [Versions 28 and 32] [Versions 28 and 33] [Versions 28 and 34] [Versions 28 and 35] [Versions 28 and 36] [Versions 28 and 37]

       1  <?php
       2      if (!isset($sortorder)) {
       3          $sortorder = '';
       4      }
       5      if (!isset($sortkey)) {
       6          $sortkey = '';
       7      }
       8  
       9      //make sure variables are properly cleaned
      10      $sortkey   = clean_param($sortkey, PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
      11      $sortorder = clean_param($sortorder, PARAM_ALPHA);   // it defines the order of the sorting (ASC or DESC)
      12  
      13      $toolsrow = array();
      14      $browserow = array();
      15      $inactive = array();
      16      $activated = array();
      17  
      18      if (!has_capability('mod/glossary:approve', $context) && $tab == GLOSSARY_APPROVAL_VIEW) {
      19      /// Non-teachers going to approval view go to defaulttab
      20          $tab = $defaulttab;
      21      }
      22  
      23  
      24      $browserow[] = new tabobject(GLOSSARY_STANDARD_VIEW,
      25                                   $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&amp;mode=letter',
      26                                   get_string('standardview', 'glossary'));
      27  
      28      $browserow[] = new tabobject(GLOSSARY_CATEGORY_VIEW,
      29                                   $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&amp;mode=cat',
      30                                   get_string('categoryview', 'glossary'));
      31  
      32      $browserow[] = new tabobject(GLOSSARY_DATE_VIEW,
      33                                   $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&amp;mode=date',
      34                                   get_string('dateview', 'glossary'));
      35  
      36      $browserow[] = new tabobject(GLOSSARY_AUTHOR_VIEW,
      37                                   $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&amp;mode=author',
      38                                   get_string('authorview', 'glossary'));
      39  
      40      if ($tab < GLOSSARY_STANDARD_VIEW || $tab > GLOSSARY_AUTHOR_VIEW) {   // We are on second row
      41          $inactive = array('edit');
      42          $activated = array('edit');
      43  
      44          $browserow[] = new tabobject('edit', '#', get_string('edit'));
      45      }
      46  
      47  /// Put all this info together
      48  
      49      $tabrows = array();
      50      $tabrows[] = $browserow;     // Always put these at the top
      51      if ($toolsrow) {
      52          $tabrows[] = $toolsrow;
      53      }
      54  
      55  
      56  ?>
      57    <div class="glossarydisplay">
      58  
      59  
      60  <?php if ($showcommonelements) { print_tabs($tabrows, $tab, $inactive, $activated); } ?>
      61  
      62    <div class="entrybox">
      63  
      64  <?php
      65  
      66      if (!isset($category)) {
      67          $category = "";
      68      }
      69  
      70  
      71      switch ($tab) {
      72          case GLOSSARY_CATEGORY_VIEW:
      73              glossary_print_categories_menu($cm, $glossary, $hook, $category);
      74          break;
      75          case GLOSSARY_APPROVAL_VIEW:
      76              glossary_print_approval_menu($cm, $glossary, $mode, $hook, $sortkey, $sortorder);
      77          break;
      78          case GLOSSARY_AUTHOR_VIEW:
      79              $search = "";
      80              glossary_print_author_menu($cm, $glossary, "author", $hook, $sortkey, $sortorder, 'print');
      81          break;
      82          case GLOSSARY_IMPORT_VIEW:
      83              $search = "";
      84              $l = "";
      85              glossary_print_import_menu($cm, $glossary, 'import', $hook, $sortkey, $sortorder);
      86          break;
      87          case GLOSSARY_EXPORT_VIEW:
      88              $search = "";
      89              $l = "";
      90              glossary_print_export_menu($cm, $glossary, 'export', $hook, $sortkey, $sortorder);
      91          break;
      92          case GLOSSARY_DATE_VIEW:
      93              if (!$sortkey) {
      94                  $sortkey = 'UPDATE';
      95              }
      96              if (!$sortorder) {
      97                  $sortorder = 'desc';
      98              }
      99              glossary_print_alphabet_menu($cm, $glossary, "date", $hook, $sortkey, $sortorder);
     100          break;
     101          case GLOSSARY_STANDARD_VIEW:
     102          default:
     103              glossary_print_alphabet_menu($cm, $glossary, "letter", $hook, $sortkey, $sortorder);
     104              if ($mode == 'search' and $hook) {
     105                  echo html_writer::tag('div', "$strsearch: $hook");
     106              }
     107          break;
     108      }
     109      echo html_writer::empty_tag('hr');
     110  ?>
    

    Search This Site: