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


PHP flexible_table::print_html方法代码示例

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


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

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

示例2: rss_display_feeds

/**
 * @param int $courseid The id of the course the user is currently viewing
 * @param int $userid We need this to know which feeds the user is allowed to manage
 * @param int $rssid If present the rss entry matching this id alone will be displayed
 *            as long as the user is allowed to manage this feed
 * @param object $context we need the context object to check what the user is allowed to do.
 */
function rss_display_feeds($courseid, $userid, $rssid = '', $context)
{
    global $db, $USER, $CFG;
    global $blogid;
    //hackish, but if there is a blogid it would be good to preserve it
    require_once $CFG->libdir . '/tablelib.php';
    $select = '';
    $managesharedfeeds = has_capability('block/rss_client:manageanyfeeds', $context);
    $manageownfeeds = has_capability('block/rss_client:manageownfeeds', $context);
    if ($rssid != '') {
        $select = 'id = ' . $rssid . ' AND ';
    }
    if ($managesharedfeeds) {
        $select .= '(userid = ' . $userid . ' OR shared = 1)';
    } else {
        if ($manageownfeeds) {
            $select .= 'userid = ' . $userid;
        }
    }
    $table = new flexible_table('rss-display-feeds');
    $table->define_columns(array('feed', 'actions'));
    $table->define_headers(array(get_string('feed', 'block_rss_client'), get_string('actions', 'moodle')));
    $table->set_attribute('cellspacing', '0');
    $table->set_attribute('id', 'rssfeeds');
    $table->set_attribute('class', 'generaltable generalbox');
    $table->column_class('feed', 'feed');
    $table->column_class('actions', 'actions');
    $table->setup();
    $feeds = get_records_select('block_rss_client', $select, sql_order_by_text('title'));
    if (!empty($feeds)) {
        foreach ($feeds as $feed) {
            if (!empty($feed->preferredtitle)) {
                $feedtitle = stripslashes_safe($feed->preferredtitle);
            } else {
                $feedtitle = stripslashes_safe($feed->title);
            }
            if ($feed->userid == $USER->id && $manageownfeeds || $feed->shared && $managesharedfeeds) {
                $feedicons = '<a href="' . $CFG->wwwroot . '/blocks/rss_client/block_rss_client_action.php?id=' . $courseid . '&amp;act=rssedit&amp;rssid=' . $feed->id . '&amp;shared=' . $feed->shared . '&amp;blogid=' . $blogid . '">' . '<img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . get_string('edit') . '" title="' . get_string('edit') . '" /></a>&nbsp;' . '<a href="' . $CFG->wwwroot . '/blocks/rss_client/block_rss_client_action.php?id=' . $courseid . '&amp;act=delfeed&amp;sesskey=' . sesskey() . '&amp;rssid=' . $feed->id . '&amp;shared=' . $feed->shared . 'blogid=' . $blogid . '"
                onclick="return confirm(\'' . get_string('deletefeedconfirm', 'block_rss_client') . '\');">' . '<img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . get_string('delete') . '" title="' . get_string('delete') . '" /></a>';
            } else {
                $feedicons = '';
            }
            $feedinfo = '
    <div class="title">
        <a href="' . $CFG->wwwroot . '/blocks/rss_client/block_rss_client_action.php?id=' . $courseid . '&amp;act=view&amp;rssid=' . $feed->id . '&amp;blogid=' . $blogid . '">
        ' . $feedtitle . '</a>
    </div>
    <div class="url">
        <a href="' . $feed->url . '">' . $feed->url . '</a>
    </div>
    <div class="description">' . $feed->description . '</div>';
            $table->add_data(array($feedinfo, $feedicons));
        }
    }
    $table->print_html();
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:63,代码来源:rsslib.php

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

示例4: flexible_table

 /**
  * Helper method dealing with the fact we can not just fetch the output of flexible_table
  *
  * @param flexible_table $table
  * @return string HTML
  */
 public function flexible_table(\flexible_table $table)
 {
     $o = '';
     ob_start();
     $table->print_html();
     $o = ob_get_contents();
     ob_end_clean();
     return $o;
 }
开发者ID:remotelearner,项目名称:moodle-mod_questionnaire,代码行数:15,代码来源:renderer.php

示例5: array


//.........这里部分代码省略.........
                    if (empty($auser->status)) { /// Confirm we have exclusively 0 or 1
                        $auser->status = 0;
                    } else {
                        $auser->status = 1;
                    }

                    $buttontext = ($auser->status == 1) ? $strupdate : $strgrade;

                    ///No more buttons, we use popups ;-).
                    $popup_url = '/mod/assignment/submissions.php?id='.$this->cm->id
                               . '&amp;userid='.$auser->id.'&amp;mode=single'.'&amp;filter='.$filter.'&amp;offset='.$offset++;

                    $button = $OUTPUT->action_link($popup_url, $buttontext);

                    $status  = '<div id="up'.$auser->id.'" class="s'.$auser->status.'">'.$button.'</div>';

                    $finalgrade = '<span id="finalgrade_'.$auser->id.'">'.$final_grade->str_grade.'</span>';

                    $outcomes = '';

                    if ($uses_outcomes) {

                        foreach($grading_info->outcomes as $n=>$outcome) {
                            $outcomes .= '<div class="outcome"><label>'.$outcome->name.'</label>';
                            $options = make_grades_menu(-$outcome->scaleid);

                            if ($outcome->grades[$auser->id]->locked or !$quickgrade) {
                                $options[0] = get_string('nooutcome', 'grades');
                                $outcomes .= ': <span id="outcome_'.$n.'_'.$auser->id.'">'.$options[$outcome->grades[$auser->id]->grade].'</span>';
                            } else {
                                $attributes = array();
                                $attributes['tabindex'] = $tabindex++;
                                $attributes['id'] = 'outcome_'.$n.'_'.$auser->id;
                                $outcomes .= ' '.html_writer::select($options, 'outcome_'.$n.'['.$auser->id.']', $outcome->grades[$auser->id]->grade, array(0=>get_string('nooutcome', 'grades')), $attributes);
                            }
                            $outcomes .= '</div>';
                        }
                    }

                    $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $this->context)) . '</a>';
                    $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
                    if ($uses_outcomes) {
                        $row[] = $outcomes;
                    }

                    $table->add_data($row);
                }
                $currentposition++;
            }
        }

        $table->print_html();  /// Print the whole table

        /// Print quickgrade form around the table
        if ($quickgrade && $table->started_output){
            $mailinfopref = false;
            if (get_user_preferences('assignment_mailinfo', 1)) {
                $mailinfopref = true;
            }
            $emailnotification =  html_writer::checkbox('mailinfo', 1, $mailinfopref, get_string('enableemailnotification','assignment'));

            $emailnotification .= $OUTPUT->help_icon('enableemailnotification', 'assignment');
            echo html_writer::tag('div', $emailnotification, array('class'=>'emailnotification'));

            $savefeedback = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'fastg', 'value'=>get_string('saveallfeedback', 'assignment')));
            echo html_writer::tag('div', $savefeedback, array('class'=>'fastgbutton'));

            echo html_writer::end_tag('form');
        } else if ($quickgrade) {
            echo html_writer::end_tag('form');
        }

        echo '</div>';
        /// End of fast grading form

        /// Mini form for setting user preference

        $formaction = new moodle_url('/mod/assignment/submissions.php', array('id'=>$this->cm->id));
        $mform = new MoodleQuickForm('optionspref', 'post', $formaction, '', array('class'=>'optionspref'));

        $mform->addElement('hidden', 'updatepref');
        $mform->setDefault('updatepref', 1);
        $mform->addElement('header', 'qgprefs', get_string('optionalsettings', 'assignment'));
        $mform->addElement('select', 'filter', get_string('show'),  $filters);

        $mform->setDefault('filter', $filter);

        $mform->addElement('text', 'perpage', get_string('pagesize', 'assignment'), array('size'=>1));
        $mform->setDefault('perpage', $perpage);

        $mform->addElement('checkbox', 'quickgrade', get_string('quickgrade','assignment'));
        $mform->setDefault('quickgrade', $quickgrade);
        $mform->addHelpButton('quickgrade', 'quickgrade', 'assignment');

        $mform->addElement('submit', 'savepreferences', get_string('savepreferences'));

        $mform->display();

        echo $OUTPUT->footer();
    }
