has_capability('mod/feedback:deletetemplate', $systemcontext)) { $templates = feedback_get_template_list($course, 'public'); if (!is_array($templates)) { echo $OUTPUT->box(get_string('no_templates_available_yet', 'feedback'), 'generalbox boxaligncenter'); } else { echo $OUTPUT->heading(get_string('public', 'feedback'), 3); echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal'); $tablecolumns = array('template', 'action'); $tableheaders = array(get_string('template', 'feedback'), ''); $tablepublic = new flexible_table('feedback_template_public_table'); $tablepublic->define_columns($tablecolumns); $tablepublic->define_headers($tableheaders); $tablepublic->define_baseurl($deleteurl); $tablepublic->column_style('action', 'width', '10%'); $tablepublic->sortable(false); $tablepublic->set_attribute('width', '100%'); $tablepublic->set_attribute('class', 'generaltable'); $tablepublic->setup(); foreach ($templates as $template) { $data = array(); $data[] = $template->name; $url = new moodle_url($deleteurl, array( 'id'=>$id, 'deletetempl'=>$template->id, 'shoulddelete'=>1, ));
$PAGE->set_context($coursecontext); $PAGE->set_pagelayout('incourse'); #---------------------- table setup here-------------------------- $refresh_txt = get_string('refresh_page', 'wiziq'); $table = new flexible_table('wixiq_content'); $table->define_columns(array('name', 'status', 'delete')); $statusicon = '<img src="'.$CFG->wwwroot.'/mod/wiziq/pix/refresh.png" alt='.$refresh_txt.'/>'; $stausimage_first = '<a href="javascript:location.reload(true)"'; $stausimage_second = ' title="'.$refresh_txt.'">'.$statusicon.'</a>'; $stausimage = $stausimage_first.$stausimage_second; $status = 'Status'." ".$stausimage; $nameheding = get_string('nameheading', 'wiziq'); $deleteheading = get_string('deleteheading', 'wiziq'); $table->define_headers(array($nameheding, $status, $deleteheading)); $table->column_style_all('text-align', 'left'); $table->column_style('name', 'width', 'auto'); $table->column_style('status', 'text-align', 'center'); $table->column_style('delete', 'text-align', 'center'); $table->column_style('status', 'width', '180px'); $table->column_style('delete', 'width', '180px'); $table->define_baseurl($PAGE->url); $table->is_downloadable(false); $table->sortable(false); $table->pageable(true); echo $OUTPUT->header(); #--------------------------tabs for navigation----------- $schedulenewwiziqclass = new moodle_url("$CFG->wwwroot/course/modedit.php", array('add' => 'wiziq', 'type' => '', 'course' => $course->id, 'section' => '0', 'return' => '0')); $navigationtabsmanage = new moodle_url("$CFG->wwwroot/mod/wiziq/index.php", array('id' => $course->id, 'sesskey' => sesskey()));
echo html_writer::start_tag('form', $formattributes); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'returnto', 'value' => s($PAGE->url->out(false)))); // Setup submissions table. $table = new flexible_table('mod-block-progress-overview'); $table->pagesize($perpage, $numberofusers); $tablecolumns = array('select', 'picture', 'fullname', 'lastonline', 'progressbar', 'progress'); $table->define_columns($tablecolumns); $tableheaders = array('', '', get_string('fullname'), get_string('lastonline', 'block_progress'), get_string('progressbar', 'block_progress'), get_string('progress', 'block_progress')); $table->define_headers($tableheaders); $table->sortable(true); $table->set_attribute('class', 'overviewTable'); $table->column_style_all('padding', '5px'); $table->column_style_all('text-align', 'left'); $table->column_style_all('vertical-align', 'middle'); $table->column_style('select', 'text-align', 'right'); $table->column_style('select', 'padding', '5px 0 5px 5px'); $table->column_style('progressbar', 'width', '200px'); $table->column_style('progress', 'text-align', 'center'); $table->no_sorting('select'); $select = ''; $table->no_sorting('picture'); $table->no_sorting('progressbar'); if ($paged) { $table->no_sorting('progress'); } $table->define_baseurl($PAGE->url); $table->setup(); // Sort the users (except by progress). $sort = $table->get_sql_sort(); $sortbyprogress = strncmp($sort, 'progress', 8) == 0;
$perpage = get_user_preferences('stampcoll_perpage', STAMPCOLL_USERS_PER_PAGE); $tablecolumns = array('picture', 'fullname', 'count', 'stamps'); $tableheaders = array('', get_string('fullname'), get_string('numberofstamps', 'stampcoll'), ''); require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-stampcoll-stamps'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/mod/stampcoll/view.php?id=' . $cm->id . '&currentgroup=' . $currentgroup); $table->sortable(true); $table->collapsible(false); $table->initialbars(true); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); $table->column_class('count', 'count'); $table->column_class('stamps', 'stamps'); $table->column_style('stamps', 'width', '50%'); $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'stamps'); $table->set_attribute('class', 'stamps'); $table->set_attribute('width', '90%'); $table->set_attribute('align', 'center'); $table->setup(); if (empty($users)) { print_heading(get_string('nousers', 'stampcoll')); return true; } /// Construct the SQL if ($where = $table->get_sql_where()) { $where .= ' AND '; } if ($sort = $table->get_sql_sort()) {
function display_submissions($message = '') { global $CFG, $db, $USER; require_once $CFG->libdir . '/gradelib.php'; // Update preferences if (isset($_POST['updatepref'])) { $perpage = optional_param('perpage', 20, PARAM_INT); $perpage = $perpage <= 0 ? 20 : $perpage; set_user_preference('assignment_perpage', $perpage); $moderationtarget = optional_param('moderationtarget', 0, PARAM_INT); $moderationtarget = $moderationtarget <= 0 ? 0 : $moderationtarget; set_user_preference('assignment_moderationtarget', $moderationtarget); } // Get preferences $perpage = get_user_preferences('assignment_perpage', 10); $moderationtarget = get_user_preferences('assignment_moderationtarget', 0); // Some shortcuts to make the code read better $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); $course = $this->course; $assignment = $this->assignment; $cm = $this->cm; $context = get_context_instance(CONTEXT_MODULE, $cm->id); $page = optional_param('page', 0, PARAM_INT); // Log this view add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id); // Print header and navigation breadcrumbs $navigation = build_navigation($this->strsubmissions, $this->cm); print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm)); // Print tabs at top of page $tabs = array(); $row = array(); $inactive = array(); $activated = array(); $row[] = new tabobject('criteria', "type/peerreview/" . self::CRITERIA_FILE . "?id=" . $this->cm->id . "&a=" . $this->assignment->id, get_string('criteria', 'assignment_peerreview')); $row[] = new tabobject('submissions', '', get_string('submissions', 'assignment_peerreview')); $tabs[] = $row; $currenttab = 'submissions'; $inactive[] = 'submissions'; $activated[] = 'submissions'; print_tabs($tabs, $currenttab, $inactive, $activated); // Print optional message if (!empty($message)) { echo $message; // display messages here if any } // Check to see if groups are being used in this assignment // find out current groups mode // $groupmode = groups_get_activity_groupmode($cm); // $currentgroup = groups_get_activity_group($cm, true); // groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/assignment/submissions.php?id=' . $cm->id); // Get all ppl that are allowed to submit assignments // if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) { if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id')) { $users = array_keys($users); } // Filter out teachers if ($users && ($teachers = get_users_by_capability($context, 'mod/assignment:grade', 'u.id'))) { $users = array_diff($users, array_keys($teachers)); } // Warn if class is too small if (count($users) < 5) { notify(get_string('numberofstudentswarning', 'assignment_peerreview')); } // if groupmembersonly used, remove users who are not in any group // if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) { // if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) { // $users = array_intersect($users, array_keys($groupingusers)); // } // } // Create the table to be shown require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-assignment-submissions'); $tablecolumns = array('picture', 'fullname', 'submitted', 'reviews', 'moderations', 'status', 'seedoreviews', 'suggestedmark', 'finalgrade'); $table->define_columns($tablecolumns); $tableheaders = array('', get_string('fullname'), get_string('submission', 'assignment_peerreview'), get_string('reviewsbystudent', 'assignment_peerreview') . helpbutton('reviewsbystudent', get_string('reviewsbystudent', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('moderationstitle', 'assignment_peerreview') . helpbutton('moderationtarget', get_string('moderationtarget', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('status') . helpbutton('status', get_string('status', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('seedoreviews', 'assignment_peerreview') . helpbutton('seedoreviews', get_string('seedoreviews', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('suggestedgrade', 'assignment_peerreview') . helpbutton('suggestedgrade', get_string('suggestedgrade', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true), get_string('finalgrade', 'assignment_peerreview') . helpbutton('finalgrade', get_string('finalgrade', 'assignment_peerreview'), 'assignment/type/peerreview/', true, false, '', true)); $table->define_headers($tableheaders); // $table->define_baseurl($CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id.'&currentgroup='.$currentgroup); $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id); // $table->sortable(true, 'submitted'); $table->sortable(false); $table->collapsible(true); // $table->initialbars(true); $table->initialbars(false); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); $table->column_class('submitted', 'submitted'); $table->column_class('reviews', 'reviews'); $table->column_class('moderations', 'moderations'); $table->column_class('status', 'status'); $table->column_class('seedoreviews', 'seedoreviews'); $table->column_class('suggestedmark', 'suggestedmark'); $table->column_class('finalgrade', 'finalgrade'); $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'submissions'); $table->set_attribute('width', '99%'); $table->set_attribute('align', 'center'); $table->column_style('submitted', 'text-align', $alignment); $table->column_style('finalgrade', 'text-align', 'center'); /* $table->no_sorting('picture'); $table->no_sorting('fullname'); $table->no_sorting('submitted'); $table->no_sorting('reviews'); $table->no_sorting('moderations'); $table->no_sorting('status'); $table->no_sorting('seedoreviews'); $table->no_sorting('suggestedmark'); $table->no_sorting('finalgrade'); */ $table->setup(); if (empty($users)) { print_heading(get_string('nosubmitusers', 'assignment')); return true; } // Construct the SQL if ($where = $table->get_sql_where()) { $where .= ' AND '; } $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, s.id AS submissionid, s.grade, s.timecreated as submitted, s.timemarked '; $sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'assignment_submissions s ON u.id=s.userid AND s.assignment=' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') '; $sort = 'ORDER BY COALESCE(submitted,2147483647) ASC, submissionid ASC, u.lastname ASC'; // if ($sort = $table->get_sql_sort()) { // $sort = ' ORDER BY '.$sort; // } $table->pagesize($perpage, count($users)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); $grademenu = make_grades_menu($this->assignment->grade); // Get the criteria $criteriaList = get_records_list('assignment_criteria', 'assignment', $this->assignment->id, 'ordernumber'); $numberOfCriteria = 0; if (is_array($criteriaList)) { $criteriaList = array_values($criteriaList); $numberOfCriteria = count($criteriaList); } if (($ausers = get_records_sql($select . $sql . $sort, $table->get_page_start(), $table->get_page_size())) !== false) { // $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers)); foreach ($ausers as $auser) { // $final_grade = $grading_info->items[0]->grades[$auser->id]; // Calculate user status $auser->status = $auser->timemarked > 0; $picture = print_user_picture($auser, $course->id, $auser->picture, false, true); $studentName = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&course=' . $this->course->id . '">' . fullname($auser) . '</a>'; // If submission has been made if (!empty($auser->submissionid)) { $filearea = $this->file_area_name($auser->id); $fileLink = ''; if (isset($this->assignment->var3) && $this->assignment->var3 == self::ONLINE_TEXT) { $url = '/mod/assignment/type/peerreview/' . self::VIEW_ONLINE_TEXT . '?id=' . $this->cm->id . '&a=' . $this->assignment->id . '&userid=' . $auser->id . '&view=moderation'; $fileLink .= '<a href="' . $CFG->wwwroot . $url . '" target="_blank" onclick="return openpopup(\'' . $url . '\',\'\',\'menubar=0,location=0,scrollbars,resizable,width=500,height=400\');"><img src="' . $CFG->pixpath . '/f/html.gif" /></a>'; } else { $basedir = $this->file_area($auser->id); if ($files = get_directory_list($basedir)) { require_once $CFG->libdir . '/filelib.php'; foreach ($files as $key => $file) { $icon = mimeinfo('icon', $file); $ffurl = get_file_url("{$filearea}/{$file}", array('forcedownload' => 1)); $fileLink .= '<a href="' . $ffurl . '" ><img src="' . $CFG->pixpath . '/f/' . $icon . '" class="icon" alt="' . $icon . '" /></a>'; } } } $submitted = '<div class="files" style="display:inline;">' . $fileLink . '</div><div style="display:inline;" id="tt' . $auser->id . '">' . userdate($auser->submitted, get_string('strftimeintable', 'assignment_peerreview')) . '</div>'; $submitted .= ' <a href="' . $CFG->wwwroot . '/mod/assignment/type/peerreview/' . self::RESUBMIT_FILE . '?id=' . $this->cm->id . '&a=' . $this->assignment->id . '&userid=' . $auser->id . '">(' . get_string('resubmitlabel', 'assignment_peerreview') . ')</a>'; // Reviews by student $numberOfReviewsByThisStudent = 0; if ($reviewsByThisStudent = get_records_select('assignment_review', 'assignment=\'' . $this->assignment->id . '\' AND reviewer=\'' . $auser->id . '\' AND complete=\'1\'')) { $numberOfReviewsByThisStudent = count($reviewsByThisStudent); $reviewsByThisStudent = array_values($reviewsByThisStudent); $reviews = '<div style="text-align:center;" id="re' . $auser->id . '">'; for ($i = 0; $i < $numberOfReviewsByThisStudent; $i++) { $reviews .= '<span id="rev' . $reviewsByThisStudent[$i]->id . '" style="padding:5px 2px;">'; $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $reviewsByThisStudent[$i]->reviewee . '&mode=single&offset=1'; $reviews .= element_to_popup_window('button', $popup_url, 'grade' . $auser->id, $i + 1, 600, 780, $i + 1, 'none', true, 'user' . $auser->id . 'rev' . $i); $reviews .= '</span>'; // $reviews .= $i<$numberOfReviewsByThisStudent-1?', ':''; } $reviews .= '</div>'; $reviews .= '<script>'; for ($i = 0; $i < $numberOfReviewsByThisStudent; $i++) { $reviews .= 'document.getElementById(\'user' . $auser->id . 'rev' . $i . '\').setAttribute(\'onmouseover\',\'document.getElementById("se' . $reviewsByThisStudent[$i]->reviewee . '").style.background="#ff9999";\');'; $reviews .= 'document.getElementById(\'user' . $auser->id . 'rev' . $i . '\').setAttribute(\'onmouseout\',\'document.getElementById("se' . $reviewsByThisStudent[$i]->reviewee . '").style.background="transparent";\');'; } $reviews .= '</script>'; } else { $reviews = '<div id="re' . $auser->id . '"> </div>'; } // Reviews of student $reviewsOfThisStudent = $this->get_reviews_of_student($auser->id); $numberOfReviewsOfThisStudent = 0; if (is_array($reviewsOfThisStudent)) { $numberOfReviewsOfThisStudent = count($reviewsOfThisStudent); } $statusCode = $this->get_status($reviewsOfThisStudent, $numberOfCriteria); $status = '<div id="st' . $auser->id . '">' . $this->print_status($statusCode, true) . '</div>'; $buttontext = get_string('review', 'assignment_peerreview'); $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++; $button = element_to_popup_window('button', $popup_url, 'grade' . $auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'reviewbutton' . $auser->id); $seedoreviews = '<div id="se' . $auser->id . '" style="text-align:center;padding:5px 0;"><span id="seOutline' . $auser->id . '" class="s' . ($statusCode <= 3 ? '0' : '1') . '" style="padding:4px 1px;">' . $button . '</span></div>'; $seedoreviews .= '<script>'; $seedoreviews .= 'document.getElementById(\'reviewbutton' . $auser->id . '\').setAttribute(\'onmouseover\',\''; for ($i = 0; $i < $numberOfReviewsOfThisStudent; $i++) { $seedoreviews .= 'buttonHighlight=document.getElementById("rev' . $reviewsOfThisStudent[$i]->review . '"); if(buttonHighlight) buttonHighlight.style.background="#ff9999";'; } $seedoreviews .= '\');'; $seedoreviews .= 'document.getElementById(\'reviewbutton' . $auser->id . '\').setAttribute(\'onmouseout\',\''; for ($i = 0; $i < $numberOfReviewsOfThisStudent; $i++) { $seedoreviews .= 'buttonHighlight=document.getElementById("rev' . $reviewsOfThisStudent[$i]->review . '"); if(buttonHighlight) buttonHighlight.style.background="transparent";'; } $seedoreviews .= '\');'; $seedoreviews .= '</script>'; // Suggest mark $suggestedmark = '<div style="text-align:center;" id="su' . $auser->id . '">'; $suggestedMarkToDisplay = $this->get_marks($reviewsOfThisStudent, $criteriaList, $numberOfReviewsByThisStudent, $this->assignment->var1); $suggestedmark .= '<input type="text" size="4" id="gvalue' . $auser->id . '" value="' . $suggestedMarkToDisplay . '" />'; $suggestedmark .= '<input type="button" value="' . get_string('set', 'assignment_peerreview') . '" onclick="mark=parseInt(document.getElementById(\'gvalue' . $auser->id . '\').value); if(isNaN(mark)) {alert(\'' . get_string('gradenotanumber', 'assignment_peerreview') . '\'); return false;} else {popup_url=\'/mod/assignment/type/peerreview/' . self::SET_MARK_FILE . '?id=' . $this->cm->id . '&a=' . $this->assignment->id . '&userid=' . $auser->id . '&mark=\'+mark; return openpopup(popup_url, \'grade5\', \'menubar=0,location=0,scrollbars,resizable,width=400,height=300\', 0);}" />'; $suggestedmark .= '</div>'; // Final grade if ($auser->timemarked > 0) { // if ($final_grade->locked or $final_grade->overridden) { // $grade = '<div id="g'.$auser->id.'">'.$final_grade->str_grade.'</div>'; // } // else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; // } } else { $grade = '<div id="g' . $auser->id . '">' . get_string('notset', 'assignment_peerreview') . '</div>'; } } else { $submitted = '<div id="tt' . $auser->id . '"> </div>'; $reviews = '<div id="re' . $auser->id . '"> </div>'; $status = '<div id="st' . $auser->id . '"> </div>'; $seedoreviews = '<div id="se' . $auser->id . '"> </div>'; $suggestedmark = '<div id="su' . $auser->id . '"> </div>'; $grade = '<div id="g' . $auser->id . '">-</div>'; } $moderationCountSQL = 'SELECT count(r.id) FROM ' . $CFG->prefix . 'assignment a, ' . $CFG->prefix . 'assignment_review r WHERE a.course=' . $course->id . ' AND a.id=r.assignment AND r.teacherreview=1 AND r.reviewee=\'' . $auser->id . '\''; $moderationCount = count_records_sql($moderationCountSQL); $moderations = '<div id="mo' . $auser->id . '" style="text-align:center;">' . ($moderationCount < $moderationtarget ? '<span class="errorStatus">' . $moderationCount . '</span>' : $moderationCount) . '</div>'; // $finalgrade = '<span id="finalgrade_'.$auser->id.'">'.$final_grade->str_grade.'</span>'; // Add the row to the table $row = array($picture, $studentName, $submitted, $reviews, $moderations, $status, $seedoreviews, $suggestedmark, $grade); $table->add_data($row); } } /// Print quickgrade form around the table require_once $CFG->dirroot . '/mod/assignment/type/peerreview/' . self::STYLES_FILE; $table->print_html(); /// Print the whole table /// Mini form for setting user preference echo '<div style="margin:5px 10px;">'; echo '<table id="optiontable" align="right">'; echo '<tr><td colspan="2" align="right">'; echo '<form id="options" action="type/peerreview/' . self::MASS_MARK_FILE . '?id=' . $this->cm->id . '&a=' . $this->assignment->id . '" method="post">'; echo '<input type="submit" value="' . get_string('massmark', 'assignment_peerreview') . '" />'; helpbutton('massmark', get_string('massmark', 'assignment_peerreview'), 'assignment/type/peerreview/'); echo '</form>'; echo '<br />'; echo '</td></tr>'; echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post">'; echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />'; echo '<tr align="right"><td>'; echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>'; echo ':</td>'; echo '<td>'; echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />'; helpbutton('pagesize', get_string('pagesize', 'assignment'), 'assignment'); echo '</td></tr>'; echo '<tr align="right"><td>'; echo '<label for="moderationtarget">' . get_string('moderationtarget', 'assignment_peerreview') . '</label>'; echo ':</td>'; echo '<td>'; echo '<input type="text" id="moderationtarget" name="moderationtarget" size="1" value="' . $moderationtarget . '" />'; helpbutton('moderationtarget', get_string('moderationtargetwhy', 'assignment_peerreview'), 'assignment/type/peerreview'); echo '</td></tr>'; echo '<tr>'; echo '<td colspan="2" align="right">'; echo '<input type="submit" value="' . get_string('savepreferences') . '" />'; echo '</form>'; echo '</td></tr></table>'; echo '</div>'; ///End of mini form print_footer($this->course); }
$boublogid = $result->boublogid; $bcontextid = $result->bcontextid; $boublogname = $result->boublogname; $bcoursename = $result->bcoursename; } else { list($bid, $boublogid, $bcontextid, $boublogname, $bcoursename) = oublog_import_getbloginfo($bid); } echo html_writer::start_tag('p', array('class' => 'oublog_import_step1_from')); echo get_string('import_step1_from', 'oublog') . '<br />' . html_writer::tag('span', $boublogname); echo html_writer::end_tag('p'); // Setup table early so sort can be determined (needs setup to be called first). $table = new flexible_table($cm->id * $bid); $url = new moodle_url('/mod/oublog/import.php', $params + $stepinfo); $table->define_baseurl($url); $table->define_columns(array('title', 'timeposted', 'tags', 'include')); $table->column_style('include', 'text-align', 'center'); $table->sortable(true, 'timeposted', SORT_DESC); $table->maxsortkeys = 1; $table->no_sorting('tags'); $table->no_sorting('include'); $table->setup(); $sort = flexible_table::get_sort_for_table($cm->id * $bid); if (empty($sort)) { $sort = 'timeposted DESC'; } if ($tags = optional_param('tags', null, PARAM_SEQUENCE)) { // Filter by joining tag instances. $stepinfo['tags'] = $tags; } $perpage = 100; // Must match value in oublog_import_getallposts.
echo $OUTPUT->footer(); die; } // Start with a description. if ($expiry > 0) { $expirydisplay = format_time($expiry); echo '<div class=\'alert\'>' . get_string('deleteexpirywarning', 'tool_recyclebin', $expirydisplay) . '</div>'; } // Define columns and headers. $firstcolstr = $context->contextlevel == CONTEXT_COURSE ? 'activity' : 'course'; $columns = array($firstcolstr, 'date', 'restore', 'delete'); $headers = array(get_string($firstcolstr), get_string('datedeleted', 'tool_recyclebin'), get_string('restore'), get_string('delete')); // Define a table. $table = new flexible_table('recyclebin'); $table->define_columns($columns); $table->column_style('restore', 'text-align', 'center'); $table->column_style('delete', 'text-align', 'center'); $table->define_headers($headers); $table->define_baseurl($PAGE->url); $table->set_attribute('id', 'recycle-bin-table'); $table->setup(); // Cache a list of modules. $modules = null; if ($context->contextlevel == CONTEXT_COURSE) { $modules = $DB->get_records('modules'); } // Add all the items to the table. $showempty = false; $canrestore = $recyclebin->can_restore(); foreach ($items as $item) { $row = array();
/** * Helper method, displays a table * of users with checkboxes next to them. * Also includes a submit button to take * action on those users. * * @param string $hook The calling hook * @return string * @todo Not in love with this method, but it works **/ function display_user_table($hook) { global $CFG; global $DB, $OUTPUT; require_once $CFG->libdir . '/tablelib.php'; ob_start(); $pagesize = optional_param('pagesize', 50, PARAM_INT); print "<form class=\"userform\" id=\"userformid\" action=\"{$CFG->wwwroot}/blocks/gdata/index.php\" method=\"post\">"; $table = new flexible_table("blocks-gdata-{$hook}"); $filter = $this->create_filter($hook, $pagesize); // Define columns based on hook switch ($hook) { case 'users': $table->define_columns(array('username', 'fullname', 'email', 'lastsync', 'status')); $table->define_headers(array(get_string('username'), get_string('fullname'), get_string('email'), get_string('lastsync', 'block_gdata'), get_string('status'))); break; case 'addusers': $table->define_columns(array('username', 'fullname', 'email')); $table->define_headers(array(get_string('username'), get_string('fullname'), get_string('email'))); break; } $table->define_baseurl("{$CFG->wwwroot}/blocks/gdata/index.php?hook={$hook}&pagesize={$pagesize}"); $table->pageable(true); $table->sortable(true, 'username', SORT_DESC); $table->set_attribute('width', '100%'); $table->set_attribute('class', 'flexible generaltable generalbox'); $table->column_style('action', 'text-align', 'center'); $table->setup(); list($select, $from, $where, $params) = $this->get_sql($hook, $filter); $total = $DB->count_records_sql("SELECT COUNT(*) {$from} {$where}", $params); $table->pagesize($pagesize, $total); if ($users = $DB->get_records_sql("{$select} {$from} {$where} ORDER BY " . $table->get_sql_sort(), array(), $table->get_page_start(), $table->get_page_size())) { foreach ($users as $user) { $username = print_checkbox("userids[]", $user->id, false, s($user->username), s($user->username), '', true); // Define table contents based on hook switch ($hook) { case 'users': if ($user->lastsync > 0) { $lastsync = userdate($user->lastsync); } else { $lastsync = get_string('never'); } $table->add_data(array($username, fullname($user), $user->email, $lastsync, get_string("status{$user->status}", 'block_gdata'))); break; case 'addusers': $table->add_data(array($username, fullname($user), $user->email)); break; } } } print $OUTPUT->box_start('boxaligncenter boxwidthwide', '', array()); print $filter->display_add(); print $filter->display_active(); if (empty($table->totalrows)) { // Avoid printing the form on empty tables print $table->finish_output(); } else { $allstr = get_string('selectall', 'block_gdata'); $nonestr = get_string('selectnone', 'block_gdata'); $submitstr = get_string("submitbutton{$hook}", 'block_gdata'); $submitallstr = get_string("submitbuttonall{$hook}", 'block_gdata', $total); $confirmstr = get_string("confirm{$hook}", 'block_gdata', $total); $confirmstr = addslashes_js($confirmstr); $options = array(50 => 50, 100 => 100, 250 => 250, 500 => 500, 1000 => 1000); print '<input type="hidden" name="hook" value="' . $hook . '" />'; print '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; print $table->finish_output(); print "<p><a href=\"#\" title=\"{$allstr}\" onclick=\"select_all_in('FORM', 'userform', 'userformid'); return false;\">{$allstr}</a> / "; print "<a href=\"#\" title=\"{$nonestr}\" onclick=\"deselect_all_in('FORM', 'userform', 'userformid'); return false;\">{$nonestr}</a></p>"; print "<input type=\"submit\" name=\"users\" value=\"{$submitstr}\" /> "; print "<input type=\"submit\" name=\"allusers\" value=\"{$submitallstr}\" onclick=\"return confirm('{$confirmstr}');\" />"; print '</form><br />'; print $OUTPUT->single_select("{$CFG->wwwroot}/blocks/gdata/index.php?hook={$hook}&pagesize=", 'changepagesize', $options, $pagesize); } print $OUTPUT->box_end(true); $tablehtml = ob_get_contents(); ob_end_clean(); return $tablehtml; }
$sql = "SELECT DISTINCT {$picturefields}, u.lastaccess\n FROM {user} u, {role_assignments} a {$groupsfrom}\n WHERE a.contextid = :contextid\n AND a.userid = u.id\n {$rolewhere}\n {$groupwhere}"; $params['contextid'] = $context->id; $users = array_values($DB->get_records_sql($sql, $params)); $numberofusers = count($users); // Setup submissions table $table = new flexible_table('mod-block-progress-overview'); $tablecolumns = array('picture', 'fullname', 'lastonline', 'progressbar', 'progress'); $table->define_columns($tablecolumns); $tableheaders = array('', get_string('fullname'), get_string('lastonline', 'block_progress'), get_string('progressbar', 'block_progress'), get_string('progress', 'block_progress')); $table->define_headers($tableheaders); $table->sortable(true); $table->set_attribute('class', 'generalbox'); $table->column_style_all('padding', '5px 10px'); $table->column_style_all('text-align', 'left'); $table->column_style_all('vertical-align', 'middle'); $table->column_style('progressbar', 'width', '200px'); $table->column_style('progress', 'text-align', 'center'); $table->no_sorting('picture'); $table->no_sorting('progressbar'); $table->define_baseurl($PAGE->url); $table->setup(); // Build table of progress bars as they are marked for ($i = 0; $i < $numberofusers; $i++) { $picture = $OUTPUT->user_picture($users[$i], array('course' => $course->id)); $name = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $users[$i]->id . '&course=' . $course->id . '">' . fullname($users[$i]) . '</a>'; if ($users[$i]->lastaccess == 0) { $lastonline = get_string('never'); } else { $lastonline = userdate($users[$i]->lastaccess); } $attempts = get_attempts($modules, $config, $events, $users[$i]->id, $course->id);
} //$filter->set_data(); $filter->display(); // Add activity button if ($cpd_years && $cpdyearid) { $buttonurl = new moodle_url('/admin/report/cpd/edit_activity.php', array('cpdyearid' => $cpdyearid)); echo $OUTPUT->single_button($buttonurl, get_string('addactivity', 'report_cpd'), 'get'); } if (!empty($cpd_years[$cpdyearid])) { echo $OUTPUT->heading(get_string('cpdyeara', 'report_cpd', $cpd_years[$cpdyearid]), 4, 'printonly'); } echo $OUTPUT->heading(fullname($USER), 3, 'printonly'); $table = new flexible_table('cpd'); $table->define_columns(array_keys($columns)); $table->define_headers(array_values($columns)); $table->column_style('edit', 'text-align', 'center'); $table->column_style('delete', 'text-align', 'center'); $table->column_class('edit', 'no_print_col'); $table->column_class('delete', 'no_print_col'); $table->define_baseurl($PAGE->url->out()); $table->sortable(false); $table->collapsible(false); $table->column_style_all('white-space', 'normal'); $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'generaltable boxalignleft cpd'); $table->setup(); foreach ($cpd_records as $cpd_record) { $table->add_data($cpd_record); } $table->finish_output();
} /// set table columns and headers $tablecolumns = array('timesent', 'subject', 'attachment', ''); $tableheaders = array(get_string('date', 'block_quickmail'), get_string('subject', 'forum'), get_string('attachment', 'block_quickmail'), get_string('action', 'block_quickmail')); $table = new flexible_table('bocks-quickmail-emaillog'); /// define table columns, headers, and base url $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/blocks/quickmail/emaillog.php?id=' . $course->id . '&instanceid=' . $instanceid); /// table settings $table->sortable(true, 'timesent', SORT_DESC); $table->collapsible(true); $table->initialbars(false); $table->pageable(true); /// column styles (make sure date does not wrap) NOTE: More table styles in styles.php $table->column_style('timesent', 'width', '40%'); $table->column_style('timesent', 'white-space', 'nowrap'); /// set attributes in the table tag $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'emaillog'); $table->set_attribute('class', 'generaltable generalbox'); $table->set_attribute('align', 'center'); $table->set_attribute('width', '80%'); $table->setup(); /// SQL $sql = "SELECT * \n FROM {$CFG->prefix}block_quickmail_log\n WHERE courseid = {$course->id} \n AND userid = {$USER->id} "; if ($table->get_sql_where()) { $sql .= 'AND ' . $table->get_sql_where(); } $sql .= ' ORDER BY ' . $table->get_sql_sort(); /// set page size
$settingslicenses = new moodle_url('/admin/settings.php?section=blocksettingcourse_files_license'); $PAGE->navbar->add(get_string('blocks')); $PAGE->navbar->add(get_string('pluginname', 'block_course_files_license'), $settingslicenses); $PAGE->navbar->add(get_string('managelicenses', 'block_course_files_license'), $managelicenses); echo $OUTPUT->header(); echo $OUTPUT->heading($strtitle, 2); $table = new flexible_table('license-display'); $table->define_columns(array('name', 'description', 'actions')); $table->define_headers(array(get_string('license_name', 'block_course_files_license'), get_string('license_description', 'block_course_files_license'), get_string('actions', 'moodle'))); $table->define_baseurl($baseurl); $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'licenses-table'); $table->set_attribute('class', 'generaltable generalbox'); $table->column_class('license', 'license'); $table->column_class('actions', 'actions'); $table->column_style('actions', 'text-align', 'right'); $table->setup(); $i = 0; $len = count($licenses); $upicon = new pix_icon('t/up', get_string('up')); $downicon = new pix_icon('t/down', get_string('down')); foreach ($licenses as $license) { $l_name = '<div class="license-name">' . $license->name . '</div>'; $l_description = '<div class="license-description">' . $license->description . '</div>'; $editurl = new moodle_url('/blocks/course_files_license/editlicense.php?id=' . $license->id . $extraparams); $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit'))); $deleteurl = new moodle_url('/blocks/course_files_license/managelicenses.php?deleteid=' . $license->id . '&sesskey=' . sesskey() . $extraparams); $deleteicon = new pix_icon('t/delete', get_string('delete')); $deleteaction = $OUTPUT->action_icon($deleteurl, $deleteicon, new confirm_action(get_string('deletelicenseconfirm', 'block_course_files_license'))); $moveaction = ''; if ($i == 0 && $len > 1) {