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


PHP flexible_table::setup方法代码示例

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


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

示例1: setup

 /**
  * Setup the columns and headers and other properties of the table and then
  * call flexible_table::setup() method.
  */
 function setup($reporturl, $question, $hassubqs)
 {
     $this->question = $question;
     // Define table columns
     $columns = array();
     $headers = array();
     if ($hassubqs) {
         $columns[] = 'subq';
         $headers[] = '';
     }
     $columns[] = 'response';
     $headers[] = get_string('response', 'quiz_statistics');
     $columns[] = 'credit';
     $headers[] = get_string('optiongrade', 'quiz_statistics');
     $columns[] = 'rcount';
     $headers[] = get_string('count', 'quiz_statistics');
     $columns[] = 'frequency';
     $headers[] = get_string('frequency', 'quiz_statistics');
     $this->define_columns($columns);
     $this->define_headers($headers);
     $this->sortable(false);
     $this->column_class('credit', 'numcol');
     $this->column_class('rcount', 'numcol');
     $this->column_class('frequency', 'numcol');
     // Set up the table
     $this->define_baseurl($reporturl->out());
     $this->collapsible(false);
     $this->set_attribute('class', 'generaltable generalbox boxaligncenter');
     parent::setup();
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:34,代码来源:statistics_question_table.php

示例2: course_report

 /**
  * course_report
  *
  * @param mixed $indicators
  * @param mixed $data
  * @access public
  * @return void
  */
 public function course_report($indicators, $data)
 {
     global $DB, $COURSE;
     if (empty($data)) {
         return '';
     }
     $table = new flexible_table('engagement-course-report');
     $table->define_baseurl(new moodle_url('/report/engagement/index.php', array('id' => $COURSE->id)));
     $headers = array();
     $columns = array();
     $headers[] = get_string('username');
     $columns[] = 'username';
     foreach ($indicators as $indicator) {
         $headers[] = get_string('pluginname', "engagementindicator_{$indicator}");
         $columns[] = "indicator_{$indicator}";
     }
     $headers[] = get_string('total');
     $columns[] = 'total';
     $table->define_headers($headers);
     $table->define_columns($columns);
     $table->sortable(true, 'total', SORT_DESC);
     $table->no_sorting('username');
     $table->column_class('username', 'student');
     foreach ($indicators as $indicator) {
         $table->column_class("indicator_{$indicator}", 'indicator');
     }
     $table->column_class('total', 'total');
     $table->set_attribute('id', 'engagement-course-report');
     $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
     $table->setup();
     foreach ($data as $user => $ind_data) {
         $row = array();
         $displayname = fullname($DB->get_record('user', array('id' => $user)));
         $url = new moodle_url('/course/report/engagement/index.php', array('id' => $COURSE->id, 'userid' => $user));
         $row[] = html_writer::link($url, $displayname);
         $total = 0;
         $total_raw = 0;
         foreach ($indicators as $indicator) {
             if (isset($ind_data["indicator_{$indicator}"]['raw'])) {
                 $ind_value = $ind_data["indicator_{$indicator}"]['raw'];
                 $weight = $ind_data["indicator_{$indicator}"]['weight'];
             } else {
                 $ind_value = 0;
                 $weight = 0;
             }
             $weighted_value = sprintf("%.0f%%", $ind_value * $weight * 100);
             $raw_value = sprintf("%.0f%%", 100 * $ind_value);
             $row[] = $weighted_value . " ({$raw_value})";
             $total += $ind_value * $weight;
             $total_raw += $ind_value;
         }
         $row[] = sprintf("%.0f%%", $total * 100);
         $table->add_data($row);
     }
     $html = $this->output->notification(get_string('reportdescription', 'coursereport_engagement'));
     ob_start();
     $table->finish_output();
     $html .= ob_get_clean();
     return $html;
 }
开发者ID:netspotau,项目名称:moodle-coursereport_engagement,代码行数:68,代码来源:renderer.php

示例3: setup

 /**
  * Setup the table, i.e. table headers
  *
  */
 public function setup()
 {
     // Set var for is downloading
     $isdownloading = $this->is_downloading();
     $this->set_attribute('cellspacing', '0');
     if ($this->rtq->group_mode()) {
         $columns = array('session' => get_string('sessionname', 'activequiz'), 'group' => get_string('group'), 'timestart' => get_string('startedon', 'activequiz'), 'timefinish' => get_string('timecompleted', 'activequiz'), 'grade' => get_string('grade'));
     } else {
         $columns = array('session' => get_string('sessionname', 'activequiz'), 'timestart' => get_string('startedon', 'activequiz'), 'timefinish' => get_string('timecompleted', 'activequiz'), 'grade' => get_string('grade'));
     }
     if (!$isdownloading) {
         $columns['attemptview'] = get_string('attemptview', 'activequiz');
     }
     $this->define_columns(array_keys($columns));
     $this->define_headers(array_values($columns));
     $this->sortable(false);
     $this->collapsible(false);
     $this->column_class('session', 'bold');
     $this->set_attribute('cellspacing', '0');
     $this->set_attribute('cellpadding', '2');
     $this->set_attribute('id', 'attempts');
     $this->set_attribute('class', 'generaltable generalbox');
     $this->set_attribute('align', 'center');
     parent::setup();
 }
开发者ID:agarnav,项目名称:moodle-mod_activequiz,代码行数:29,代码来源:ownattempts.php

示例4: setup

 /**
  * Setup the columns and headers and other properties of the table and then
  * call flexible_table::setup() method.
  */
 function setup($quiz, $cmid, $reporturl, $s)
 {
     $this->quiz = $quiz;
     $this->cmid = $cmid;
     // Define table columns
     $columns = array();
     $headers = array();
     $columns[] = 'number';
     $headers[] = get_string('questionnumber', 'quiz_statistics');
     if (!$this->is_downloading()) {
         $columns[] = 'icon';
         $headers[] = '';
         $columns[] = 'actions';
         $headers[] = '';
     } else {
         $columns[] = 'qtype';
         $headers[] = get_string('questiontype', 'quiz_statistics');
     }
     $columns[] = 'name';
     $headers[] = get_string('questionname', 'quiz');
     $columns[] = 's';
     $headers[] = get_string('attempts', 'quiz_statistics');
     if ($s > 1) {
         $columns[] = 'facility';
         $headers[] = get_string('facility', 'quiz_statistics');
         $columns[] = 'sd';
         $headers[] = get_string('standarddeviationq', 'quiz_statistics');
     }
     $columns[] = 'random_guess_score';
     $headers[] = get_string('random_guess_score', 'quiz_statistics');
     $columns[] = 'intended_weight';
     $headers[] = get_string('intended_weight', 'quiz_statistics');
     $columns[] = 'effective_weight';
     $headers[] = get_string('effective_weight', 'quiz_statistics');
     $columns[] = 'discrimination_index';
     $headers[] = get_string('discrimination_index', 'quiz_statistics');
     $columns[] = 'discriminative_efficiency';
     $headers[] = get_string('discriminative_efficiency', 'quiz_statistics');
     $this->define_columns($columns);
     $this->define_headers($headers);
     $this->sortable(false);
     $this->column_class('s', 'numcol');
     $this->column_class('random_guess_score', 'numcol');
     $this->column_class('intended_weight', 'numcol');
     $this->column_class('effective_weight', 'numcol');
     $this->column_class('sd', 'numcol');
     $this->column_class('facility', 'numcol');
     $this->column_class('discrimination_index', 'numcol');
     $this->column_class('discriminative_efficiency', 'numcol');
     // Set up the table
     $this->define_baseurl($reporturl->out());
     $this->collapsible(true);
     $this->set_attribute('id', 'questionstatistics');
     $this->set_attribute('class', 'generaltable generalbox boxaligncenter');
     parent::setup();
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:60,代码来源:statistics_table.php

示例5: 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

示例6: list_transactions

 public function list_transactions($transactions)
 {
     global $CFG;
     $table = new flexible_table('local-magentoconnector-transaction-list');
     $table->define_columns(array('user', 'course', 'transactionid', 'timestamp'));
     $table->define_headers(array(get_string('user'), get_string('course'), get_string('transactionid', 'local_magentoconnector'), get_string('timestamp', 'local_magentoconnector')));
     $table->define_baseurl(new moodle_url('/local/magentoconnector/viewtransactions.php'));
     $table->sortable(false);
     $table->collapsible(false);
     $table->column_class('user', 'user');
     $table->column_class('course', 'course');
     $table->column_class('transactionid', 'transactionid');
     $table->column_class('timestamp', 'timestamp');
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'local-magentoconnector-transaction-list');
     $table->set_attribute('class', 'local-magentoconnector-transaction-list generaltable');
     $table->set_attribute('width', '100%');
     $table->setup();
     if ($transactions) {
         $user = new stdClass();
         foreach ($transactions as $transaction) {
             $user->id = $transaction->userid;
             $user->firstname = $transaction->firstname;
             $user->lastname = $transaction->lastname;
             $user->firstnamephonetic = $transaction->firstnamephonetic;
             $user->lastnamephonetic = $transaction->lastnamephonetic;
             $user->middlename = $transaction->middlename;
             $user->alternatename = $transaction->alternatename;
             $row = array();
             $userurl = new moodle_url($CFG->wwwroot . '/user/profile.php', array('id' => $user->id));
             $row[] = html_writer::link($userurl, fullname($user), array('title' => get_string('viewprofile')));
             $courseurl = new moodle_url($CFG->wwwroot . '/course/view.php', array('id' => $transaction->courseid));
             $row[] = html_writer::link($courseurl, $transaction->course, array('title' => $transaction->course));
             $row[] = $transaction->ordernum;
             $row[] = userdate($transaction->timestamp, get_string('strftimedatetime'));
             $table->add_data($row);
         }
     }
     $table->print_html();
 }
开发者ID:srinathweb,项目名称:moodle_magento_connector,代码行数:40,代码来源:renderer.php

示例7: setup

 /**
  * Setup the table, i.e. table headers
  *
  */
 public function setup()
 {
     // Set var for is downloading
     $isdownloading = $this->is_downloading();
     $this->set_attribute('cellspacing', '0');
     $columns = array('fullname' => get_string('name'), 'attempt' => get_string('attemptno', 'activequiz'), 'preview' => get_string('preview'), 'timestart' => get_string('startedon', 'activequiz'), 'timefinish' => get_string('timecompleted', 'activequiz'), 'timemodified' => get_string('timemodified', 'activequiz'), 'status' => get_string('status'), 'attemptgrade' => get_string('attempt_grade', 'activequiz'));
     if (!$isdownloading) {
         $columns['edit'] = get_string('response_attempt_controls', 'activequiz');
     }
     $this->define_columns(array_keys($columns));
     $this->define_headers(array_values($columns));
     $this->sortable(true, 'timestart');
     $this->collapsible(true);
     $this->column_class('fullname', 'bold');
     $this->column_class('sumgrades', 'bold');
     $this->set_attribute('cellspacing', '0');
     $this->set_attribute('cellpadding', '2');
     $this->set_attribute('id', 'attempts');
     $this->set_attribute('class', 'generaltable generalbox');
     $this->set_attribute('align', 'center');
     parent::setup();
 }
开发者ID:agarnav,项目名称:moodle-mod_activequiz,代码行数:26,代码来源:sessionattempts.php

示例8: setup

 /**
  * Setup the table, i.e. table headers
  *
  */
 public function setup()
 {
     // Set var for is downloading
     $isdownloading = $this->is_downloading();
     $this->set_attribute('cellspacing', '0');
     if ($this->rtq->group_mode()) {
         $columns = array('fullname' => get_string('name'), 'group' => get_string('groupmembership', 'activequiz'), 'grade' => get_string('grade'), 'timemodified' => get_string('timemodified', 'activequiz'));
     } else {
         $columns = array('fullname' => get_string('name'), 'grade' => get_string('grade'), 'timemodified' => get_string('timemodified', 'activequiz'));
     }
     $this->define_columns(array_keys($columns));
     $this->define_headers(array_values($columns));
     $this->sortable(true);
     $this->collapsible(true);
     $this->column_class('fullname', 'bold');
     $this->column_class('grade', 'bold');
     $this->set_attribute('cellspacing', '0');
     $this->set_attribute('cellpadding', '2');
     $this->set_attribute('id', 'grades');
     $this->set_attribute('class', 'generaltable generalbox');
     $this->set_attribute('align', 'center');
     parent::setup();
 }
开发者ID:agarnav,项目名称:moodle-mod_activequiz,代码行数:27,代码来源:overallgradesview.php

示例9: display


//.........这里部分代码省略.........
                $table->define_columns($columns);
                $table->define_headers($headers);
                $table->define_baseurl($PAGE->url);

                $table->sortable(true);
                $table->collapsible(true);

                // This is done to prevent redundant data, when a user has multiple attempts
                $table->column_suppress('picture');
                $table->column_suppress('fullname');
                foreach ($extrafields as $field) {
                    $table->column_suppress($field);
                }

                $table->no_sorting('start');
                $table->no_sorting('finish');
                $table->no_sorting('score');

                foreach ($scoes as $sco) {
                    if ($sco->launch != '') {
                        $table->no_sorting('scograde'.$sco->id);
                    }
                }

                $table->column_class('picture', 'picture');
                $table->column_class('fullname', 'bold');
                $table->column_class('score', 'bold');

                $table->set_attribute('cellspacing', '0');
                $table->set_attribute('id', 'attempts');
                $table->set_attribute('class', 'generaltable generalbox');

                // Start working -- this is necessary as soon as the niceties are over
                $table->setup();
            } else if ($download == 'ODS') {
                require_once("$CFG->libdir/odslib.class.php");

                $filename .= ".ods";
                // Creating a workbook
                $workbook = new MoodleODSWorkbook("-");
                // Sending HTTP headers
                $workbook->send($filename);
                // Creating the first worksheet
                $sheettitle = get_string('report', 'scorm');
                $myxls =& $workbook->add_worksheet($sheettitle);
                // format types
                $format =& $workbook->add_format();
                $format->set_bold(0);
                $formatbc =& $workbook->add_format();
                $formatbc->set_bold(1);
                $formatbc->set_align('center');
                $formatb =& $workbook->add_format();
                $formatb->set_bold(1);
                $formaty =& $workbook->add_format();
                $formaty->set_bg_color('yellow');
                $formatc =& $workbook->add_format();
                $formatc->set_align('center');
                $formatr =& $workbook->add_format();
                $formatr->set_bold(1);
                $formatr->set_color('red');
                $formatr->set_align('center');
                $formatg =& $workbook->add_format();
                $formatg->set_bold(1);
                $formatg->set_color('green');
                $formatg->set_align('center');
                // Here starts workshhet headers
开发者ID:numbas,项目名称:moodle,代码行数:67,代码来源:report.php

示例10: 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}&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