开发者ID:nuckey,项目名称:moodle,代码行数:101,代码来源:lib.php

示例6: dialogue_list_conversations


//.........这里部分代码省略.........
        $sqlsort = $sortparts[0];
        if (strpos($sqlsort, 'subject') !== false) {
            $order = $sqlsort;
        }
        if (strpos($sqlsort, 'total') !== false) {
            $order = $sqlsort;
        }
        if (strpos($sqlsort, 'lastentry') !== false) {
            $order = $sqlsort;
            $order = str_replace('lastentry', 'c.timemodified', $order);
        }
        if (strpos($sqlsort, 'firstname') !== false) {
            $namesort = $sqlsort;
        }
        if (strpos($sqlsort, 'lastname') !== false) {
            $namesort = $sqlsort;
        }
        if (strpos($sqlsort, 'unread') !== false) {
            $namesort = $sqlsort;
        }
    }
    // list the conversations requiring a resonse from this user in full
    if ($conversations = dialogue_get_conversations($dialogue, $USER, $condition, $order, $groupid)) {
        foreach ($conversations as $conversation) {
            if (in_array($USER->id, $dialoguemanagers)) {
                if (!in_array($conversation->userid, $dialoguemanagers)) {
                    if (!($with = get_record('user', 'id', $conversation->userid))) {
                        error("User's record not found");
                    }
                } else {
                    if (!($with = get_record('user', 'id', $conversation->recipientid))) {
                        error("User's record not found");
                    }
                }
            } else {
                if ($USER->id != $conversation->userid) {
                    if (!($with = get_record('user', 'id', $conversation->userid))) {
                        error("User's record not found");
                    }
                } else {
                    if (!($with = get_record('user', 'id', $conversation->recipientid))) {
                        error("User's record not found");
                    }
                }
            }
            // save sortable field values for each conversation so can sort by them later
            $names[$conversation->id] = fullname($with);
            $unread[$conversation->id] = $conversation->total - $conversation->readings;
            $names_firstlast[$conversation->id] = $with->firstname . ' ' . $with->lastname;
            $names_lastfirst[$conversation->id] = $with->lastname . ' ' . $with->firstname;
            $photos[$conversation->id] = print_user_picture($with, $course->id, true, 0, true);
            $ids[$conversation->id] = $with->id;
        }
        // sort an array of conversations based on which field user clicked to sort in the UI
        $sortedvalues = $names;
        // default is sort by fullname from above
        switch ($namesort) {
            case 'firstname ASC':
                $sortedvalues = $names_firstlast;
                natcasesort($sortedvalues);
                break;
            case 'firstname DESC':
                $sortedvalues = $names_firstlast;
                natcasesort($sortedvalues);
                $sortedvalues = array_reverse($sortedvalues, true);
                break;
            case 'lastname ASC':
                $sortedvalues = $names_lastfirst;
                natcasesort($sortedvalues);
                break;
            case 'lastname DESC':
                $sortedvalues = $names_lastfirst;
                natcasesort($sortedvalues);
                $sortedvalues = array_reverse($sortedvalues, true);
                break;
            case 'unread ASC':
                $sortedvalues = $unread;
                asort($sortedvalues);
                break;
            case 'unread DESC':
                $sortedvalues = $unread;
                arsort($sortedvalues);
                break;
        }
        foreach ($sortedvalues as $cid => $val) {
            $conversation = $conversations[$cid];
            if ($unread[$cid] > 0) {
                $unreadcount = '<span class="unread">' . $unread[$cid] . '</span>';
            } else {
                $unreadcount = 0;
            }
            $profileurl = "{$CFG->wwwroot}/user/view.php?id=" . $ids[$conversation->id] . "&amp;course={$dialogue->course}";
            $entryurl = "{$CFG->wwwroot}/mod/dialogue/dialogues.php?id=" . $cm->id . "&amp;action=printdialogue&amp;cid=" . $cid;
            $row = array($photos[$conversation->id], "<a href='{$entryurl}'>" . $conversation->subject . '</a>', "<a href='{$profileurl}'>" . $names[$conversation->id] . '</a>', $conversation->total, $unreadcount, userdate($conversation->timemodified));
            $table->add_data($row);
        }
        $table->print_html();
        /// Print the whole table
    }
}
开发者ID:netspotau,项目名称:moodle-mod_dialogue,代码行数:101,代码来源:locallib.php

