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


PHP flexible_table::add_data方法代码示例

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


在下文中一共展示了flexible_table::add_data方法的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: 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&q=' . $quiz->id . '&action=viewquestion&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

示例3: question_behaviour_enable_disable_icons

            $rowclass = 'dimmed_text';
        }
    } else {
        $icons = $OUTPUT->spacer(array('class' => 'iconsmall'));
    }
    // Move icons.
    $icons .= question_behaviour_icon_html('up', $behaviour, 't/up', get_string('up'), null);
    $icons .= question_behaviour_icon_html('down', $behaviour, 't/down', get_string('down'), null);
    $row[] = $icons;
    // Delete link, if available.
    if ($needed[$behaviour]) {
        $row[] = '';
    } else {
        $row[] = html_writer::link(new moodle_url($thispageurl, array('delete' => $behaviour, 'sesskey' => sesskey())), get_string('delete'), array('title' => get_string('uninstallbehaviour', 'question')));
    }
    $table->add_data($row, $rowclass);
}
$table->finish_output();
echo $OUTPUT->footer();
function question_behaviour_enable_disable_icons($behaviour, $enabled)
{
    if ($enabled) {
        return question_behaviour_icon_html('disable', $behaviour, 't/hide', get_string('enabled', 'question'), get_string('disable'));
    } else {
        return question_behaviour_icon_html('enable', $behaviour, 't/show', get_string('disabled', 'question'), get_string('enable'));
    }
}
function question_behaviour_icon_html($action, $behaviour, $icon, $alt, $tip)
{
    global $OUTPUT;
    return $OUTPUT->action_icon(new moodle_url('/admin/qbehaviours.php', array($action => $behaviour, 'sesskey' => sesskey())), new pix_icon($icon, $alt, 'moodle', array('title' => '', 'class' => 'iconsmall')), null, array('title' => $tip));
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:qbehaviours.php

示例4: array


//.........这里部分代码省略.........
                         $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                     } else {
                         $grade = '<div id="g' . $auser->id . '">-</div>';
                     }
                 }
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>';
                 } else {
                     if ($quickgrade) {
                         $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 . '&amp;userid=' . $auser->id . '&amp;mode=single' . '&amp;offset=' . $offset++;
             $button = link_to_popup_window($popup_url, 'grade' . $auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'button' . $auser->id);
             $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 .= ' ';
                         $outcomes .= choose_from_menu($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'), '', 0, true, false, 0, 'outcome_' . $n . '_' . $auser->id);
                     }
                     $outcomes .= '</div>';
                 }
             }
             $row = array($picture, fullname($auser), $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>';
         //echo '<div style="text-align:center"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>';
     }
     $table->print_html();
     /// Print the whole table
     if ($quickgrade) {
         echo '<div style="text-align:center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>';
         echo '</form>';
     }
     /// End of fast grading form
     /// Mini form for setting user preference
     echo '<br />';
     echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post">';
     echo '<div>';
     echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />';
     echo '<table id="optiontable" align="right">';
     echo '<tr align="right"><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 . '" />';
     helpbutton('pagesize', get_string('pagesize', 'assignment'), 'assignment');
     echo '</td></tr>';
     echo '<tr align="right">';
     echo '<td>';
     print_string('quickgrade', 'assignment');
     echo ':</td>';
     echo '<td>';
     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', 'assignment'), 'assignment') . '</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 '</div>';
     echo '</form>';
     ///End of mini form
     print_footer($this->course);
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:lib.php