示例11: array

        } 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,
                                                ));

                $data[] = $OUTPUT->single_button($url, $strdeletefeedback, 'post');
                $tablepublic->add_data($data);
            }
            $tablepublic->finish_output();
            echo $OUTPUT->box_end();
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:delete_template.php

示例12: implode

 /**
  * Prints a table with users and their attempts
  *
  * @return void
  * @todo Add current grade to the table
  *       Finnish documenting
  **/
 function view_question($quiz, $question)
 {
     global $CFG, $db;
     $users = get_course_students($quiz->course);
     $userids = implode(',', array_keys($users));
     $usercount = count($users);
     // set up table
     $tablecolumns = array('picture', 'fullname', 'timefinish', 'grade');
     $tableheaders = array('', get_string('name'), get_string("completedon", "quiz"), '');
     $table = new flexible_table('mod-quiz-report-grading');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/quiz/report.php?mode=grading&amp;q=' . $quiz->id . '&amp;action=viewquestion&amp;questionid=' . $question->id);
     $table->sortable(true);
     $table->initialbars($usercount > 20);
     // will show initialbars if there are more than 20 users
     $table->pageable(true);
     $table->collapsible(true);
     $table->column_suppress('fullname');
     $table->column_suppress('picture');
     $table->column_suppress('grade');
     $table->column_class('picture', 'picture');
     // attributes in the table tag
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'generaltable generalbox');
     $table->set_attribute('align', 'center');
     //$table->set_attribute('width', '50%');
     // get it ready!
     $table->setup();
     // this sql is a join of the attempts table and the user table.  I do this so I can sort by user name and attempt number (not id)
     $select = 'SELECT ' . sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')) . ' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, u.id AS userid, u.firstname, u.lastname, u.picture ';
     $from = 'FROM ' . $CFG->prefix . 'user u LEFT JOIN ' . $CFG->prefix . 'quiz_attempts qa ON (u.id = qa.userid AND qa.quiz = ' . $quiz->id . ') ';
     $where = 'WHERE u.id IN (' . $userids . ') ';
     $where .= 'AND ' . $db->IfNull('qa.attempt', '0') . ' != 0 ';
     $where .= 'AND ' . $db->IfNull('qa.timefinish', '0') . ' != 0 ';
     $where .= 'AND preview = 0 ';
     // ignore previews
     if ($table->get_sql_where()) {
         // forgot what this does
         $where .= 'AND ' . $table->get_sql_where();
     }
     // sorting of the table
     if ($sort = $table->get_sql_sort()) {
         $sort = 'ORDER BY ' . $sort;
         // seems like I would need to have u. or qa. infront of the ORDER BY attribues... but seems to work..
     } else {
         // my default sort rule
         $sort = 'ORDER BY u.firstname, u.lastname, qa.timefinish ASC';
     }
     // set up the pagesize
     $total = count_records_sql('SELECT COUNT(DISTINCT(' . sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')) . ')) ' . $from . $where);
     $table->pagesize(10, $total);
     // get the attempts and process them
     if ($attempts = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
         foreach ($attempts as $attempt) {
             $picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true);
             // link to student profile
             $userlink = "<a href=\"{$CFG->wwwroot}/user/view.php?id={$attempt->userid}&amp;course={$quiz->course}\">" . fullname($attempt, true) . '</a>';
             if (!$this->is_graded($question, $attempt)) {
                 $style = 'class="manual-ungraded"';
             } else {
                 $style = 'class="manual-graded"';
             }
             // link for the attempt
             $attemptlink = "<a {$style} href=\"report.php?mode=grading&amp;action=grade&amp;q={$quiz->id}&amp;questionid={$question->id}&amp;attemptid={$attempt->attemptid}\">" . userdate($attempt->timefinish, get_string('strftimedatetime')) . '</a>';
             // grade all attempts for this user
             $gradelink = "<a href=\"report.php?mode=grading&amp;action=grade&amp;q={$quiz->id}&amp;questionid={$question->id}&amp;userid={$attempt->userid}\">" . get_string('grade') . '</a>';
             $table->add_data(array($picture, $userlink, $attemptlink, $gradelink));
         }
     }
     // grade all and "back" links
     $links = "<div class=\"boxaligncenter\"><a href=\"report.php?mode=grading&amp;action=grade&amp;q={$quiz->id}&amp;questionid={$question->id}&amp;gradeall=1\">" . get_string('gradeall', 'quiz') . '</a> | ' . "<a href=\"report.php?mode=grading&amp;q={$quiz->id}&amp;action=viewquestions\">" . get_string('backtoquestionlist', 'quiz') . '</a></div>' . print_heading($question->name);
     echo $links;
     echo '<div id="tablecontainer">';
     $table->print_html();
     echo '</div>';
     echo $links;
 }