示例7: navmenu


//.........这里部分代码省略.........
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">&nbsp;</div>';
                     }
                 }
             }
             if (empty($auser->status)) {
                 /// Confirm we have exclusively 0 or 1
                 $auser->status = 0;
             } else {
                 $auser->status = 1;
             }
             $buttontext = $auser->status == 1 ? $strupdate : $strgrade;
             ///No more buttons, we use popups ;-).
             $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++;
             $link = html_link::make($popup_url, $buttontext);
             $link->add_action(new popup_action('click', $link->url, 'grade' . $auser->id, array('height' => 600, 'width' => 700)));
             $link->title = $buttontext;
             $button = $OUTPUT->link($link);
             $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>';
             $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>';
             $outcomes = '';
             if ($uses_outcomes) {
                 foreach ($grading_info->outcomes as $n => $outcome) {
                     $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>';
                     $options = make_grades_menu(-$outcome->scaleid);
                     if ($outcome->grades[$auser->id]->locked or !$quickgrade) {
                         $options[0] = get_string('nooutcome', 'grades');
                         $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>';
                     } else {
                         $outcomes .= ' ';
                         $select = html_select::make($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'));
                         $select->nothingvalue = '0';
                         $select->tabindex = $tabindex++;
                         $select->id = 'outcome_' . $n . '_' . $auser->id;
                         $outcomes .= $OUTPUT->select($select);
                     }
                     $outcomes .= '</div>';
                 }
             }
             $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser) . '</a>';
             $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
             if ($uses_outcomes) {
                 $row[] = $outcomes;
             }
             $table->add_data($row);
         }
     }
     /// Print quickgrade form around the table
     if ($quickgrade) {
         echo '<form action="submissions.php" id="fastg" method="post">';
         echo '<div>';
         echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
         echo '<input type="hidden" name="mode" value="fastgrade" />';
         echo '<input type="hidden" name="page" value="' . $page . '" />';
         echo '</div>';
     }
     $table->print_html();
     /// Print the whole table
     if ($quickgrade) {
         $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : '';
         echo '<div class="fgcontrols">';
         echo '<div class="emailnotification">';
         echo '<label for="mailinfo">' . get_string('enableemailnotification', 'assignment') . '</label>';
         echo '<input type="hidden" name="mailinfo" value="0" />';
         echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" ' . $lastmailinfo . ' />';
         echo $OUTPUT->help_icon(moodle_help_icon::make('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment')) . '</p></div>';
         echo '</div>';
         echo '<div class="fastgbutton"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>';
         echo '</div>';
         echo '</form>';
     }
     /// End of fast grading form
     /// Mini form for setting user preference
     echo '<div class="qgprefs">';
     echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post"><div>';
     echo '<input type="hidden" name="updatepref" value="1" />';
     echo '<table id="optiontable">';
     echo '<tr><td>';
     echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>';
     echo '</td>';
     echo '<td>';
     echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />';
     echo $OUTPUT->help_icon(moodle_help_icon::make('pagesize', get_string('pagesize', 'assignment'), 'assignment'));
     echo '</td></tr>';
     echo '<tr><td>';
     echo '<label for="quickgrade">' . get_string('quickgrade', 'assignment') . '</label>';
     echo '</td>';
     echo '<td>';
     $checked = $quickgrade ? 'checked="checked"' : '';
     echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" ' . $checked . ' />';
     echo $OUTPUT->help_icon(moodle_help_icon::make('quickgrade', get_string('quickgrade', 'assignment'), 'assignment')) . '</p></div>';
     echo '</td></tr>';
     echo '<tr><td colspan="2">';
     echo '<input type="submit" value="' . get_string('savepreferences') . '" />';
     echo '</td></tr></table>';
     echo '</div></form></div>';
     ///End of mini form
     echo $OUTPUT->footer();
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:lib.php

示例8: display


