Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/backup/util/ui/base_ui_stage.class.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00041 abstract class base_ui_stage {
00046     protected $stage = 1;
00051     protected $ui;
00056     protected $stageform = null;
00060     protected $params = null;
00065     public function __construct(base_ui $ui, array $params=null) {
00066         $this->ui = $ui;
00067         $this->params = $params;
00068     }
00073     final public function get_params() {
00074         return $this->params;
00075     }
00080     final public function get_stage() {
00081         return $this->stage;
00082     }
00087     final public function get_next_stage() {
00088         return floor($this->stage*2);
00089     }
00094     final public function get_prev_stage() {
00095         return floor($this->stage/2);
00096     }
00101     public function get_name() {
00102         return get_string('currentstage'.$this->stage,'backup');
00103     }
00108     final public function get_uniqueid() {
00109         return $this->ui->get_uniqueid();
00110     }
00111 
00120     public function display() {
00121 
00122         $form = $this->initialise_stage_form();
00123         // a nasty hack follows to work around the sad fact that moodle quickforms
00124         // do not allow to actually return the HTML content, just to echo it
00125         flush();
00126         ob_start();
00127         $form->display();
00128         $output = ob_get_contents();
00129         ob_end_clean();
00130 
00131         return $output;
00132     }
00133 
00142     abstract public function process(base_moodleform $form=null);
00150     abstract protected function initialise_stage_form();
00151 
00152     final public function get_ui() {
00153         return $this->ui;
00154     }
00155 
00156     public function is_first_stage() {
00157         return $this->stage == 1;
00158     }
00159 }
 All Data Structures Namespaces Files Functions Variables Enumerations