开发者ID:veritech,项目名称:pare-project,代码行数:86,代码来源:report.php

示例13: 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

示例14: array

 /**
  *  Display all the submissions ready for grading
  */
 function display_submissions($message = '')
 {
     global $CFG, $db, $USER;
     require_once $CFG->libdir . '/gradelib.php';
     /* first we check to see if the form has just been submitted
      * to request user_preference updates
      */
     if (isset($_POST['updatepref'])) {
         $perpage = optional_param('perpage', 10, PARAM_INT);
         $perpage = $perpage <= 0 ? 10 : $perpage;
         set_user_preference('assignment_perpage', $perpage);
         set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
     }
     /* next we get perpage and quickgrade (allow quick grade) params
      * from database
      */
     $perpage = get_user_preferences('assignment_perpage', 10);
     $quickgrade = get_user_preferences('assignment_quickgrade', 0);
     $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);
     if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) {
         $uses_outcomes = true;
     } else {
         $uses_outcomes = false;
     }
     $teacherattempts = true;
     /// Temporary measure
     $page = optional_param('page', 0, PARAM_INT);
     $strsaveallfeedback = get_string('saveallfeedback', 'assignment');
     /// Some shortcuts to make the code read better
     $course = $this->course;
     $assignment = $this->assignment;
     $cm = $this->cm;
     $tabindex = 1;
     //tabindex for quick grading tabbing; Not working for dropdowns yet
     add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
     $navlinks = array();
     $navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
     $navlinks[] = array('name' => format_string($this->assignment->name, true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance');
     $navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title');
     $navigation = build_navigation($navlinks);
     print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
     if (!empty($message)) {
         echo $message;
         // display messages here if any
     }
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// find out current groups mode
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
     groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
     /// Get all ppl that are allowed to submit assignments
     $users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false);
     $users = array_keys($users);
     if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) {
         $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id');
         $users = array_intersect($users, array_keys($groupingusers));
     }
     $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade');
     if ($uses_outcomes) {
         $tablecolumns[] = 'outcome';
         // no sorting based on outcomes column
     }
     $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . $course->student . ')', get_string('lastmodified') . ' (' . $course->teacher . ')', get_string('status'), get_string('finalgrade', 'grades'));
     if ($uses_outcomes) {
         $tableheaders[] = get_string('outcome', 'grades');
     }
     require_once $CFG->libdir . '/tablelib.php';
     $table = new flexible_table('mod-assignment-submissions');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&amp;currentgroup=' . $currentgroup);
     $table->sortable(true, 'lastname');
     //sorted by lastname by default
     $table->collapsible(true);
     $table->initialbars(true);
     $table->column_suppress('picture');
     $table->column_suppress('fullname');
     $table->column_class('picture', 'picture');
     $table->column_class('fullname', 'fullname');
     $table->column_class('grade', 'grade');
     $table->column_class('submissioncomment', 'comment');
     $table->column_class('timemodified', 'timemodified');
     $table->column_class('timemarked', 'timemarked');
     $table->column_class('status', 'status');
     $table->column_class('finalgrade', 'finalgrade');
     if ($uses_outcomes) {
         $table->column_class('outcome', 'outcome');
     }
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'submissions');
     $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();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:lib.php

