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


PHP flexible_table::column_class方法代码示例

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


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

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

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

示例3: array


//.........这里部分代码省略.........
        }

        $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').' ('.get_string('submission', 'assignment').')',
                              get_string('lastmodified').' ('.get_string('grade').')',
                              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.'&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', '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'));
            echo '</div>';
            return true;
        }
        if ($this->assignment->assignmenttype=='upload' || $this->assignment->assignmenttype=='online' || $this->assignment->assignmenttype=='uploadsingle') { //TODO: this is an ugly hack, where is the plugin spirit? (skodak)
            echo '<div style="text-align:right"><a href="submissions.php?id='.$this->cm->id.'&amp;download=zip">'.get_string('downloadall', 'assignment').'</a></div>';
        }
    /// Construct the SQL
开发者ID:nuckey,项目名称:moodle,代码行数:67,代码来源:lib.php

示例4: navmenu

 /**
  *  Display all the submissions ready for grading
  *
  * @global object
  * @global object
  * @global object
  * @global object
  * @param string $message
  * @return bool|void
  */
 function display_submissions($message = '')
 {
     global $CFG, $DB, $USER, $DB, $OUTPUT;
     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;
     }
     $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->cm->id, $this->assignment->id, $this->cm->id);
     $navigation = build_navigation($this->strsubmissions, $this->cm);
     print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
     $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
     if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
         echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>';
     }
     if (!empty($message)) {
         echo $message;
         // display messages here if any
     }
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// Check to see if groups are being used in this assignment
     /// find out current groups mode
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
     groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
     /// Get all ppl that are allowed to submit assignments
     if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) {
         $users = array_keys($users);
     }
     // if groupmembersonly used, remove users who are not in any group
     if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) {
         if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
             $users = array_intersect($users, array_keys($groupingusers));
         }
     }
     $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') . ' (' . get_string('submission', 'assignment') . ')', get_string('lastmodified') . ' (' . get_string('grade') . ')', 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');
     }
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:lib.php

示例5: array

if (count($rs) == 0) {
    $add = 1;
}
echo $OUTPUT->header();
echo html_writer::start_tag('div', array('class' => 'content'));
echo html_writer::tag('h2', $strmanagelinks, array('class' => 'main'));
// Generate the table.
echo html_writer::start_tag('form', array('method' => 'post', 'action' => $baseurl));
$table = new flexible_table('links-administration');
$table->define_columns(array('linktext', 'url', 'notes', 'defaultshow', 'category', 'actions'));
$table->define_headers(array(get_string('linktext', 'block_links'), get_string('url', 'block_links'), get_string('notes', 'block_links'), get_string('defaultshow', 'block_links'), get_string('category', 'block_links'), get_string('actions', 'moodle')));
$table->define_baseurl($baseurl);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'links');
$table->set_attribute('class', 'generaltable generalbox');
$table->column_class('linktext', 'linktext');
$table->column_class('url', 'url');
$table->column_class('notes', 'notes');
$table->column_class('defaultshow', 'defaultshow');
$table->column_class('category', 'category');
$table->column_class('actions', 'actions');
$table->setup();
foreach ($rs as $index => $link) {
    if ($link->defaultshow == '1') {
        $show = get_string('yes');
    } else {
        $show = get_string('no');
    }
    $editurl = new moodle_url('/blocks/links/edit.php', array('id' => $link->id));
    $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')));
    $deleteurl = new moodle_url('/blocks/links/config_global_action.php', array('delete' => $link->id, 'sesskey' => sesskey()));
开发者ID:sbourget,项目名称:moodle-block_links,代码行数:31,代码来源:config_global_action.php

示例6: display


//.........这里部分代码省略.........
                if ($displayoptions['right']) {
                    $columns[] = 'right' . $id;
                    $headers[] = get_string('rightanswerx', 'scormreport_interactions', $id);
                }
            }

            if (!$download) {
                $table = new flexible_table('mod-scorm-report');

                $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');
开发者ID:numbas,项目名称:moodle,代码行数:67,代码来源:report.php

示例7:

if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING || $emarking->type == EMARKING_TYPE_PEER_REVIEW && $issupervisor) {
    $columns[] = 'marker';
}
if ($emarking->type == EMARKING_TYPE_ON_SCREEN_MARKING || $emarking->type == EMARKING_TYPE_PEER_REVIEW) {
    $columns[] = 'grade';
}
$columns[] = 'status';
$columns[] = 'actions';
$columns[] = 'select';
// Define flexible table (can be sorted in different ways).
$showpages = new flexible_table('emarking-view-' . $cm->id);
$showpages->set_attribute('id', 'emarking-main');
$showpages->define_headers($headers);
$showpages->define_columns($columns);
$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();
开发者ID:sikeze,项目名称:emarking,代码行数:31,代码来源:view.php