//.........这里部分代码省略.........
                     if ($attempt->timefinish) {
                         $row[] = $attempt->feedbacktext;
                     } else {
                         $row[] = '-';
                     }
                 }
                 if (!$download) {
                     $table->add_data($row);
                 } else {
                     if ($download == 'Excel' or $download == 'ODS') {
                         $colnum = 0;
                         foreach ($row as $item) {
                             $myxls->write($rownum, $colnum, $item, $format);
                             $colnum++;
                         }
                         $rownum++;
                     } else {
                         if ($download == 'CSV') {
                             $text = implode("\t", $row);
                             echo $text . " \n";
                         }
                     }
                 }
             }
         }
         if (!$download) {
             // Start form.
             echo '<div id="tablecontainer">';
             echo '<form id="attemptsform" method="post" action="report.php" ' . 'onsubmit="var menu = document.getElementById(\'menuaction\'); ' . 'return (menu.options[menu.selectedIndex].value == \'delete\' ? confirm(\'' . $strreallydel . '\') : true);">';
             echo '<div>';
             echo '<input type="hidden" name="id" value="' . $cm->id . '" />';
             echo '<input type="hidden" name="mode" value="overview" />';
             // Print table.
             $table->print_html();
             // Print "Select all" etc..
             if (!empty($attempts)) {
                 echo '<table id="commands">';
                 echo '<tr><td>';
                 echo '<a href="javascript:select_all_in(\'DIV\',null,\'tablecontainer\');">' . get_string('selectall', 'game') . '</a> / ';
                 echo '<a href="javascript:deselect_all_in(\'DIV\',null,\'tablecontainer\');">' . get_string('selectnone', 'game') . '</a> ';
                 echo '&nbsp;&nbsp;';
                 $options = array('delete' => get_string('delete'));
                 echo choose_from_menu($options, 'action', '', get_string('withselected', 'game'), 'if(this.selectedIndex > 0) submitFormById(\'attemptsform\');', '', true);
                 echo '<noscript id="noscriptmenuaction" style="display: inline;"><div>';
                 echo '<input type="submit" value="' . get_string('go') . '" /></div></noscript>';
                 echo '<script type="text/javascript">' . "\n<!--\n" . 'document.getElementById("noscriptmenuaction").style.display = "none";' . "\n-->\n" . '</script>';
                 echo '</td></tr></table>';
             }
             // Close form.
             echo '</div>';
             echo '</form></div>';
             if (!empty($attempts)) {
                 echo '<table class="boxaligncenter"><tr>';
                 $options = array();
                 $options["id"] = "{$cm->id}";
                 $options["q"] = "{$game->id}";
                 $options["mode"] = "overview";
                 $options['sesskey'] = sesskey();
                 $options["noheader"] = "yes";
                 $options['noattempts'] = $noattempts;
                 $options['detailedmarks'] = $detailedmarks;
                 echo '<td>';
                 $options["download"] = "ODS";
                 print_single_button("report.php", $options, get_string("downloadods", 'game'));
                 echo "</td>\n";
                 echo '<td>';
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:67,代码来源:report.php

示例9: print_memorybank_report3

function print_memorybank_report3($qid)
{
    global $CFG, $USER;
    require_once $CFG->libdir . '/tablelib.php';
    $tablecolumns = array('id', 'username', 'grade', 'timeanswered', 'currenthalflife');
    $tableheaders = array('answer id', 'student', 'grade', 'date', 'halflife, days');
    $tableheaders = array(get_string('answer_id', 'memorybank'), get_string('student', 'memorybank'), get_string('grade', 'memorybank'), get_string('date', 'memorybank'), get_string('halflife', 'memorybank'));
    $table = new flexible_table('memorybank_report3');
    $table->define_columns($tablecolumns);
    $table->define_headers($tableheaders);
    $table->sortable(true, 'id');
    $table->set_attribute('cellspacing', '0');
    $table->set_attribute('cellpadding', '5');
    $table->set_attribute('id', 'memorybank-report');
    $table->set_attribute('class', 'boxaligncenter generaltable');
    $table->setup();
    $sort = $table->get_sql_sort();
    $SQL = "\r\n        SELECT \r\n          {$CFG->prefix}memorybank_submissions.id,\r\n          CONCAT({$CFG->prefix}user.lastname, ' ',  {$CFG->prefix}user.firstname) as username,\r\n          {$CFG->prefix}memorybank_submissions.grade,\r\n          {$CFG->prefix}memorybank_submissions.timeanswered,\r\n          {$CFG->prefix}memorybank_submissions.currenthalflife\r\n        FROM\r\n         {$CFG->prefix}memorybank_submissions\r\n         INNER JOIN {$CFG->prefix}user ON ({$CFG->prefix}memorybank_submissions.userid={$CFG->prefix}user.id)\r\n        WHERE \r\n          {$CFG->prefix}memorybank_submissions.qid = {$qid}\r\n        ORDER BY {$sort}\r\n\t";
    $results = get_records_sql($SQL, 0, 500);
    $i = sizeof($results);
    foreach ($results as $result) {
        $table->data[] = array($result->id, $result->username, $result->grade, date(MEMORYBANK_DATE_FORMAT, $result->timeanswered), $result->currenthalflife / 86400);
    }
    global $FULLME;
    //	print_header_simple('report','','','',"<meta http-equiv='Refresh' content='30;$FULLME'>");
    /*    echo '<div style="text-align: center; padding: 20px;">';
        popup_form("$CFG->wwwroot/mod/memorybank/view.php?what=answerlist&qid={$qid}&date",
            $options, 'instid', $instid, '', '', '', false, 'self', '');
        echo '</div>'; // here we need to privide some filter
    */
    echo '
    <style>
        .controls img {
            padding: 0 3px;
            cursor: pointer;
        }
    </style><br>';
    $table->print_html();
    print_footer();
    die;
}
开发者ID:kopohi,项目名称:memorybank,代码行数:41,代码来源:lib.php

示例10: display_allfilesform


//.........这里部分代码省略.........
                     }
                     $lastmodified = "";
                     if (count($filetable->data) > 0) {
                         $lastmodified = html_writer::table($filetable);
                         $lastmodified .= html_writer::span(userdate($auser->timemodified), "timemodified");
                     } else {
                         $lastmodified = get_string('nofiles', 'publication');
                     }
                     $row[] = $lastmodified;
                     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) {
                             if (count($statustable->data) > 0) {
                                 $status = html_writer::table($statustable);
                             } else {
                                 $status = '';
                             }
                             $row[] = $status;
                         }
                         if (count($permissiontable->data) > 0) {
                             $permissions = html_writer::table($permissiontable);
                         } else {
                             $permissions = '';
                         }
                         $row[] = $permissions;
                         $row[] = html_writer::table($visibleforuserstable);
                     }
                     $table->add_data($row);
                 }
                 $currentposition++;
             }
             if (true) {
                 // Always display download option.
                 $html .= html_writer::start_tag('div', array('class' => 'mod-publication-download-link'));
                 $html .= html_writer::link(new moodle_url('/mod/publication/view.php', array('id' => $this->coursemodule->id, 'action' => 'zip')), get_string('downloadall', 'publication'));
                 $html .= html_writer::end_tag('div');
             }
             echo $html;
             $html = "";
             $table->print_html();
             // Print the whole table.
             $options = array();
             if (true) {
                 // Always display download option.
                 $options['zipusers'] = get_string('zipusers', 'publication');
             }
             if ($totalfiles > 0) {
                 if (has_capability('mod/publication:approve', $context)) {
                     $options['approveusers'] = get_string('approveusers', 'publication');
                     $options['rejectusers'] = get_string('rejectusers', 'publication');
                     if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
                         $options['resetstudentapproval'] = get_string('resetstudentapproval', 'publication');
                     }
                 }
             }
             if (has_capability('mod/publication:grantextension', $this->get_context())) {
                 $options['grantextension'] = get_string('grantextension', 'publication');
             }
             if (count($options) > 0) {
                 if (has_capability('mod/publication:approve', $context)) {
                     $html .= html_writer::empty_tag('input', array('type' => 'reset', 'name' => 'resetvisibility', 'value' => get_string('reset', 'publication'), 'class' => 'visibilitysaver'));
                     if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
                         $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'savevisibility', 'value' => get_string('saveapproval', 'publication'), 'class' => 'visibilitysaver'));
                     } else {
                         $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'savevisibility', 'value' => get_string('saveteacherapproval', 'publication'), 'class' => 'visibilitysaver'));
                     }
                 }
                 $html .= html_writer::start_div('withselection');
                 $html .= html_writer::span(get_string('withselected', 'publication'));
                 $html .= html_writer::select($options, 'action');
                 $html .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'submitgo', 'value' => get_string('go', 'publication')));
                 $html .= html_writer::end_div();
             }
         } else {
             $html .= html_writer::tag('div', get_string('nothingtodisplay', 'publication'), array('class' => 'nosubmisson'));
         }
     } else {
         $html .= html_writer::tag('div', get_string('nothingtodisplay', 'publication'), array('class' => 'nosubmisson'));
     }
     // Select all/none.
     $html .= html_writer::start_tag('div', array('class' => 'checkboxcontroller'));
     $html .= "<script type=\"text/javascript\">\n                                        function toggle_userselection() {\n                                        var checkboxes = document.getElementsByClassName('userselection');\n                                        var sel = document.getElementById('selectallnone');\n\n                                        if (checkboxes.length > 0) {\n                                        checkboxes[0].checked = sel.checked;\n\n                                        for(var i = 1; i < checkboxes.length;i++) {\n                                        checkboxes[i].checked = checkboxes[0].checked;\n    }\n    }\n    }\n                                        </script>";
     $html .= html_writer::end_div();
     $html .= html_writer::end_div();
     $html .= html_writer::end_div();
     echo $html;
     echo html_writer::end_tag('form');
     // Mini form for setting user preference.
     $html = '';
     $formaction = new moodle_url('/mod/publication/view.php', array('id' => $this->coursemodule->id));
     $mform = new MoodleQuickForm('optionspref', 'post', $formaction, '', array('class' => 'optionspref'));
     $mform->addElement('hidden', 'updatepref');
     $mform->setDefault('updatepref', 1);
     $mform->addElement('header', 'qgprefs', get_string('optionalsettings', 'publication'));
     $mform->addElement('text', 'perpage', get_string('entiresperpage', 'publication'), array('size' => 1));
     $mform->setDefault('perpage', $perpage);
     $mform->addElement('submit', 'savepreferences', get_string('savepreferences'));
     $mform->display();
     return $html;
 }
