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


PHP flexible_table::finish_output方法代码示例

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


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

示例1: run_table_test

 protected function run_table_test($columns, $headers, $sortable, $collapsible, $suppress, $nosorting, $data, $pagesize)
 {
     $table = new flexible_table('tablelib_test');
     $table->define_columns($columns);
     $table->define_headers($headers);
     $table->define_baseurl('/invalid.php');
     $table->sortable($sortable);
     $table->collapsible($collapsible);
     foreach ($suppress as $column) {
         $table->column_suppress($column);
     }
     foreach ($nosorting as $column) {
         $table->no_sorting($column);
     }
     $table->setup();
     $table->pagesize($pagesize, count($data));
     foreach ($data as $row) {
         $table->add_data_keyed($row);
     }
     $table->finish_output();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:21,代码来源:tablelib_test.php

示例2: question_behaviour_enable_disable_icons

        }
    } 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

示例3: display


//.........这里部分代码省略.........
                                                $j++;
                                                $element = 'cmi.interactions_'.$i.'.correct_responses_'.$j.'.pattern';
                                            }
                                            $row[] = $rightans;
                                        } else {
                                            $row[] = ' ';
                                        }
                                    }
                                    $i++;
                                    $element = 'cmi.interactions_'.$i.'.id';
                                }
                            //---end of interaction data*/
                            } else {
                                // if we don't have track data, we haven't attempted yet
                                $strstatus = get_string('notattempted', 'scorm');
                                if (!$download) {
                                    $row[] = '<img src="'.$OUTPUT->pix_url('notattempted', 'scorm').'" alt="'.$strstatus.'" title="'.$strstatus.'" /><br/>'.$strstatus;
                                } else {
                                    $row[] = $strstatus;
                                }
                            }
                        }
                    }

                    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) {
                    $table->finish_output();
                    if ($candelete) {
                        echo '<table id="commands">';
                        echo '<tr><td>';
                        echo '<a href="javascript:select_all_in(\'DIV\', null, \'scormtablecontainer\');">'.
                             get_string('selectall', 'scorm').'</a> / ';
                        echo '<a href="javascript:deselect_all_in(\'DIV\', null, \'scormtablecontainer\');">'.
                             get_string('selectnone', 'scorm').'</a> ';
                        echo '&nbsp;&nbsp;';
                        echo '<input type="submit" value="'.get_string('deleteselected', 'quiz_overview').'"/>';
                        echo '</td></tr></table>';
                        // Close form
                        echo '</div>';
                        echo '</form>';
                    }
                    echo '</div>';
                    if (!empty($attempts)) {
                        echo '<table class="boxaligncenter"><tr>';
                        echo '<td>';
                        echo $OUTPUT->single_button(new moodle_url($PAGE->url,
                                                                   array('download'=>'ODS') + $displayoptions),
                                                                   get_string('downloadods'));
                        echo "</td>\n";
                        echo '<td>';
                        echo $OUTPUT->single_button(new moodle_url($PAGE->url,
                                                                   array('download'=>'Excel') + $displayoptions),
                                                                   get_string('downloadexcel'));
                        echo "</td>\n";
                        echo '<td>';
                        echo $OUTPUT->single_button(new moodle_url($PAGE->url,
                                                                   array('download'=>'CSV') + $displayoptions),
                                                                   get_string('downloadtext'));
                        echo "</td>\n";
                        echo "<td>";
                        echo "</td>\n";
                        echo '</tr></table>';
                    }
                }
            } else {
                if ($candelete && !$download) {
                    echo '</div>';
                    echo '</form>';
                    $table->finish_output();
                }
                echo '</div>';
            }
            // Show preferences form irrespective of attempts are there to report or not
            if (!$download) {
                $mform->set_data(compact('detailedrep', 'pagesize', 'attemptsmode'));
                $mform->display();
            }
            if ($download == 'Excel' or $download == 'ODS') {
                $workbook->close();
                exit;
            } else if ($download == 'CSV') {
                exit;
            }
        } else {
            echo $OUTPUT->notification(get_string('noactivity', 'scorm'));
        }
    }// function ends
开发者ID:numbas,项目名称:moodle,代码行数:101,代码来源:report.php