示例8: count

 /**
  * Prints a table with users and their attempts
  *
  * @return void
  * @todo Add current grade to the table
  *       Finnish documenting
  **/
 function view_question($quiz, $question, $totalattempts, $ungraded)
 {
     global $CFG;
     $usercount = count($this->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($this->viewurl->out());
     $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();
     list($select, $from, $where) = $this->attempts_sql($quiz->id, true, $question->id);
     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
     $table->pagesize(QUIZ_REPORT_DEFAULT_PAGE_SIZE, $totalattempts);
     // get the attempts and process them
     if ($attempts = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
         // grade all link
         $links = "<strong><a href=\"report.php?mode=grading&amp;gradeall=1&amp;q={$quiz->id}&amp;questionid={$question->id}\">" . get_string('gradeall', 'quiz_grading', $totalattempts) . '</a></strong>';
         if ($ungraded > 0) {
             $links .= "<br /><strong><a href=\"report.php?mode=grading&amp;gradeungraded=1&amp;q={$quiz->id}&amp;questionid={$question->id}\">" . get_string('gradeungraded', 'quiz_grading', $ungraded) . '</a></strong>';
             if ($ungraded > QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE) {
                 $links .= "<br /><strong><a href=\"report.php?mode=grading&amp;gradenextungraded=1&amp;q={$quiz->id}&amp;questionid={$question->id}\">" . get_string('gradenextungraded', 'quiz_grading', QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE) . '</a></strong>';
             }
         }
         $table->add_data_keyed(array('grade' => $links));
         $table->add_separator();
         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>';
             $gradedclass = question_state_is_graded($attempt) ? ' class="highlightgraded" ' : '';
             $gradedstring = question_state_is_graded($attempt) ? ' ' . get_string('graded', 'quiz_grading') : '';
             // link for the attempt
             $attemptlink = "<a {$gradedclass}href=\"report.php?mode=grading&amp;q={$quiz->id}&amp;questionid={$question->id}&amp;attemptid={$attempt->attemptid}\">" . userdate($attempt->timefinish, get_string('strftimedatetime')) . $gradedstring . '</a>';
             // grade all attempts for this user
             $gradelink = "<a href=\"report.php?mode=grading&amp;q={$quiz->id}&amp;questionid={$question->id}&amp;userid={$attempt->userid}\">" . get_string('grade') . '</a>';
             $table->add_data(array($picture, $userlink, $attemptlink, $gradelink));
         }
         $table->add_separator();
         $table->add_data_keyed(array('grade' => $links));
         // print everything here
         echo '<div id="tablecontainer">';
         $table->print_html();
         echo '</div>';
     } else {
         notify(get_string('noattemptstoshow', 'quiz'));
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:84,代码来源:report.php

示例9: array

     $perpage = $perpage <= 0 ? STAMPCOLL_USERS_PER_PAGE : $perpage;
     set_user_preference('stampcoll_perpage', $perpage);
 }
 /// Next we get perpage param from database
 $perpage = get_user_preferences('stampcoll_perpage', STAMPCOLL_USERS_PER_PAGE);
 $tablecolumns = array('picture', 'fullname', 'count', 'stamps');
 $tableheaders = array('', get_string('fullname'), get_string('numberofstamps', 'stampcoll'), '');
 require_once $CFG->libdir . '/tablelib.php';
 $table = new flexible_table('mod-stampcoll-stamps');
 $table->define_columns($tablecolumns);
 $table->define_headers($tableheaders);
 $table->define_baseurl($CFG->wwwroot . '/mod/stampcoll/view.php?id=' . $cm->id . '&amp;currentgroup=' . $currentgroup);
 $table->sortable(true);
 $table->collapsible(false);
 $table->initialbars(true);
 $table->column_class('picture', 'picture');
 $table->column_class('fullname', 'fullname');
 $table->column_class('count', 'count');
 $table->column_class('stamps', 'stamps');
 $table->column_style('stamps', 'width', '50%');
 $table->set_attribute('cellspacing', '0');
 $table->set_attribute('id', 'stamps');
 $table->set_attribute('class', 'stamps');
 $table->set_attribute('width', '90%');
 $table->set_attribute('align', 'center');
 $table->setup();
 if (empty($users)) {
     print_heading(get_string('nousers', 'stampcoll'));
     return true;
 }
 /// Construct the SQL
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:view.php

示例10: array

$columns = array();
$columns[] = 'lastname';
if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING) {
    $columns[] = 'marker';
}
if ($emarking->type == EMARKING_TYPE_NORMAL) {
    $columns[] = 'grade';
}
$columns[] = 'status';
$columns[] = 'actions';
// Define flexible table (can be sorted in different ways)
$showpages = new flexible_table('emarking-view-' . $cmid);
$showpages->define_headers($headers);
$showpages->define_columns($columns);
$showpages->define_baseurl($urlemarking);
$showpages->column_class('actions', 'actions');
$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->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();
开发者ID:eduagdo,项目名称:emarking,代码行数:31,代码来源:view.php