开发者ID:Kathrin84,项目名称:moodle-mod_publication,代码行数:101,代码来源:locallib.php

示例11: geogebra_view_results


//.........这里部分代码省略.........
        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;
                // Attempts summary
                $attempts = geogebra_get_user_attempts($geogebra->id, $auser->id);
                $attemptssummary = geogebra_get_user_grades($geogebra, $auser->id);
                if ($attemptssummary) {
                    $row[] = $attemptssummary->attempts;
                    $row[] = geogebra_time2str($attemptssummary->duration);
                    $row[] = $attemptssummary->grade;
                    $rowclass = $attemptssummary->attempts > 0 ? 'summary-row' : "";
                } else {
                    $row[] = "";
                    $row[] = "";
                    $row[] = "";
                    $rowclass = "";
                }
                $row[] = "";
                $row[] = "";
                $row[] = "";
                $row[] = "";
                $table->add_data($row, $rowclass);
                // Show attempts information
                foreach ($attempts as $attempt) {
                    $row = array();
                    // In the attempts row, show only the summary of the attempt (it's not necessary to repeat user information)
                    for ($i = 0; $i < count($extradata) + 2; $i++) {
                        array_push($row, '');
                    }
                    // Attempt information
                    $row = geogebra_get_attempt_row($geogebra, $attempt, $auser, $cm, $context, $row);
                    /*array_push($row, $attempt->duration);
                      array_push($row, $attempt->grade);
                      array_push($row, $attempt->comment);*/
                    $table->add_data($row);
                }
            }
        }
        $table->print_html();
        // Print the whole table
    } else {
        echo $OUTPUT->notification(get_string('msg_nosessions', 'geogebra'), 'notifymessage');
    }
}
开发者ID:ninelanterns,项目名称:moodle-mod_geogebra,代码行数:101,代码来源:locallib.php