示例4: foreach

            $tablepublic->set_attribute('class', 'generaltable');
            $tablepublic->setup();

            foreach ($templates as $template) {
                $data = array();
                $data[] = $template->name;
                $url = new moodle_url($deleteurl, array(
                                                'id'=>$id,
                                                'deletetempl'=>$template->id,
                                                'shoulddelete'=>1,
                                                ));

                $data[] = $OUTPUT->single_button($url, $strdeletefeedback, 'post');
                $tablepublic->add_data($data);
            }
            $tablepublic->finish_output();
            echo $OUTPUT->box_end();
        }
    }

    echo $OUTPUT->box_start('boxaligncenter boxwidthnormal');
    $url = new moodle_url($deleteurl, array(
                                    'id'=>$id,
                                    'canceldelete'=>1,
                                    ));

    echo $OUTPUT->single_button($url, get_string('back'), 'post');
    echo $OUTPUT->box_end();
}

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

示例5: display


//.........这里部分代码省略.........
                                     }
                                     if ($displayoptions['objectivescore']) {
                                         if (isset($objectivescore[$name])) {
                                             $row[] = s($objectivescore[$name]);
                                         } else {
                                             $row[] = $emptycell;
                                         }
                                     }
                                 }
                             }
                             // End of interaction data.
                         } else {
                             // If we don't have track data, we haven't attempted yet.
                             $strstatus = get_string('notattempted', 'scorm');
                             if (!$download) {
                                 $row[] = \html_writer::img($OUTPUT->pix_url('notattempted', 'scorm'), $strstatus, array('title' => $strstatus)) . \html_writer::empty_tag('br') . $strstatus;
                             } else {
                                 $row[] = $strstatus;
                             }
                             // Complete the empty cells.
                             for ($i = 0; $i < count($columns) - $nbmaincolumns; $i++) {
                                 $row[] = $emptycell;
                             }
                         }
                     }
                 }
                 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') {
                             $csvexport->add_data($row);
                         }
                     }
                 }
             }
             if (!$download) {
                 $table->finish_output();
                 if ($candelete) {
                     echo \html_writer::start_tag('table', array('id' => 'commands'));
                     echo \html_writer::start_tag('tr') . \html_writer::start_tag('td');
                     echo \html_writer::link('javascript:select_all_in(\'DIV\', null, \'scormtablecontainer\');', get_string('selectall', 'scorm')) . ' / ';
                     echo \html_writer::link('javascript:deselect_all_in(\'DIV\', null, \'scormtablecontainer\');', get_string('selectnone', 'scorm'));
                     echo '&nbsp;&nbsp;';
                     echo \html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('deleteselected', 'scorm'), 'class' => 'btn btn-secondary'));
                     echo \html_writer::end_tag('td') . \html_writer::end_tag('tr') . \html_writer::end_tag('table');
                     // Close form.
                     echo \html_writer::end_tag('div');
                     echo \html_writer::end_tag('form');
                 }
                 echo \html_writer::end_div();
                 if (!empty($attempts)) {
                     echo \html_writer::start_tag('table', array('class' => 'boxaligncenter')) . \html_writer::start_tag('tr');
                     echo \html_writer::start_tag('td');
                     echo $OUTPUT->single_button(new \moodle_url($PAGE->url, array('download' => 'ODS') + $displayoptions), get_string('downloadods'), 'post', ['class' => 'm-t-1']);
                     echo \html_writer::end_tag('td');
                     echo \html_writer::start_tag('td');
                     echo $OUTPUT->single_button(new \moodle_url($PAGE->url, array('download' => 'Excel') + $displayoptions), get_string('downloadexcel'), 'post', ['class' => 'm-t-1']);
                     echo \html_writer::end_tag('td');
                     echo \html_writer::start_tag('td');
                     echo $OUTPUT->single_button(new \moodle_url($PAGE->url, array('download' => 'CSV') + $displayoptions), get_string('downloadtext'), 'post', ['class' => 'm-t-1']);
                     echo \html_writer::end_tag('td');
                     echo \html_writer::start_tag('td');
                     echo \html_writer::end_tag('td');
                     echo \html_writer::end_tag('tr') . \html_writer::end_tag('table');
                 }
             }
         } else {
             if ($candelete && !$download) {
                 echo \html_writer::end_div();
                 echo \html_writer::end_tag('form');
                 $table->finish_output();
             }
             echo \html_writer::end_div();
         }
         // Show preferences form irrespective of attempts are there to report or not.
         if (!$download) {
             $mform->set_data(compact('detailedrep', 'pagesize', 'attemptsmode'));
             $mform->display();
         }
         if ($download == 'Excel' or $download == 'ODS') {
             $workbook->close();
             exit;
         } else {
             if ($download == 'CSV') {
                 $csvexport->download_file();
                 exit;
             }
         }
     } else {
         echo $OUTPUT->notification(get_string('noactivity', 'scorm'));
     }
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:101,代码来源:report.php

