本文整理汇总了PHP中moodle_url::remove_params方法的典型用法代码示例。如果您正苦于以下问题:PHP moodle_url::remove_params方法的具体用法?PHP moodle_url::remove_params怎么用?PHP moodle_url::remove_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodle_url
的用法示例。
在下文中一共展示了moodle_url::remove_params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
$search = trim(optional_param('search', '', PARAM_TEXT));
$alpha = optional_param('alpha', '', PARAM_ALPHA);
// TODO: with a little more work, we could keep the previously selected sort here
$params = $_GET;
unset($params['page']);
// We want to go back to the first page
unset($params['search']);
// And clear the search
$target = $this->page->get_new_page($params);
echo "<table class=\"searchbox\" style=\"margin-left:auto;margin-right:auto\" cellpadding=\"10\"><tr><td>";
echo "<form action=\"" . $target->get_url() . "\" method=\"post\">";
echo "<fieldset class=\"invisiblefieldset\">";
echo "<input type=\"text\" name=\"search\" value=\"" . s($search, true) . "\" size=\"20\" />";
echo '<input type="submit" value="' . get_string('search') . '" />';
//remove the "bare" parameter to prevent from loading only part of the page
$moodleurl = new moodle_url($target->get_url());
$moodleurl->remove_params('mode');
if ($search) {
echo "<input type=\"button\" onclick=\"document.location='" . $moodleurl->out() . "';\" " . "value=\"Show all items\" />";
}
echo "</fieldset></form>";
echo "</td></tr></table>";
}
示例2: get_progress_bar
/**
* Customises the backup progress bar
*
* @global moodle_page $PAGE
* @return array
*/
public function get_progress_bar()
{
global $PAGE;
$stage = self::STAGE_COMPLETE;
$currentstage = $this->stage->get_stage();
$items = array();
while ($stage > 0) {
$classes = array('backup_stage');
if (floor($stage / 2) == $currentstage) {
$classes[] = 'backup_stage_next';
} else {
if ($stage == $currentstage) {
$classes[] = 'backup_stage_current';
} else {
if ($stage < $currentstage) {
$classes[] = 'backup_stage_complete';
}
}
}
$item = array('text' => strlen(decbin($stage * 2)) . '. ' . get_string('importcurrentstage' . $stage, 'backup'), 'class' => join(' ', $classes));
if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && (!self::$skipcurrentstage || $stage * 2 != $currentstage)) {
$item['link'] = new moodle_url($PAGE->url, $this->stage->get_params() + array('backup' => $this->get_backupid(), 'stage' => $stage));
}
array_unshift($items, $item);
$stage = floor($stage / 2);
}
$selectorlink = new moodle_url($PAGE->url, $this->stage->get_params());
$selectorlink->remove_params('importid');
array_unshift($items, array('text' => '1. ' . get_string('importcurrentstage0', 'backup'), 'class' => join(' ', $classes), 'link' => $selectorlink));
return $items;
}
示例3: edit_question
/**
* Edit a RTQ question
*
* @param int $questionid the RTQ questionid
*
* @return mixed
*/
public function edit_question($questionid)
{
global $DB;
$actionurl = clone $this->baseurl;
$actionurl->param('action', 'editquestion');
$actionurl->param('rtqquestionid', $questionid);
$rtqquestion = $DB->get_record('activequiz_questions', array('id' => $questionid), '*', MUST_EXIST);
$qrecord = $DB->get_record('question', array('id' => $rtqquestion->questionid), '*', MUST_EXIST);
$mform = new add_question_form($actionurl, array('rtq' => $this->rtq, 'questionname' => $qrecord->name, 'defaultmark' => $qrecord->defaultmark, 'showhistoryduringquiz' => $rtqquestion->showhistoryduringquiz, 'edit' => true));
// form handling
if ($mform->is_cancelled()) {
// redirect back to list questions page
$this->baseurl->remove_params('action');
redirect($this->baseurl, null, 0);
} else {
if ($data = $mform->get_data()) {
// process data from the form
$question = new \stdClass();
$question->id = $rtqquestion->id;
$question->activequizid = $this->rtq->getRTQ()->id;
$question->questionid = $rtqquestion->questionid;
$question->notime = $data->notime;
$question->questiontime = $data->indvquestiontime;
$question->tries = $data->numberoftries;
$question->points = number_format($data->points, 2);
$DB->update_record('activequiz_questions', $question);
// ensure there is no action or questionid in the baseurl
$this->baseurl->remove_params('action', 'questionid');
redirect($this->baseurl, null, 0);
} else {
// display the form
$mform->set_data(array('indvquestiontime' => $rtqquestion->questiontime, 'notime' => $rtqquestion->notime, 'numberoftries' => $rtqquestion->tries, 'points' => $rtqquestion->points));
$this->renderer->print_editpage_header();
$this->renderer->editrender_addquestionform($mform);
$this->renderer->end_editpage();
}
}
}
示例4: starred
public function starred($message, $userid, $type, $offset = 0, $view = false) {
$params = array(
'starred' => $message->id(),
'sesskey' => sesskey()
);
$url = new moodle_url($this->page->url, $params);
$url->param('offset', $offset);
$output = html_writer::start_tag('span', array('class' => 'mail_flags'));
if ($view) {
$url->param('m', $message->id());
$url->remove_params(array('offset'));
}
if ($message->starred($userid)) {
$linkparams = array('title' => get_string('starred', 'local_mail'));
$output .= html_writer::link($url, html_writer::tag('span', '', array('class' => 'mail_starred')), $linkparams);
} else {
$linkparams = array('title' => get_string('unstarred', 'local_mail'));
$output .= html_writer::link($url, html_writer::tag('span', '', array('class' => 'mail_unstarred')), $linkparams);
}
$output .= html_writer::end_tag('span');
return $output;
}
示例5: array
$urlparams['userid'] = $userid;
$urlparams['start'] = $start;
$urlparams['end'] = $end;
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$PAGE->set_course($course);
$context = $PAGE->context;
if (has_capability('block/timetracker:manageworkers', $context)) {
//supervisor
print_error('This page is not accessible by a supervisor');
}
$worker = $DB->get_record('block_timetracker_workerinfo', array('id' => $userid));
if (!$worker) {
print_error('usernotexist', 'block_timetracker', $CFG->wwwroot . '/blocks/timetracker/index.php?id=' . $course->id);
}
$index = new moodle_url($CFG->wwwroot . '/blocks/timetracker/index.php', $urlparams);
$index->remove_params('userid', 'start', 'end');
$timesheeturl = new moodle_url($CFG->wwwroot . '/blocks/timetracker/timesheet.php', $urlparams);
$timesheeturl->remove_params('start', 'end');
$workersigurl = new moodle_url($CFG->wwwroot . '/blocks/timetracker/workersig.php', $urlparams);
$conflicts = check_worker_hours_for_conflicts($userid, $start, $end);
if (sizeof($conflicts) == 0) {
redirect($workersigurl);
}
$strtitle = get_string('pluginname', 'block_timetracker');
$PAGE->set_url($timesheeturl);
$PAGE->set_title($strtitle);
$PAGE->set_heading($strtitle);
$PAGE->set_pagelayout('base');
echo $OUTPUT->header();
$tabs = get_tabs($urlparams, false, $courseid);
$tabs = array($tabs);
示例6: get_nojslink
/**
* Gets a link for this page that will work with JS disabled.
*
* @global moodle_page $PAGE
* @param moodle_page $page
* @return moodle_url
*/
public function get_nojslink(moodle_page $page = null)
{
if ($page === null) {
global $PAGE;
$page = $PAGE;
}
$link = new moodle_url($page->url, array('nonjscomment' => true, 'comment_itemid' => $this->itemid, 'comment_context' => $this->context->id, 'comment_area' => $this->commentarea));
$link->remove_params(array('comment_page'));
return $link;
}
示例7: output
/**
* Prepare comment code in html
* @param boolean $return
* @return mixed
*/
public function output($return = true)
{
global $PAGE, $OUTPUT;
static $template_printed;
$this->link = $PAGE->url;
$murl = new moodle_url($this->link);
$murl->remove_params('nonjscomment');
$murl->param('nonjscomment', 'true');
$murl->param('comment_itemid', $this->itemid);
$murl->param('comment_context', $this->context->id);
$murl->param('comment_area', $this->commentarea);
$murl->remove_params('comment_page');
$this->link = $murl->out();
$options = new stdClass();
$options->client_id = $this->cid;
$options->commentarea = $this->commentarea;
$options->itemid = $this->itemid;
$options->page = 0;
$options->courseid = $this->courseid;
$options->contextid = $this->contextid;
$options->env = $this->env;
$options->component = $this->component;
if ($this->env == 'block_comments') {
$options->notoggle = true;
$options->autostart = true;
}
$PAGE->requires->js_init_call('M.core_comment.init', array($options), true);
if (!empty(self::$nonjs)) {
// return non js comments interface
return $this->print_comments(self::$comment_page, $return, true);
}
$strsubmit = get_string('savecomment');
$strcancel = get_string('cancel');
$strshowcomments = get_string('showcommentsnonjs');
$sesskey = sesskey();
$html = '';
// print html template
// Javascript will use the template to render new comments
if (empty($template_printed) && !empty($this->viewcap)) {
$html .= '<div style="display:none" id="cmt-tmpl">' . $this->template . '</div>';
$template_printed = true;
}
if (!empty($this->viewcap)) {
// print commenting icon and tooltip
$icon = $OUTPUT->pix_url('t/collapsed');
$html .= <<<EOD
<div class="mdl-left">
<a class="showcommentsnonjs" href="{$this->link}">{$strshowcomments}</a>
EOD;
if ($this->env != 'block_comments') {
$html .= <<<EOD
<a id="comment-link-{$this->cid}" class="comment-link" href="#">
<img id="comment-img-{$this->cid}" src="{$icon}" alt="{$this->linktext}" title="{$this->linktext}" />
<span id="comment-link-text-{$this->cid}">{$this->linktext} {$this->count}</span>
</a>
EOD;
}
$html .= <<<EOD
<div id="comment-ctrl-{$this->cid}" class="comment-ctrl">
<ul id="comment-list-{$this->cid}" class="comment-list">
<li class="first"></li>
EOD;
// in comments block, we print comments list right away
if ($this->env == 'block_comments') {
$html .= $this->print_comments(0, true, false);
$html .= '</ul>';
$html .= $this->get_pagination(0);
} else {
$html .= <<<EOD
</ul>
<div id="comment-pagination-{$this->cid}" class="comment-pagination"></div>
EOD;
}
// print posting textarea
if (!empty($this->postcap)) {
$html .= <<<EOD
<div class='comment-area'>
<div class="bd">
<textarea name="content" rows="2" cols="20" id="dlg-content-{$this->cid}"></textarea>
</div>
<div class="fd" id="comment-action-{$this->cid}">
<a href="#" id="comment-action-post-{$this->cid}"> {$strsubmit} </a>
EOD;
if ($this->env != 'block_comments') {
$html .= "<span> | </span><a href=\"#\" id=\"comment-action-cancel-{$this->cid}\"> {$strcancel} </a>";
}
$html .= <<<EOD
</div>
</div>
<div class="clearer"></div>
EOD;
}
$html .= <<<EOD
</div><!-- end of comment-ctrl -->
</div>
//.........这里部分代码省略.........
示例8: display_instances_list
/**
* Display a repository instance list (with edit/delete/create links)
*
* @static
* @param stdClass $context the context for which we display the instance
* @param string $typename if set, we display only one type of instance
*/
public static function display_instances_list($context, $typename = null)
{
global $CFG, $USER, $OUTPUT;
$output = $OUTPUT->box_start('generalbox');
//if the context is SYSTEM, so we call it from administration page
$admin = $context->id == SYSCONTEXTID ? true : false;
if ($admin) {
$baseurl = new moodle_url('/' . $CFG->admin . '/repositoryinstance.php', array('sesskey' => sesskey()));
$output .= $OUTPUT->heading(get_string('siteinstances', 'repository'));
} else {
$baseurl = new moodle_url('/repository/manage_instances.php', array('contextid' => $context->id, 'sesskey' => sesskey()));
}
$namestr = get_string('name');
$pluginstr = get_string('plugin', 'repository');
$settingsstr = get_string('settings');
$deletestr = get_string('delete');
// Retrieve list of instances. In administration context we want to display all
// instances of a type, even if this type is not visible. In course/user context we
// want to display only visible instances, but for every type types. The repository::get_instances()
// third parameter displays only visible type.
$params = array();
$params['context'] = array($context);
$params['currentcontext'] = $context;
$params['return_types'] = 0;
$params['onlyvisible'] = !$admin;
$params['type'] = $typename;
$instances = repository::get_instances($params);
$instancesnumber = count($instances);
$alreadyplugins = array();
$table = new html_table();
$table->head = array($namestr, $pluginstr, $settingsstr, $deletestr);
$table->align = array('left', 'left', 'center', 'center');
$table->data = array();
$updowncount = 1;
foreach ($instances as $i) {
$settings = '';
$delete = '';
$type = repository::get_type_by_id($i->options['typeid']);
if ($type->get_contextvisibility($context)) {
if (!$i->readonly) {
$settingurl = new moodle_url($baseurl);
$settingurl->param('type', $i->options['type']);
$settingurl->param('edit', $i->id);
$settings .= html_writer::link($settingurl, $settingsstr);
$deleteurl = new moodle_url($baseurl);
$deleteurl->param('delete', $i->id);
$deleteurl->param('type', $i->options['type']);
$delete .= html_writer::link($deleteurl, $deletestr);
}
}
$type = repository::get_type_by_id($i->options['typeid']);
$table->data[] = array(format_string($i->name), $type->get_readablename(), $settings, $delete);
//display a grey row if the type is defined as not visible
if (isset($type) && !$type->get_visible()) {
$table->rowclasses[] = 'dimmed_text';
} else {
$table->rowclasses[] = '';
}
if (!in_array($i->name, $alreadyplugins)) {
$alreadyplugins[] = $i->name;
}
}
$output .= html_writer::table($table);
$instancehtml = '<div>';
$addable = 0;
//if no type is set, we can create all type of instance
if (!$typename) {
$instancehtml .= '<h3>';
$instancehtml .= get_string('createrepository', 'repository');
$instancehtml .= '</h3><ul>';
$types = repository::get_editable_types($context);
foreach ($types as $type) {
if (!empty($type) && $type->get_visible()) {
// If the user does not have the permission to view the repository, it won't be displayed in
// the list of instances. Hiding the link to create new instances will prevent the
// user from creating them without being able to find them afterwards, which looks like a bug.
if (!has_capability('repository/' . $type->get_typename() . ':view', $context)) {
continue;
}
$instanceoptionnames = repository::static_function($type->get_typename(), 'get_instance_option_names');
if (!empty($instanceoptionnames)) {
$baseurl->param('new', $type->get_typename());
$instancehtml .= '<li><a href="' . $baseurl->out() . '">' . get_string('createxxinstance', 'repository', get_string('pluginname', 'repository_' . $type->get_typename())) . '</a></li>';
$baseurl->remove_params('new');
$addable++;
}
}
}
$instancehtml .= '</ul>';
} else {
$instanceoptionnames = repository::static_function($typename, 'get_instance_option_names');
if (!empty($instanceoptionnames)) {
//create a unique type of instance
//.........这里部分代码省略.........
示例9: foreach
$users = $DB->get_records_sql($sql, $params);
if ($page * $perpage > count($users)) {
$page = 0;
}
$url = new moodle_url($PAGE->url);
$url->remove_params(array('page'));
echo $OUTPUT->paging_bar(count($users), $page, $perpage, $url, 'page');
$users = array_slice($users, $page * $perpage, $perpage, true);
foreach ($users as $user) {
$user->fullname = fullname($user);
$user->score = 0;
}
$strtotals = get_string('totals', 'realtimequiz');
list($usql, $uparams) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED);
$nousersurl = new moodle_url($PAGE->url);
$nousersurl->remove_params(array('showusers'));
$userlink = html_writer::link($nousersurl, get_string('hideusers', 'realtimequiz'));
} else {
$usersurl = new moodle_url($PAGE->url);
$usersurl->param('showusers', 1);
$userlink = html_writer::link($usersurl, get_string('showusers', 'realtimequiz'));
}
echo html_writer::tag('p', $userlink);
echo '<br /><table border="1" style="border-style: none;">';
if (!empty($questions)) {
foreach ($questions as $question) {
echo '<tr class="realtimequiz_report_question"><td width="30%">' . $question->questionnum . '</td>';
$answers = $DB->get_records('realtimequiz_answer', array('questionid' => $question->id), 'id');
if (!empty($answers)) {
$iscorrectanswer = false;
foreach ($answers as $answer) {
示例10: course_filter_selector
/**
* 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);
}
示例11: message_remove_url_params
/**
* strip off action parameters like 'removecontact'
* @param moodle_url/string $moodleurl a URL. Typically the current page URL.
* @return string the URL minus parameters that perform actions (like adding/removing/blocking a contact).
*/
function message_remove_url_params($moodleurl) {
$newurl = new moodle_url($moodleurl);
$newurl->remove_params('addcontact','removecontact','blockcontact','unblockcontact');
return $newurl->out();
}
示例12: stdClass
echo $OUTPUT->header();
$ratingoptions = new stdClass();
$ratingoptions->context = $context;
$ratingoptions->component = $component;
$ratingoptions->ratingarea = $ratingarea;
$ratingoptions->itemid = $itemid;
$ratingoptions->sort = $sqlsort;
$rm = new rating_manager();
$ratings = $rm->get_all_ratings_for_item($ratingoptions);
if (!$ratings) {
$msg = get_string('noratings', 'rating');
echo html_writer::tag('div', $msg, array('class' => 'mdl-align'));
} else {
// To get the sort URL, copy the current URL and remove any previous sort.
$sorturl = new moodle_url($url);
$sorturl->remove_params('sort');
$table = new html_table();
$table->cellpadding = 3;
$table->cellspacing = 3;
$table->attributes['class'] = 'generalbox ratingtable';
$table->head = array('', html_writer::link(new moodle_url($sorturl, array('sort' => 'firstname')), $strname), html_writer::link(new moodle_url($sorturl, array('sort' => 'rating')), $strrating), html_writer::link(new moodle_url($sorturl, array('sort' => 'time')), $strtime));
$table->colclasses = array('', 'firstname', 'rating', 'time');
$table->data = array();
// If the scale was changed after ratings were submitted some ratings may have a value above the current maximum.
// We can't just do count($scalemenu) - 1 as custom scales start at index 1, not 0.
$maxrating = max(array_keys($scalemenu));
foreach ($ratings as $rating) {
if (!$canviewallratings and $USER->id != $rating->userid) {
continue;
}
// Undo the aliasing of the user id column from user_picture::fields().
示例13: get_string
$cm = get_coursemodule_from_instance("giportfolio", $giportfolio->id, $course->id, false, MUST_EXIST);
$url->param('p', $p);
}
if ($currenttab !== 'all') {
$url->param('tab', $currenttab);
}
$PAGE->set_url($url);
require_login($course->id, false, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/giportfolio:gradegiportfolios', $context);
require_capability('mod/giportfolio:viewgiportfolios', $context);
$PAGE->set_title(format_string($giportfolio->name));
echo $OUTPUT->header();
// Set up the list of tabs.
$allurl = new moodle_url($PAGE->url);
$allurl->remove_params('tab');
$sincelastloginurl = new moodle_url($PAGE->url, array('tab' => 'sincelastlogin'));
$nocommentsurl = new moodle_url($PAGE->url, array('tab' => 'nocomments'));
$tabs = array(new tabobject('all', $allurl, get_string('allusers', 'mod_giportfolio')), new tabobject('sincelastlogin', $sincelastloginurl, get_string('sincelastlogin', 'mod_giportfolio')), new tabobject('nocomments', $nocommentsurl, get_string('nocomments', 'mod_giportfolio')));
echo get_string('studentgiportfolios', 'mod_giportfolio');
echo '</br>';
if ($CFG->version > 2013051400) {
echo $OUTPUT->tabtree($tabs, $currenttab);
} else {
$tabs = array($tabs);
echo print_tabs($tabs, $currenttab, array(), array(), true);
}
echo get_string('filterlist', 'mod_giportfolio');
$tabindex = 1;
// Tabindex for quick grading tabbing; Not working for dropdowns yet.
// Check to see if groups are being used in this assignment.
示例14: definition
//.........这里部分代码省略.........
if ($subunit->timein > $this->reportstart) {
$start = $subunit->timein;
} else {
$start = $this->reportstart;
}
$currelapsed = $subunit->timeout - $start;
}
$hrs = get_hours($currelapsed, $subunit->courseid);
$total += $hrs;
$row .= $hrs . ' hour(s)';
$row .= '<br />';
}
}
$row .= '</td>' . "\n";
} else {
//unit occurs all in one repstart-repend
$row .= '<td style="text-align: center">';
$row .= userdate($unit->timein, get_string('datetimeformat', 'block_timetracker'));
$row .= ' to ' . userdate($unit->timeout, get_string('datetimeformat', 'block_timetracker'));
$row .= '</td>';
$row .= '<td style="text-align: center">';
$currelapsed = $unit->timeout - $unit->timein;
$hrs = get_hours($currelapsed, $unit->courseid);
$total += $hrs;
$row .= $hrs . ' hour(s)</td>';
}
if ($canmanage || $canview) {
$urlparams['id'] = $unit->courseid;
$urlparams['userid'] = $unit->userid;
$urlparams['sesskey'] = sesskey();
$urlparams['unitid'] = $unit->id;
$unitdateinfo = usergetdate($unit->timein);
if ($unit->timesheetid && !$unit->submitted) {
//show greyed out icons and no URL
$row .= '<td style="text-align: center">' . html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/wait.png', 'class' => 'icon')) . '</td>';
} else {
if ($unit->timesheetid && $unit->submitted) {
$row .= '<td style="text-align: center">' . html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/certified.png', 'class' => 'icon')) . '</td>';
} else {
if (!$unit->canedit) {
//show greyed out icons and no URL
$row .= '<td style="text-align: center">' . html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/clock_edit_bw.png', 'class' => 'icon')) . ' ' . html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/clock_delete_bw.png', 'class' => 'icon')) . '</td>';
} else {
$deleteurl = new moodle_url($baseurl . '/deleteworkunit.php', $urlparams);
$deleteicon = new pix_icon('clock_delete', get_string('delete'), 'block_timetracker');
$deleteaction = $OUTPUT->action_icon($deleteurl, $deleteicon, new confirm_action('Are you sure you want to delete this work unit?'));
//error_log (($now - $unit->timein)-(86400*35));
$editurl = new moodle_url($baseurl . '/editunit.php', $urlparams);
$editurl->remove_params('sesskey');
$editaction = $OUTPUT->action_icon($editurl, new pix_icon('clock_edit', get_string('edit'), 'block_timetracker'));
$row .= '<td style="text-align: center">';
if ($canmanage) {
$row .= $editaction . ' ' . $deleteaction . '</td>';
} else {
$row .= ' ';
}
$row .= '</td>';
}
}
}
} else {
$urlparams['id'] = $this->courseid;
$urlparams['userid'] = $unit->userid;
$urlparams['sesskey'] = sesskey();
$urlparams['unitid'] = $unit->id;
$unitdateinfo = usergetdate($unit->timein);
if ($unit->timesheetid && !$unit->submitted) {
//show greyed out icons and no URL
$row .= '<td style="text-align: center">' . html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/wait.png', 'class' => 'icon')) . '</td>';
} else {
if ($unit->timesheetid && $unit->submitted) {
$row .= '<td style="text-align: center">' . html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/certified.png', 'class' => 'icon')) . '</td>';
} else {
if (!$unit->canedit) {
//show greyed out icons and no URL
$alertaction = html_writer::empty_tag('img', array('src' => $CFG->wwwroot . '/blocks/timetracker/pix/alert_bw.gif', 'class' => 'icon'));
} else {
$alerturl = new moodle_url($baseurl . '/alert.php', $urlparams);
$alerticon = new pix_icon('alert', 'Alert Supervisor of Error', 'block_timetracker');
$alertaction = $OUTPUT->action_icon($alerturl, $alerticon);
$row .= '<td style="text-align:center">' . $alertaction . '</td>';
}
}
}
}
$row .= '</tr>';
$mform->addElement('html', $row);
}
$finalrow = '<tr>';
if ($canmanage) {
$finalrow .= '<td> </td>';
}
$finalrow .= '<td> </td>
<td> </td>
<td style="text-align: center; border-top: 1px solid black"><b>Total:
</b>' . round($total, 3) . ' hour(s)</td>
<td> </td></tr></table>';
$mform->addElement('html', $finalrow);
}
}
示例15: view_overview
/**
* view overview tab
*/
public function view_overview()
{
global $PAGE, $OUTPUT;
$groupid = optional_param('groupid', 0, PARAM_INT);
$groupingid = optional_param('groupingid', 0, PARAM_INT);
$orientation = optional_param('orientation', 0, PARAM_BOOL);
$url = new moodle_url($PAGE->url, array('sesskey' => sesskey(), 'groupid' => $groupid, 'groupingid' => $groupingid, 'orientation' => $orientation));
// Process submitted form!
if (data_submitted() && confirm_sesskey() && optional_param('confirm', 0, PARAM_BOOL)) {
// Execution has been confirmed?!
$hideform = 0;
$pushtomdl = optional_param('pushtomdl', 0, PARAM_BOOL);
if ($pushtomdl) {
list($error, $message) = $this->push_registrations($groupid, $groupingid);
}
if ($error) {
echo $OUTPUT->notification($message, 'notifyproblem');
} else {
echo $OUTPUT->notification($message, 'notifysuccess');
}
} else {
if (data_submitted() && confirm_sesskey()) {
// Display confirm-dialog!
$hideform = 1;
$pushtomdl = optional_param('pushtomdl', 0, PARAM_BOOL);
if ($pushtomdl) {
// Try only!
list($error, $message) = $this->push_registrations($groupid, $groupingid, true);
$attr = array();
$attr['confirm'] = 1;
$attr['pushtomdl'] = 1;
$attr['sesskey'] = sesskey();
$continue = new moodle_url($PAGE->url, $attr);
$cancel = new moodle_url($PAGE->url);
if ($error) {
$continue->remove_params('confirm', 'group');
$continue = new single_button($continue, get_string('continue'), 'get');
$cancel = null;
}
echo $this->confirm($message, $continue, $cancel);
} else {
$hideform = 0;
}
} else {
$hideform = 0;
}
}
if (!$hideform) {
$groupings = groups_get_all_groupings($this->course->id);
$options = array(0 => get_string('all'));
if (count($groupings)) {
foreach ($groupings as $grouping) {
$options[$grouping->id] = $grouping->name;
}
}
$groupingselect = new single_select($url, 'groupingid', $options, $groupingid, false);
$groups = $this->get_active_groups(false, false, 0, 0, $groupingid);
$options = array(0 => get_string('all'));
if (count($groups)) {
foreach ($groups as $group) {
$options[$group->id] = $group->name;
}
}
if (!key_exists($groupid, $options)) {
$groupid = 0;
$url->param('groupid', 0);
echo $OUTPUT->box($OUTPUT->notification(get_string('group_not_in_grouping', 'grouptool') . html_writer::empty_tag('br') . get_string('switched_to_all_groups', 'grouptool'), 'notifyproblem'), 'generalbox centered');
}
$groupselect = new single_select($url, 'groupid', $options, $groupid, false);
$options = array(0 => get_string('portrait', 'grouptool'), 1 => get_string('landscape', 'grouptool'));
$orientationselect = new single_select($url, 'orientation', $options, $orientation, false);
$syncstatus = $this->get_sync_status();
if ($syncstatus[0]) {
/*
* Out of sync? --> show button to get registrations from grouptool to moodle
* (just register not already registered persons and let the others be)
*/
$url = new moodle_url($PAGE->url, array('pushtomdl' => 1, 'sesskey' => sesskey()));
$button = new single_button($url, get_string('updatemdlgrps', 'grouptool'));
echo $OUTPUT->box(html_writer::empty_tag('br') . $OUTPUT->render($button) . html_writer::empty_tag('br'), 'generalbox centered');
}
echo html_writer::tag('div', get_string('grouping', 'group') . ' ' . $OUTPUT->render($groupingselect), array('class' => 'centered grouptool_overview_filter')) . html_writer::tag('div', get_string('group', 'group') . ' ' . $OUTPUT->render($groupselect), array('class' => 'centered grouptool_overview_filter')) . html_writer::tag('div', get_string('orientation', 'grouptool') . ' ' . $OUTPUT->render($orientationselect), array('class' => 'centered grouptool_userlist_filter'));
// If we don't only get the data, the output happens directly per group!
$this->group_overview_table($groupingid, $groupid);
}
}