Ejemplo n.º 1
0
reason_include_once('classes/session_php.php');
include_once DISCO_INC . 'controller.php';
if (!carl_is_php5()) {
    echo '<p>Sorry this requires php 5 for now</p>';
    die;
}
// Require that whomever is using the form have access.
reason_require_authentication('', 'session');
// Include all of the forms.
reason_include_once('scripts/developer_tools/page_type_wizard/SelectForm.php');
reason_include_once('scripts/developer_tools/page_type_wizard/EditForm.php');
reason_include_once('scripts/developer_tools/page_type_wizard/FormatForm.php');
//Initialize the controller and set a few options.
$controller = new FormController();
$controller->set_session_class('Session_PHP');
$controller->set_session_name('REASON_SESSION');
$controller->set_data_context('page_type_wizard');
$controller->show_back_button = true;
$controller->clear_form_data_on_finish = false;
$controller->allow_arbitrary_start = false;
// Set up the progression of forms.
$forms = array('SelectForm' => array('start_step' => true, 'next_steps' => array('EditForm' => array('label' => 'Select this page type')), 'step_decision' => array('type' => 'user')), 'EditForm' => array('next_steps' => array('FormatForm' => array('label' => 'Next')), 'step_decision' => array('type' => 'user')), 'FormatForm' => array('final_step' => array('label' => 'export')));
// Add, init, and run the forms.
$controller->add_forms($forms);
$controller->init();
//$controller->set_request( $_REQUEST );
$controller->run();
?>
</body>
</html>
Ejemplo n.º 2
0
 function run()
 {
     $nametag = $this->admin_page->user_id;
     $face = $this->admin_page->authenticated_user_id;
     if (empty($_REQUEST['site_id'])) {
         echo "Please select a site to get started.";
         return;
     }
     if (!empty($_REQUEST['newsletterIsFinished'])) {
         echo "<h1>Newsletter sent!</h1>";
         echo "<h2>Process complete.<h2>";
         echo '<p><a href="' . $this->admin_page->make_link(array('newsletterIsFinished' => '')) . '">Send another newsletter</a></p>' . "\n";
         return;
     }
     $controller = new FormController();
     $controller->set_session_class('Session_PHP');
     $controller->set_session_name('REASON_SESSION');
     $controller->set_data_context('newsletter_maker_' . $this->admin_page->site_id);
     $controller->show_back_button = true;
     $controller->clear_form_data_on_finish = true;
     $controller->allow_arbitrary_start = false;
     $controller->authenticated_user_id = $face;
     $controller->user_id = $face;
     if ($nametag != $face) {
         if (reason_user_has_privs($face, 'pose_as_other_user')) {
             $controller->user_id = $nametag;
         }
     }
     // Set up the progression of forms.
     $forms = array('SelectIncludes' => array('start_step' => true, 'next_steps' => array('SelectItems' => array('label' => 'Continue')), 'step_decision' => array('type' => 'user')), 'SelectItems' => array('next_steps' => array('SelectTemplate' => array('label' => 'Continue')), 'step_decision' => array('type' => 'user')), 'SelectTemplate' => array('next_steps' => array('EditNewsletter' => array('label' => 'Continue')), 'step_decision' => array('type' => 'user')), 'EditNewsletter' => array('next_steps' => array('ComposeEmail' => array('label' => 'Continue')), 'step_decision' => array('type' => 'user')), 'ComposeEmail' => array('final_step' => true));
     // Add, init, and run the forms.
     $controller->add_forms($forms);
     $controller->init();
     $controller->preserve_query_string = true;
     $controller->run();
 }