示例15: setup

 public function setup($download = '')
 {
     global $CFG;
     // Extra headers
     $this->postsheader = array(get_string('date'), get_string('time'), get_string('title', 'oublog'), get_string('content'), get_string('attachments', 'oublog'));
     $this->commentsheader = array(get_string('date'), get_string('time'), get_string('title', 'oublog'), get_string('content'), get_string('postauthor', 'oublog'), get_string('postdate', 'oublog'), get_string('posttime', 'oublog'), get_string('posttitle', 'oublog'));
     $this->posts = array(get_string('posts', 'oublog'));
     $this->comments = array(get_string('comments', 'oublog'));
     $headers = array(format_string($this->course->shortname, true), format_string($this->oublog->name, true));
     if (!empty($this->groupname)) {
         $headers[] = $this->groupname;
     }
     $headers[] = $this->userfullname;
     // set columns as the maximum otherwise the table
     // won't add_data correctly
     $columns = array();
     for ($i = 1; $i <= 8; $i++) {
         $columns[] = 'column' . $i;
     }
     $this->define_columns($columns);
     $this->define_headers($headers);
     $this->define_baseurl($CFG->wwwroot . '/mod/oublog/userparticipation.php?id=' . $this->cmid . '&amp;user=' . $this->userid . '&amp;group=' . $this->groupid . '&amp;start=' . $this->start . '&amp;end=' . $this->end);
     $this->set_attribute('cellspacing', '0');
     $this->set_attribute('id', 'participation');
     $this->set_attribute('class', 'participation');
     $this->set_attribute('width', '100%');
     $this->set_attribute('align', 'center');
     $this->sortable(false);
     parent::setup();
 }
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:30,代码来源:participation_table.php


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