示例11: print_memorybank_report1

function print_memorybank_report1($instid, $course = false)
{
    global $CFG, $USER;
    require_once $CFG->libdir . '/tablelib.php';
    $tablecolumns = array('commands', 'id', 'question', 'number_of_answers', 'average_score');
    $tableheaders = array(get_string('commands', 'memorybank'), get_string('question_id', 'memorybank'), get_string('question_text', 'memorybank'), get_string('number_of_answers', 'memorybank'), get_string('average_score', 'memorybank'));
    $table = new flexible_table('memorybank_report1');
    $table->define_columns($tablecolumns);
    $table->define_headers($tableheaders);
    $table->sortable(true, 'id');
    $table->no_sorting('commands');
    $table->set_attribute('cellspacing', '0');
    $table->set_attribute('cellpadding', '5');
    $table->set_attribute('id', 'memorybank-report');
    $table->set_attribute('class', 'boxaligncenter generaltable');
    $table->column_class('commands', 'controls');
    $table->setup();
    $sort = $table->get_sql_sort();
    $SQL = "\r\n        SELECT \r\n          {$CFG->prefix}memorybank_bank.id,\r\n          {$CFG->prefix}memorybank_bank.question,\r\n          {$CFG->prefix}memorybank_bank.visible,\r\n          {$CFG->prefix}memorybank_submissions.qid,\r\n          COUNT({$CFG->prefix}memorybank_submissions.qid) as number_of_answers,\r\n          AVG({$CFG->prefix}memorybank_submissions.grade) as average_score\r\n        FROM\r\n         {$CFG->prefix}memorybank_bank\r\n         LEFT OUTER JOIN {$CFG->prefix}memorybank_submissions ON ({$CFG->prefix}memorybank_bank.id={$CFG->prefix}memorybank_submissions.qid)\r\n        WHERE \r\n          {$CFG->prefix}memorybank_bank.modid = {$instid}\r\n        GROUP BY\r\n          {$CFG->prefix}memorybank_bank.id,\r\n          {$CFG->prefix}memorybank_bank.question,\r\n          {$CFG->prefix}memorybank_submissions.qid\r\n        ORDER BY {$sort}\r\n\t";
    $results = get_records_sql($SQL, 0, 500);
    if (is_array($results)) {
        foreach ($results as $result) {
            $commands = "<a href=\"view.php?instid={$instid}&amp;what=delete&amp;qid={$result->id}\"><img src=\"{$CFG->pixpath}/t/delete.gif\" /></a>";
            if ($result->visible) {
                $commands .= "<a href=\"view.php?instid={$instid}&amp;what=showhide&amp;qid={$result->id}&amp;view=edit\"><img src=\"{$CFG->pixpath}/t/hide.gif\" /></a>";
            } else {
                $commands .= "<a href=\"view.php?instid={$instid}&amp;what=showhide&amp;qid={$result->id}&amp;view=edit\"><img src=\"{$CFG->pixpath}/t/show.gif\" /></a>";
            }
            //if ($result->number_of_answers)
            $commands .= "<a href=\"view.php?what=answerlist&amp;instid={$instid}&amp;qid={$result->id}\"><img src=\"{$CFG->pixpath}/t/log.gif\" /></a>";
            $commands .= "<a href=\"view.php?what=edit&amp;instid={$instid}&amp;qid={$result->id}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" /></a>";
            $avg_score = $result->number_of_answers ? round($result->average_score, 2) : '-';
            $table->data[] = array($commands, $result->id, $result->question, (int) $result->number_of_answers, $avg_score);
        }
    }
    $strroletoassign = get_string("listallbanks", "memorybank");
    $options = array();
    //    $options = array('0'=>get_string('listallbanks', 'memorybank').'...');
    foreach (get_all_instances_in_course("memorybank", $course) as $memorybank) {
        $options[$memorybank->id] = $memorybank->name;
    }
    echo '<div style="text-align: center; padding: 20px;">';
    popup_form("{$CFG->wwwroot}/mod/memorybank/view.php?what=questionlist&instid=", $options, 'instid', $instid, '', '', '', false, 'self', '');
    echo '
    <style>
        .controls img {
            padding: 0 3px;
            cursor: pointer;
        }
    </style>    
    </div>';
    if (isset($table->data)) {
        $table->print_html();
    } else {
        echo 'no data';
    }
    print_footer();
    die;
}
开发者ID:kopohi,项目名称:memorybank,代码行数:59,代码来源:lib.php

