[ Index ]

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

title

Body

[close]

/my/ -> pagelib.php (source)

   1  <?php  //$Id: pagelib.php,v 1.11.2.3 2008/09/15 11:29:24 mudrd8mz Exp $
   2  
   3  require_once($CFG->libdir.'/pagelib.php');
   4  
   5  class page_my_moodle extends page_base {
   6  
   7      function get_type() {
   8          return PAGE_MY_MOODLE;
   9      }
  10  
  11      function user_allowed_editing() {
  12          page_id_and_class($id,$class);
  13          if ($id == PAGE_MY_MOODLE) {
  14              return true;
  15          } else if (has_capability('moodle/my:manageblocks', get_context_instance(CONTEXT_SYSTEM)) && defined('ADMIN_STICKYBLOCKS')) {
  16              return true;
  17          }
  18          return false;
  19      }
  20  
  21      function user_is_editing() {
  22          global $USER;
  23          if (has_capability('moodle/my:manageblocks', get_context_instance(CONTEXT_SYSTEM)) && defined('ADMIN_STICKYBLOCKS')) {
  24              return true;
  25          }
  26          return (!empty($USER->editing));
  27      }
  28  
  29      function print_header($title) {
  30  
  31          global $USER, $CFG;
  32  
  33          $replacements = array(
  34                                '%fullname%' => get_string('mymoodle','my')
  35          );
  36          foreach($replacements as $search => $replace) {
  37              $title = str_replace($search, $replace, $title);
  38          }
  39  
  40          $site = get_site();
  41  
  42          $button = update_mymoodle_icon($USER->id);
  43          $nav = get_string('mymoodle','my');
  44          $header = $site->shortname.': '.$nav;
  45          $navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
  46          $navigation = build_navigation($navlinks);
  47          
  48          $loggedinas = user_login_string($site);
  49  
  50          if (empty($CFG->langmenu)) {
  51              $langmenu = '';
  52          } else {
  53              $currlang = current_language();
  54              $langs = get_list_of_languages();
  55              $langlabel = get_accesshide(get_string('language'));
  56              $langmenu = popup_form($CFG->wwwroot .'/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
  57          }
  58  
  59          print_header($title, $header,$navigation,'','',true, $button, $loggedinas.$langmenu);
  60  
  61      }
  62      
  63      function url_get_path() {
  64          global $CFG;
  65          page_id_and_class($id,$class);
  66          if ($id == PAGE_MY_MOODLE) {
  67              return $CFG->wwwroot.'/my/index.php';
  68          } elseif (defined('ADMIN_STICKYBLOCKS')){
  69              return $CFG->wwwroot.'/'.$CFG->admin.'/stickyblocks.php';
  70          }
  71      }
  72  
  73      function url_get_parameters() {
  74          if (defined('ADMIN_STICKYBLOCKS')) {
  75              return array('pt' => ADMIN_STICKYBLOCKS);
  76          } else {
  77              return array();
  78          }
  79      }
  80         
  81      function blocks_default_position() {
  82          return BLOCK_POS_LEFT;
  83      }
  84  
  85      function blocks_get_positions() {
  86          return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
  87      }
  88  
  89      function blocks_move_position(&$instance, $move) {
  90          if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
  91              return BLOCK_POS_RIGHT;
  92          } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
  93              return BLOCK_POS_LEFT;
  94          }
  95          return $instance->position;
  96      }
  97  
  98      function get_format_name() {
  99          return MY_MOODLE_FORMAT;
 100      }
 101  }
 102  
 103  
 104  define('PAGE_MY_MOODLE',   'my-index');
 105  define('MY_MOODLE_FORMAT', 'my'); //doing this so we don't run into problems with applicable formats.
 106  
 107  page_map_class(PAGE_MY_MOODLE, 'page_my_moodle');
 108  
 109  ?>


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