Beispiel #1
0
 /**
  * Handles an action.
  *
  * If an Action object was not registered here, controller's handle()
  * method will be called.
  *
  * @access public
  * @param  string Name of the action
  * @throws PEAR_Error
  */
 function handle($actionName)
 {
     if (isset($this->_actions[$actionName])) {
         return $this->_actions[$actionName]->perform($this, $actionName);
     } else {
         return $this->controller->handle($this, $actionName);
     }
 }
Beispiel #2
0
 /**
  * Constructor Summary
  *
  * o Creates a standard progress bar generator wizard.
  *   <code>
  *   $generator = new HTML_Progress_Generator();
  *   </code>
  *
  * o Creates a progress bar generator wizard with
  *   customized actions: progress bar preview, form rendering, buttons manager
  *   <code>
  *   $controllerName = 'myPrivateGenerator';
  *   $attributes = array(
  *        'preview' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionPreview', see 'HTML/Progress/generator/preview.php')
  *        'display' => name of a HTML_QuickForm_Action_Display instance
  *                     (default 'ActionDisplay', see 'HTML/Progress/generator/default.php')
  *        'process' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionProcess', see 'HTML/Progress/generator/process.php')
  *   );
  *   $generator = new HTML_Progress_Generator($controllerName, $attributes);
  *   </code>
  *
  * @param      string    $controllerName(optional) Name of generator wizard (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  * @param      array     $errorPrefs    (optional) Hash of params to configure error handler
  *
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function HTML_Progress_Generator($controllerName = 'ProgressGenerator', $attributes = array(), $errorPrefs = array())
 {
     $this->_progress = new HTML_Progress($errorPrefs);
     if (!is_string($controllerName)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$controllerName', 'was' => gettype($controllerName), 'expected' => 'string', 'paramnum' => 1));
     } elseif (!is_array($attributes)) {
         return HTML_Progress::raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2));
     }
     parent::HTML_QuickForm_Controller($controllerName);
     // Check if Action(s) are customized
     $ActionPreview = isset($attributes['preview']) ? $attributes['preview'] : 'ActionPreview';
     $ActionDisplay = isset($attributes['display']) ? $attributes['display'] : 'ActionDisplay';
     $ActionProcess = isset($attributes['process']) ? $attributes['process'] : 'ActionProcess';
     $this->_tabs = array(0 => array('page1', 'Property1', 'Progress'), 1 => array('page2', 'Property2', 'Cell'), 2 => array('page3', 'Property3', 'Border'), 3 => array('page4', 'Property4', 'String'), 4 => array('page5', 'Preview', 'Preview'), 5 => array('page6', 'Save', 'Save'));
     foreach ($this->_tabs as $tab) {
         list($pageName, $className, $tabName) = $tab;
         // Add each tab of the wizard
         $this->addPage(new $className($pageName));
         // These actions manage going directly to the pages with the same name
         $this->addAction($pageName, new HTML_QuickForm_Action_Direct());
     }
     $preview = $this->getPage('page5');
     // The customized actions
     if (!class_exists($ActionPreview)) {
         include_once 'HTML/Progress/generator/preview.php';
         $ActionPreview = 'ActionPreview';
     }
     if (!class_exists($ActionDisplay)) {
         include_once 'HTML/Progress/generator/default.php';
         $ActionDisplay = 'ActionDisplay';
     }
     if (!class_exists($ActionProcess)) {
         include_once 'HTML/Progress/generator/process.php';
         $ActionProcess = 'ActionProcess';
     }
     $preview->addAction('apply', new $ActionPreview());
     $this->addAction('display', new $ActionDisplay());
     $this->addAction('process', new $ActionProcess());
     $this->addAction('cancel', new $ActionProcess());
     // set ProgressBar default values on first run
     $sess = $this->container();
     $defaults = $sess['defaults'];
     if (count($sess['defaults']) == 0) {
         $this->setDefaults(array('progressclass' => 'progressBar', 'shape' => HTML_PROGRESS_BAR_HORIZONTAL, 'way' => 'natural', 'autosize' => true, 'progresssize' => array('bgcolor' => '#FFFFFF'), 'rAnimSpeed' => 100, 'borderpainted' => false, 'borderclass' => 'progressBarBorder', 'borderstyle' => array('style' => 'solid', 'width' => 0, 'color' => '#000000'), 'cellid' => 'progressCell%01s', 'cellclass' => 'cell', 'cellvalue' => array('min' => 0, 'max' => 100, 'inc' => 1), 'cellsize' => array('width' => 15, 'height' => 20, 'spacing' => 2, 'count' => 10), 'cellcolor' => array('active' => '#006600', 'inactive' => '#CCCCCC'), 'cellfont' => array('family' => 'Courier, Verdana', 'size' => 8, 'color' => '#000000'), 'stringpainted' => false, 'stringid' => 'installationProgress', 'stringsize' => array('width' => 50, 'height' => '', 'bgcolor' => '#FFFFFF'), 'stringvalign' => 'right', 'stringalign' => 'right', 'stringfont' => array('family' => 'Verdana, Arial, Helvetica, sans-serif', 'size' => 12, 'color' => '#000000'), 'strings' => implode(";\n", array(0 => '10,Hello world', 1 => '20,Welcome', 2 => '30,to', 3 => '40,HTML_Progress v1', 4 => '60,by', 5 => '70,Laurent Laville', 6 => '100,Have a nice day !')), 'phpcss' => array('P' => true)));
     }
 }
Beispiel #3
0
 /**
  * All CRM single or multi page pages should inherit from this class.
  *
  * @param string $title
  *   Descriptive title of the controller.
  * @param bool $modal
  *   Whether controller is modal.
  * @param mixed $mode
  * @param string $scope
  *   Name of session if we want unique scope, used only by Controller_Simple.
  * @param bool $addSequence
  *   Should we add a unique sequence number to the end of the key.
  * @param bool $ignoreKey
  *   Should we not set a qfKey for this controller (for standalone forms).
  */
 public function __construct($title = NULL, $modal = TRUE, $mode = NULL, $scope = NULL, $addSequence = FALSE, $ignoreKey = FALSE)
 {
     // this has to true for multiple tab session fix
     $addSequence = TRUE;
     // let the constructor initialize this, should happen only once
     if (!isset(self::$_template)) {
         self::$_template = CRM_Core_Smarty::singleton();
         self::$_session = CRM_Core_Session::singleton();
     }
     // lets try to get it from the session and/or the request vars
     // we do this early on in case there is a fatal error in retrieving the
     // key and/or session
     $this->_entryURL = CRM_Utils_Request::retrieve('entryURL', 'String', $this);
     // add a unique validable key to the name
     $name = CRM_Utils_System::getClassName($this);
     if ($name == 'CRM_Core_Controller_Simple' && !empty($scope)) {
         // use form name if we have, since its a lot better and
         // definitely different for different forms
         $name = $scope;
     }
     $name = $name . '_' . $this->key($name, $addSequence, $ignoreKey);
     $this->_title = $title;
     if ($scope) {
         $this->_scope = $scope;
     } else {
         $this->_scope = CRM_Utils_System::getClassName($this);
     }
     $this->_scope = $this->_scope . '_' . $this->_key;
     // only use the civicrm cache if we have a valid key
     // else we clash with other users CRM-7059
     if (!empty($this->_key)) {
         CRM_Core_Session::registerAndRetrieveSessionObjects(array("_{$name}_container", array('CiviCRM', $this->_scope)));
     }
     parent::__construct($name, $modal);
     $snippet = CRM_Utils_Array::value('snippet', $_REQUEST);
     if ($snippet) {
         if ($snippet == 3) {
             $this->_print = CRM_Core_Smarty::PRINT_PDF;
         } elseif ($snippet == 4) {
             // this is used to embed fragments of a form
             $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
             self::$_template->assign('suppressForm', TRUE);
             $this->_generateQFKey = FALSE;
         } elseif ($snippet == 5) {
             // mode deprecated in favor of json
             // still used by dashlets, probably nothing else
             $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
         } elseif (in_array($snippet, array(CRM_Core_Smarty::PRINT_JSON, 6))) {
             $this->_print = CRM_Core_Smarty::PRINT_JSON;
             $this->_QFResponseType = 'json';
         } else {
             $this->_print = CRM_Core_Smarty::PRINT_SNIPPET;
         }
     }
     // if the request has a reset value, initialize the controller session
     if (!empty($_GET['reset'])) {
         $this->reset();
         // in this case we'll also cache the url as a hidden form variable, this allows us to
         // redirect in case the session has disappeared on us
         $this->_entryURL = CRM_Utils_System::makeURL(NULL, TRUE, FALSE, NULL, TRUE);
         $this->set('entryURL', $this->_entryURL);
     }
     // set the key in the session
     // do this at the end so we have initialized the object
     // and created the scope etc
     $this->set('qfKey', $this->_key);
     // also retrieve and store destination in session
     $this->_destination = CRM_Utils_Request::retrieve('civicrmDestination', 'String', $this, FALSE, NULL, $_REQUEST);
 }
