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


PHP flexible_table::get_page_start方法代码示例

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


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

示例1: implode

    $where = "WHERE " . implode(" AND ", $wheres);
} else {
    $where = "";
}
if ($table->get_sql_sort()) {
    $sort = ' ORDER BY ' . $table->get_sql_sort();
} else {
    $sort = '';
}
if ($mode === MODE_PICTURES) {
    $sort = ' ORDER BY u.lastname';
}
$matchcount = $DB->count_records_sql("SELECT COUNT(u.id) {$from} {$where}", $params);
$table->pagesize($perpage, $matchcount);
// list of users at the current visible page - paging makes it relatively short
$userlist = $DB->get_recordset_sql("{$select} {$from} {$where} {$sort}", $params, $table->get_page_start(), $table->get_page_size());
/// If there are multiple Roles in the course, then show a drop down menu for switching
if (false and count($rolenames) > 1) {
    echo '<div class="rolesform">';
    echo '<label for="rolesform_jump">' . get_string('currentrole', 'role') . '&nbsp;</label>';
    echo $OUTPUT->single_select($rolenamesurl, 'roleid', $rolenames, $roleid, null, 'rolesform');
    echo '</div>';
} else {
    if (count($rolenames) == 1) {
        // when all users with the same role - print its name
        echo '<div class="rolesform">';
        echo get_string('role') . get_string('labelsep', 'langconfig');
        $rolename = reset($rolenames);
        echo $rolename;
        echo '</div>';
    }
开发者ID:actXc,项目名称:moodle-block_roster_tbird,代码行数:31,代码来源:view.php

示例2: array


//.........这里部分代码省略.........
     /// 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) {
                             $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:67,代码来源:lib.php

示例3: display


//.........这里部分代码省略.........
     $table->column_class('rpercent', 'numcol');
     $table->column_class('facility', 'numcol');
     $table->column_class('qsd', 'numcol');
     $table->column_class('disc_index', 'numcol');
     $table->column_class('disc_coeff', 'numcol');
     $table->column_suppress('id');
     $table->column_suppress('qname');
     $table->column_suppress('facility');
     $table->column_suppress('qsd');
     $table->column_suppress('disc_index');
     $table->column_suppress('disc_coeff');
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'itemanalysis');
     $table->set_attribute('class', 'generaltable generalbox');
     // Start working -- this is necessary as soon as the niceties are over
     $table->setup();
     $tablesort = $table->get_sql_sort();
     $sorts = explode(",", trim($tablesort));
     if ($tablesort and is_array($sorts)) {
         $sortindex = array();
         $sortorder = array();
         foreach ($sorts as $sort) {
             $data = explode(" ", trim($sort));
             $sortindex[] = trim($data[0]);
             $s = trim($data[1]);
             if ($s == "ASC") {
                 $sortorder[] = SORT_ASC;
             } else {
                 $sortorder[] = SORT_DESC;
             }
         }
         if (count($sortindex) > 0) {
             $sortindex[] = "id";
             $sortorder[] = SORT_ASC;
             foreach ($questions as $qid => $row) {
                 $index1[$qid] = $row[$sortindex[0]];
                 $index2[$qid] = $row[$sortindex[1]];
             }
             array_multisort($index1, $sortorder[0], $index2, $sortorder[1], $questions);
         }
     }
     $format_options = new stdClass();
     $format_options->para = false;
     $format_options->noclean = true;
     $format_options->newlines = false;
     // Now it is time to page the data, simply slice the keys in the array
     if (!isset($pagesize) || (int) $pagesize < 1) {
         $pagesize = 10;
     }
     $table->pagesize($pagesize, count($questions));
     $start = $table->get_page_start();
     $pagequestions = array_slice(array_keys($questions), $start, $pagesize);
     foreach ($pagequestions as $qnum) {
         $q = $questions[$qnum];
         $qid = $q['id'];
         $question = get_record('question', 'id', $qid);
         if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $course->id))) {
             $qnumber = " (" . link_to_popup_window('/question/question.php?id=' . $qid, '&amp;cmid=' . $cm->id . 'editquestion', $qid, 450, 550, get_string('edit'), 'none', true) . ") ";
         } else {
             $qnumber = $qid;
         }
         $qname = '<div class="qname">' . format_text($question->name . " :  ", $question->questiontextformat, $format_options, $quiz->course) . '</div>';
         $qicon = print_question_icon($question, true);
         $qreview = quiz_question_preview_button($quiz, $question);
         $qtext = format_text($question->questiontext, $question->questiontextformat, $format_options, $quiz->course);
         $qquestion = $qname . "\n" . $qtext . "\n";
         $responses = array();
         foreach ($q['responses'] as $aid => $resp) {
             $response = new stdClass();
             if ($q['credits'][$aid] <= 0) {
                 $qclass = 'uncorrect';
             } elseif ($q['credits'][$aid] == 1) {
                 $qclass = 'correct';
             } else {
                 $qclass = 'partialcorrect';
             }
             $response->credit = '<span class="' . $qclass . '">(' . format_float($q['credits'][$aid], 2) . ') </span>';
             $response->text = '<span class="' . $qclass . '">' . format_text($resp, FORMAT_MOODLE, $format_options, $quiz->course) . ' </span>';
             $count = $q['rcounts'][$aid] . '/' . $q['count'];
             $response->rcount = $count;
             $response->rpercent = '(' . format_float($q['rcounts'][$aid] / $q['count'] * 100, 0) . '%)';
             $responses[] = $response;
         }
         $facility = format_float($q['facility'] * 100, 0) . "%";
         $qsd = format_float($q['qsd'], 3);
         $di = format_float($q['disc_index'], 2);
         $dc = format_float($q['disc_coeff'], 2);
         $response = array_shift($responses);
         $table->add_data(array($qnumber . "\n<br />" . $qicon . "\n " . $qreview, $qquestion, $response->text, $response->credit, $response->rcount, $response->rpercent, $facility, $qsd, $di, $dc));
         foreach ($responses as $response) {
             $table->add_data(array('', '', $response->text, $response->credit, $response->rcount, $response->rpercent, '', '', '', ''));
         }
     }
     print_heading_with_help(get_string("analysistitle", "quiz_analysis"), "itemanalysis", "quiz");
     echo '<div id="tablecontainer">';
     $table->print_html();
     echo '</div>';
     $this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
     return true;
 }