示例6: view_plugins_table

    /**
     * Write the HTML for the submission plugins table.
     *
     * @return None
     */
    private function view_plugins_table() {
        global $OUTPUT, $CFG;
        /** Include tablelib.php */
        require_once($CFG->libdir . '/tablelib.php');

        // Set up the table.
        $this->view_header();
        $table = new flexible_table($this->subtype . 'pluginsadminttable');
        $table->define_baseurl($this->pageurl);
        $table->define_columns(array('pluginname', 'version', 'hideshow', 'order',
                'delete', 'settings'));
        $table->define_headers(array(get_string($this->subtype . 'pluginname', 'assign'),
                get_string('version'), get_string('hideshow', 'assign'),
                get_string('order'), get_string('delete'), get_string('settings')));
        $table->set_attribute('id', $this->subtype . 'plugins');
        $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
        $table->setup();


        $plugins = $this->get_sorted_plugins_list();
        $shortsubtype = substr($this->subtype, strlen('assign'));

        foreach ($plugins as $idx => $plugin) {
            $row = array();

            $row[] = get_string('pluginname', $this->subtype . '_' . $plugin);
            $row[] = get_config($this->subtype . '_' . $plugin, 'version');

            $visible = !get_config($this->subtype . '_' . $plugin, 'disabled');

            if ($visible) {
                $row[] = $this->format_icon_link('hide', $plugin, 'i/hide', get_string('disable'));
            } else {
                $row[] = $this->format_icon_link('show', $plugin, 'i/show', get_string('enable'));
            }

            $movelinks = '';
            if (!$idx == 0) {
                $movelinks .= $this->format_icon_link('moveup', $plugin, 't/up', get_string('up'));
            } else {
                $movelinks .= $OUTPUT->spacer(array('width'=>15));
            }
            if ($idx != count($plugins) - 1) {
                $movelinks .= $this->format_icon_link('movedown', $plugin, 't/down', get_string('down'));
            }
            $row[] = $movelinks;

            if ($row[1] != '') {
                $row[] = $this->format_icon_link('delete', $plugin, 't/delete', get_string('delete'));
            } else {
                $row[] = '&nbsp;';
            }
            if ($row[1] != '' && file_exists($CFG->dirroot . '/mod/assign/' . $shortsubtype . '/' . $plugin . '/settings.php')) {
                $row[] = html_writer::link(new moodle_url('/admin/settings.php',
                        array('section' => $this->subtype . '_' . $plugin)), get_string('settings'));
            } else {
                $row[] = '&nbsp;';
            }
            $table->add_data($row);
        }


        $table->finish_output();
        $this->view_footer();
    }
开发者ID:nicusX,项目名称:moodle,代码行数:70,代码来源:adminlib.php