示例5: array

 $data = array();
 $a = new stdClass();
 $a->count = $totalcount;
 $a->items = $role->name;
 if ($matchcount != $totalcount) {
     $a->count = $matchcount . '/' . $a->count;
 }
 echo '<h2>' . get_string('counteditems', '', $a) . '</h2>' . "\n";
 echo '<form action="' . $CFG->wwwroot . '/user/action_redir.php" method="post" id="studentsform">' . "\n";
 echo '<div>' . "\n";
 echo '<input type="hidden" name="id" value="' . $id . '" />' . "\n";
 echo '<input type="hidden" name="returnto" value="' . s($PAGE->url) . '" />' . "\n";
 echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />' . "\n";
 foreach ($users as $u) {
     $data = array('<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $u->userid . '&amp;course=' . $course->id . '">' . fullname($u, true) . '</a>' . "\n", !empty($u->count) ? get_string('yes') . ' (' . $u->count . ') ' : get_string('no'), '<input type="checkbox" class="usercheckbox" name="user' . $u->userid . '" value="' . $u->count . '" />' . "\n");
     $table->add_data($data);
 }
 $table->print_html();
 if ($perpage == SHOW_ALL_PAGE_SIZE) {
     $perpageurl = new moodle_url($baseurl, array('perpage' => DEFAULT_PAGE_SIZE));
     echo html_writer::start_div('', array('id' => 'showall'));
     echo html_writer::link($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE));
     echo html_writer::end_div();
 } else {
     if ($matchcount > 0 && $perpage < $matchcount) {
         $perpageurl = new moodle_url($baseurl, array('perpage' => SHOW_ALL_PAGE_SIZE));
         echo html_writer::start_div('', array('id' => 'showall'));
         echo html_writer::link($perpageurl, get_string('showall', '', $matchcount));
         echo html_writer::end_div();
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:index.php

示例6: sesskey

    } else {
        $version = "{$block->version} ({$plugin->version})";
    }
    if (!$blockobject) {
        // ignore
        $undeletable = '';
    } else {
        if (in_array($blockname, $undeletableblocktypes)) {
            $undeletable = '<a href="blocks.php?unprotect=' . $blockid . '&amp;sesskey=' . sesskey() . '" title="' . $strunprotect . '">' . '<img src="' . $OUTPUT->pix_url('t/unlock') . '" class="icon" alt="' . $strunprotect . '" /></a>';
        } else {
            $undeletable = '<a href="blocks.php?protect=' . $blockid . '&amp;sesskey=' . sesskey() . '" title="' . $strprotect . '">' . '<img src="' . $OUTPUT->pix_url('t/unlock_gray') . '" class="icon" alt="' . $strprotect . '" /></a>';
        }
    }
    $row = array('<span' . $class . '>' . $strblockname . '</span>', $blocklist, '<span' . $class . '>' . $version . '</span>', $visible, $undeletable, $delete, $settings);
    $table->add_data($row);
}
$table->print_html();
if (!empty($incompatible)) {
    echo $OUTPUT->heading(get_string('incompatibleblocks', 'blockstable', 'admin'));
    $table = new flexible_table('admin-blocks-incompatible');
    $table->define_columns(array('block', 'delete'));
    $table->define_headers(array($strname, $strdelete));
    $table->define_baseurl($CFG->wwwroot . '/' . $CFG->admin . '/blocks.php');
    $table->set_attribute('class', 'incompatibleblockstable generaltable');
    $table->setup();
    foreach ($incompatible as $block) {
        $table->add_data(array($block->name, '<a href="blocks.php?delete=' . $block->id . '&amp;sesskey=' . sesskey() . '">' . $strdelete . '</a>'));
    }
    $table->print_html();
}
echo $OUTPUT->footer();
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:blocks.php

示例7: array

$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()));
    $deleteicon = new pix_icon('t/delete', get_string('delete'));
    $deleteaction = $OUTPUT->action_icon($deleteurl, $deleteicon, new confirm_action(get_string('deletelinkconfirm', 'block_links')));
    $icons = $editaction . ' ' . $deleteaction;
    $table->add_data(array($link->linktext, html_writer::link($link->url, $link->url, array('target' => '_blank')), $link->notes, $show, $link->department, $icons));
}
$table->print_html();
echo html_writer::end_tag('form');
echo html_writer::start_tag('div', array('class' => 'actionbuttons'));
echo html_writer::empty_tag('hr', array());
$addurl = new moodle_url('/blocks/links/edit.php', array());
echo $OUTPUT->single_button($addurl, get_string('addlink', 'block_links'), 'get');
echo html_writer::end_tag('div');
echo html_writer::end_tag('div');
echo $OUTPUT->footer();
开发者ID:sbourget,项目名称:moodle-block_links,代码行数:31,代码来源:config_global_action.php

