コード例 #1
0
ファイル: renderer.php プロジェクト: nfreear/moodle
 /**
  * Renders a course enrolment table
  *
  * @param course_enrolment_table $table
  * @return string
  */
 protected function render_course_enrolment_users_table(course_enrolment_users_table $table)
 {
     $table->initialise_javascript();
     $content = '';
     $enrolmentselector = $table->get_enrolment_selector();
     if ($enrolmentselector) {
         $content .= $this->output->render($enrolmentselector);
     }
     $cohortenroller = $table->get_cohort_enrolment_control();
     if ($cohortenroller) {
         $content .= $this->output->render($cohortenroller);
     }
     $content .= $this->output->render($table->get_enrolment_type_filter());
     $content .= $this->output->render($table->get_paging_bar());
     $content .= html_writer::table($table);
     $content .= $this->output->render($table->get_paging_bar());
     $enrolmentselector = $table->get_enrolment_selector();
     if ($enrolmentselector) {
         $content .= $this->output->render($enrolmentselector);
     }
     $cohortenroller = $table->get_cohort_enrolment_control();
     if ($cohortenroller) {
         $content .= $this->output->render($cohortenroller);
     }
     return $content;
 }
コード例 #2
0
ファイル: renderer.php プロジェクト: nutanrajmalanai/moodle
    /**
     * Renders a course enrolment table
     *
     * @param course_enrolment_table $table
     * @return string
     */
    protected function render_course_enrolment_users_table(course_enrolment_users_table $table) {

        $table->initialise_javascript();

        $buttons = $table->get_manual_enrol_buttons();
        $buttonhtml = '';
        if (count($buttons) > 0) {
            $buttonhtml .= html_writer::start_tag('div', array('class' => 'enrol_user_buttons'));
            foreach ($buttons as $button) {
                $buttonhtml .= $this->render($button);
            }
            $buttonhtml .= html_writer::end_tag('div');
        }

        $content = '';
        if (!empty($buttonhtml)) {
            $content .= $buttonhtml;
        }
        $content .= $this->output->render($table->get_enrolment_type_filter());
        $content .= $this->output->render($table->get_paging_bar());

        // Check if the table has any bulk operations. If it does we want to wrap the table in a
        // form so that we can capture and perform any required bulk operations.
        if ($table->has_bulk_user_enrolment_operations()) {
            $content .= html_writer::start_tag('form', array('action' => new moodle_url('/enrol/bulkchange.php'), 'method' => 'post'));
            foreach ($table->get_combined_url_params() as $key => $value) {
                if ($key == 'action') {
                    continue;
                }
                $content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
            }
            $content .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'bulkchange'));
            $content .= html_writer::table($table);
            $content .= html_writer::start_tag('div', array('class' => 'singleselect bulkuserop'));
            $content .= html_writer::start_tag('select', array('name' => 'bulkuserop'));
            $content .= html_writer::tag('option', get_string('withselectedusers', 'enrol'), array('value' => ''));
            $options = array('' => get_string('withselectedusers', 'enrol'));
            foreach ($table->get_bulk_user_enrolment_operations() as $operation) {
                $content .= html_writer::tag('option', $operation->get_title(), array('value' => $operation->get_identifier()));
            }
            $content .= html_writer::end_tag('select');
            $content .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
            $content .= html_writer::end_tag('div');

            $content .= html_writer::end_tag('form');
        } else {
            $content .= html_writer::table($table);
        }
        $content .= $this->output->render($table->get_paging_bar());
        if (!empty($buttonhtml)) {
            $content .= $buttonhtml;
        }
        return $content;
    }