开发者ID:veritech,项目名称:pare-project,代码行数:101,代码来源:report.php

示例4: confirm

     $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());
     echo '<div id="scormtablecontainer">';
     if ($candelete) {
         // Start form
         $strreallydel = addslashes_js(get_string('deleteattemptcheck', 'scorm'));
         echo '<form id="attemptsform" method="post" action="' . $reporturlwithdisplayoptions->out(true) . '" onsubmit="return confirm(\'' . $strreallydel . '\');">';
         echo '<input type="hidden" name="action" value="delete"/>';
         echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
         echo '<div style="display: none;">';
         echo html_writer::input_hidden_params($reporturlwithdisplayoptions);
         echo '</div>';
         echo '<div>';
     }
     $table->initialbars($totalinitials > 20);
     // Build table rows
 } else {
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:31,代码来源:report.php

示例5: navmenu


//.........这里部分代码省略.........
     }
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'submissions');
     $table->set_attribute('width', '100%');
     //$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();
     if (empty($users)) {
         echo $OUTPUT->heading(get_string('nosubmitusers', '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, u.imagealt,
                       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 {user} u ' . 'LEFT JOIN {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 = $DB->get_records_sql($select . $sql . $sort, null, $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];
             $grademax = $grading_info->items[0]->grademax;
             $final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2);
             $locked_overridden = 'locked';
             if ($final_grade->overridden) {
                 $locked_overridden = 'overridden';
             }
             /// Calculate user status
             $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified;
             $picture = $OUTPUT->user_picture(moodle_user_picture::make($auser, $course->id));
             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 . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>';
                     } else {
                         if ($quickgrade) {
开发者ID:ajv,项目名称:Offline-Caching,代码行数:67,代码来源:lib.php

示例6: display


//.........这里部分代码省略.........
             foreach ($sortparts as $sortpart) {
                 $sortpart = trim($sortpart);
                 if (substr($sortpart, 0, 1) == '$') {
                     if (!$questionsort) {
                         $qid = intval(substr($sortpart, 1));
                         $select .= ', grade ';
                         $from .= ' LEFT JOIN {question_sessions} qns ON qns.attemptid = qa.id ' . 'LEFT JOIN {question_states} qs ON qs.id = qns.newgraded ';
                         $where .= ' AND (' . sql_isnull('qns.questionid') . ' OR qns.questionid = ' . $qid . ')';
                         $newsort[] = 'grade ' . (strpos($sortpart, 'ASC') ? 'ASC' : 'DESC');
                         $questionsort = true;
                     }
                 } else {
                     $newsort[] = $sortpart;
                 }
             }
             // Reconstruct the sort string.
             $sort = ' ORDER BY ' . implode(', ', $newsort);
         }
         // Fix some wired sorting.
         if (empty($sort)) {
             $sort = ' ORDER BY qa.id';
         }
         $table->pagesize($pagesize, $total);
     }
     // If there is feedback, include it in the query.
     if ($hasfeedback) {
         $select .= ', qf.feedbacktext ';
         $from .= " JOIN {game_feedback} qf ON " . "qf.gameid = {$game->id} AND qf.mingrade <= qa.score * {$game->grade}  AND qa.score * {$game->grade} < qf.maxgrade";
     }
     // Fetch the attempts.
     if (!empty($from)) {
         // If we're in the site course and displaying no attempts, it makes no sense to do the query.
         if (!$download) {
             $attempts = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size());
         } else {
             $attempts = get_records_sql($select . $from . $where . $sort);
         }
     } else {
         $attempts = array();
     }
     // Build table rows.
     if (!$download) {
         $table->initialbars($totalinitials > 20);
     }
     if (!empty($attempts) || !empty($noattempts)) {
         if ($attempts) {
             foreach ($attempts as $attempt) {
                 $picture = print_user_picture($attempt->userid, $course->id, $attempt->picture, false, true);
                 /* Uncomment the commented lines below if you are choosing to show unenrolled users and
                  * have uncommented the corresponding lines earlier in this script
                  * if (in_array($attempt->userid, $unenrolledusers)) {
                  *    $userlink = '<a class="dimmed" href="'.$CFG->wwwroot.
                  *       '/user/view.php?id='.$attempt->userid.'&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
                  *}
                  *else {
                  *   $userlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.
                  *      $attempt->userid.'&amp;course='.$course->id.'">'.fullname($attempt).'</a>';
                  *}
                  */
                 if (!$download) {
                     $row = array('<input type="checkbox" name="attemptid[]" value="' . $attempt->attempt . '" />', $picture, $userlink, empty($attempt->attempt) ? '-' : '<a href="review.php?q=' . $game->id . '&amp;attempt=' . $attempt->attempt . '">' . userdate($attempt->timestart, $strtimeformat) . '</a>', empty($attempt->timefinish) ? '-' : '<a href="review.php?q=' . $game->id . '&amp;attempt=' . $attempt->attempt . '">' . userdate($attempt->timefinish, $strtimeformat) . '</a>', empty($attempt->attempt) ? '-' : (empty($attempt->timefinish) ? get_string('unfinished', 'game') : format_time($attempt->duration)));
                 } else {
                     $row = array(fullname($attempt), empty($attempt->attempt) ? '-' : userdate($attempt->timestart, $strtimeformat), empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish, $strtimeformat), empty($attempt->attempt) ? '-' : (empty($attempt->timefinish) ? get_string('unfinished', 'game') : format_time($attempt->duration)));
                 }
                 if ($game->grade) {
                     if (!$download) {
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:67,代码来源:report.php

示例7: COUNT

/// because it retrieves ALL users (without role checking) - MDL-14034
if ($table->get_sql_sort()) {
    $sort = ' ORDER BY ' . $table->get_sql_sort();
    if ($context->id != $frontpagectx->id or $roleid >= 0) {
        $sort .= ', r.hidden DESC';
    }
} else {
    $sort = '';
    if ($context->id != $frontpagectx->id or $roleid >= 0) {
        $sort .= ' ORDER BY r.hidden DESC';
    }
}
$matchcount = count_records_sql('SELECT COUNT(distinct u.id) ' . $from . $where . $wheresearch);
$table->initialbars(true);
$table->pagesize($perpage, $matchcount);
$userlist = get_recordset_sql($select . $from . $where . $wheresearch . $sort, $table->get_page_start(), $table->get_page_size());
if ($context->id == $frontpagectx->id) {
    $strallsiteusers = get_string('allsiteusers', 'role');
    if ($CFG->defaultfrontpageroleid) {
        if ($fprole = get_record('role', 'id', $CFG->defaultfrontpageroleid)) {
            $fprole = role_get_name($fprole, $frontpagectx);
            $strallsiteusers = "{$strallsiteusers} ({$fprole})";
        }
    }
    $rolenames = array(-1 => $strallsiteusers) + $rolenames;
}
/// If there are multiple Roles in the course, then show a drop down menu for switching
if (count($rolenames) > 1) {
    echo '<div class="rolesform">';
    echo '<label for="rolesform_jump">' . get_string('currentrole', 'role') . '&nbsp;</label>';
    if ($context->id != $frontpagectx->id) {
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:index.php

示例8: checksubmit

    }
    if ($table->get_sql_sort()) {
        $sql .= ' ORDER BY ' . $table->get_sql_sort();
    }
    $countsql = "SELECT COUNT(DISTINCT(ra.userid))\n                       FROM {$CFG->prefix}role_assignments ra\n                      WHERE ra.contextid {$relatedcontexts} AND ra.roleid = {$roleid}";
    $totalcount = count_records_sql($countsql);
    if ($table->get_sql_where()) {
        $matchcount = count_records_sql($countsql . ' AND ' . $table->get_sql_where());
    } else {
        $matchcount = $totalcount;
    }
    echo '<div id="participationreport">' . "\n";
    echo '<p class="modulename">' . $modulename . ' ' . $strviews . ': ' . implode(', ', $viewnames) . '<br />' . "\n" . $modulename . ' ' . $strposts . ': ' . implode(', ', $postnames) . '</p>' . "\n";
    $table->initialbars($totalcount > $perpage);
    $table->pagesize($perpage, $matchcount);
    if (!($users = get_records_sql($sql, $table->get_page_start(), $table->get_page_size()))) {
        $users = array();
        // tablelib will handle saying 'Nothing to display' for us.
    }
    $data = array();
    $a->count = $totalcount;
    $a->items = $role->name;
    if ($matchcount != $totalcount) {
        $a->count = $matchcount . '/' . $a->count;
    }
    echo '<h2>' . get_string('counteditems', '', $a) . '</h2>' . "\n";
    echo '
<script type="text/javascript">
//<![CDATA[
function checksubmit(form) {
    var destination = form.formaction.options[form.formaction.selectedIndex].value;
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:index.php

示例9: navmenu


//.........这里部分代码省略.........
     		$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);
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:67,代码来源:assignment.class.php

示例10: COUNT

 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, COUNT(s.id) AS count ';
 $sql = 'FROM ' . $CFG->prefix . 'user AS u ' . 'LEFT JOIN ' . $CFG->prefix . 'stampcoll_stamps s ON u.id = s.userid AND s.stampcollid = ' . $stampcoll->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', array_keys($users)) . ') ' . 'GROUP BY u.id, u.firstname, u.lastname, u.picture ';
 if (!$stampcoll->displayzero) {
     $sql .= 'HAVING COUNT(s.id) > 0 ';
 }
 // First query with not limits to get the number of returned rows
 if (($ausers = get_records_sql($select . $sql . $sort)) !== false) {
     $table->pagesize($perpage, count($ausers));
     // Second query with pagination limits
     if (($ausers = get_records_sql($select . $sql . $sort, $table->get_page_start(), $table->get_page_size())) !== false) {
         foreach ($ausers as $auser) {
             $picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true);
             $fullname = fullname($auser);
             $count = $auser->count;
             $stamps = '';
             if (isset($userstamps[$auser->id])) {
                 foreach ($userstamps[$auser->id] as $s) {
                     $stamps .= stampcoll_stamp($s, $stampcoll->image);
                 }
                 unset($s);
             }
             $row = array($picture, $fullname, $count, $stamps);
             $table->add_data($row);
         }
     }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:view.php

示例11: IN

$table->no_sorting('grade');
// 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', $extrafields);
if (!empty($users)) {
    $select = "SELECT {$ufields} ";
    $sql = 'FROM {user} u ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
    $ausers = $DB->get_records_sql($select . $sql . $sort, $params, $table->get_page_start(), $table->get_page_size());
    if ($ausers !== false) {
        //$grading_info = grade_get_grades($course->id, 'mod', 'jclic', $jclic->id, array_keys($ausers));
        $countusers = 0;
        foreach ($ausers as $auser) {
            $sessions_summary = jclic_get_sessions_summary($jclic->id, $auser->id);
            if ($sessions_summary->attempts <= 0) {
                continue;
            }
            $countusers++;
            $picture = $OUTPUT->user_picture($auser);
            $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $context)) . '</a>';
            $extradata = array();
            foreach ($extrafields as $field) {
                $extradata[] = $auser->{$field};
            }
开发者ID:danielvdml,项目名称:moodleyarcho,代码行数:31,代码来源:report.php

示例12: array

        case 'time':
            $databaseOrder = 'o.timesent %DIR%';
            break;
    }
    if ($direction == SORT_ASC) {
        $databaseOrder = str_replace('%DIR%', 'ASC', $databaseOrder);
    } else {
        $databaseOrder = str_replace('%DIR%', 'DESC', $databaseOrder);
    }
    if ($orderBy != '') {
        $databaseOrder = ', ' . $databaseOrder;
    }
    $orderBy .= $databaseOrder;
}
// All parameters *MUST* be sorted out by here - getting messages
$sentMessages = $sentMessagesDAO->getSentMessagesForUser($userToView, $orderBy, 0, 0, $table->get_page_start(), $table->get_page_size(), $includeEvents);
// Populate table
foreach ($sentMessages as $message) {
    if ($table->is_downloading()) {
        $messageContent = $message->getMessageText();
    } else {
        $messageContent = html_writer::tag('a', $message->getMessageText(), array('href' => 'status.php?message=' . $message->getId() . '&course=' . $courseId . '&instance=' . $instanceId));
    }
    $rowData = array($message->getUser()->getFullNameForDisplay(!$table->is_downloading()), $message->getTxttoolsAccount()->getUsername(), $messageContent, $message->getTimeSent('%H:%M:%S,  %d %B %Y'));
    if ($includeEvents == TxttoolsSentMessageDAO::$EVENT_QUERY_INCLUDE || $includeEvents == TxttoolsSentMessageDAO::$EVENT_QUERY_EXCLUSIVE) {
        $eventStr = $message->isEventCreated() ? get_string('fragsystem', 'block_moodletxt') : get_string('fraguser', 'block_moodletxt');
        array_push($rowData, $eventStr);
    }
    $table->add_data($rowData);
}
$table->finish_output();
开发者ID:educacionbe,项目名称:campus,代码行数:31,代码来源:sent.php

示例13: array

$table->setup();

if ($sort = $table->get_sql_sort()) {
    $sort = ' ORDER BY ' . $sort;
}

$sql = 'SELECT * FROM {facetoface_room} WHERE custom = 0';

$perpage = 25;

$totalcount = $DB->count_records_select('facetoface_room', 'custom = 0');

$table->initialbars($totalcount > $perpage);
$table->pagesize($perpage, $totalcount);

$rooms = $DB->get_records_sql($sql.$sort, array(), $table->get_page_start(), $table->get_page_size());

$rooms_in_use = array_keys($DB->get_records_sql('SELECT DISTINCT(roomid) FROM {facetoface_sessions}'));

foreach ($rooms as $room) {
    $row = array();
    $buttons = array();

    $row[] = $room->name;
    $row[] = $room->building;
    $row[] = $room->address;
    $row[] = $room->capacity;

    $editbutton = '';
    $deletebutton = '';
    /*commented by hameed on 21 dec reg: bug fix*/
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:31,代码来源:manage.php

示例14: display_allfilesform


//.........这里部分代码省略.........
     // Sorted by lastname by default.
     $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

示例15: display


//.........这里部分代码省略.........
         }
         if (!$download) {
             // Add extra limits due to initials bar.
             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, $params);
                 $totalinitials = $count->nbresults;
                 if ($twhere) {
                     $countsql .= ' AND ' . $twhere;
                 }
                 $count = $DB->get_record_sql($countsql, $params);
                 $total = $count->nbresults;
             }
             $table->pagesize($pagesize, $total);
             echo \html_writer::start_div('scormattemptcounts');
             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 \html_writer::end_div();
         }
         // Fetch the attempts.
         if (!$download) {
             $attempts = $DB->get_records_sql($select . $from . $where . $sort, $params, $table->get_page_start(), $table->get_page_size());
             echo \html_writer::start_div('', array('id' => 'scormtablecontainer'));
             if ($candelete) {
                 // Start form.
                 $strreallydel = addslashes_js(get_string('deleteattemptcheck', 'scorm'));
                 echo \html_writer::start_tag('form', array('id' => 'attemptsform', 'method' => 'post', 'action' => $PAGE->url->out(false), 'onsubmit' => 'return confirm("' . $strreallydel . '");'));
                 echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'delete'));
                 echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
                 echo \html_writer::start_div('', array('style' => 'display: none;'));
                 echo \html_writer::input_hidden_params($PAGE->url);
                 echo \html_writer::end_div();
                 echo \html_writer::start_div();
             }
             $table->initialbars($totalinitials > 20);
             // Build table rows.
         } else {
             $attempts = $DB->get_records_sql($select . $from . $where . $sort, $params);
         }
         if ($attempts) {
             foreach ($attempts as $scouser) {
                 $row = array();
                 if (!empty($scouser->attempt)) {
                     $timetracks = scorm_get_sco_runtime($scorm->id, false, $scouser->userid, $scouser->attempt);
                 } else {
                     $timetracks = '';
                 }
                 if (in_array('checkbox', $columns)) {
                     if ($candelete && !empty($timetracks->start)) {
                         $row[] = \html_writer::checkbox('attemptid[]', $scouser->userid . ':' . $scouser->attempt, false);
                     } else {
                         if ($candelete) {
                             $row[] = '';
                         }
开发者ID:lucaboesch,项目名称:moodle,代码行数:67,代码来源:report.php


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