[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/tag/ -> search.php (source)

   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * @package    core
  20   * @subpackage tag
  21   * @copyright  2007 Luiz Cruz <[email protected]>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  require_once('../config.php');
  26  require_once ('lib.php');
  27  require_once ('locallib.php');
  28  
  29  require_login();
  30  
  31  if (empty($CFG->usetags)) {
  32      print_error('tagsaredisabled', 'tag');
  33  }
  34  
  35  $query   = optional_param('query', '', PARAM_RAW);
  36  $page    = optional_param('page', 0, PARAM_INT); // which page to show
  37  $perpage = optional_param('perpage', 18, PARAM_INT);
  38  
  39  $params = array();
  40  if ($query !== '') {
  41      $params['query'] = $query;
  42  }
  43  if ($page !== 0) {
  44      $params['page'] = $page;
  45  }
  46  if ($perpage !== 18) {
  47      $params['perpage'] = $perpage;
  48  }
  49  $PAGE->set_url(new moodle_url('/tag/search.php', $params));
  50  $PAGE->set_context(context_system::instance());
  51  $PAGE->set_pagelayout('standard');
  52  
  53  $systemcontext = context_system::instance();
  54  $manage_link = '&nbsp;';
  55  
  56  $PAGE->set_title(get_string('tags', 'tag'));
  57  $PAGE->set_heading($SITE->fullname.': '.$PAGE->title);
  58  echo $OUTPUT->header();
  59  
  60  if ( has_capability('moodle/tag:manage',$systemcontext) ) {
  61      echo '<div class="managelink"><a href="'. $CFG->wwwroot .'/tag/manage.php">' . get_string('managetags', 'tag') . '</a></div>' ;
  62  }
  63  
  64  echo $OUTPUT->heading(get_string('searchtags', 'tag'), 2);
  65  
  66  tag_print_search_box();
  67  
  68  if(!empty($query)) {
  69       tag_print_search_results($query, $page, $perpage);
  70  }
  71  
  72  echo '<br/><br/>';
  73  
  74  echo $OUTPUT->box_start('generalbox', 'big-tag-cloud-box');
  75  tag_print_cloud(null, 150);
  76  echo $OUTPUT->box_end();
  77  
  78  echo $OUTPUT->footer();


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1