示例7: switch

 /**
  * Helper method, displays a table
  * of users with checkboxes next to them.
  * Also includes a submit button to take
  * action on those users.
  *
  * @param string $hook The calling hook
  * @return string
  * @todo Not in love with this method, but it works
  **/
 function display_user_table($hook)
 {
     global $CFG;
     global $DB, $OUTPUT;
     require_once $CFG->libdir . '/tablelib.php';
     ob_start();
     $pagesize = optional_param('pagesize', 50, PARAM_INT);
     print "<form class=\"userform\" id=\"userformid\" action=\"{$CFG->wwwroot}/blocks/gdata/index.php\" method=\"post\">";
     $table = new flexible_table("blocks-gdata-{$hook}");
     $filter = $this->create_filter($hook, $pagesize);
     // Define columns based on hook
     switch ($hook) {
         case 'users':
             $table->define_columns(array('username', 'fullname', 'email', 'lastsync', 'status'));
             $table->define_headers(array(get_string('username'), get_string('fullname'), get_string('email'), get_string('lastsync', 'block_gdata'), get_string('status')));
             break;
         case 'addusers':
             $table->define_columns(array('username', 'fullname', 'email'));
             $table->define_headers(array(get_string('username'), get_string('fullname'), get_string('email')));
             break;
     }
     $table->define_baseurl("{$CFG->wwwroot}/blocks/gdata/index.php?hook={$hook}&amp;pagesize={$pagesize}");
     $table->pageable(true);
     $table->sortable(true, 'username', SORT_DESC);
     $table->set_attribute('width', '100%');
     $table->set_attribute('class', 'flexible generaltable generalbox');
     $table->column_style('action', 'text-align', 'center');
     $table->setup();
     list($select, $from, $where, $params) = $this->get_sql($hook, $filter);
     $total = $DB->count_records_sql("SELECT COUNT(*) {$from} {$where}", $params);
     $table->pagesize($pagesize, $total);
     if ($users = $DB->get_records_sql("{$select} {$from} {$where} ORDER BY " . $table->get_sql_sort(), array(), $table->get_page_start(), $table->get_page_size())) {
         foreach ($users as $user) {
             $username = print_checkbox("userids[]", $user->id, false, s($user->username), s($user->username), '', true);
             // Define table contents based on hook
             switch ($hook) {
                 case 'users':
                     if ($user->lastsync > 0) {
                         $lastsync = userdate($user->lastsync);
                     } else {
                         $lastsync = get_string('never');
                     }
                     $table->add_data(array($username, fullname($user), $user->email, $lastsync, get_string("status{$user->status}", 'block_gdata')));
                     break;
                 case 'addusers':
                     $table->add_data(array($username, fullname($user), $user->email));
                     break;
             }
         }
     }
     print $OUTPUT->box_start('boxaligncenter boxwidthwide', '', array());
     print $filter->display_add();
     print $filter->display_active();
     if (empty($table->totalrows)) {
         // Avoid printing the form on empty tables
         print $table->finish_output();
     } else {
         $allstr = get_string('selectall', 'block_gdata');
         $nonestr = get_string('selectnone', 'block_gdata');
         $submitstr = get_string("submitbutton{$hook}", 'block_gdata');
         $submitallstr = get_string("submitbuttonall{$hook}", 'block_gdata', $total);
         $confirmstr = get_string("confirm{$hook}", 'block_gdata', $total);
         $confirmstr = addslashes_js($confirmstr);
         $options = array(50 => 50, 100 => 100, 250 => 250, 500 => 500, 1000 => 1000);
         print '<input type="hidden" name="hook" value="' . $hook . '" />';
         print '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
         print $table->finish_output();
         print "<p><a href=\"#\" title=\"{$allstr}\" onclick=\"select_all_in('FORM', 'userform', 'userformid'); return false;\">{$allstr}</a> / ";
         print "<a href=\"#\" title=\"{$nonestr}\" onclick=\"deselect_all_in('FORM', 'userform', 'userformid'); return false;\">{$nonestr}</a></p>";
         print "<input type=\"submit\" name=\"users\" value=\"{$submitstr}\" />&nbsp;&nbsp;";
         print "<input type=\"submit\" name=\"allusers\" value=\"{$submitallstr}\" onclick=\"return confirm('{$confirmstr}');\" />";
         print '</form><br />';
         print $OUTPUT->single_select("{$CFG->wwwroot}/blocks/gdata/index.php?hook={$hook}&amp;pagesize=", 'changepagesize', $options, $pagesize);
     }
     print $OUTPUT->box_end(true);
     $tablehtml = ob_get_contents();
     ob_end_clean();
     return $tablehtml;
 }
开发者ID:stefanotirati,项目名称:moodle-google-apps,代码行数:89,代码来源:block_gdata.php

示例8: course_report

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


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