示例12: display_allfilesform


//.........这里部分代码省略.........
     $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))) {
             $tablecolumns[] = $cur;
             $tableheaders[] = $cur == 'phone1' ? get_string('phone') : get_string($cur);
         }
     }
     $tableheaders[] = get_string('lastmodified');
     $tablecolumns[] = 'timemodified';
     if (has_capability('mod/publication:approve', $context)) {
         // Not necessary in upload mode without studentapproval.
         if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
             $tablecolumns[] = 'studentapproval';
             $tableheaders[] = get_string('studentapproval', 'publication') . ' ' . $OUTPUT->help_icon('studentapproval', 'publication');
         }
         $tablecolumns[] = 'teacherapproval';
         if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
             $tableheaders[] = get_string('obtainstudentapproval', 'publication');
         } else {
             $tableheaders[] = get_string('teacherapproval', 'publication');
         }
         $tablecolumns[] = 'visibleforstudents';
         $tableheaders[] = get_string('visibleforstudents', 'publication');
     }
     require_once $CFG->libdir . '/tablelib.php';
     $table = new flexible_table('mod-publication-allfiles');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/publication/view.php?id=' . $cm->id . '&amp;currentgroup=' . $currentgroup);
     $table->sortable(true, 'lastname');
     // 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.
开发者ID:Kathrin84,项目名称:moodle-mod_publication,代码行数:67,代码来源:locallib.php

示例13:

require_once $CFG->libdir . '/tablelib.php';
$table = new flexible_table('mod-stampcoll-editstamps');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/stampcoll/editstamps.php?id=' . $cm->id . '&amp;currentgroup=' . $currentgroup);
$table->sortable(true, 'lastname');
// default sort - do not use "count" here!
if (!$cap_viewotherstamps) {
    // prevent sorting by stamps count and so guessing the number of them
    $table->no_sorting('count');
}
$table->collapsible(false);
$table->initialbars(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'fullname');
$table->column_class('count', 'count');
$table->column_class('comment', 'comment');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'stamps');
$table->set_attribute('class', 'stamps');
$table->set_attribute('width', '90%');
$table->set_attribute('align', 'center');
$table->setup();
if (empty($users)) {
    print_heading(get_string('nousers', 'stampcoll'));
    return true;
}
/// Construct the SQL
if ($where = $table->get_sql_where()) {
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:editstamps.php

示例14: foreach

array_push($tableheaders, get_string('inboxtableheadertime', 'block_moodletxt'));
array_push($tablecolumns, 'tags');
array_push($tableheaders, get_string('inboxtableheadertags', 'block_moodletxt'));
if (!$table->is_downloading()) {
    array_push($tablecolumns, 'options');
    array_push($tableheaders, get_string('inboxtableheaderoptions', 'block_moodletxt'));
}
// Finish off table options
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->sortable(true, 'timereceived', SORT_DESC);
$table->no_sorting('checkbox');
$table->no_sorting('messagetext');
$table->no_sorting('options');
$table->no_sorting('tags');
$table->column_class('tags', 'tagDrop');
$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
// Output errors if necessary
if (!$table->is_downloading()) {
    // Drop in page header
    echo $output->header();
    $addTagListItems = '';
    $tagCloud = new moodletxt_message_tag_cloud(get_string('headertags', 'block_moodletxt'));
    $tagCloud->set_attribute('class', 'mdltxt_right');
    $tagCloud->set_attribute('style', 'text-align:right;');
    $maxCount = 1;
    // Find tag with largest number of messages assigned
    foreach ($tagList as $tag) {
        if ($tag->getTagCount() > $maxCount) {
            $maxCount = $tag->getTagCount();
开发者ID:educacionbe,项目名称:campus,代码行数:31,代码来源:received.php

示例15: geogebra_view_results

function geogebra_view_results($geogebra, $context, $cm, $course, $action)
{
    global $CFG, $DB, $OUTPUT, $PAGE, $USER;
    if ($action == 'submitgrade') {
        // Upgrade submitted grade
        $grade = optional_param('grade', '', PARAM_INT);
        $gradecomment = optional_param_array('comment_editor', '', PARAM_RAW);
        $attemptid = optional_param('attemptid', '', PARAM_INT);
        $attempt = geogebra_get_attempt($attemptid);
        parse_str($attempt->vars, $parsedvars);
        $parsedvars['grade'] = $grade;
        $attempt->vars = http_build_query($parsedvars, '', '&');
        geogebra_update_attempt($attemptid, $attempt->vars, GEOGEBRA_UPDATE_TEACHER, $gradecomment['text']);
    }
    // Show students list with their results
    require_once $CFG->libdir . '/gradelib.php';
    $perpage = optional_param('perpage', 10, PARAM_INT);
    $perpage = $perpage <= 0 ? 10 : $perpage;
    $page = optional_param('page', 0, PARAM_INT);
    // Find out current groups mode
    $groupmode = groups_get_activity_groupmode($cm);
    $currentgroup = groups_get_activity_group($cm, true);
    // Get all ppl that are allowed to submit geogebra
    list($esql, $params) = get_enrolled_sql($context, 'mod/geogebra:submit', $currentgroup);
    $sql = "SELECT u.id FROM {user} u " . "LEFT JOIN ({$esql}) eu ON eu.id=u.id " . "WHERE u.deleted = 0 AND eu.id=u.id ";
    $users = $DB->get_records_sql($sql, $params);
    if (!empty($users)) {
        $users = array_keys($users);
    }
    // If groupmembersonly used, remove users who are not in any group
    if ($users and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) {
        if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
            $users = array_intersect($users, array_keys($groupingusers));
        }
    }
    // TODO: Review to show all users information
    if (!empty($users)) {
        // Create results table
        $extrafields = get_extra_user_fields($context);
        $tablecolumns = array_merge(array('picture', 'fullname'), $extrafields, array('attempts', 'duration', 'grade', 'comment', 'datestudent', 'dateteacher', 'status'));
        $extrafieldnames = array();
        foreach ($extrafields as $field) {
            $extrafieldnames[] = get_user_field_name($field);
        }
        $tableheaders = array_merge(array('', get_string('fullnameuser')), $extrafieldnames, array(get_string('attempts', 'geogebra'), get_string('duration', 'geogebra'), get_string('grade'), get_string('comment', 'geogebra'), get_string('lastmodifiedsubmission', 'geogebra'), get_string('lastmodifiedgrade', 'geogebra'), get_string('status', 'geogebra')));
        require_once $CFG->libdir . '/tablelib.php';
        $table = new flexible_table('mod-geogebra-results');
        $table->define_columns($tablecolumns);
        $table->define_headers($tableheaders);
        $table->define_baseurl($CFG->wwwroot . '/mod/geogebra/report.php?id=' . $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');
        foreach ($extrafields as $field) {
            $table->column_class($field, $field);
        }
        $table->set_attribute('cellspacing', '0');
        $table->set_attribute('id', 'attempts');
        $table->set_attribute('class', 'results generaltable generalbox');
        $table->set_attribute('width', '100%');
        $table->no_sorting('attempts');
        $table->no_sorting('duration');
        $table->no_sorting('grade');
        $table->no_sorting('comment');
        $table->no_sorting('datestudent');
        $table->no_sorting('dateteacher');
        $table->no_sorting('status');
        // 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);
        $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());
        $table->pagesize($perpage, count($users));
        $offset = $page * $perpage;
        // Offset used to calculate index of student in that particular query, needed for the pop up to know who's next
        if ($ausers !== false) {
            // $grading_info = grade_get_grades($course->id, 'mod', 'geogebra', $geogebra->id, array_keys($ausers));
            foreach ($ausers as $auser) {
                $picture = $OUTPUT->user_picture($auser);
                $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $context)) . '</a>';
                $row = array($picture, $userlink);
                $extradata = array();
                foreach ($extrafields as $field) {
                    $extradata[] = $auser->{$field};
                }
                $row += $extradata;
//.........这里部分代码省略.........
开发者ID:ninelanterns,项目名称:moodle-mod_geogebra,代码行数:101,代码来源:locallib.php


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