示例8: sesskey

    }
    if ($count > 0) {
        $countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist={$module->name}" . "&amp;sesskey=" . sesskey() . "\" title=\"{$strshowmodulecourse}\">{$count}</a>";
    } else {
        if ($count < 0) {
            $countlink = get_string('error');
        } else {
            $countlink = "{$count}";
        }
    }
    if ($missing) {
        $visible = '';
        $class = '';
    } else {
        if ($module->visible) {
            $visible = "<a href=\"modules.php?hide={$module->name}&amp;sesskey=" . sesskey() . "\" title=\"{$strhide}\">" . "<img src=\"" . $OUTPUT->pix_url('i/hide') . "\" class=\"icon\" alt=\"{$strhide}\" /></a>";
            $class = '';
        } else {
            $visible = "<a href=\"modules.php?show={$module->name}&amp;sesskey=" . sesskey() . "\" title=\"{$strshow}\">" . "<img src=\"" . $OUTPUT->pix_url('i/show') . "\" class=\"icon\" alt=\"{$strshow}\" /></a>";
            $class = ' class="dimmed_text"';
        }
    }
    if ($module->name == "forum") {
        $delete = "";
        $visible = "";
        $class = "";
    }
    $table->add_data(array('<span' . $class . '>' . $strmodulename . '</span>', $countlink, '<span' . $class . '>' . $module->version . '</span>', $visible, $delete, $settings));
}
$table->print_html();
echo $OUTPUT->footer();
开发者ID:ravivare,项目名称:moodle-1,代码行数:31,代码来源:modules.php

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

示例10: foreach

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

示例11: array

if ($coursemap = feedback_get_courses_from_sitecourse_map($feedback->id)) {
    $table = new flexible_table('coursemaps');
    $table->baseurl = $url;
    $table->define_columns( array('course'));
    $table->define_headers( array(get_string('mappedcourses', 'feedback')));

    $table->setup();

    $unmapurl = new moodle_url('/mod/feedback/unmapcourse.php');
    foreach ($coursemap as $cmap) {
        $coursecontext = context_course::instance($cmap->courseid);
        $cmapshortname = format_string($cmap->shortname, true, array('context' => $coursecontext));
        $cmapfullname = format_string($cmap->fullname, true, array('context' => $coursecontext));
        $unmapurl->params(array('id'=>$id, 'cmapid'=>$cmap->id));
        $anker = '<a href="'.$unmapurl->out().'">';
        $anker .= '<img src="'.$OUTPUT->pix_url('t/delete').'" alt="Delete" />';
        $anker .= '</a>';
        $table->add_data(array($anker.' ('.$cmapshortname.') '.$cmapfullname));
    }

    $table->print_html();
} else {
    echo '<h3>'.get_string('mapcoursenone', 'feedback').'</h3>';
}


echo $OUTPUT->box_end();

echo $OUTPUT->footer();
开发者ID:verbazend,项目名称:AWFA,代码行数:29,代码来源:mapcourse.php