示例12: array


//.........这里部分代码省略.........
                 if ($auser->timemarked > 0) {
                     $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
                     if ($quickgrade) {
                         $grade = '<div id="g' . $auser->id . '">' . choose_from_menu(make_grades_menu($this->wqgrade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++) . '</div>';
                     } else {
                         $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                     }
                 } else {
                     $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                     if ($quickgrade) {
                         $grade = '<div id="g' . $auser->id . '">' . choose_from_menu(make_grades_menu($this->wqgrade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++) . '</div>';
                     } else {
                         $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                     }
                 }
                 ///Print Comment
                 if ($quickgrade) {
                     $comment = '<div id="com' . $auser->id . '"><textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment[' . $auser->id . ']">' . $auser->submissioncomment . '</textarea></div>';
                 } else {
                     $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>';
                 }
             } else {
                 $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                 $status = '<div id="st' . $auser->id . '">&nbsp;</div>';
                 if ($quickgrade) {
                     // allow editing
                     $grade = '<div id="g' . $auser->id . '">' . choose_from_menu(make_grades_menu($this->wqgrade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++) . '</div>';
                 } else {
                     $grade = '<div id="g' . $auser->id . '">-</div>';
                 }
                 if ($quickgrade) {
                     $comment = '<div id="com' . $auser->id . '"><textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment[' . $auser->id . ']">' . $auser->submissioncomment . '</textarea></div>';
                 } else {
                     $comment = '<div id="com' . $auser->id . '">&nbsp;</div>';
                 }
             }
             if (empty($auser->status)) {
                 /// Confirm we have exclusively 0 or 1
                 $auser->status = 0;
             } else {
                 $auser->status = 1;
             }
             $buttontext = $auser->status == 1 ? $strupdate : $strgrade;
             ///No more buttons, we use popups ;-).
             $button = link_to_popup_window('/mod/webquestscorm/submissions.php?cmid=' . $this->cm->id . '&element=uploadedTasks&amp;userid=' . $auser->id . '&amp;subelement=single' . '&amp;offset=' . $offset++, 'grade' . $auser->id, $buttontext, 500, 780, $buttontext, 'none', true, 'button' . $auser->id);
             $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>';
             $row = array($picture, fullname($auser), $grade, $comment, $studentmodified, $teachermodified, $status);
             $table->add_data($row);
         }
     }
     /// Print quickgrade form around the table
     if ($quickgrade) {
         echo '<form action="submissions.php?cmid=' . $this->cm->id . '" name="fastg" method="post">';
         echo '<input type="hidden" name="id" value="' . $this->cm->id . '">';
         echo '<input type="hidden" name="mode" value="fastgrade">';
         echo '<input type="hidden" name="page" value="' . $page . '">';
         echo '<input type="hidden" name="tabs" value="required" />';
         echo '<p align="center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'webquestscorm') . '" /></p>';
     }
     $table->print_html();
     /// Print the whole table
     if ($quickgrade) {
         echo '<p align="center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'webquestscorm') . '" /></p>';
         echo '</form>';
     }
     /// End of fast grading form
     /// Mini form for setting user preference
     echo '<br />';
     echo '<form name="options" action="submissions.php?cmid=' . $this->cm->id . '" method="post">';
     echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />';
     echo '<input type="hidden" name="tabs" value="required" />';
     echo '<table id="optiontable" align="center">';
     echo '<tr align="right"><td>';
     echo '<label for="perpage">' . get_string('pagesize', 'webquestscorm') . '</label>';
     echo ':</td>';
     echo '<td align="left">';
     echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />';
     helpbutton('pagesize', get_string('pagesize', 'webquestscorm'), 'webquestscorm');
     echo '</td></tr>';
     echo '<tr align="right">';
     echo '<td>';
     print_string('quickgrade', 'webquestscorm');
     echo ':</td>';
     echo '<td align="left">';
     if ($quickgrade) {
         echo '<input type="checkbox" name="quickgrade" value="1" checked="checked" />';
     } else {
         echo '<input type="checkbox" name="quickgrade" value="1" />';
     }
     helpbutton('quickgrade', get_string('quickgrade', 'webquestscorm'), 'webquestscorm') . '</p></div>';
     echo '</td></tr>';
     echo '<tr>';
     echo '<td colspan="2" align="right">';
     echo '<input type="submit" value="' . get_string('savepreferences') . '" />';
     echo '</td></tr></table>';
     echo '</form>';
     ///End of mini form
     print_footer($this->course);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:submissions.class.php

