moodle_url PHP Class Code Examples

This page contains top rated real world PHP examples of class moodle_url extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: lib.php Project: evltuma/moodle
0
/**
 * Returns navigation controls (tabtree) to be displayed on cohort management pages
 *
 * @param context $context system or category context where cohorts controls are about to be displayed
 * @param moodle_url $currenturl
 * @return null|renderable
 */
function cohort_edit_controls(context $context, moodle_url $currenturl)
{
    $tabs = array();
    $currenttab = 'view';
    $viewurl = new moodle_url('/cohort/index.php', array('contextid' => $context->id));
    if ($searchquery = $currenturl->get_param('search')) {
        $viewurl->param('search', $searchquery);
    }
    if ($context->contextlevel == CONTEXT_SYSTEM) {
        $tabs[] = new tabobject('view', new moodle_url($viewurl, array('showall' => 0)), get_string('systemcohorts', 'cohort'));
        $tabs[] = new tabobject('viewall', new moodle_url($viewurl, array('showall' => 1)), get_string('allcohorts', 'cohort'));
        if ($currenturl->get_param('showall')) {
            $currenttab = 'viewall';
        }
    } else {
        $tabs[] = new tabobject('view', $viewurl, get_string('cohorts', 'cohort'));
    }
    if (has_capability('moodle/cohort:manage', $context)) {
        $addurl = new moodle_url('/cohort/edit.php', array('contextid' => $context->id));
        $tabs[] = new tabobject('addcohort', $addurl, get_string('addcohort', 'cohort'));
        if ($currenturl->get_path() === $addurl->get_path() && !$currenturl->param('id')) {
            $currenttab = 'addcohort';
        }
        $uploadurl = new moodle_url('/cohort/upload.php', array('contextid' => $context->id));
        $tabs[] = new tabobject('uploadcohorts', $uploadurl, get_string('uploadcohorts', 'cohort'));
        if ($currenturl->get_path() === $uploadurl->get_path()) {
            $currenttab = 'uploadcohorts';
        }
    }
    if (count($tabs) > 1) {
        return new tabtree($tabs, $currenttab);
    }
    return null;
}
Example #2
Show file File: renderer.php Project: EmmanuelYupit/educursos
0
 /**
  * Display basic information about lock instances.
  *
  * @todo Add some actions so that people can configure lock instances.
  *
  * @param array $locks
  * @return string
  */
 public function lock_summaries(array $locks)
 {
     $table = new html_table();
     $table->colclasses = array('name', 'type', 'default', 'uses', 'actions');
     $table->rowclasses = array('lock_name', 'lock_type', 'lock_default', 'lock_uses', 'lock_actions');
     $table->head = array(get_string('lockname', 'cache'), get_string('locktype', 'cache'), get_string('lockdefault', 'cache'), get_string('lockuses', 'cache'), get_string('actions', 'cache'));
     $table->data = array();
     $tick = $this->output->pix_icon('i/valid', '');
     foreach ($locks as $lock) {
         $actions = array();
         if ($lock['uses'] === 0 && !$lock['default']) {
             $url = new moodle_url('/cache/admin.php', array('lock' => $lock['name'], 'action' => 'deletelock', 'sesskey' => sesskey()));
             $actions[] = html_writer::link($url, get_string('delete', 'cache'));
         }
         $table->data[] = new html_table_row(array(new html_table_cell($lock['name']), new html_table_cell($lock['type']), new html_table_cell($lock['default'] ? $tick : ''), new html_table_cell($lock['uses']), new html_table_cell(join(' ', $actions))));
     }
     $url = new moodle_url('/cache/admin.php', array('action' => 'newlockinstance', 'sesskey' => sesskey()));
     $select = new single_select($url, 'lock', cache_administration_helper::get_addable_lock_options());
     $select->label = get_string('addnewlockinstance', 'cache');
     $html = html_writer::start_tag('div', array('id' => 'core-cache-lock-summary'));
     $html .= $this->output->heading(get_string('locksummary', 'cache'), 3);
     $html .= html_writer::table($table);
     $html .= html_writer::tag('div', $this->output->render($select), array('class' => 'new-instance'));
     $html .= html_writer::end_tag('div');
     return $html;
 }
