Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

*** empty log message ***

  • Loading branch information...
commit 22792afb0d49bc130863503895bab4e1d3c58a8d 1 parent 2b0f65e
luizlaydner authored

Showing 1 changed file with 105 additions and 0 deletions. Show diff stats Hide diff stats

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

0 comments on commit 22792af

Please sign in to comment.
Something went wrong with that request. Please try again.