示例13: array

    echo html_writer::tag('h3', $course->fullname);
    $comments = report_comments_getcoursecomments($courseid, $sort);
    $tabl->define_columns(array('date', 'author', 'content', 'action'));
    $tabl->define_headers(array(get_string('date'), get_string('author', 'search'), get_string('content'), get_string('action')));
} else {
    $user = $DB->get_record('user', array('id' => $userid), 'firstname, lastname');
    echo html_writer::tag('h3', $user->firstname . ' ' . $user->lastname);
    $comments = report_comments_getusercomments($userid);
    $tabl->define_columns(array('date', 'course', 'content', 'action'));
    $tabl->define_headers(array(get_string('date'), get_string('course'), get_string('content'), get_string('action')));
}
if (count($comments) == 0) {
    echo $OUTPUT->notification(get_string('nocomments', 'moodle'));
} else {
    $tabl->sortable(true, 'date', SORT_DESC);
    $tabl->no_sorting('action');
    $tabl->define_baseurl(new moodle_url($url, $arr));
    $tabl->set_attribute('class', 'admintable generaltable');
    $tabl->setup();
    $tablrows = array();
    $link = new moodle_url($url, array('course' => $courseid, 'action' => 'delete', 'sesskey' => sesskey()));
    foreach ($comments as $c) {
        $action = html_writer::link(new moodle_url($link, array('commentid' => $c->id)), get_string('delete'));
        $tabl->add_data(array($c->time, $c->fullname, $c->content, $action));
    }
    $tabl->print_html();
}
echo $OUTPUT->footer($course);
// Trigger a report viewed event.
$event = \report_comments\event\report_viewed::create(array('context' => $context));
$event->trigger();
开发者ID:ewallah,项目名称:moodle-report_comments,代码行数:31,代码来源:index.php

示例14: display


//.........这里部分代码省略.........
                         }
                         $rownum++;
                     } else {
                         if ($download == 'CSV') {
                             $text = implode("\t", $row);
                             echo $text . " \n";
                         }
                     }
                 }
             }
             //end of adding data from attempts data to table / download
             //now add averages :
             if (!$download && $attempts) {
                 $averagesql = "SELECT AVG(qg.grade) AS grade " . "FROM {$CFG->prefix}quiz_grades qg " . "WHERE quiz=" . $quiz->id;
                 $table->add_separator();
                 if ($groupstudentslist) {
                     $groupaveragesql = $averagesql . " AND qg.userid IN ({$groupstudentslist})";
                     $groupaverage = get_record_sql($groupaveragesql);
                     $groupaveragerow = array('fullname' => get_string('groupavg', 'grades'), 'sumgrades' => round($groupaverage->grade, $quiz->decimalpoints), 'feedbacktext' => quiz_report_feedback_for_grade($groupaverage->grade, $quiz->id));
                     if ($detailedmarks && $qmsubselect) {
                         $avggradebyq = quiz_get_average_grade_for_questions($quiz, $groupstudentslist);
                         $groupaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $questions, $quiz, $download);
                     }
                     $table->add_data_keyed($groupaveragerow);
                 }
                 $overallaverage = get_record_sql($averagesql . " AND qg.userid IN ({$studentslist})");
                 $overallaveragerow = array('fullname' => get_string('overallaverage', 'grades'), 'sumgrades' => round($overallaverage->grade, $quiz->decimalpoints), 'feedbacktext' => quiz_report_feedback_for_grade($overallaverage->grade, $quiz->id));
                 if ($detailedmarks && $qmsubselect) {
                     $avggradebyq = quiz_get_average_grade_for_questions($quiz, $studentslist);
                     $overallaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $questions, $quiz, $download);
                 }
                 $table->add_data_keyed($overallaveragerow);
             }
             if (!$download) {
                 // Start form
                 echo '<div id="tablecontainer">';
                 echo '<form id="attemptsform" method="post" action="' . $reporturlwithdisplayoptions->out(true) . '" onsubmit="return confirm(\'' . $strreallydel . '\');">';
                 echo '<div style="display: none;">';
                 echo $reporturlwithdisplayoptions->hidden_params_out();
                 echo '</div>';
                 echo '<div>';
                 // Print table
                 $table->print_html();
                 // Print "Select all" etc.
                 if (!empty($attempts) && $candelete) {
                     echo '<table id="commands">';
                     echo '<tr><td>';
                     echo '<a href="javascript:select_all_in(\'DIV\',null,\'tablecontainer\');">' . get_string('selectall', 'quiz') . '</a> / ';
                     echo '<a href="javascript:deselect_all_in(\'DIV\',null,\'tablecontainer\');">' . get_string('selectnone', 'quiz') . '</a> ';
                     echo '&nbsp;&nbsp;';
                     echo '<input type="submit" value="' . get_string('deleteselected', 'quiz_overview') . '"/>';
                     echo '</td></tr></table>';
                 }
                 // Close form
                 echo '</div>';
                 echo '</form></div>';
                 if (!empty($attempts)) {
                     echo '<table class="boxaligncenter"><tr>';
                     echo '<td>';
                     print_single_button($reporturl->out(true), $pageoptions + $displayoptions + array('download' => 'ODS'), get_string('downloadods'));
                     echo "</td>\n";
                     echo '<td>';
                     print_single_button($reporturl->out(true), $pageoptions + $displayoptions + array('download' => 'Excel'), get_string('downloadexcel'));
                     echo "</td>\n";
                     echo '<td>';
                     print_single_button($reporturl->out(true), $pageoptions + $displayoptions + array('download' => 'CSV'), get_string('downloadtext'));
                     echo "</td>\n";
                     echo "<td>";
                     helpbutton('overviewdownload', get_string('overviewdownload', 'quiz_overview'), 'quiz');
                     echo "</td>\n";
                     echo '</tr></table>';
                 }
             }
         } else {
             if (!$download) {
                 $table->print_html();
             }
         }
         if ($download == 'Excel' or $download == 'ODS') {
             $workbook->close();
             exit;
         } else {
             if ($download == 'CSV') {
                 exit;
             }
         }
     }
     if (!$download) {
         // Print display options
         $mform->set_data($displayoptions + compact('detailedmarks', 'pagesize'));
         $mform->display();
         //should be quicker than a COUNT to test if there is at least one record :
         if ($showgrades && record_exists('quiz_grades', 'quiz', $quiz->id)) {
             $imageurl = $CFG->wwwroot . '/mod/quiz/report/overview/overviewgraph.php?id=' . $quiz->id;
             print_heading(get_string('overviewreportgraph', 'quiz_overview'));
             echo '<div class="mdl-align"><img src="' . $imageurl . '" alt="' . get_string('overviewreportgraph', 'quiz_overview') . '" /></div>';
         }
     }
     return true;
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:101,代码来源:report.php