Example #3
Show file File: block_feedback.php Project: bobpuffer/moodleUCLA-LUTH
0
 function get_content()
 {
     global $CFG, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
         $this->content->items = array(get_string('missing_feedback_module', 'block_feedback'));
         return $this->content;
     }
     $courseid = $this->page->course->id;
     if ($courseid <= 0) {
         $courseid = SITEID;
     }
     $icon = '<img src="' . $OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />';
     if (empty($this->instance->pageid)) {
         $this->instance->pageid = SITEID;
     }
     if ($feedbacks = feedback_get_feedbacks_from_sitecourse_map($courseid)) {
         $baseurl = new moodle_url('/mod/feedback/view.php');
         foreach ($feedbacks as $feedback) {
             $url = new moodle_url($baseurl);
             $url->params(array('id' => $feedback->cmid, 'courseid' => $courseid));
             $this->content->items[] = '<a href="' . $url->out() . '">' . $icon . $feedback->name . '</a>';
         }
     }
     return $this->content;
 }
Example #4
Show file File: lib.php Project: Gavinthisisit/Moodle
0
function chat_extend_navigation($navigation, $course, $module, $cm)
{
    global $CFG;
    $currentgroup = groups_get_activity_group($cm, true);
    if (has_capability('mod/chat:chat', context_module::instance($cm->id))) {
        $strenterchat = get_string('enterchat', 'chat');
        $target = $CFG->wwwroot . '/mod/chat/';
        $params = array('id' => $cm->instance);
        if ($currentgroup) {
            $params['groupid'] = $currentgroup;
        }
        $links = array();
        $url = new moodle_url($target . 'gui_' . $CFG->chat_method . '/index.php', $params);
        $action = new popup_action('click', $url, 'chat' . $course->id . $cm->instance . $currentgroup, array('height' => 500, 'width' => 700));
        $links[] = new action_link($url, $strenterchat, $action);
        $url = new moodle_url($target . 'gui_basic/index.php', $params);
        $action = new popup_action('click', $url, 'chat' . $course->id . $cm->instance . $currentgroup, array('height' => 500, 'width' => 700));
        $links[] = new action_link($url, get_string('noframesjs', 'message'), $action);
        foreach ($links as $link) {
            $navigation->add($link->text, $link, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/group', ''));
        }
    }
    $chatusers = chat_get_users($cm->instance, $currentgroup, $cm->groupingid);
    if (is_array($chatusers) && count($chatusers) > 0) {
        $users = $navigation->add(get_string('currentusers', 'chat'));
        foreach ($chatusers as $chatuser) {
            $userlink = new moodle_url('/user/view.php', array('id' => $chatuser->id, 'course' => $course->id));
            $users->add(fullname($chatuser) . ' ' . format_time(time() - $chatuser->lastmessageping), $userlink, navigation_node::TYPE_USER, null, null, new pix_icon('i/user', ''));
        }
    }
}
Example #5
Show file File: lib.php Project: ecampbell/moodle-booktool_wordimport
0
/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $node The node to add module settings to
 */
function booktool_wordimport_extend_settings_navigation(settings_navigation $settings, navigation_node $node)
{
    global $PAGE;
    if ($PAGE->cm->modname !== 'book') {
        return;
    }
    $params = $PAGE->url->params();
    if (empty($params['id']) and empty($params['cmid'])) {
        return;
    }
    if (empty($PAGE->cm->context)) {
        $PAGE->cm->context = get_context_module::instance($PAGE->cm->instance);
    }
    if (!(has_capability('booktool/wordimport:import', $PAGE->cm->context) and has_capability('mod/book:edit', $PAGE->cm->context))) {
        return;
    }
    // Configure Import link, and pass in the current chapter in case the insert should happen here rather than at the end.
    $url1 = new moodle_url('/mod/book/tool/wordimport/index.php', array('id' => $PAGE->cm->id, 'chapterid' => $params['chapterid']));
    $node->add(get_string('importchapters', 'booktool_wordimport'), $url1, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/document', '', 'moodle', array('class' => 'iconsmall', 'title' => '')));
    // Configure Export links for book and current chapter.
    $url2 = new moodle_url('/mod/book/tool/wordimport/index.php', array('id' => $PAGE->cm->id, 'action' => 'export'));
    $node->add(get_string('exportbook', 'booktool_wordimport'), $url2, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/document', '', 'moodle', array('class' => 'iconsmall', 'title' => '')));
    $url3 = new moodle_url('/mod/book/tool/wordimport/index.php', array('id' => $PAGE->cm->id, 'chapterid' => $params['chapterid'], 'action' => 'export'));
    $node->add(get_string('exportchapter', 'booktool_wordimport'), $url3, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/document', '', 'moodle', array('class' => 'iconsmall', 'title' => '')));
}
Example #6
Show file File: renderer.php Project: evltuma/moodle
0
 /**
  * Displays a course filter selector
  *
  * @param moodle_url $returnurl The URL that the user should be taken too upon selecting a course.
  * @param string $label The label to use for the course select.
  * @return string
  */
 protected function course_filter_selector(moodle_url $returnurl, $label = null)
 {
     global $USER, $SESSION, $CFG;
     if (!isloggedin() or isguestuser()) {
         return '';
     }
     if (has_capability('moodle/calendar:manageentries', context_system::instance()) && !empty($CFG->calendar_adminseesall)) {
         $courses = get_courses('all', 'c.shortname', 'c.id,c.shortname');
     } else {
         $courses = enrol_get_my_courses();
     }
     unset($courses[SITEID]);
     $courseoptions = array();
     $courseoptions[SITEID] = get_string('fulllistofcourses');
     foreach ($courses as $course) {
         $coursecontext = context_course::instance($course->id);
         $courseoptions[$course->id] = format_string($course->shortname, true, array('context' => $coursecontext));
     }
     if ($this->page->course->id !== SITEID) {
         $selected = $this->page->course->id;
     } else {
         $selected = '';
     }
     $courseurl = new moodle_url($returnurl);
     $courseurl->remove_params('course');
     $select = new single_select($courseurl, 'course', $courseoptions, $selected, null);
     $select->class = 'cal_courses_flt';
     if ($label !== null) {
         $select->set_label($label);
     } else {
         $select->set_label(get_string('listofcourses'), array('class' => 'accesshide'));
     }
     return $this->output->render($select);
 }
Example #7
Show file File: renderer.php Project: 375michael40veit/moodle-mod_booking
0
 /**
  * render userbookings for the whole site sorted per user
  * @param array $userbookings
  * @return string rendered html
  */
 public function render_bookings_per_user($userbookings)
 {
     $output = html_writer::div(' ');
     $items = array();
     foreach ($userbookings as $userid => $options) {
         $items = array();
         foreach ($options as $optionid => $user) {
             // if the user is visible in only one booking instance, than show the user otherwise do not show
             if ($user->status[$optionid]->bookingvisible) {
                 $bookinginstanceurl = new moodle_url('/mod/booking/view.php', array('id' => $user->status[$optionid]->bookingcmid));
                 $bookingcourseurl = new moodle_url('/course/view.php', array('id' => $user->status[$optionid]->courseid));
                 $bookinglink = html_writer::link($bookinginstanceurl, $user->status[$optionid]->bookingtitle);
                 $courselink = html_writer::link($bookingcourseurl, $user->status[$optionid]->coursename);
                 $html = html_writer::span($user->status[$optionid]->bookingoptiontitle . " {$bookinglink}.  {$courselink} " . get_string($user->status[$optionid]->booked, 'booking'));
                 $items[] = $html;
             }
         }
         if (!empty($items)) {
             $user = reset($options);
             $output .= html_writer::tag('span', $this->output->user_picture($user) . " " . fullname($user)) . " ";
             $output .= html_writer::link('mailto:' . $user->email, $user->email);
             $output .= html_writer::alist($items);
         }
     }
     return $output;
 }
Example #8
Show file File: tag.php Project: alanaipe2015/moodle
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     global $CFG;
     require_once $CFG->libdir . '/externallib.php';
     $r = new stdClass();
     $r->id = (int) $this->record->id;
     $r->rawname = clean_param($this->record->rawname, PARAM_TAG);
     $r->name = clean_param($this->record->name, PARAM_TAG);
     $format = clean_param($this->record->descriptionformat, PARAM_INT);
     list($r->description, $r->descriptionformat) = external_format_text($this->record->description, $format, \context_system::instance()->id, 'core', 'tag', $r->id);
     $r->flag = clean_param($this->record->flag, PARAM_INT);
     if (isset($this->record->official)) {
         $r->official = clean_param($this->record->official, PARAM_INT);
     } else {
         $r->official = $this->record->tagtype === 'official' ? 1 : 0;
     }
     $url = new moodle_url('/tag/index.php', array('id' => $this->record->id));
     $r->viewurl = $url->out(false);
     $manageurl = new moodle_url('/tag/manage.php', array('sesskey' => sesskey(), 'tagid' => $this->record->id));
     $url = new moodle_url($manageurl);
     $url->param('action', 'changetype');
     $url->param('tagtype', $r->official ? 'default' : 'official');
     $r->changetypeurl = $url->out(false);
     $url = new moodle_url($manageurl);
     $url->param('action', $this->record->flag ? 'resetflag' : 'setflag');
     $r->changeflagurl = $url->out(false);
     return $r;
 }
Example #9
Show file File: core_renderer.php Project: antoniorodrigues/redes-digitais
0
 public function earlier_user_menu()
 {
     global $USER, $CFG, $OUTPUT;
     if ($CFG->branch > "27") {
         return '';
     }
     $uname = fullname($USER, true);
     $dlink = new moodle_url("/my");
     $plink = new moodle_url("/user/profile.php", array("id" => $USER->id));
     $lo = new moodle_url('/login/logout.php', array('sesskey' => sesskey()));
     $content = '<li class="dropdown no-divider">
     <a class="dropdown-toggle"
     data-toggle="dropdown"
     href="#">
     ' . $uname . '
     <i class="fa fa-chevron-down"></i><span class="caretup"></span>
     </a>
     <ul class="dropdown-menu">
     <li><a href="' . $dlink . '">Dashboard</a></li>
     <li><a href="' . $plink . '">Profile</a></li>
     <li><a href="' . $lo . '">Logout</a></li>
     </ul>
     </li>';
     return $content;
 }
Example #10
Show file File: manage_table.php Project: evltuma/moodle
0
 /**
  * Generate the edit column.
  *
  * @param \stdClass $tool event data.
  * @return string
  */
 public function col_edit($tool)
 {
     global $OUTPUT;
     $buttons = array();
     $instance = new \stdClass();
     $instance->id = $tool->enrolid;
     $instance->courseid = $tool->courseid;
     $instance->enrol = 'lti';
     $instance->status = $tool->status;
     $strdelete = get_string('delete');
     $strenable = get_string('enable');
     $strdisable = get_string('disable');
     $url = new \moodle_url('/enrol/lti/index.php', array('sesskey' => sesskey(), 'courseid' => $this->courseid));
     if ($this->ltiplugin->can_delete_instance($instance)) {
         $aurl = new \moodle_url($url, array('action' => 'delete', 'instanceid' => $instance->id));
         $buttons[] = $OUTPUT->action_icon($aurl, new \pix_icon('t/delete', $strdelete, 'core', array('class' => 'iconsmall')));
     }
     if ($this->ltienabled && $this->ltiplugin->can_hide_show_instance($instance)) {
         if ($instance->status == ENROL_INSTANCE_ENABLED) {
             $aurl = new \moodle_url($url, array('action' => 'disable', 'instanceid' => $instance->id));
             $buttons[] = $OUTPUT->action_icon($aurl, new \pix_icon('t/hide', $strdisable, 'core', array('class' => 'iconsmall')));
         } else {
             if ($instance->status == ENROL_INSTANCE_DISABLED) {
                 $aurl = new \moodle_url($url, array('action' => 'enable', 'instanceid' => $instance->id));
                 $buttons[] = $OUTPUT->action_icon($aurl, new \pix_icon('t/show', $strenable, 'core', array('class' => 'iconsmall')));
             }
         }
     }
     if ($this->ltienabled && $this->canconfig) {
         $linkparams = array('courseid' => $instance->courseid, 'id' => $instance->id, 'type' => $instance->enrol, 'returnurl' => new \moodle_url('/enrol/lti/index.php', array('courseid' => $this->courseid)));
         $editlink = new \moodle_url("/enrol/editinstance.php", $linkparams);
         $buttons[] = $OUTPUT->action_icon($editlink, new \pix_icon('t/edit', get_string('edit'), 'core', array('class' => 'iconsmall')));
     }
     return implode(' ', $buttons);
 }
Example #11
Show file File: renderers.php Project: EmmanuelYupit/educursos
0
 /**
  * Renders a custom menu object (located in outputcomponents.php)
  *
  * The custom menu this method override the render_custom_menu function
  * in outputrenderers.php
  * @staticvar int $menucount
  * @param custom_menu $menu
  * @return string
  */
 protected function render_custom_menu(custom_menu $menu)
 {
     // If the menu has no children return an empty string
     if (!$menu->has_children()) {
         return '';
     }
     // Add a login or logout link
     if (isloggedin()) {
         $branchlabel = get_string('logout');
         $branchurl = new moodle_url('/login/logout.php');
     } else {
         $branchlabel = get_string('login');
         $branchurl = new moodle_url('/login/index.php');
     }
     $branch = $menu->add($branchlabel, $branchurl, $branchlabel, -1);
     // Initialise this custom menu
     $content = html_writer::start_tag('ul', array('class' => 'dropdown dropdown-horizontal'));
     // Render each child
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item);
     }
     // Close the open tags
     $content .= html_writer::end_tag('ul');
     // Return the custom menu
     return $content;
 }
Example #12
Show file File: award_criteria_overall.php Project: evltuma/moodle
0
 /**
  * Add appropriate form elements to the criteria form
  *
  * @param stdClass $data details of overall criterion
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $prefix = 'criteria-' . $this->id;
     if (count($data->criteria) > 2) {
         echo $OUTPUT->box_start();
         if (!empty($this->description)) {
             $badge = new badge($this->badgeid);
             echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
         }
         echo $OUTPUT->heading($this->get_title(), 2);
         $agg = $data->get_aggregation_methods();
         if (!$data->is_locked() && !$data->is_active()) {
             $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
             $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
             echo $OUTPUT->box($editaction, array('criteria-header'));
             $url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
             echo $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null, null, array('aria-describedby' => 'overall'));
             echo html_writer::span(get_string('overallcrit', 'badges'), '', array('id' => 'overall'));
         } else {
             echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
         }
         echo $OUTPUT->box_end();
     }
 }
Example #13
Show file File: renderer.php Project: Gavinthisisit/Moodle
0
 /**
  * Returns information about the current reviewees of the given participant and a selector do add new one
  *
  * @return string html code
  */
 protected function helper_reviewees_of_participant(stdclass $allocation, array $userinfo, array $authors, $selfassessment)
 {
     $o = '';
     if (is_null($allocation->submissionid)) {
         $o .= $this->output->container(get_string('withoutsubmission', 'teamwork'), 'info');
     }
     $exclude = array();
     if (!$selfassessment) {
         $exclude[$allocation->userid] = true;
         $o .= $this->output->container(get_string('selfassessmentdisabled', 'teamwork'), 'info');
     }
     // todo add an option to exclude users without own submission
     $options = array_diff_key($authors, $exclude);
     if ($options) {
         $handler = new moodle_url($this->page->url, array('mode' => 'new', 'by' => $allocation->userid, 'sesskey' => sesskey()));
         $select = new single_select($handler, 'of', $options, '', array('' => get_string('chooseuser', 'teamwork')), 'addreviewby' . $allocation->userid);
         $select->set_label(get_string('addreviewee', 'teamworkallocation_manual'));
         $o .= $this->output->render($select);
     } else {
         $o .= $this->output->container(get_string('nothingtoreview', 'teamwork'), 'info');
     }
     $o .= html_writer::start_tag('ul', array());
     foreach ($allocation->reviewerof as $authorid => $assessmentid) {
         $o .= html_writer::start_tag('li', array());
         $o .= $this->output->user_picture($userinfo[$authorid], array('courseid' => $this->page->course->id, 'size' => 16));
         $o .= fullname($userinfo[$authorid]);
         // delete icon
         $handler = new moodle_url($this->page->url, array('mode' => 'del', 'what' => $assessmentid, 'sesskey' => sesskey()));
         $o .= $this->helper_remove_allocation_icon($handler);
         $o .= html_writer::end_tag('li');
     }
     $o .= html_writer::end_tag('ul');
     return $o;
 }
Example #14
Show file File: renderable.php Project: evltuma/moodle
0
 /**
  * Constructor.
  *
  * @param string $logreader (optional)reader pluginname from which logs will be fetched.
  * @param stdClass|int $course (optional) course record or id
  * @param moodle_url|string $url (optional) page url.
  * @param int $date date (optional) from which records will be fetched.
  * @param int $page (optional) page number.
  * @param int $perpage (optional) number of records to show per page.
  * @param string $order (optional) sortorder of fetched records
  */
 public function __construct($logreader = "", $course = 0, $url = "", $date = 0, $page = 0, $perpage = 100, $order = "timecreated DESC")
 {
     global $PAGE;
     // Use first reader as selected reader, if not passed.
     if (empty($logreader)) {
         $readers = $this->get_readers();
         if (!empty($readers)) {
             reset($readers);
             $logreader = key($readers);
         } else {
             $logreader = null;
         }
     }
     $this->selectedlogreader = $logreader;
     // Use page url if empty.
     if (empty($url)) {
         $url = new moodle_url($PAGE->url);
     } else {
         $url = new moodle_url($url);
     }
     $this->url = $url;
     // Use site course id, if course is empty.
     if (!empty($course) && is_int($course)) {
         $course = get_course($course);
     }
     $this->course = $course;
     if ($date == 0) {
         $date = time() - self::CUTOFF;
     }
     $this->date = $date;
     $this->page = $page;
     $this->perpage = $perpage;
     $this->order = $order;
     $this->set_refresh_rate();
 }
Example #15
Show file File: renderer.php Project: EmmanuelYupit/educursos
0
 /**
  * Returns HTML to display action links for a page
  *
  * @param lesson_page $page
  * @param bool $printmove
  * @param bool $printaddpage
  * @return string
  */
 public function page_action_links(lesson_page $page, $printmove, $printaddpage = false)
 {
     global $CFG;
     $actions = array();
     if ($printmove) {
         $printmovehtml = new moodle_url('/mod/lesson/lesson.php', array('id' => $this->page->cm->id, 'action' => 'move', 'pageid' => $page->id, 'sesskey' => sesskey()));
         $actions[] = html_writer::link($printmovehtml, '<img src="' . $this->output->pix_url('t/move') . '" class="iconsmall" alt="' . get_string('move') . '" />');
     }
     $url = new moodle_url('/mod/lesson/editpage.php', array('id' => $this->page->cm->id, 'pageid' => $page->id, 'edit' => 1));
     $actions[] = html_writer::link($url, '<img src="' . $this->output->pix_url('t/edit') . '" class="iconsmall" alt="' . get_string('update') . '" />');
     $url = new moodle_url('/mod/lesson/view.php', array('id' => $this->page->cm->id, 'pageid' => $page->id));
     $actions[] = html_writer::link($url, '<img src="' . $this->output->pix_url('t/preview') . '" class="iconsmall" alt="' . get_string('preview') . '" />');
     $url = new moodle_url('/mod/lesson/lesson.php', array('id' => $this->page->cm->id, 'action' => 'confirmdelete', 'pageid' => $page->id, 'sesskey' => sesskey()));
     $actions[] = html_writer::link($url, '<img src="' . $this->output->pix_url('t/delete') . '" class="iconsmall" alt="' . get_string('delete') . '" />');
     if ($printaddpage) {
         $options = array();
         $manager = lesson_page_type_manager::get($page->lesson);
         $links = $manager->get_add_page_type_links($page->id);
         foreach ($links as $link) {
             $options[$link['type']] = $link['name'];
         }
         $options[0] = get_string('question', 'lesson');
         $addpageurl = new moodle_url('/mod/lesson/editpage.php', array('id' => $this->page->cm->id, 'pageid' => $page->id, 'sesskey' => sesskey()));
         $addpageselect = new single_select($addpageurl, 'qtype', $options, null, array('' => get_string('addanewpage', 'lesson') . '...'), 'addpageafter' . $page->id);
         $addpageselector = $this->output->render($addpageselect);
     }
     if (isset($addpageselector)) {
         $actions[] = $addpageselector;
     }
     return implode(' ', $actions);
 }
Example #16
Show file File: award_criteria.php Project: evltuma/moodle
0
 /**
  * Add appropriate criteria elements
  *
  * @param stdClass $data details of various criteria
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $agg = $data->get_aggregation_methods();
     $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
     $deleteurl = new moodle_url('/badges/criteria_action.php', array('badgeid' => $this->badgeid, 'delete' => true, 'type' => $this->criteriatype));
     $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
     $deleteaction = $OUTPUT->action_icon($deleteurl, new pix_icon('t/delete', get_string('delete')), null, array('class' => 'criteria-action'));
     echo $OUTPUT->box_start();
     if (!$data->is_locked() && !$data->is_active()) {
         echo $OUTPUT->box($deleteaction . $editaction, array('criteria-header'));
     }
     echo $OUTPUT->heading($this->get_title() . $OUTPUT->help_icon('criteria_' . $this->criteriatype, 'badges'), 3, 'main help');
     if (!empty($this->description)) {
         $badge = new badge($this->badgeid);
         echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
     }
     if (!empty($this->params)) {
         if (count($this->params) > 1) {
             echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method($this->criteriatype)])), array('clearfix'));
         } else {
             echo $OUTPUT->box(get_string('criteria_descr_single_' . $this->criteriatype, 'badges'), array('clearfix'));
         }
         echo $OUTPUT->box($this->get_details(), array('clearfix'));
     }
     echo $OUTPUT->box_end();
 }
Example #17
Show file File: backup_ui_stage.class.php Project: bobpuffer/moodleUCLA-LUTH
0
 /**
  * Displays the completed backup stage.
  *
  * Currently this just involves redirecting to the file browser with an
  * appropriate message.
  *
  * @param core_backup_renderer $renderer
  * @return string HTML code to echo
  */
 public function display(core_backup_renderer $renderer)
 {
     // Get the resulting stored_file record
     $type = $this->get_ui()->get_controller()->get_type();
     $courseid = $this->get_ui()->get_controller()->get_courseid();
     switch ($type) {
         case 'activity':
             $cmid = $this->get_ui()->get_controller()->get_id();
             $cm = get_coursemodule_from_id(null, $cmid, $courseid);
             $modcontext = context_module::instance($cm->id);
             $restorerul = new moodle_url('/backup/restorefile.php', array('contextid' => $modcontext->id));
             break;
         case 'course':
         default:
             $coursecontext = context_course::instance($courseid);
             $restorerul = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id));
     }
     $output = '';
     $output .= $renderer->box_start();
     if (!empty($this->results['include_file_references_to_external_content'])) {
         $output .= $renderer->notification(get_string('filereferencesincluded', 'backup'), 'notifyproblem');
     }
     if (!empty($this->results['missing_files_in_pool'])) {
         $output .= $renderer->notification(get_string('missingfilesinpool', 'backup'), 'notifyproblem');
     }
     $output .= $renderer->notification(get_string('executionsuccess', 'backup'), 'notifysuccess');
     $output .= $renderer->continue_button($restorerul);
     $output .= $renderer->box_end();
     return $output;
 }
