Exemplo n.º 1
0
 /**
  * Edit Miscellaneous data
  * @param bool $creating - creating a new user
  * @param bool $reDisplay - re-display after update
  * @return string/bool - edit screen or true on save and not re-display
  */
 public function userMisc($creating = false, $reDisplay = false)
 {
     // Form elements
     $form = new sfc\Form(SSP_Path(), $this->cfg->userMiscTable, "userMisc");
     $form->errorAutoFormDisplay = false;
     $mainContent = array();
     if ($creating) {
         $mainContent["title"] = "Miscellaneous information";
     } else {
         $mainContent["title"] = "Edit info";
     }
     $form->tpl = $this->tpl($mainContent, $creating);
     if ($this->subTpl != "") {
         $form->tplf = $this->subTpl;
     } else {
         $form->tplf = "changemisc.tpl";
     }
     $form->fe('text', "Title", "Title (Mr/Mrs/Mz/Dr/Prof.)");
     $form->fep("width=10");
     $form->fe('text', "FirstName", "First Name");
     $form->fep("width=30,required=true");
     $form->fe('text', "Initials", "Initials");
     $form->fep("width=5");
     $form->fe('text', "FamilyName", "Family  Name", 30);
     $form->fep("width=30,required=true");
     $form->fe('textarea', "Address", "Address");
     $form->fep("width=30,lines=5");
     $form->fe('text', "TownCity", "Town or City");
     $form->fep("width=20");
     $form->fe('text', "PostCode", "Post Code");
     $form->fep("width=10, maxLength=10, maxChar=10");
     $form->fe('text', "County", "County");
     $form->fep("width=30");
     if ($creating) {
         $form->fe("submit", "submit", "Next");
     } else {
         $form->fe("submit", "submit", "Save");
     }
     $return = '';
     if ($form->processForm($_POST)) {
         if (!$form->error) {
             // update database
             $query = $form->querySave(true);
             $where = array("UserId" => $this->id);
             $this->db->update($this->cfg->userMiscTable, $form->saveFields, $where, "SSP user admin: Saving misc member data");
             if ($reDisplay) {
                 $form->tda("saved");
                 $return = $form->create(true);
             } else {
                 $return = true;
             }
         } else {
             $return = $form->create(true);
         }
     } else {
         $query = $form->querySelect();
         $where = array("UserId" => $this->id);
         $dataUpdate = $this->db->get($this->cfg->userMiscTable, $where, "SSP user admin: Getting User Misc data for update");
         $form->data = get_object_vars($dataUpdate);
         $return = $form->create(true);
     }
     return $return;
 }
Exemplo n.º 2
0
 /**
  * Change advanced admin configuration
  * @return bool - true on success
  */
 public function changeAdmin()
 {
     $checkData = array('0', '1');
     $form = new sfc\Form(SSP_Path(), $this->cfg->userTable, "changeAdmin");
     $form->tpl = $this->tpl(array("title" => "Change advanced information"));
     $form->addPlaceholder = $this->addPlaceholder;
     $form->tplf = "changeadmin.tpl";
     $form->fe("check", "UserIpCheck", "Check user IP for logon and session", $checkData);
     $form->fe("text", "UserIp", "User IP address", "Users Ip address");
     $form->fep("maxChar=255, maxLength=255");
     $form->fe("select", "UserAccess", "User Access rights", $this->cfg->userAccessTypeDropdown);
     $form->fe("check", "UserDisabled", "User Disabled", $checkData);
     $form->fe("check", "UserPending", "User Pending program enable", $checkData);
     $form->fe("check", "UserAdminPending", "User waiting admin vetting", $checkData);
     $form->fe("check", "CreationFinished", "User creation finished", $checkData);
     $form->fe("check", "UserWaiting", "Waiting for user to act on email", $checkData);
     $result = "";
     if ($form->processForm($_POST)) {
         if (!$form->error) {
             // Submit changed data
             $query = $form->querySave();
             $this->updateUser($form->saveFields, "SSP Admin: Updating user advanced information");
             $form->tda("saved");
             $result = $form->create(true);
         }
     } else {
         // get old data
         $form->querySelect();
         $form->data = get_object_vars($this->getUser($form->selectFields, "SSP Admin: Getting advanced user data for change"));
         $result = $form->create(true);
     }
     return $result;
 }
Exemplo n.º 3
0
if ($form->processForm($_POST)) {
    if (!$form->error and $form->previewSave) {
        echo $form->create(true);
        echo "<p>Form submitted</p>";
        echo "<pre>";
        var_dump($_POST);
        echo "</pre>";
        $form->whereCondition = "id = ?";
        $form->whereValues = array("asdlkjflka");
        $result1 = $form->querySelect();
        echo "Select query for form";
        echo "<pre>";
        var_dump($result1);
        echo "</pre>";
        $form->alsoAdd = array("id" => "asdlkjflka");
        $result2 = $form->querySave();
        echo "Insert query for form";
        echo "<pre>";
        var_dump($result2);
        echo "</pre>";
        $result3 = $form->querySave(true);
        echo "Update query for form";
        echo "<pre>";
        var_dump($result3);
        echo "</pre>";
    }
} else {
    echo $form->create();
}
echo "<pre>";
// var_dump($form);