示例15: display_usersviewed_recording

 public function display_usersviewed_recording($recscoid, $cmid, $context, $recording)
 {
     global $DB, $OUTPUT, $USER, $CFG;
     if (!empty($recscoid)) {
         if (!($cm = get_coursemodule_from_id('adobeconnect', $cmid))) {
             print_error('Course Module ID was incorrect');
         }
         if (!($course = $DB->get_record('course', array('id' => $cm->course)))) {
             print_error('Course is misconfigured');
         }
         list($esql, $params) = get_enrolled_sql($context);
         $joins = array("FROM {user} u");
         $wheres = array();
         $logsql = "SELECT DISTINCT userid  FROM {adobeconnect_watched} where instanceid = {$cmid} and scoid = {$recscoid}";
         $select = "SELECT u.id, u.username, u.firstname, u.lastname,\n                      u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename,\n                      u.email, u.picture,\n                      u.lang, u.maildisplay, u.imagealt";
         $joins[] = "JOIN ({$esql}) e ON e.id = u.id";
         // Course enrolled users only.
         $joins[] = "JOIN ({$logsql}) r ON r.userid = u.id";
         // Course enrolled users only.
         $params['courseid'] = $course->id;
         // Performance hacks - we preload user contexts together with accounts.
         $tablealias = 'ctx';
         $contextlevel = CONTEXT_USER;
         $joinon = 'u.id';
         $ccselect = ", " . context_helper::get_preload_record_columns_sql($tablealias);
         $ccjoin = "LEFT JOIN {context} {$tablealias} ON ({$tablealias}.instanceid = {$joinon}\n                          AND {$tablealias}.contextlevel = {$contextlevel})";
         $select .= $ccselect;
         $joins[] = $ccjoin;
         $table = new flexible_table('user-recordings-viewed' . $cmid);
         $tablecolumns = array('userpic', 'fullname', 'username');
         $tableheaders = array(get_string('userpic'), get_string('fullnameuser'), get_string('username'));
         $table->define_columns($tablecolumns);
         $table->define_headers($tableheaders);
         $table->set_attribute('cellspacing', '0');
         $table->set_attribute('class', 'generaltable generalbox');
         $table->define_baseurl('');
         $table->setup();
         $from = implode("\n", $joins);
         if ($wheres) {
             $where = "WHERE " . implode(" AND ", $wheres);
         } else {
             $where = "";
         }
         $sort = ' ORDER BY u.firstname, u.lastname, u.username';
         $userrows = $DB->get_recordset_sql("{$select} {$from} {$where} {$sort}", $params);
         echo html_writer::start_tag('div', array('id' => 'recEditArea'));
         echo html_writer::tag('h3', get_string('recordinglog_title', 'adobeconnect'));
         echo html_writer::tag('p', get_string('recordinglog_summary', 'adobeconnect', $recording->name));
         echo html_writer::start_tag('div', array('class' => 'aconbtn', 'style' => ''));
         $cancelbtnparam = array('type' => 'button', 'value' => get_string('recordingcancelbutton', 'adobeconnect'), 'onclick' => 'window.close();', 'name' => 'btnshow');
         echo html_writer::empty_tag('input', $cancelbtnparam);
         echo html_writer::end_tag('div');
         if (count($userrows) > 0) {
             $usersprinted = array();
             foreach ($userrows as $user) {
                 if (in_array($user->id, $usersprinted)) {
                     // Prevent duplicates by r.hidden - MDL-13935.
                     continue;
                 }
                 $usersprinted[] = $user->id;
                 // Add new user to the array of users printed.
                 context_helper::preload_from_record($user);
                 $usercontext = context_user::instance($user->id);
                 if ($piclink = $USER->id == $user->id || has_capability('moodle/user:viewdetails', $context) || has_capability('moodle/user:viewdetails', $usercontext)) {
                     $profilelink = '<strong><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $course->id . '">' . fullname($user) . '</a></strong>';
                 } else {
                     $profilelink = '<strong>' . fullname($user) . '</strong>';
                 }
                 $data = array($OUTPUT->user_picture($user, array('size' => 35, 'courseid' => $course->id)), $profilelink);
                 if (!isset($hiddenfields['username'])) {
                     $data[] = $user->username;
                 }
                 $table->add_data($data);
             }
             echo $table->print_html();
         } else {
             echo $OUTPUT->heading(get_string('nothingtodisplay'));
         }
         echo html_writer::end_tag('div');
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:81,代码来源:renderer.php


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