当前位置: 首页>>代码示例>>PHP>>正文


PHP flexible_table::pagesize方法代码示例

本文整理汇总了PHP中flexible_table::pagesize方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::pagesize方法的具体用法?PHP flexible_table::pagesize怎么用?PHP flexible_table::pagesize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flexible_table的用法示例。


在下文中一共展示了flexible_table::pagesize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run_table_test

 protected function run_table_test($columns, $headers, $sortable, $collapsible, $suppress, $nosorting, $data, $pagesize)
 {
     $table = new flexible_table('tablelib_test');
     $table->define_columns($columns);
     $table->define_headers($headers);
     $table->define_baseurl('/invalid.php');
     $table->sortable($sortable);
     $table->collapsible($collapsible);
     foreach ($suppress as $column) {
         $table->column_suppress($column);
     }
     foreach ($nosorting as $column) {
         $table->no_sorting($column);
     }
     $table->setup();
     $table->pagesize($pagesize, count($data));
     foreach ($data as $row) {
         $table->add_data_keyed($row);
     }
     $table->finish_output();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:21,代码来源:tablelib_test.php

示例2: switch

 /**
  * 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}&amp;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}\" />&nbsp;&nbsp;";
         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}&amp;pagesize=", 'changepagesize', $options, $pagesize);
     }
     print $OUTPUT->box_end(true);
     $tablehtml = ob_get_contents();
     ob_end_clean();
     return $tablehtml;
 }
开发者ID:stefanotirati,项目名称:moodle-google-apps,代码行数:89,代码来源:block_gdata.php

示例3: display

 function display($quiz, $cm, $course)
 {
     /// This function just displays the report
     global $CFG, $SESSION, $db, $QTYPES;
     $strnoquiz = get_string('noquiz', 'quiz');
     $strnoattempts = get_string('noattempts', 'quiz');
     /// Only print headers if not asked to download data
     $download = optional_param('download', NULL);
     if (!$download) {
         $this->print_header_and_tabs($cm, $course, $quiz, $reportmode = "analysis");
     }
     /// Construct the table for this particular report
     if (!$quiz->questions) {
         print_heading($strnoattempts);
         return true;
     }
     /// Check to see if groups are being used in this quiz
     if ($groupmode = groupmode($course, $cm)) {
         // Groups are being used
         if (!$download) {
             $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id={$cm->id}&amp;mode=analysis");
         } else {
             $currentgroup = get_and_set_current_group($course, $groupmode);
         }
     } else {
         $currentgroup = get_and_set_current_group($course, $groupmode);
     }
     // set Table and Analysis stats options
     if (!isset($SESSION->quiz_analysis_table)) {
         $SESSION->quiz_analysis_table = array('attemptselection' => 0, 'lowmarklimit' => 0, 'pagesize' => 10);
     }
     foreach ($SESSION->quiz_analysis_table as $option => $value) {
         $urlparam = optional_param($option, NULL);
         if ($urlparam === NULL) {
             ${$option} = $value;
         } else {
             ${$option} = $SESSION->quiz_analysis_table[$option] = $urlparam;
         }
     }
     $scorelimit = $quiz->sumgrades * $lowmarklimit / 100;
     // ULPGC ecastro DEBUG this is here to allow for different SQL to select attempts
     switch ($attemptselection) {
         case QUIZ_ALLATTEMPTS:
             $limit = '';
             $group = '';
             break;
         case QUIZ_HIGHESTATTEMPT:
             $limit = ', max(qa.sumgrades) ';
             $group = ' GROUP BY qa.userid ';
             break;
         case QUIZ_FIRSTATTEMPT:
             $limit = ', min(qa.timemodified) ';
             $group = ' GROUP BY qa.userid ';
             break;
         case QUIZ_LASTATTEMPT:
             $limit = ', max(qa.timemodified) ';
             $group = ' GROUP BY qa.userid ';
             break;
     }
     if ($attemptselection != QUIZ_ALLATTEMPTS) {
         $sql = 'SELECT qa.userid ' . $limit . 'FROM ' . $CFG->prefix . 'user u LEFT JOIN ' . $CFG->prefix . 'quiz_attempts qa ON u.id = qa.userid ' . 'WHERE qa.quiz = ' . $quiz->id . ' AND qa.preview = 0 ' . $group;
         $usermax = get_records_sql_menu($sql);
     }
     $groupmembers = '';
     $groupwhere = '';
     //Add this to the SQL to show only group users
     if ($currentgroup) {
         $groupmembers = ', ' . groups_members_from_sql();
         $groupwhere = ' AND ' . groups_members_where_sql($currentgroup, 'u.id');
     }
     $sql = 'SELECT  qa.* FROM ' . $CFG->prefix . 'quiz_attempts qa, ' . $CFG->prefix . 'user u ' . $groupmembers . 'WHERE u.id = qa.userid AND qa.quiz = ' . $quiz->id . ' AND qa.preview = 0 AND ( qa.sumgrades >= ' . $scorelimit . ' ) ' . $groupwhere;
     // ^^^^^^ es posible seleccionar aqu TODOS los quizzes, como quiere Jussi,
     // pero habra que llevar la cuenta ed cada quiz para restaura las preguntas (quizquestions, states)
     /// Fetch the attempts
     $attempts = get_records_sql($sql);
     if (empty($attempts)) {
         print_heading(get_string('nothingtodisplay'));
         $this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
         return true;
     }
     /// Here we rewiew all attempts and record data to construct the table
     $questions = array();
     $statstable = array();
     $questionarray = array();
     foreach ($attempts as $attempt) {
         $questionarray[] = quiz_questions_in_quiz($attempt->layout);
     }
     $questionlist = quiz_questions_in_quiz(implode(",", $questionarray));
     $questionarray = array_unique(explode(",", $questionlist));
     $questionlist = implode(",", $questionarray);
     unset($questionarray);
     foreach ($attempts as $attempt) {
         switch ($attemptselection) {
             case QUIZ_ALLATTEMPTS:
                 $userscore = 0;
                 // can be anything, not used
                 break;
             case QUIZ_HIGHESTATTEMPT:
                 $userscore = $attempt->sumgrades;
                 break;
//.........这里部分代码省略.........
开发者ID:veritech,项目名称:pare-project,代码行数:101,代码来源:report.php

示例4: array


//.........这里部分代码省略.........
     $table->set_attribute('width', '90%');
     //$table->set_attribute('align', 'center');
     $table->no_sorting('finalgrade');
     $table->no_sorting('outcome');
     // Start working -- this is necessary as soon as the niceties are over
     $table->setup();
     /// Check to see if groups are being used in this assignment
     if (!$teacherattempts) {
         $teachers = get_course_teachers($course->id);
         if (!empty($teachers)) {
             $keys = array_keys($teachers);
         }
         foreach ($keys as $key) {
             unset($users[$key]);
         }
     }
     if (empty($users)) {
         print_heading(get_string('noattempts', 'assignment'));
         return true;
     }
     /// Construct the SQL
     if ($where = $table->get_sql_where()) {
         $where .= ' AND ';
     }
     if ($sort = $table->get_sql_sort()) {
         $sort = ' ORDER BY ' . $sort;
     }
     $select = 'SELECT u.id, u.firstname, u.lastname, u.picture,
                       s.id AS submissionid, s.grade, s.submissioncomment,
                       s.timemodified, s.timemarked,
                       COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
     $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) . ') ';
     $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);
     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 && $auser->timemarked >= $auser->timemodified;
             $picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true);
             if (empty($auser->submissionid)) {
                 $auser->grade = -1;
                 //no submission yet
             }
             if (!empty($auser->submissionid)) {
                 ///Prints student answer and student modified date
                 ///attach file or print link to student answer, depending on the type of the assignment.
                 ///Refer to print_student_answer in inherited classes.
                 if ($auser->timemodified > 0) {
                     $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>';
                 } else {
                     $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 }
                 ///Print grade, dropdown or text
                 if ($auser->timemarked > 0) {
                     $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                     } else {
                         if ($quickgrade) {
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:67,代码来源:lib.php

示例5: list

     list($twhere, $tparams) = $table->get_sql_where();
     if ($twhere) {
         $where .= ' AND ' . $twhere;
         //initial bar
         $params = array_merge($params, $tparams);
     }
     if (!empty($countsql)) {
         $count = $DB->get_record_sql($countsql);
         $totalinitials = $count->nbresults;
         if ($twhere) {
             $countsql .= ' AND ' . $twhere;
         }
         $count = $DB->get_record_sql($countsql, $params);
         $total = $count->nbresults;
     }
     $table->pagesize($pagesize, $total);
     echo '<div class="quizattemptcounts">';
     if ($count->nbresults == $count->nbattempts) {
         echo get_string('reportcountattempts', 'scorm', $count);
     } else {
         if ($count->nbattempts > 0) {
             echo get_string('reportcountallattempts', 'scorm', $count);
         } else {
             echo $count->nbusers . ' ' . get_string('users');
         }
     }
     echo '</div>';
 }
 // Fetch the attempts
 if (!$download) {
     $attempts = $DB->get_records_sql($select . $from . $where . $sort, $params, $table->get_page_start(), $table->get_page_size());
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:31,代码来源:report.php

示例6: display

 /**
  * Display the report.
  */
 public function display($game, $cm, $course)
 {
     global $CFG, $SESSION, $DB;
     // Define some strings.
     $strreallydel = addslashes(get_string('deleteattemptcheck', 'game'));
     $strtimeformat = get_string('strftimedatetime');
     $strreviewquestion = get_string('reviewresponse', 'quiz');
     // Only print headers if not asked to download data.
     if (!($download = optional_param('download', null))) {
         $this->print_header_and_tabs($cm, $course, $game, $reportmode = "overview");
     }
     // Deal with actions.
     $action = optional_param('action', '', PARAM_ACTION);
     switch ($action) {
         case 'delete':
             // Some attempts need to be deleted.
             $attemptids = optional_param('attemptid', array(), PARAM_INT);
             foreach ($attemptids as $attemptid) {
                 if ($attemptid && ($todelete = get_record('game_attempts', 'id', $attemptid))) {
                     delete_records('game_attempts', 'id', $attemptid);
                     delete_records('game_queries', 'attemptid', $attemptid);
                     // Search game_attempts for other instances by this user.
                     // If none, then delete record for this game, this user from game_grades.
                     // else recalculate best grade.
                     $userid = $todelete->userid;
                     if (!record_exists('game_attempts', 'userid', $userid, 'gameid', $game->id)) {
                         delete_records('game_grades', 'userid', $userid, 'gameid', $game->id);
                     } else {
                         game_save_best_score($game, $userid);
                     }
                 }
             }
             break;
     }
     // Print information on the number of existing attempts.
     if (!$download) {
         // Do not print notices when downloading.
         if ($attemptnum = count_records('game_attempts', 'gameid', $game->id)) {
             $a = new stdClass();
             $a->attemptnum = $attemptnum;
             $a->studentnum = count_records_select('game_attempts', "gameid = '{$game->id}' AND preview = '0'", 'COUNT(DISTINCT userid)');
             $a->studentstring = $course->students;
             notify(get_string('numattempts', 'game', $a));
         }
     }
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     // Find out current groups mode.
     if ($groupmode = groupmode($course, $cm)) {
         // Groups are being used.
         if (!$download) {
             $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id={$cm->id}&amp;mode=overview");
         } else {
             $currentgroup = get_and_set_current_group($course, $groupmode);
         }
     } else {
         $currentgroup = get_and_set_current_group($course, $groupmode);
     }
     // Set table options.
     $noattempts = optional_param('noattempts', 0, PARAM_INT);
     $detailedmarks = optional_param('detailedmarks', 0, PARAM_INT);
     $pagesize = optional_param('pagesize', 10, PARAM_INT);
     $hasfeedback = game_has_feedback($game->id) && $game->grade > 1.0E-7;
     if ($pagesize < 1) {
         $pagesize = 10;
     }
     // Now check if asked download of data.
     if ($download) {
         $filename = clean_filename("{$course->shortname} " . format_string($game->name, true));
         $sort = '';
     }
     // Define table columns.
     $tablecolumns = array('checkbox', 'picture', 'fullname', 'timestart', 'timefinish', 'duration');
     $tableheaders = array(null, '', get_string('fullname'), get_string('startedon', 'game'), get_string('timecompleted', 'game'), get_string('attemptduration', 'game'));
     if ($game->grade) {
         $tablecolumns[] = 'grade';
         $tableheaders[] = get_string('grade', 'game') . '/' . $game->grade;
     }
     if ($detailedmarks) {
         // We want to display marks for all questions.
         // Start by getting all questions.
         $questionlist = game_questions_in_game($game->questions);
         $questionids = explode(',', $questionlist);
         $sql = "SELECT q.*, i.score AS maxgrade, i.id AS instance" . "  FROM {question} q," . "       {game_queries} i" . " WHERE i.gameid = '{$game->id}' AND q.id = i.questionid" . "   AND q.id IN ({$questionlist})";
         if (!($questions = get_records_sql($sql))) {
             print_error('No questions found');
         }
         $number = 1;
         foreach ($questionids as $key => $id) {
             if ($questions[$id]->length) {
                 // Only print questions of non-zero length.
                 $tablecolumns[] = '$' . $id;
                 $tableheaders[] = '#' . $number;
                 $questions[$id]->number = $number;
                 $number += $questions[$id]->length;
             } else {
                 // Get rid of zero length questions.
                 unset($questions[$id]);
//.........这里部分代码省略.........
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:101,代码来源:report.php

示例7:

$showpages->define_baseurl($urlemarking);
$showpages->column_class('actions', 'actions');
$showpages->column_class('lastname', 'lastname');
if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING || $emarking->type == EMARKING_TYPE_PEER_REVIEW && $issupervisor) {
    $showpages->column_class('marker', 'lastname');
}
$defaulttsort = $emarking->anonymous < 2 ? null : 'lastname';
$showpages->sortable(true, $defaulttsort, SORT_ASC);
if ($emarking->anonymous < 2) {
    $showpages->no_sorting('lastname');
}
$showpages->no_sorting('comment');
$showpages->no_sorting('actions');
$showpages->no_sorting('select');
$showpages->pageable(true);
$showpages->pagesize($perpage, $totalstudents);
$showpages->setup();
// Decide on sorting depending on URL parameters and flexible table configuration.
$orderby = $emarking->anonymous < 2 ? 'ORDER BY sort ASC' : 'ORDER BY u.lastname ASC';
if ($showpages->get_sql_sort()) {
    $orderby = 'ORDER BY ' . $showpages->get_sql_sort();
    $tsort = $showpages->get_sql_sort();
}
// Get submissions with extra info to show.
$sqldrafts .= $orderby;
// Run the query on the database.
$drafts = $DB->get_recordset_sql($sqldrafts, $params, $page * $perpage, $perpage);
$unpublishedsubmissions = 0;
// Prepare data for the table.
foreach ($drafts as $draft) {
    // Student info.
开发者ID:sikeze,项目名称:emarking,代码行数:31,代码来源:view.php

示例8: count

}
$userids = array_keys($userrecords);
$users = array_values($userrecords);
$numberofusers = count($users);
$paged = $numberofusers > $perpage;
if (!$paged) {
    $page = 0;
}
// Form for messaging selected participants.
$formattributes = array('action' => $CFG->wwwroot . '/user/action_redir.php', 'method' => 'post', 'id' => 'participantsform');
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 = '';
开发者ID:nwp90,项目名称:Moodle-block_progress,代码行数:31,代码来源:overview.php

示例9: StdClass


//.........这里部分代码省略.........
     if (!empty($this->config->filters)) {
         try {
             $filterquerystring = $this->prepare_filters();
         } catch (Exception $e) {
             if (debugging()) {
                 echo $e->error;
             }
             return get_string('invalidorobsoletefilterquery', 'block_dashboard');
         }
     } else {
         $this->filteredsql = str_replace('<%%FILTERS%%>', '', $this->sql);
     }
     $this->sql = str_replace('<%%FILTERS%%>', '', $this->sql);
     // needed to prepare for filter range prefetch
     if (!empty($this->params)) {
         $filterquerystring = $filterquerystring ? $filterquerystring . '&' . $this->prepare_params() : $this->prepare_params();
     } else {
         $this->sql = str_replace('<%%PARAMS%%>', '', $this->sql);
         // needed to prepare for filter range prefetch
         $this->filteredsql = str_replace('<%%PARAMS%%>', '', $this->filteredsql);
         // needed to prepare for filter range prefetch
     }
     $sort = optional_param('tsort' . $this->instance->id, @$this->config->defaultsort, PARAM_TEXT);
     if (!empty($sort)) {
         // do not sort if already sorted in explained query
         if (!preg_match('/ORDER\\s+BY/si', $this->sql)) {
             $this->filteredsql .= " ORDER BY {$sort}";
         }
     }
     $this->filteredsql = $this->protect($this->filteredsql);
     // ######### GETTING RESULTS
     $countres = $this->count_records($error);
     // if too many results, we force paging mode
     if (empty($this->config->pagesize) && $countres > $CFG->block_dashboard_big_result_threshold && !empty($this->config->bigresult)) {
         $text .= '<span class="error">' . get_string('toomanyrecordsusepaging', 'block_dashboard') . '</span><br/>';
         $this->config->pagesize = $CFG->block_dashboard_big_result_threshold;
         $rpage = 0;
     }
     // getting real results including page and offset
     if (!empty($this->config->pagesize)) {
         $offset = $rpage * $this->config->pagesize;
     } else {
         $offset = '';
     }
     try {
         $results = $this->fetch_dashboard_data($this->filteredsql, @$this->config->pagesize, $offset);
     } catch (Exception $e) {
         return get_string('invalidorobsoletequery', 'block_dashboard', $this->config->query);
     }
     if ($results) {
         $table = new flexible_table('mod-dashboard' . $this->instance->id);
         $instancecontrolvars = array(TABLE_VAR_PAGE => 'rpage' . $this->instance->id, TABLE_VAR_SORT => 'tsort' . $this->instance->id, TABLE_VAR_HIDE => 'thide' . $this->instance->id, TABLE_VAR_SHOW => 'tshow' . $this->instance->id);
         $table->set_control_variables($instancecontrolvars);
         // use full not to collide with flexipage paging
         $tablecolumns = array();
         $tableheaders = array();
         foreach ($this->output as $field => $label) {
             $tablecolumns[] = $field;
             $tableheaders[] = $label;
         }
         $table->define_columns($tablecolumns);
         $table->define_headers($tableheaders);
         $filterquerystringadd = isset($filterquerystring) ? "&amp;{$filterquerystring}" : '';
         if (@$this->config->inblocklayout) {
             $table->define_baseurl($CFG->wwwroot . '/course/view.php?id=' . $COURSE->id . $coursepage . $filterquerystringadd);
         } else {
开发者ID:andrewhancox,项目名称:moodle-block_dashboard,代码行数:67,代码来源:block_dashboard.php

示例10: array

        $extratables = 'JOIN {giportfolio_contributions} c ON c.giportfolioid = :portfolioid AND c.userid = u.id
                    LEFT JOIN {grade_grades} g ON g.itemid = :gradeid AND g.userid = u.id';
        $params['gradeid'] = $DB->get_field('grade_items', 'id', array('itemtype' => 'mod', 'itemmodule' => 'giportfolio', 'iteminstance' => $giportfolio->id));
        $params['portfolioid'] = $giportfolio->id;
        $where .= "(g.feedback IS null OR g.feedback = '') AND ";
    }
}
if ($sort = $table->get_sql_sort()) {
    $sort = ' ORDER BY ' . $sort;
}
$ufields = user_picture::fields('u', $extrafields);
if (!empty($allusers)) {
    $select = "SELECT DISTINCT {$ufields} ";
    $sql = 'FROM {user} u ' . $extratables . ' WHERE ' . $where . 'u.id IN (' . $listusersids . ') ';
    $pusers = $DB->get_records_sql($select . $sql . $sort, $params, $table->get_page_start(), $table->get_page_size());
    $table->pagesize($perpage, count($pusers));
    $offset = $page * $perpage;
    $grademenu = make_grades_menu($giportfolio->grade);
    $rowclass = null;
    $endposition = $offset + $perpage;
    $currentposition = 0;
    $strview = get_string('view');
    $strnotstarted = get_string('notstarted', 'mod_giportfolio');
    $strprivate = get_string('private', 'mod_giportfolio');
    $strgrade = get_string('grade');
    foreach ($pusers as $puser) {
        if ($currentposition == $offset && $offset < $endposition) {
            $picture = $OUTPUT->user_picture($puser);
            $usercontribution = giportfolio_get_user_contribution_status($giportfolio->id, $puser->id);
            $private = false;
            if (!$usercontribution) {
开发者ID:andrewhancox,项目名称:moodle-mod_giportfolio,代码行数:31,代码来源:submissions.php

示例11: array

$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide mtxtCentredCells');
// Set structure
$tablecolumns = array("user", "account", "message", "time");
$tableheaders = array(get_string('tableheaderuser', 'block_moodletxt'), get_string('tableheadertxttoolsaccount', 'block_moodletxt'), get_string('tableheadermessagetext', 'block_moodletxt'), get_string('tableheadertimesent', 'block_moodletxt'));
// ;)
if ($includeEvents == TxttoolsSentMessageDAO::$EVENT_QUERY_INCLUDE || $includeEvents == TxttoolsSentMessageDAO::$EVENT_QUERY_EXCLUSIVE) {
    array_push($tablecolumns, "generation");
    array_push($tableheaders, get_string('tableheadergeneration', 'block_moodletxt'));
}
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->sortable(true, 'time', SORT_DESC);
$table->no_sorting('message');
$table->collapsible(true);
$table->pageable(true);
$table->pagesize($MESSAGES_PER_PAGE, $sentMessagesDAO->countMessagesSent(0, $USER->id));
if ($download != '') {
    $table->is_downloading($download, get_string('exportsheetsent', 'block_moodletxt'), get_string('exporttitlesent', 'block_moodletxt'));
}
$table->is_downloadable(true);
$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
// BEGIN PAGE OUTPUT
if (!$table->is_downloading()) {
    // Drop in page header
    echo $output->header();
    echo $output->box($sentMessagesDAO->countMessagesSent() . get_string('sentnoticefrag1', 'block_moodletxt') . $sentMessagesDAO->countMessageRecipients() . get_string('sentnoticefrag2', 'block_moodletxt') . html_writer::empty_tag('br') . $sentMessagesDAO->countMessagesSent(0, $userToView) . get_string('sentnoticefrag3', 'block_moodletxt'));
    // Show select box allow user to show/hide event-generated messages
    $eventSelect = new single_select(new moodle_url('sent.php', array('course' => $courseId, 'instance' => $instanceId, 'user' => $userToView)), 'events', array(TxttoolsSentMessageDAO::$EVENT_QUERY_DISCARD => get_string('optioneventhide', 'block_moodletxt'), TxttoolsSentMessageDAO::$EVENT_QUERY_INCLUDE => get_string('optioneventshow', 'block_moodletxt'), TxttoolsSentMessageDAO::$EVENT_QUERY_EXCLUSIVE => get_string('optioneventonly', 'block_moodletxt')), $includeEvents, false);
    $eventSelect->set_label(get_string('labelshowmessagebygenerator', 'block_moodletxt'));
    echo $output->render($eventSelect);
开发者ID:educacionbe,项目名称:campus,代码行数:31,代码来源:sent.php

示例12: array

             $newtagarr = array();
             foreach ($post->tags as $tag) {
                 $newtagarr[$tag->id] = $tag->tag;
             }
             $post->tags = $newtagarr;
         }
     }
 } else {
     list($posts, $total, $tagnames) = oublog_import_getallposts($boublogid, $sort, $USER->id, $page, $tags);
 }
 if ($posts) {
     // Finish seting up table vars.
     $url = new moodle_url('/mod/oublog/import.php', $params + $stepinfo);
     $table->define_baseurl($url);
     $perpage = $total < $perpage ? $total : $perpage;
     $table->pagesize($perpage, $total);
     $taghead = get_string('import_step1_table_tags', 'oublog');
     if (!empty($tagnames)) {
         // Add tag filter removal links.
         $taghead .= '<br />';
         foreach ($tagnames as $tagid => $tag) {
             $tagaarcopy = explode(',', $tags);
             unset($tagaarcopy[array_search($tagid, $tagaarcopy)]);
             $turl = new moodle_url('/mod/oublog/import.php', array_merge($params, $stepinfo, array('tags' => implode(',', $tagaarcopy))));
             $taghead .= ' ' . html_writer::link($turl, $OUTPUT->pix_icon('t/delete', get_string('import_step1_removetag', 'oublog', $tag->tag))) . ' ' . format_text($tag->tag, FORMAT_HTML);
         }
     }
     $table->define_headers(array(get_string('import_step1_table_title', 'oublog'), get_string('import_step1_table_posted', 'oublog'), $taghead, get_string('import_step1_table_include', 'oublog')));
     echo html_writer::start_tag('form', array('method' => 'post', 'action' => qualified_me()));
     $untitledcount = 1;
     foreach ($posts as &$post) {
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:31,代码来源:import.php

示例13: display_allfilesform


//.........这里部分代码省略.........
     $table->collapsible(false);
     $table->initialbars(true);
     $table->column_class('fullname', 'fullname');
     $table->column_class('timemodified', 'timemodified');
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'publications');
     $table->set_attribute('width', '100%');
     $table->no_sorting('studentapproval');
     $table->no_sorting('selection');
     $table->no_sorting('teacherapproval');
     $table->no_sorting('visibleforstudents');
     // Start working -- this is necessary as soon as the niceties are over.
     $table->setup();
     // Construct the SQL.
     list($where, $params) = $table->get_sql_where();
     if ($where) {
         $where .= ' AND ';
     }
     if ($sort = $table->get_sql_sort()) {
         $sort = ' ORDER BY ' . $sort;
     }
     $ufields = user_picture::fields('u');
     $useridentityfields = $CFG->showuseridentity != '' ? 'u.' . str_replace(', ', ', u.', $CFG->showuseridentity) . ', ' : '';
     $totalfiles = 0;
     if (!empty($users)) {
         $select = 'SELECT ' . $ufields . ', ' . $useridentityfields . ' username,
                             COUNT(*) filecount,
                             SUM(files.studentapproval) as status,
                             MAX(files.timecreated) timemodified ';
         $sql = 'FROM {user} u ' . 'LEFT JOIN {publication_file} files ON u.id = files.userid
                         AND files.publication = ' . $this->get_instance()->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(', ', $users) . ') ' . 'GROUP BY ' . $ufields . ', ' . $useridentityfields . ' username ';
         $ausers = $DB->get_records_sql($select . $sql . $sort, $params, $table->get_page_start(), $table->get_page_size());
         $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');
         if ($ausers !== false) {
             $endposition = $offset + $perpage;
             $currentposition = 0;
             $valid = $OUTPUT->pix_icon('i/valid', get_string('student_approved', 'publication'));
             $questionmark = $OUTPUT->pix_icon('questionmark', get_string('student_pending', 'publication'), 'mod_publication');
             $invalid = $OUTPUT->pix_icon('i/invalid', get_string('student_rejected', 'publication'));
             $visibleforstundetsyes = $OUTPUT->pix_icon('i/valid', get_string('visibleforstudents_yes', 'publication'));
             $visibleforstundetsno = $OUTPUT->pix_icon('i/invalid', get_string('visibleforstudents_no', 'publication'));
             $viewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
             foreach ($ausers as $auser) {
                 if ($currentposition >= $offset && $currentposition < $endposition) {
                     // Calculate user status.
                     $selecteduser = html_writer::checkbox('selectedeuser[' . $auser->id . ']', 'selected', false, null, array('class' => 'userselection'));
                     $useridentity = $CFG->showuseridentity != '' ? explode(',', $CFG->showuseridentity) : array();
                     foreach ($useridentity as $cur) {
                         if (!(get_config('publication', 'hideidnumberfromstudents') && $cur == "idnumber" && !has_capability('mod/publication:approve', $context)) && !($cur != "idnumber" && !has_capability('mod/publication:approve', $context))) {
                             if (!empty($auser->{$cur})) {
                                 ${$cur} = html_writer::tag('div', $auser->{$cur}, array('id' => 'u' . $cur . $auser->id));
                             } else {
                                 ${$cur} = html_writer::tag('div', '-', array('id' => 'u' . $cur . $auser->id));
                             }
                         }
                     }
                     $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser, $viewfullnames) . '</a>';
                     $extension = $this->user_extensionduedate($auser->id);
                     if ($extension) {
                         if (has_capability('mod/publication:grantextension', $context) || has_capability('mod/publication:approve', $context)) {
                             $userlink .= '<br/>' . get_string('extensionto', 'publication') . ': ' . userdate($extension);
                         }
开发者ID:Kathrin84,项目名称:moodle-mod_publication,代码行数:67,代码来源:locallib.php

示例14: isset

        if ($mygroupid > 0) {
            $usedgroupid = $mygroupid;
        } else {
            $usedgroupid = false;
        }
    } else {
        $usedgroupid = false;
    }
    $nonrespondents = questionnaire_get_incomplete_users($cm, $sid, $usedgroupid);
    $countnonrespondents = count($nonrespondents);
    $table->initialbars(false);
    if ($showall) {
        $startpage = false;
        $pagecount = false;
    } else {
        $table->pagesize($perpage, $countnonrespondents);
        $startpage = $table->get_page_start();
        $pagecount = $table->get_page_size();
    }
}
$nonrespondents = questionnaire_get_incomplete_users($cm, $sid, $usedgroupid, $sort, $startpage, $pagecount);
// Viewreports-start.
// Print the list of students.
echo isset($groupselect) ? $groupselect : '';
echo '<div class="clearer"></div>';
echo $OUTPUT->box_start('left-align');
$countries = get_string_manager()->get_list_of_countries();
$strnever = get_string('never');
$datestring = new stdClass();
$datestring->year = get_string('year');
$datestring->years = get_string('years');
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:show_nonrespondents.php

示例15: foreach

 // Allow column hiding.
 $table->initialbars(true);
 $table->column_suppress('courseshort');
 $table->column_suppress('schedulerid');
 $table->column_suppress('starttime');
 $table->column_suppress('studentfullname');
 $table->column_suppress('notes');
 $table->set_attribute('id', 'dates');
 $table->set_attribute('class', 'datelist');
 $table->column_class('course', 'datelist_course');
 $table->column_class('scheduler', 'datelist_scheduler');
 $table->setup();
 // Get extra query parameters from flexible_table behaviour.
 $where = $table->get_sql_where();
 $sort = $table->get_sql_sort();
 $table->pagesize($limit, $numrecords);
 if (!empty($sort)) {
     $sql .= " ORDER BY {$sort}";
 }
 $results = $DB->get_records_sql($sql, $params);
 foreach ($results as $id => $row) {
     $courseurl = new moodle_url('/course/view.php', array('id' => $row->courseid));
     $coursedata = html_writer::link($courseurl, $row->courseshort);
     $schedulerurl = new moodle_url('/mod/scheduler/view.php', array('a' => $row->schedulerid));
     $schedulerdata = html_writer::link($schedulerurl, format_string($row->name));
     $a = mod_scheduler_renderer::slotdatetime($row->starttime, $row->duration);
     $whendata = get_string('slotdatetime', 'scheduler', $a);
     $whourl = new moodle_url('/mod/scheduler/view.php', array('what' => 'viewstudent', 'a' => $row->schedulerid, 'appointmentid' => $row->id));
     $whodata = html_writer::link($whourl, $row->studentfullname);
     $whatdata = format_string($row->notes);
     $gradedata = $row->scale == 0 ? '' : $output->format_grade($row->scale, $row->grade);
开发者ID:ninelanterns,项目名称:moodle-mod_scheduler,代码行数:31,代码来源:datelist.php


注:本文中的flexible_table::pagesize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。