Beispiel #4
0
 /**
  * Registers a handler for a specific action.
  *
  * @param      string    $actionName  name of the action
  * @param      object    $action      the handler for the action
  * @return     void
  * @access     public
  * @since      2.1.0
  */
 function addAction($actionName, &$action)
 {
     $this->_act[$actionName] = get_class($action);
     parent::addAction($actionName, $action);
 }
<input type="hidden" name="os0" value="">
<input type="hidden" name="on1" value="Reference No: <?php 
        echo 'M09-' . $last_id;
        ?>
 ">
<input type="hidden" name="os1" value="">
<br>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif">
</form>
<?php 
        echo htmlentities(T_("Note:")) . " " . htmlentities(T_("Your registration is only valid as soon as we received your payment.")) . "<br>\n";
        echo htmlentities(T_("You have to pay within 2 weeks of completing your registration (this is now), otherwise the system will delete your registration automatically")) . "<br>\n";
        session_destroy();
    }
}
// Neue Formular-Objekte mit eindeutigem Namen ableiten
$seite1 = new Form_Personal('seite1');
$seite2 = new Form_Motivation('seite2');
$seite4 = new Form_Bankdaten('seite4');
// Neues Controller-Objekt ableiten
$controller = new HTML_QuickForm_Controller('mnformular', true);
// Formularseiten hinzufuegen
$controller->addPage($seite1);
$controller->addPage($seite2);
$controller->addPage($seite4);
// add the actions
$controller->addAction('display', new ActionDisplay());
$controller->addAction('process', new ActionProcess());
// Controller ausfuehren
$controller->run();
$mdb2->disconnect();
Beispiel #6
0
                //		                redirect($CFG->wwwroot."/course/importstudents.php?id=$course->id");
                //		            } else {
                //		                // Redirect to roles assignment
                //		                redirect($CFG->wwwroot."/$CFG->admin/roles/assign.php?contextid=$context->id");
                //		            }
            }
            // if (empty($course))
        } else {
            // no data has been taken from session (wizard)
            print_error('coursenotcreated');
        }
        redirect($CFG->wwwroot . "/course/view.php?id={$course->id}");
    }
}
//class ActionProcess
$wizard = new HTML_QuickForm_Controller('courseWizard', true);
$wizard->addPage(new NewCourseBasic('page1'));
$wizard->addPage(new NewCourseTechnology('page2'));
$wizard->addPage(new NewCourseSyncAsync('page3'));
// read values from the previous step
$wizard->setDefaults($wizard->exportValues());
$wizard->addAction('display', new ActionDisplay());
$wizard->addAction('process', new ActionProcess());
// generate heading
$site = get_site();
$streditcoursesettings = get_string("editcoursesettings");
$straddnewcourse = get_string("addnewcourse");
$stradministration = get_string("administration");
$strcategories = get_string("categories");
$navlinks = array();
$navlinks[] = array('name' => $stradministration, 'link' => "{$CFG->wwwroot}/{$CFG->admin}/index.php", 'type' => 'misc');
Beispiel #7
0
 /**
  * Constructor (ZE2) Summary
  *
  * o Creates a standard progress bar generator wizard.
  *   <code>
  *   $generator = new HTML_Progress2_Generator();
  *   </code>
  *
  * o Creates a progress bar generator wizard with
  *   customized actions: progress bar preview, form rendering, buttons manager
  *   <code>
  *   $controllerName = 'myPrivateGenerator';
  *   $attributes = array(
  *        'preview' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionPreview', see 'HTML/Progress2/Generator/Preview.php')
  *        'display' => name of a HTML_QuickForm_Action_Display instance
  *                     (default 'ActionDisplay', see 'HTML/Progress2/Generator/Default.php')
  *        'process' => name of a HTML_QuickForm_Action instance
  *                     (default 'ActionProcess', see 'HTML/Progress2/Generator/Process.php')
  *   );
  *   $generator = new HTML_Progress2_Generator($controllerName, $attributes);
  *   </code>
  *
  * @param      string    $controllerName(optional) Name of generator wizard (QuickForm)
  * @param      array     $attributes    (optional) List of renderer options
  * @param      array     $errorPrefs    (optional) Hash of params to configure error handler
  *
  * @since      2.0.0
  * @access     protected
  * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  */
 function __construct($controllerName = 'ProgressGenerator', $attributes = array(), $errorPrefs = array())
 {
     $this->_progress = new HTML_Progress2($errorPrefs, HTML_PROGRESS2_BAR_HORIZONTAL, 0, 100);
     if (!is_string($controllerName)) {
         return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$controllerName', 'was' => gettype($controllerName), 'expected' => 'string', 'paramnum' => 1));
     } elseif (!is_array($attributes)) {
         return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT, 'exception', array('var' => '$attributes', 'was' => gettype($attributes), 'expected' => 'array', 'paramnum' => 2));
     }
     parent::HTML_QuickForm_Controller($controllerName);
     // Check if Action(s) are customized
     $ActionPreview = isset($attributes['preview']) ? $attributes['preview'] : 'ActionPreview';
     $ActionDisplay = isset($attributes['display']) ? $attributes['display'] : 'ActionDisplay';
     $ActionProcess = isset($attributes['process']) ? $attributes['process'] : 'ActionProcess';
     $this->_tabs = array(0 => array('page1', 'Property1', 'Progress'), 1 => array('page2', 'Property2', 'Cell'), 2 => array('page3', 'Property3', 'Border'), 3 => array('page4', 'Property4', 'String'), 4 => array('page5', 'Preview', 'Preview'), 5 => array('page6', 'Save', 'Save'));
     foreach ($this->_tabs as $tab) {
         list($pageName, $className, $tabName) = $tab;
         // Add each tab of the wizard
         $this->addPage(new $className($pageName));
         // These actions manage going directly to the pages with the same name
         $this->addAction($pageName, new HTML_QuickForm_Action_Direct());
     }
     $preview =& $this->getPage('page5');
     // The customized actions
     if (!class_exists($ActionPreview)) {
         include_once 'HTML/Progress2/Generator/Preview.php';
         $ActionPreview = 'ActionPreview';
     }
     if (!class_exists($ActionDisplay)) {
         include_once 'HTML/Progress2/Generator/Default.php';
         $ActionDisplay = 'ActionDisplay';
     }
     if (!class_exists($ActionProcess)) {
         include_once 'HTML/Progress2/Generator/Process.php';
         $ActionProcess = 'ActionProcess';
     }
     $preview->addAction('apply', new $ActionPreview());
     $this->addAction('display', new $ActionDisplay());
     $this->addAction('process', new $ActionProcess());
     $this->addAction('cancel', new $ActionProcess());
     // set ProgressBar default values on first run
     $sess = $this->container();
     $defaults = $sess['defaults'];
     if (count($sess['defaults']) == 0) {
         $this->setDefaults(array('shape' => HTML_PROGRESS2_BAR_HORIZONTAL, 'way' => 'natural', 'autosize' => true, 'progresssize' => array('left' => 10, 'top' => 25, 'position' => 'relative', 'bgcolor' => '#FFFFFF'), 'rAnimSpeed' => 100, 'borderpainted' => false, 'borderclass' => 'progressBorder%s', 'borderstyle' => array('style' => 'solid', 'width' => 0, 'color' => '#000000'), 'cellid' => 'pcel%01s', 'cellclass' => 'cell%s', 'cellvalue' => array('min' => 0, 'max' => 100, 'inc' => 1), 'cellsize' => array('width' => 15, 'height' => 20, 'spacing' => 2, 'count' => 10), 'cellcolor' => array('active' => '#006600', 'inactive' => '#CCCCCC', 'bgcolor' => '#FFFFFF'), 'cellfont' => array('family' => 'Courier, Verdana', 'size' => 8, 'color' => '#000000'), 'stringpainted' => false, 'stringid' => 'txt1', 'stringclass' => 'progressTextLabel%s', 'stringvalue' => 'something to display', 'stringsize' => array('left' => 5, 'top' => 5), 'stringvalign' => 'top', 'stringalign' => 'left', 'stringfont' => array('family' => 'Verdana, Tahoma, Arial', 'size' => 11, 'color' => '#000000'), 'stringweight' => 'normal', 'phpcss' => array('P' => true)));
     }
 }