示例12: array

                //html_writer::link
                wiziq_authentication($value->id, $timekey, $hash);
                $delete = get_string('content_delete', 'wiziq');
                $delete = new moodle_url('/mod/wiziq/contentsubmit.php',
                array('course' => $course->id, 'action' => WIZIQ_DELETE,
                      'deleteid' => $value->id, 'sesskey' => sesskey(),
                      'parentid' => $pnodeid, 'timekey' => $timekey, 'hash' => $hash));
                $deleteicon = '<img src="'.$CFG->wwwroot.'/mod/wiziq/pix/delete.png" />';
                $deleteconfirmmsg = get_string('deleteconfirmcontent', 'wiziq');
                $deleteconfirmmsgname = $deleteconfirmmsg." ".$nameonly;
                $deleteconfirm = new confirm_action($deleteconfirmmsgname);
                $delete_wiziq_content = new action_link($delete, $deleteicon,
                                                        $deleteconfirm, array());
                $deletecontent = $OUTPUT->render($delete_wiziq_content);
            }
             $table->add_data(array($name, $status, $deletecontent));
        }
    } else {
        $name = '';
        $status = 'Nothing Inside';
        $delete = '';
        $table->add_data(array($name, $status, $delete));
    }

    #------------------------creating form-------------------------------------------
    if (empty($pgpnode)) {
        $folder = html_writer::label('Folder Name', 'foldername', true);
        $folder .= " " . html_writer::tag('input', '', array('id' => 'parentid',
            'type' => 'hidden', 'name' => 'parentid', 'value' => $pnodeid));
        $folder .= " " . html_writer::tag('input', '', array('id' => 'folderpath',
            'type' => 'hidden', 'name' => 'folderpath', 'value' => $folderpath));
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:31,代码来源:content.php

示例13: array

$sql = "select c.id, c.shortname\n              from {course} c\n             where c.shortname " . $DB->sql_ilike() . " ?\n                   OR c.fullname " . $DB->sql_ilike() . " ?";
$params = array("%{$searchcourse}%", "%{$searchcourse}%");
if (($courses = $DB->get_records_sql_menu($sql, $params)) && !empty($searchcourse)) {
    echo ' ' . get_string('courses') . ': ';
    choose_from_menu($courses, 'coursefilter', $coursefilter, 'choose');
    echo '<input type="submit" value="' . get_string('mapcourse', 'feedback') . '"/>';
    helpbutton('mapcourses', '', 'feedback', true, true);
    echo '<input type="button" value="' . get_string('searchagain') . '" onclick="document.location=\'mapcourse.php?id=' . $id . '\'"/>';
    echo '<input type="hidden" name="searchcourse" value="' . $searchcourse . '"/>';
    echo '<input type="hidden" name="feedbackid" value="' . $feedback->id . '"/>';
    helpbutton('searchcourses', '', 'feedback', true, true);
} else {
    echo '<input type="text" name="searchcourse" value="' . $searchcourse . '"/> <input type="submit" value="' . get_string('searchcourses') . '"/>';
    helpbutton('searchcourses', '', 'feedback', true, true);
}
echo '</form>';
if ($coursemap = feedback_get_courses_from_sitecourse_map($feedback->id)) {
    $table = new flexible_table('coursemaps');
    $table->define_columns(array('course'));
    $table->define_headers(array(get_string('mappedcourses', 'feedback')));
    $table->setup();
    foreach ($coursemap as $cmap) {
        $table->add_data(array('<a href="' . htmlspecialchars('unmapcourse.php?id=' . $id . '&cmapid=' . $cmap->id) . '"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="Delete" /></a> (' . $cmap->shortname . ') ' . $cmap->fullname));
    }
    $table->print_html();
} else {
    echo '<h3>' . get_string('mapcoursenone', 'feedback') . '</h3>';
}
// print_simple_box_end();
print_box_end();
print_footer($course);
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:mapcourse.php

示例14: display


//.........这里部分代码省略.........
                     }
                 }
                 if ($detailedmarks) {
                     if (empty($attempt->attempt)) {
                         foreach ($questions as $question) {
                             $row[] = '-';
                         }
                     } else {
                         foreach ($questions as $questionid => $question) {
                             $stateforqinattempt = $gradedstatesbyattempt[$attempt->attemptuniqueid][$questionid];
                             if (question_state_is_graded($stateforqinattempt)) {
                                 $grade = quiz_rescale_grade($stateforqinattempt->grade, $quiz);
                             } else {
                                 $grade = '--';
                             }
                             if (!$download) {
                                 $grade = $grade . '/' . quiz_rescale_grade($question->grade, $quiz);
                                 $row[] = link_to_popup_window('/mod/quiz/reviewquestion.php?state=' . $stateforqinattempt->id . '&amp;number=' . $question->number, 'reviewquestion', $grade, 450, 650, $strreviewquestion, 'none', true);
                             } else {
                                 $row[] = $grade;
                             }
                         }
                     }
                 }
                 // Feedback column.
                 if ($hasfeedback) {
                     if ($attempt->timefinish) {
                         $row[] = quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $quiz), $quiz->id);
                     } 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";
                         }
                     }
                 }
             }
             //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})");
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:67,代码来源:report.php

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


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