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


PHP html_table::add_class方法代码示例

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


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

示例1: array

 function output_individual_question_data($quiz, $question, $reporturl, $quizstats)
 {
     global $CFG, $DB, $QTYPES, $OUTPUT;
     require_once $CFG->dirroot . '/mod/quiz/report/statistics/statistics_question_table.php';
     $this->qtable = new quiz_report_statistics_question_table($question->id);
     $downloadtype = $this->table->is_downloading();
     if (!$this->table->is_downloading()) {
         $datumfromtable = $this->table->format_row($question);
         $questioninfotable = new html_table();
         $questioninfotable->align = array('center', 'center');
         $questioninfotable->width = '60%';
         $questioninfotable->add_class('generaltable titlesleft');
         $questioninfotable->data = array();
         $questioninfotable->data[] = array(get_string('modulename', 'quiz'), $quiz->name);
         $questioninfotable->data[] = array(get_string('questionname', 'quiz_statistics'), $question->name . ' ' . $datumfromtable['actions']);
         $questioninfotable->data[] = array(get_string('questiontype', 'quiz_statistics'), $datumfromtable['icon'] . ' ' . get_string($question->qtype, 'quiz') . ' ' . $datumfromtable['icon']);
         $questioninfotable->data[] = array(get_string('positions', 'quiz_statistics'), $question->_stats->positions);
         $questionstatstable = new html_table();
         $questionstatstable->align = array('center', 'center');
         $questionstatstable->width = '60%';
         $questionstatstable->add_class('generaltable titlesleft');
         unset($datumfromtable['number']);
         unset($datumfromtable['icon']);
         $actions = $datumfromtable['actions'];
         unset($datumfromtable['actions']);
         unset($datumfromtable['name']);
         $labels = array('s' => get_string('attempts', 'quiz_statistics'), 'facility' => get_string('facility', 'quiz_statistics'), 'sd' => get_string('standarddeviationq', 'quiz_statistics'), 'random_guess_score' => get_string('random_guess_score', 'quiz_statistics'), 'intended_weight' => get_string('intended_weight', 'quiz_statistics'), 'effective_weight' => get_string('effective_weight', 'quiz_statistics'), 'discrimination_index' => get_string('discrimination_index', 'quiz_statistics'), 'discriminative_efficiency' => get_string('discriminative_efficiency', 'quiz_statistics'));
         foreach ($datumfromtable as $item => $value) {
             $questionstatstable->data[] = array($labels[$item], $value);
         }
         echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'));
         echo $OUTPUT->table($questioninfotable);
         echo $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat) . $actions, 'boxaligncenter generalbox boxwidthnormal mdl-align');
         echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'));
         echo $OUTPUT->table($questionstatstable);
     } else {
         $this->qtable->export_class_instance($this->table->export_class_instance());
         $questiontabletitle = !empty($question->number) ? '(' . $question->number . ') ' : '';
         $questiontabletitle .= "\"{$question->name}\"";
         $questiontabletitle = "<em>{$questiontabletitle}</em>";
         if ($downloadtype == 'xhtml') {
             $questiontabletitle = get_string('analysisofresponsesfor', 'quiz_statistics', $questiontabletitle);
         }
         $exportclass =& $this->table->export_class_instance();
         $exportclass->start_table($questiontabletitle);
     }
     if ($QTYPES[$question->qtype]->show_analysis_of_responses()) {
         if (!$this->table->is_downloading()) {
             echo $OUTPUT->heading(get_string('analysisofresponses', 'quiz_statistics'));
         }
         $teacherresponses = $QTYPES[$question->qtype]->get_possible_responses($question);
         $this->qtable->setup($reporturl, $question, count($teacherresponses) > 1);
         if ($this->table->is_downloading()) {
             $exportclass->output_headers($this->qtable->headers);
         }
         $responses = $DB->get_records('quiz_question_response_stats', array('quizstatisticsid' => $quizstats->id, 'questionid' => $question->id), 'credit DESC, subqid ASC, aid ASC, rcount DESC');
         $responses = quiz_report_index_by_keys($responses, array('subqid', 'aid'), false);
         foreach ($responses as $subqid => $response) {
             foreach (array_keys($responses[$subqid]) as $aid) {
                 uasort($responses[$subqid][$aid], array('quiz_statistics_report', 'sort_answers'));
             }
             if (isset($responses[$subqid]['0'])) {
                 $wildcardresponse = new object();
                 $wildcardresponse->answer = '*';
                 $wildcardresponse->credit = 0;
                 $teacherresponses[$subqid][0] = $wildcardresponse;
             }
         }
         $first = true;
         $subq = 0;
         foreach ($teacherresponses as $subqid => $tresponsesforsubq) {
             $subq++;
             $qhaswildcards = $QTYPES[$question->qtype]->has_wildcards_in_responses($question, $subqid);
             if (!$first) {
                 $this->qtable->add_separator();
             }
             uasort($tresponsesforsubq, array('quiz_statistics_report', 'sort_response_details'));
             foreach ($tresponsesforsubq as $aid => $teacherresponse) {
                 $teacherresponserow = new object();
                 $teacherresponserow->response = $teacherresponse->answer;
                 $teacherresponserow->rcount = 0;
                 $teacherresponserow->subq = $subq;
                 $teacherresponserow->credit = $teacherresponse->credit;
                 if (isset($responses[$subqid][$aid])) {
                     $singleanswer = count($responses[$subqid][$aid]) == 1 && $responses[$subqid][$aid][0]->response == $teacherresponserow->response;
                     if (!$singleanswer && $qhaswildcards) {
                         $this->qtable->add_separator();
                     }
                     foreach ($responses[$subqid][$aid] as $response) {
                         $teacherresponserow->rcount += $response->rcount;
                     }
                     if ($aid != 0 || $qhaswildcards) {
                         $this->qtable->add_data_keyed($this->qtable->format_row($teacherresponserow));
                     }
                     if (!$singleanswer) {
                         foreach ($responses[$subqid][$aid] as $response) {
                             if (!$downloadtype || $downloadtype == 'xhtml') {
                                 $indent = '&nbsp;&nbsp;&nbsp;&nbsp;';
                             } else {
                                 $indent = '    ';
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:report.php

示例2: get_summary_info

 /**
  * Return the html contents for the summary for the last execution of the
  * given test type
  *
  * @param string $type of the test to return last execution summary (dbtest|unittest)
  * @return string html contents of the summary
  */
 public static function get_summary_info($type)
 {
     global $CFG, $OUTPUT;
     $serfilepath = $CFG->dataroot . '/codecoverage/' . $type . '/codecoverage.ser';
     if (file_exists($serfilepath) && is_readable($serfilepath)) {
         if ($data = unserialize(file_get_contents($serfilepath))) {
             // return one table with all the totals (we avoid individual file results here)
             $result = '';
             $table = new html_table();
             $table->align = array('right', 'left');
             $table->tablealign = 'center';
             $table->add_class('codecoveragetable');
             $table->id = 'codecoveragetable_' . $type;
             $table->rowclasses = array('label', 'value');
             $table->data = array(array(get_string('date'), userdate($data->time)), array(get_string('files'), format_float($data->totalfiles, 0)), array(get_string('totallines', 'simpletest'), format_float($data->totalln, 0)), array(get_string('executablelines', 'simpletest'), format_float($data->totalcoveredln + $data->totaluncoveredln, 0)), array(get_string('coveredlines', 'simpletest'), format_float($data->totalcoveredln, 0)), array(get_string('uncoveredlines', 'simpletest'), format_float($data->totaluncoveredln, 0)), array(get_string('coveredpercentage', 'simpletest'), format_float($data->totalpercentage, 2) . '%'));
             $url = $CFG->wwwroot . '/admin/report/unittest/coveragefile.php/' . $type . '/index.html';
             $result .= $OUTPUT->heading($data->title, 3, 'main codecoverageheading');
             $result .= $OUTPUT->heading('<a href="' . $url . '" onclick="javascript:window.open(' . "'" . $url . "'" . ');return false;"' . ' title="">' . get_string('codecoveragecompletereport', 'simpletest') . '</a>', 4, 'main codecoveragelink');
             $result .= $OUTPUT->table($table);
             return $OUTPUT->box($result, 'generalbox boxwidthwide boxaligncenter codecoveragebox', '', true);
         }
     }
     return false;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:simpletestcoveragelib.php

示例3: print_moodle_environment

/**
 * This function will print one beautiful table with all the environmental
 * configuration and how it suits Moodle needs.
 *
 * @global object
 * @param boolean $result final result of the check (true/false)
 * @param array $environment_results array of results gathered
 * @return void
 */
function print_moodle_environment($result, $environment_results)
{
    global $CFG, $OUTPUT;
    /// Get some strings
    $strname = get_string('name');
    $strinfo = get_string('info');
    $strreport = get_string('report');
    $strstatus = get_string('status');
    $strok = get_string('ok');
    $strerror = get_string('error');
    $strcheck = get_string('check');
    $strbypassed = get_string('bypassed');
    $strrestricted = get_string('restricted');
    $strenvironmenterrortodo = get_string('environmenterrortodo', 'admin');
    /// Table headers
    $servertable = new html_table();
    //table for server checks
    $servertable->head = array($strname, $strinfo, $strreport, $strstatus);
    $servertable->align = array('center', 'center', 'left', 'center');
    $servertable->wrap = array('nowrap', '', '', 'nowrap');
    $servertable->size = array('10', 10, '100%', '10');
    $servertable->width = '90%';
    $servertable->add_class('environmenttable generaltable');
    $serverdata = array('ok' => array(), 'warn' => array(), 'error' => array());
    $othertable = new html_table();
    //table for custom checks
    $othertable->head = array($strinfo, $strreport, $strstatus);
    $othertable->align = array('center', 'left', 'center');
    $othertable->wrap = array('', '', 'nowrap');
    $othertable->size = array(10, '100%', '10');
    $othertable->width = '90%';
    $othertable->add_class('environmenttable generaltable');
    $otherdata = array('ok' => array(), 'warn' => array(), 'error' => array());
    /// Iterate over each environment_result
    $continue = true;
    foreach ($environment_results as $environment_result) {
        $errorline = false;
        $warningline = false;
        $stringtouse = '';
        if ($continue) {
            $type = $environment_result->getPart();
            $info = $environment_result->getInfo();
            $status = $environment_result->getStatus();
            $error_code = $environment_result->getErrorCode();
            /// Process Report field
            $rec = new stdClass();
            /// Something has gone wrong at parsing time
            if ($error_code) {
                $stringtouse = 'environmentxmlerror';
                $rec->error_code = $error_code;
                $status = $strerror;
                $errorline = true;
                $continue = false;
            }
            if ($continue) {
                /// We are comparing versions
                if ($rec->needed = $environment_result->getNeededVersion()) {
                    $rec->current = $environment_result->getCurrentVersion();
                    if ($environment_result->getLevel() == 'required') {
                        $stringtouse = 'environmentrequireversion';
                    } else {
                        $stringtouse = 'environmentrecommendversion';
                    }
                    /// We are checking installed & enabled things
                } else {
                    if ($environment_result->getPart() == 'custom_check') {
                        if ($environment_result->getLevel() == 'required') {
                            $stringtouse = 'environmentrequirecustomcheck';
                        } else {
                            $stringtouse = 'environmentrecommendcustomcheck';
                        }
                    } else {
                        if ($environment_result->getPart() == 'php_setting') {
                            if ($status) {
                                $stringtouse = 'environmentsettingok';
                            } else {
                                if ($environment_result->getLevel() == 'required') {
                                    $stringtouse = 'environmentmustfixsetting';
                                } else {
                                    $stringtouse = 'environmentshouldfixsetting';
                                }
                            }
                        } else {
                            if ($environment_result->getLevel() == 'required') {
                                $stringtouse = 'environmentrequireinstall';
                            } else {
                                $stringtouse = 'environmentrecommendinstall';
                            }
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:environmentlib.php

示例4: object

/// Check that we have at least one category defined
if ($DB->count_records('user_info_category') == 0) {
    $defaultcategory = new object();
    $defaultcategory->name = $strdefaultcategory;
    $defaultcategory->sortorder = 1;
    $DB->insert_record('user_info_category', $defaultcategory);
    redirect($redirect);
}
/// Show all categories
$categories = $DB->get_records('user_info_category', null, 'sortorder ASC');
foreach ($categories as $category) {
    $table = new html_table();
    $table->head = array(get_string('profilefield', 'admin'), get_string('edit'));
    $table->align = array('left', 'right');
    $table->width = '95%';
    $table->add_class('generaltable profilefield');
    $table->data = array();
    if ($fields = $DB->get_records('user_info_field', array('categoryid' => $category->id), 'sortorder ASC')) {
        foreach ($fields as $field) {
            $table->data[] = array($field->name, profile_field_icons($field));
        }
    }
    echo $OUTPUT->heading(format_string($category->name) . ' ' . profile_category_icons($category));
    if (count($table->data)) {
        echo $OUTPUT->table($table);
    } else {
        echo $OUTPUT->notification($strnofields);
    }
}
/// End of $categories foreach
echo '<hr />';
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:index.php

示例5: array

    print_header_simple(format_string($attemptobj->get_quiz_name()), '', $attemptobj->navigation($title), '', '', true, $attemptobj->update_module_button());
}
/// Print tabs if they should be there.
if ($attemptobj->is_preview_user()) {
    $currenttab = 'preview';
    include 'tabs.php';
}
/// Print heading.
echo $OUTPUT->heading(format_string($attemptobj->get_quiz_name()));
if ($attemptobj->is_preview_user()) {
    $attemptobj->print_restart_preview_button();
}
echo $OUTPUT->heading($title);
/// Prepare the summary table header
$table = new html_table();
$table->add_class('generaltable quizsummaryofattempt boxaligncenter');
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
$table->align = array('left', 'left');
$table->size = array('', '');
$scorescolumn = $attemptobj->get_review_options()->scores;
if ($scorescolumn) {
    $table->head[] = get_string('marks', 'quiz');
    $table->align[] = 'left';
    $table->size[] = '';
}
$table->data = array();
/// Get the summary info for each question.
$questionids = $attemptobj->get_question_ids();
foreach ($attemptobj->get_question_iterator() as $number => $question) {
    if ($question->length == 0) {
        continue;
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:summary.php

示例6: array

 $user = make_context_subobj($user);
 $context = get_context_instance(CONTEXT_COURSE, $course->id);
 if (isset($user->context->id)) {
     $usercontext = $user->context;
 } else {
     $usercontext = get_context_instance(CONTEXT_USER, $user->id);
 }
 $countries = get_list_of_countries();
 /// Get the hidden field list
 if (has_capability('moodle/course:viewhiddenuserfields', $context)) {
     $hiddenfields = array();
 } else {
     $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
 }
 $table = new html_table();
 $table->add_class('userinfobox');
 $row = new html_table_row();
 $row->cells[0] = new html_table_cell();
 $row->cells[0]->add_class('left side');
 $row->cells[0]->text = $OUTPUT->user_picture(moodle_user_picture::make($user, $course->id));
 $row->cells[1] = new html_table_cell();
 $row->cells[1]->add_class('content');
 $row->cells[1]->text = $OUTPUT->container(fullname($user, has_capability('moodle/site:viewfullnames', $context)), 'username');
 $row->cells[1]->text .= $OUTPUT->container_start('info');
 if (!empty($user->role)) {
     $row->cells[1]->text .= get_string('role') . ': ' . $user->role . '<br />';
 }
 if ($user->maildisplay == 1 or $user->maildisplay == 2 and $course->id != SITEID and !isguest() or has_capability('moodle/course:viewhiddenuserfields', $context)) {
     $link = new html_link();
     $link->url = "mailto:{$user->email}";
     $link->text = $user->email;
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:index.php

示例7: sesskey

 case 'grade':
     // Grading form
     // Expects the following to be set: $attemptid, $answer, $user, $page, $attempt
     echo '<div class="grade">
               <form id="essaygrade" method="post" action="' . $CFG->wwwroot . '/mod/lesson/essay.php">
               <input type="hidden" name="id" value="' . $cm->id . '" />
               <input type="hidden" name="mode" value="update" />
               <input type="hidden" name="attemptid" value="' . $attemptid . '" />
               <input type="hidden" name="sesskey" value="' . sesskey() . '" />';
     // All tables will have these settings
     $originaltable = new html_table();
     $originaltable->align = array('left');
     $originaltable->wrap = array();
     $originaltable->width = '50%';
     $originaltable->size = array('100%');
     $originaltable->add_class('generaltable gradetable');
     // Print the question
     $table = clone $originaltable;
     $table->head = array(get_string('question', 'lesson'));
     $options = new stdClass();
     $options->noclean = true;
     $table->data[] = array(format_text($page->contents, FORMAT_MOODLE, $options));
     echo $OUTPUT->table($table);
     // Now the user's answer
     $essayinfo = unserialize($attempt->useranswer);
     $table = clone $originaltable;
     $table = new html_table();
     $table->head = array(get_string('studentresponse', 'lesson', fullname($user, true)));
     $table->data[] = array(s($essayinfo->answer));
     echo $OUTPUT->table($table);
     // Now a response box and grade drop-down for grader
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:essay.php

示例8: array

    /// Display the form for giving a reason for rejecting the request.
    admin_externalpage_print_header($rejectform->focus());
    $rejectform->display();
    echo $OUTPUT->footer();
    exit;
}
/// Print a list of all the pending requests.
admin_externalpage_print_header();
$pending = $DB->get_records('course_request');
if (empty($pending)) {
    echo $OUTPUT->heading(get_string('nopendingcourses'));
} else {
    echo $OUTPUT->heading(get_string('coursespending'));
    /// Build a table of all the requests.
    $table = new html_table();
    $table->add_class('pendingcourserequests generaltable');
    $table->align = array('center', 'center', 'center', 'center', 'center', 'center', 'center');
    $table->head = array('&nbsp;', get_string('shortname'), get_string('fullname'), get_string('requestedby'), get_string('summary'), get_string('requestreason'), get_string('action'));
    $strrequireskey = get_string('requireskey');
    /// Loop over requested courses.
    foreach ($pending as $course) {
        $requester = $DB->get_record('user', array('id' => $course->requester));
        $row = array();
        /// Check here for shortname collisions and warn about them.
        if ($DB->record_exists('course', array('shortname' => $course->shortname))) {
            $course->shortname .= ' [*]';
            $collision = 1;
        }
        /// Show an enrolment key icon in the first column if applicable.
        if (!empty($course->password)) {
            $row[] = '<img hspace="1" alt="' . $strrequireskey . '" class="icon" src="' . $OUTPUT->old_icon_url('i/key') . '" />';
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:pending.php


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