Пример #1
0
 function get_content()
 {
     global $CFG;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $context = context_system::instance();
     $this->content = new object();
     $this->content->text = '';
     $this->content->footer = '';
     $items = array();
     //check request permissions
     if (block_courserequest_can_do_request()) {
         $items[] = '<a href="' . $CFG->wwwroot . '/local/elisprogram/index.php?action=default&s=crp">' . get_string('courserequestpages', 'block_courserequest') . '</a>';
     }
     if (has_capability('block/courserequest:config', $context)) {
         //make sure custom fields are enabled for some context
         $allowclassfields = get_config('block_courserequest', 'use_class_fields') == '1';
         $allowcoursefields = get_config('block_courserequest', 'use_course_fields') == '1';
         if ($allowclassfields || $allowcoursefields) {
             $items[] = '<a href="' . $CFG->wwwroot . '/local/elisprogram/index.php?action=default&s=erp">' . get_string('editrequestpages', 'block_courserequest') . '</a>';
         }
     }
     if (has_capability('block/courserequest:approve', $context)) {
         $items[] = '<a href="' . $CFG->wwwroot . '/local/elisprogram/index.php?action=default&s=arp">' . get_string('approvependingrequests', 'block_courserequest') . '</a>';
     }
     if (!empty($items)) {
         $this->content->text .= implode('<br />', $items);
     }
     return $this->content;
 }
Пример #2
0
 /**
  * Checks permissions for the "Requests" tab
  *
  * @return  boolean  True if page access is allowed, otherwise false
  */
 function can_do_requests()
 {
     // check request permissions
     return block_courserequest_can_do_request();
 }