[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/tag/ -> pagelib.php (source)

   1  <?php
   2  
   3  require_once($CFG->libdir.'/pagelib.php');
   4  require_once ('lib.php');
   5  
   6  define('PAGE_TAG_INDEX', 'tag-index');
   7  define('TAG_FORMAT', 'tag');
   8  
   9  class page_tag extends page_base {
  10  
  11      var $tag_object = NULL;
  12      
  13      function get_type() {
  14          return PAGE_TAG_INDEX;
  15      }
  16  
  17      function user_allowed_editing() {
  18          $systemcontext = get_context_instance(CONTEXT_SYSTEM);
  19          return has_capability('moodle/tag:editblocks', $systemcontext);        
  20      }
  21  
  22      function user_is_editing() {
  23          global $USER;
  24  
  25          return (!empty($USER->editing));
  26      }
  27  
  28      
  29      function url_get_path() {
  30          global $CFG;
  31          return $CFG->wwwroot.'/tag/index.php';
  32  
  33      }
  34  
  35      function url_get_parameters() {
  36          $param = array();
  37          $param['id'] = $this->id;
  38          return $param;
  39      }
  40         
  41      function blocks_default_position() {
  42          return BLOCK_POS_LEFT;
  43      }
  44  
  45      function blocks_get_positions() {
  46          return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
  47      }
  48  
  49      function blocks_move_position(&$instance, $move) {
  50          if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
  51              return BLOCK_POS_RIGHT;
  52          } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
  53              return BLOCK_POS_LEFT;
  54          }
  55          return $instance->position;
  56      }
  57  
  58      function get_format_name() {
  59          return TAG_FORMAT;
  60      }
  61      
  62      //-----------  printing funtions -----------
  63      
  64      function print_header() {
  65  
  66          global $USER, $CFG;
  67  
  68          $tagname = tag_display_name($this->tag_object);
  69  
  70          $navlinks = array();
  71          $navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
  72          $navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
  73  
  74          $navigation = build_navigation($navlinks);
  75          $title = get_string('tag', 'tag') .' - '. $tagname;
  76          
  77          $button = '';
  78          if( $this->user_allowed_editing() ) {
  79              $button = update_tag_button($this->id);
  80          }
  81          print_header_simple($title, '', $navigation, '', '', '', $button);
  82      }    
  83      
  84      function print_footer() {
  85          print_footer();
  86      }
  87  }
  88  
  89  page_map_class(PAGE_TAG_INDEX, 'page_tag');
  90  
  91  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7