Beispiel #8
0
// $Id: signup.php,v 1.56 2007/08/17 19:09:21 nicolasconnault Exp $
require_once '../config.php';
// kowy - use new wizard instead
//require_once('signup_form.php');
require_once 'signup_form_su.php';
if (empty($CFG->registerauth)) {
    error("Sorry, you may not use this page.");
}
$authplugin = get_auth_plugin($CFG->registerauth);
if (!$authplugin->can_signup()) {
    error("Sorry, you may not use this page.");
}
//HTTPS is potentially required in this page
httpsrequired();
$mform_signup = new HTML_QuickForm_Controller('newuserWizard', true);
$mform_signup->addPage(new WizardStepOne());
$mform_signup->addPage(new WizardStepTwo());
$mform_signup->addPage(new WizardStepThree());
$mform_signup->addPage(new WizardStepFour());
$mform_signup->addPage(new WizardStepFive());
$mform_signup->addPage(new WizardStepSix());
$mform_signup->addPage(new WizardStepSeven());
// read values from the previous step
$mform_signup->setDefaults($mform_signup->exportValues());
$mform_signup->addAction('display', new ActionDisplay());
$mform_signup->addAction('process', new ActionProcess());
//    if ($mform_signup->is_cancelled()) {
//        redirect($CFG->httpswwwroot.'/login/index.php');
//
//    } else if ($user = $mform_signup->get_data()) {