Пример #1
0
 /**
  * Renders the active method selector at the grading method management screen
  *
  * @param grading_manager $gradingman
  * @param moodle_url $targeturl
  * @return string
  */
 public function management_method_selector(grading_manager $manager, moodle_url $targeturl)
 {
     $method = $manager->get_active_method();
     $methods = $manager->get_available_methods(false);
     $methods['none'] = get_string('gradingmethodnone', 'core_grading');
     $selector = new single_select(new moodle_url($targeturl, array('sesskey' => sesskey())), 'setmethod', $methods, empty($method) ? 'none' : $method, null, 'activemethodselector');
     $selector->set_label(get_string('changeactivemethod', 'core_grading'));
     $selector->set_help_icon('gradingmethod', 'core_grading');
     return $this->output->render($selector);
 }
Пример #2
0
         print_collapsible_region_end();
     }
     break;
 case workshop::PHASE_EVALUATION:
     if (has_capability('mod/workshop:viewallassessments', $PAGE->context)) {
         $perpage = get_user_preferences('workshop_perpage', 10);
         $groupid = groups_get_activity_group($workshop->cm, true);
         $data = $workshop->prepare_grading_report_data($USER->id, $groupid, $page, $perpage, $sortby, $sorthow);
         if ($data) {
             $showauthornames = has_capability('mod/workshop:viewauthornames', $workshop->context);
             $showreviewernames = has_capability('mod/workshop:viewreviewernames', $workshop->context);
             if (has_capability('mod/workshop:overridegrades', $PAGE->context)) {
                 // Print a drop-down selector to change the current evaluation method.
                 $selector = new single_select($PAGE->url, 'eval', workshop::available_evaluators_list(), $workshop->evaluation, false, 'evaluationmethodchooser');
                 $selector->set_label(get_string('evaluationmethod', 'mod_workshop'));
                 $selector->set_help_icon('evaluationmethod', 'mod_workshop');
                 $selector->method = 'post';
                 echo $output->render($selector);
                 // load the grading evaluator
                 $evaluator = $workshop->grading_evaluation_instance();
                 $form = $evaluator->get_settings_form(new moodle_url($workshop->aggregate_url(), compact('sortby', 'sorthow', 'page')));
                 $form->display();
             }
             // prepare paging bar
             $baseurl = new moodle_url($PAGE->url, array('sortby' => $sortby, 'sorthow' => $sorthow));
             $pagingbar = new paging_bar($data->totalcount, $page, $perpage, $baseurl, 'page');
             // grading report display options
             $reportopts = new stdclass();
             $reportopts->showauthornames = $showauthornames;
             $reportopts->showreviewernames = $showreviewernames;
             $reportopts->sortby = $sortby;
Пример #3
0
$button->tooltip = 'This is the tooltip';
$button->formid = 'canbeset';
$button->class = 'classonbutton';
$button->add_confirm_action('This message appears to confirm when you push the button');
echo $OUTPUT->render($button);
echo html_writer::tag('p', 'A single select form. Quick way using a function:');
$url = new moodle_url('index.php', array('urlparams' => 'become', 'hidden' => 'fields'));
$options = array(1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four');
echo $OUTPUT->single_select($url, 'youpicked', $options, '', array('' => 'choose'), 'formid');
echo html_writer::tag('p', 'A single select form. Manually rendered:');
$select = new single_select($url, 'youpicked', $options);
$select->set_label('This is a label for the select');
$select->tooltip = 'This is the tooltip';
//this doesn't seem to work - moodle bug?
//$select->add_confirm_action('Confirm you want to do this');
$select->set_help_icon('activities', 'moodle');
echo $OUTPUT->render($select);
echo html_writer::tag('p', 'A url select form. Typically used for navigation.');
$urls = array('/admin/tool/elementlibrary/' => 'Index', '/admin/tool/elementlibrary/common.php' => 'Common elements', '/admin/tool/elementlibrary/mform.php' => 'Moodle form elements', '/admin/tool/elementlibrary/tables.php' => 'Tables', '/admin/tool/elementlibrary/tabs.php' => 'Tabs');
echo $OUTPUT->url_select($urls, '', array('' => 'choose'), 'formid');
/*
* This never loads and isn't called this way anywhere else?
echo html_writer::tag('p', 'A stand-alone file picker:');
$options = new stdClass();
echo $OUTPUT->file_picker($options);
*/
// get any cmid to make this work
$cmid = $DB->get_field('course_modules', 'id', array(), IGNORE_MULTIPLE);
$modulename = $DB->get_field('modules', 'name', array(), IGNORE_MULTIPLE);
if ($cmid) {
    echo html_writer::tag('p', 'An "update module" button. The module name is the value from the modules table e.g. "workshop". The button won\'t be shown if the user doesn\'t have the capability to manage that activity.');
Пример #4
0
 /**
  * Display tag filter as a link or dropdown
  * @param array $taglist is array of tags
  * @param mod_forumng $forum
  * @param string $selectid of tag if selected
  * @return string for printing out
  */
 public function render_tag_filter($taglist, $forum, $selectid = null)
 {
     $baseurl = 'view.php?' . $forum->get_link_params(mod_forumng::PARAM_HTML);
     if (isset($selectid)) {
         $tagname = htmlspecialchars($taglist[$selectid]->displayname);
         $taglink = get_string('removefiltering', 'forumng', $tagname);
         $taglink .= ' (';
         $taglink .= html_writer::tag('a', get_string('show_all', 'forumng'), array('href' => $baseurl));
         $taglink .= ')';
         $out = html_writer::tag('div', $taglink, array('class' => 'forumng_discuss_tagfilter'));
     } else {
         // Display dropdown.
         foreach ($taglist as $tag) {
             $options[$tag->id] = htmlspecialchars($tag->displayname) . '  (' . $tag->count . ')';
         }
         $tagurl = new moodle_url('/mod/forumng/view.php?', $forum->get_link_params_array(mod_forumng::PARAM_PLAIN));
         $select = new single_select($tagurl, 'tag', $options, '');
         $select->label = get_string('filterdiscussions', 'forumng');
         $select->set_help_icon('forumngdiscusstagfilter', 'forumng');
         $output = $this->render($select);
         $out = '<div class="forumng_discuss_tagfilter">' . $output . '</div>';
     }
     return $out;
 }
Пример #5
0
    echo $OUTPUT->render($select);
      echo '</div>';
    if(count( $displaylist)<=1)
       echo $hier-> cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('create_department','local_departments'),$CFG->wwwroot.'/local/departments/departments.php');    
  
} else {
    foreach ($schools as $scl) {
        $key = $scl->id;
        $value = $scl->fullname;
    }
    //$displaylist=$hier->get_departments_forschool($key);
    $displaylist = $hier->get_departments_forschool($modulelist->schoolid, false, true, true);
    echo '<div class="selfilterpos" style="float:none;">';
    $select = new single_select(new moodle_url('/local/modules/assigncourse.php?moduleid=' . $moduleids . '&scid=' . $key . ''), 'id', $displaylist, $id, null, 'switchcategory');
    $select->set_label(get_string('dept', 'local_departments') . ':');
    $select->set_help_icon('dept_formatname', 'local_departments');
    echo $OUTPUT->render($select);
    echo '</div>';
    if(count( $displaylist)<=1)
      echo $hier-> cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('create_department','local_departments'),$CFG->wwwroot.'/local/departments/departments.php');     
   
}
echo '<hr>';
// Print out all the modules.
$sql = "SELECT * FROM {local_cobaltcourses} where departmentid=$id  AND visible=1";
$courses = $DB->get_records_sql($sql);
if (!empty($id) && !empty($id)) {
    if (!$courses) {
        // There is no course to display.       
       echo $hier-> cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('createcourse','local_cobaltcourses'),$CFG->wwwroot.'/local/cobaltcourses/cobaltcourse.php');
    } else {
Пример #6
0
 /**
  * Display rating filter as a link or dropdown
  * @param mod_forumng $forum
  * @papam int $selectedid for choosing default value from dropdown
  * @return string for printing out
  */
 public function render_ratings_filter($forum, $selectedid = 0)
 {
     // Display dropdown.
     $options = array();
     $options[mod_forumng::GRADING_AVERAGE] = get_string('grading_average', 'forumng');
     $options[mod_forumng::GRADING_COUNT] = get_string('grading_count', 'forumng');
     $options[mod_forumng::GRADING_SUM] = get_string('grading_sum', 'forumng');
     $usageurl = new moodle_url('/mod/forumng/feature/usage/usage.php?', $forum->get_link_params_array(mod_forumng::PARAM_PLAIN));
     $select = new single_select($usageurl, 'ratings', $options, $selectedid, false);
     $select->label = get_string('forumngratingsfilter', 'forumngfeature_usage');
     $select->set_help_icon('forumngratingsfilter', 'forumngfeature_usage');
     $output = $this->render($select);
     $out = '<div class="forumng_ratings_filter">' . $output . '</div>';
     return $out;
 }
            $blockobj = block_instance($block->blockname, $block, $PAGE);
            if ($blockobj->user_can_edit()) {
                $blockdatextrator = report_editdates_block_date_extractor::make($block->blockname, $course);
                if ($blockdatextrator) {
                    $blockdatextrator->save_dates($blockobj, $datesettings);
                }
            }
        }
        // Commit transaction and finish up.
        $transaction->allow_commit();
        rebuild_course_cache($course->id);
        redirect($PAGE->url);
    }
}
// Prepare activity type menu.
$select = new single_select($baseurl, 'activitytype', $activitytypes, $activitytype, null, 'activitytypeform');
$select->set_label(get_string('activitytypefilter', 'report_editdates'));
$select->set_help_icon('activitytypefilter', 'report_editdates');
// Making log entry.
$event = \report_editdates\event\report_viewed::create(array('context' => $coursecontext, 'other' => array('activitytype' => $activitytype)));
$event->trigger();
// Set page title and page heading.
$PAGE->set_title($course->shortname . ': ' . get_string('editdates', 'report_editdates'));
$PAGE->set_heading($course->fullname);
// Displaying the page.
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($course->fullname));
echo $OUTPUT->heading(get_string('activityfilter', 'report_editdates'));
echo $OUTPUT->render($select);
$mform->display();
echo $OUTPUT->footer();