示例#1
0
} elseif (!$sub && $uid) {
    // Fetch the user data for $uid if there is no submitted data
    // and the user is authenticated.
    $udm->getUser($uid);
}
/* Now Output the Form.

   Any necessary changes to the form should have been registered
   before now, including any error messages, notices, or
   complete form overhauls. This can happen either within the
   $udm object, or from print() or echo() statements.

   By default, the form will include AMP's base template code,
   and any database-backed intro text to the appropriate module.

*/
$mod_id = $udm->modTemplateID;
//require_once( 'header.php' );
require_once 'AMP/Content/Buffer.php';
require_once 'AMP/System/Page/Display.php';
$page_output = "<h2>Add/Edit " . $udm->name . "</h2>" . "<font color = \"red\">" . $udm->outputErrors() . "</font>" . $udm->output();
$display = new AMP_Content_Buffer();
$display->add($page_output);
$flash = AMP_System_Flash::instance();
$fake_controller = $flash;
$complete_page =& AMP_System_Page_Display::instance($fake_controller);
$complete_page->add($flash, AMP_CONTENT_DISPLAY_KEY_FLASH);
$complete_page->add($display);
print $complete_page->execute();
// Append the footer and clean up.
//require_once( 'footer.php' );
示例#2
0
    $pid = Petition::findByModin($modin);
}
$current_petition->read($pid);
if ($current_petition->id) {
    // Fetch the form instance specified by submitted modin value.
    $udm = new UserDataInput($dbcon, $current_petition->getFormId());
    // Was data submitted via the web?
    $sub = isset($_REQUEST['btnUdmSubmit']) && $_REQUEST['btnUdmSubmit'];
    //OUTPUT THE PAGE
    echo $current_petition->progressBox();
    // Fetch or save user data.
    if ($udm->submitted) {
        // Save only if submitted data is present, and the user is
        // authenticated, or if the submission is anonymous (i.e., !$uid)
        $save_success = $udm->saveUser();
        echo $udm->output();
        if ($save_success) {
            echo $current_petition->petition_signers();
        }
    }
    if (isset($_REQUEST['signers']) && $_REQUEST['signers']) {
        echo $current_petition->petition_signers();
    }
    if (!$_REQUEST['btnUdmSubmit'] and !$_REQUEST["signers"] and !$_REQUEST["uid"]) {
        echo $current_petition->intro_text();
        echo $current_petition->signature_link();
        echo '<p class="title">Sign Petition</p>';
        print $udm->output();
    }
} else {
    echo $current_petition->petitionlist();
示例#3
0
$modidselect = $dbcon->Execute("SELECT id from modules where userdatamodid=" . $dbcon->qstr( $modin ) )
 or die( "Couldn't get module information: " . $dbcon->ErrorMsg() );

$modid = $modidselect->Fields("id");
*/
// Fetch the form instance specified by submitted modin value.
$udm = new UserDataInput($dbcon, $modin, true);
$udm->doPlugin("QuickForm", "BuildAdmin");
$mod_id = $udm->modTemplateID;
// Was data submitted via the web?
$sub = isset($_REQUEST['btnUdmSubmit']) && $_REQUEST['btnUdmSubmit'];
// Fetch or save user data.
if ($sub) {
    $udm->doPlugin('AMPsystem', 'Save');
    ampredirect(AMP_url_update($_SERVER['PHP_SELF'], array('modin' => $modin)));
}
/* Now Output the Form.

   Any necessary changes to the form should have been registered
   before now, including any error messages, notices, or
   complete form overhauls. This can happen either within the
   $udm object, or from print() or echo() statements.

   By default, the form will include AMP's base template code,
   and any database-backed intro text to the appropriate module.

*/
include "header.php";
print "<h2>Add/Edit " . $udm->name . " Form</h2>";
print $udm->output();
include "footer.php";
示例#4
0
$udm = new UserDataInput(AMP_dbcon(), 20);
$udm->getUser($AMP_Authen_Handler->getUserId());
// Hide fields that should be present on the signup form, but not on the edit form
// Custom1 = username
// Custom2 = password
// remember users email field so we can use it later when we save
$email = $udm->fields['Email'];
// Remove non-editable fields so that they don't display on the form
$non_editable_fields = array('custom1', 'custom2', 'Email');
foreach ($non_editable_fields as $field_name) {
    unset($udm->fields[$field_name]);
}
// if there is POST data, save and redirect back to self.
if (isset($_POST['btnUdmSubmit'])) {
    // add email field back in so DIA syncing works
    if (empty($udm->fields['Email'])) {
        $udm->fields['Email'] = $email;
        //add the email back in the post so that the udm save function doesn't throw a validation error.
        $_POST['Email'] = $email['value'];
    }
    $udm->saveUser();
    AMP_flashMessage('Profile Updated');
    AMP_redirect('profile.php');
}
//BaseModuleIntro uses this local variable to decide what intro text to display for this page.
//$intro_id = $udm->modTemplateID;
$intro_id = AMP_CONTENT_EDIT_PROFILE_INTROTEXT_ID;
AMP_directDisplay('<div id="' . sprintf(AMP_UDM_FORM_CONTAINER, 20) . '">' . $udm->output() . '</div>');
require_once 'AMP/BaseTemplate.php';
require_once 'AMP/BaseModuleIntro.php';
require_once 'AMP/BaseFooter.php';
示例#5
0
 function _build_preview()
 {
     $udm_copy = new UserDataInput($this->dbcon, $this->udm->instance, true);
     $udm_copy->form = null;
     $udm_copy->showForm = true;
     $html = $udm_copy->output('html');
     preg_replace("/<[^>]*form[^>]*>/", "", $html);
     $this->fields['preview'] = array('tab' => array('type' => 'header', 'values' => 'Preview'), 'rendered' => array('type' => 'static', 'values' => $html));
     $this->_build_form($this->fields['preview'], 'preview');
 }
示例#6
0
if ($uid) {
    // Set authentication token if uid present
    $auth = $udm->authenticate($uid, $otp);
}
// Fetch or save user data.
if ((!$uid || $auth) && $udm->submitted) {
    // Save only if submitted data is present, and the user is
    // authenticated, or if the submission is anonymous (i.e., !$uid)
    $udm->saveUser();
} elseif ($uid && $auth && !$udm->submitted) {
    // Fetch the user data for $uid if there is no submitted data
    // and the user is authenticated.
    $udm->getUser($uid);
}
/* Now Output the Form.

   Any necessary changes to the form should have been registered
   before now, including any error messages, notices, or
   complete form overhauls. This can happen either within the
   $udm object, or from print() or echo() statements.

   By default, the form will include AMP's base template code,
   and any database-backed intro text to the appropriate module.

*/
$intro_id = $udm->modTemplateID;
AMP_directDisplay($udm->output());
require_once 'AMP/BaseTemplate.php';
require_once 'AMP/BaseModuleIntro.php';
// Append the footer and clean up.
require_once 'AMP/BaseFooter.php';