Exemple #1
0
    /**
     * Returns the HTML code to print the user interface
     */
    public function ui() {
        global $PAGE;

        $output = $PAGE->get_renderer('mod_workshop');

        $m = optional_param('m', null, PARAM_INT);  // status message code
        $message = new workshop_message();
        if ($m == self::MSG_SUCCESS) {
            $message->set_text(get_string('randomallocationdone', 'workshopallocation_random'));
            $message->set_type(workshop_message::TYPE_OK);
        }

        $out  = $output->container_start('random-allocator');
        $out .= $output->render($message);
        // the nasty hack follows to bypass the sad fact that moodle quickforms do not allow to actually
        // return the HTML content, just to display it
        ob_start();
        $this->mform->display();
        $out .= ob_get_contents();
        ob_end_clean();

        // if there are some not-grouped participant in a group mode, warn the user
        $gmode = $this->get_group_mode();
        if (VISIBLEGROUPS == $gmode or SEPARATEGROUPS == $gmode) {
            $nogroupusers = $this->workshop->get_ungrouped_users(); //this function exists for a reason
            if (!empty($nogroupusers)) {
                $list = array();
                foreach ($nogroupusers as $nogroupuser) {
                    $list[] = fullname($nogroupuser);
                }
                $a = implode(', ', $list);
                $out .= $output->box(get_string('nogroupusers', 'workshopallocation_random', $a), 'generalbox warning nogroupusers');
            }
        }

        // TODO $out .= $output->heading(get_string('stats', 'workshopallocation_random'));

        $out .= $output->container_end();

        return $out;
    }
Exemple #2
0
 /**
  * Returns the HTML code to print the user interface
  */
 public function ui()
 {
     global $PAGE;
     $output = $PAGE->get_renderer('mod_workshop');
     $m = optional_param('m', null, PARAM_INT);
     // status message code
     $message = new workshop_message();
     if ($m == self::MSG_SUCCESS) {
         $message->set_text(get_string('randomallocationdone', 'workshopallocation_random'));
         $message->set_type(workshop_message::TYPE_OK);
     }
     $out = $output->container_start('random-allocator');
     $out .= $output->render($message);
     // the nasty hack follows to bypass the sad fact that moodle quickforms do not allow to actually
     // return the HTML content, just to display it
     ob_start();
     $this->mform->display();
     $out .= ob_get_contents();
     ob_end_clean();
     $out .= $output->container_end();
     // TODO $out .= $output->heading(get_string('stats', 'workshopallocation_random'));
     return $out;
 }