Example #18
Show file File: outputrequirementslib.php Project: educakanchay/campus
0
 /**
  * Returns js code to load amd module loader, then insert inline script tags
  * that contain require() calls using RequireJS.
  * @return string
  */
 protected function get_amd_footercode()
 {
     global $CFG;
     $output = '';
     $jsrev = $this->get_jsrev();
     $jsloader = new moodle_url($CFG->httpswwwroot . '/lib/javascript.php');
     $jsloader->set_slashargument('/' . $jsrev . '/');
     $requirejsloader = new moodle_url($CFG->httpswwwroot . '/lib/requirejs.php');
     $requirejsloader->set_slashargument('/' . $jsrev . '/');
     $requirejsconfig = file_get_contents($CFG->dirroot . '/lib/requirejs/moodle-config.js');
     // No extension required unless slash args is disabled.
     $jsextension = '.js';
     if (!empty($CFG->slasharguments)) {
         $jsextension = '';
     }
     $requirejsconfig = str_replace('[BASEURL]', $requirejsloader, $requirejsconfig);
     $requirejsconfig = str_replace('[JSURL]', $jsloader, $requirejsconfig);
     $requirejsconfig = str_replace('[JSEXT]', $jsextension, $requirejsconfig);
     $output .= html_writer::script($requirejsconfig);
     if ($CFG->debugdeveloper) {
         $output .= html_writer::script('', $this->js_fix_url('/lib/requirejs/require.js'));
     } else {
         $output .= html_writer::script('', $this->js_fix_url('/lib/requirejs/require.min.js'));
     }
     // First include must be to a module with no dependencies, this prevents multiple requests.
     $prefix = "require(['core/first'], function() {\n";
     $suffix = "\n});";
     $output .= html_writer::script($prefix . implode(";\n", $this->amdjscode) . $suffix);
     return $output;
 }
Example #19
Show file File: lib.php Project: EmmanuelYupit/educursos
0
 /**
  * Get information export plugins
  * @param int $courseid
  * @return array
  */
 public static function get_plugins_export($courseid)
 {
     global $CFG;
     if (self::$exportplugins !== null) {
         return self::$exportplugins;
     }
     $context = context_course::instance($courseid);
     $exportplugins = array();
     if (has_capability('moodle/grade:export', $context)) {
         foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
             if (!has_capability('gradeexport/' . $plugin . ':view', $context)) {
                 continue;
             }
             $pluginstr = get_string('pluginname', 'gradeexport_' . $plugin);
             $url = new moodle_url('/grade/export/' . $plugin . '/index.php', array('id' => $courseid));
             $exportplugins[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
         }
         if ($CFG->gradepublishing) {
             $url = new moodle_url('/grade/export/keymanager.php', array('id' => $courseid));
             $exportplugins['keymanager'] = new grade_plugin_info('keymanager', $url, get_string('keymanager', 'grades'));
         }
     }
     if (count($exportplugins) > 0) {
         asort($exportplugins);
         self::$exportplugins = $exportplugins;
     } else {
         self::$exportplugins = false;
     }
     return self::$exportplugins;
 }