예제 #1
0
     $self = whoami();
     //allowing to build action form
 }
 $form = new UserProfileForm($languages, $allowEditProfile, $allowEditConfirm, $self . '.php');
 unset($user_dataAr['password']);
 $user_dataAr['email'] = $user_dataAr['e_mail'];
 unset($user_dataAr['e_mail']);
 $form->fillWithArrayData($user_dataAr);
 if (!$editUserObj->hasExtra()) {
     // user has no extra, let's display it
     $data = $form->render();
 } else {
     require_once ROOT_DIR . '/include/HtmlLibrary/UserExtraModuleHtmlLib.inc.php';
     // the extra UserExtraForm is needed as well
     require_once ROOT_DIR . '/include/Forms/UserExtraForm.inc.php';
     $extraForm = new UserExtraForm($languages);
     $extraForm->fillWithArrayData($user_dataAr);
     $tabContents = array();
     /**
      * @author giorgio 22/nov/2013
      * Uncomment and edit the below array to have the needed
      * jQuery tabs to be used for user extra data and tables
      */
     // 		$tabsArray = array (
     // 				array (translateFN ("Anagrafica"), $form),
     // 				array (translateFN ("Sample Extra 1:1"), $extraForm),
     // 				array (translateFN ("Sample Extra 1:n"), 'oneToManyDataSample'),
     // 		);
     /**
      * If you want the $extraForm fields embedded in the $form tab instead
      * of being on its own tab, use the following:
예제 #2
0
 */
$editUserObj = null;
switch ($userObj->getType()) {
    case AMA_TYPE_STUDENT:
    case AMA_TYPE_AUTHOR:
        $editUserObj =& $userObj;
        break;
    case AMA_TYPE_SWITCHER:
        $userId = DataValidator::is_uinteger($_POST['id_utente']);
        if ($userId !== false) {
            $editUserObj = MultiPort::findUser($userId);
        }
        break;
}
if (!is_null($editUserObj) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $form = new UserExtraForm($languages);
    $form->fillWithPostData();
    if ($form->isValid()) {
        $editUserObj->setExtras($_POST);
        $result = MultiPort::setUser($editUserObj, array(), true, ADAUser::getExtraTableName());
        if (!AMA_DB::isError($result)) {
            /**
             * Set the session user to the saved one if it's not
             * a switcher, that is not saving its own profile
             */
            if ($userObj->getType() != AMA_TYPE_SWITCHER) {
                $_SESSION['sess_userObj'] = $editUserObj;
            }
            $retArray = array("status" => "OK", "title" => $title, "msg" => translateFN("Scheda salvata"));
        } else {
            $retArray = array("status" => "ERROR", "title" => $title, "msg" => translateFN("Errore nel salvataggio"));