Example #1
0
 /**
  * displayAddForm
  *
  * Displays the form for adding an address.
  *
  * @return void
  */
 function displayAddForm()
 {
     $country_list = buildCountryList();
     $selected = getDefaultCountry();
     $country_options = buildHtmlSelectOptions($country_list, $selected);
     $validator = new FormValidator();
     // TODO
     // Make this a removable alert message (part of Alerts table)
     echo '
         <form id="addressbook_form" action="addressbook.php" method="post">
             <p class="info-alert">
                 ' . T_('Please only add addresses for Non-members. Anyone who is a member of this website must add/update their own address.') . '
             </p>
             <fieldset>
                 <legend><span>' . T_('Add Address') . '</span></legend>
                 <div class="field-row">
                     <div class="field-label"><label for="fname"><b>' . T_('First Name') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="fname" id="fname" size="25"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="lname"><b>' . T_('Last Name') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="lname" id="lname" size="25"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="email"><b>' . T_('Email') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="email" id="email" size="50"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="country"><b>' . T_('Country') . '</b></label></div>
                     <div class="field-widget">
                         <select name="country" id="country">
                             <option></option>
                             <option value="US">' . T_('UNITED STATES') . '</option>
                             <option>------</option>
                             ' . $country_options . '
                         </select>
                     </div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="address"><b>' . T_('Street Address') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="address" id="address" size="25"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="city"><b>' . T_('City') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="city" id="city" size="50"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="state"><b>' . T_('State') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="state" id="state" size="50"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="zip"><b>' . T_('Zip Code') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="zip" id="zip" size="10"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="home"><b>' . T_('Home Phone') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="home" id="home" size="20"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="work"><b>' . T_('Work Phone') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="work" id="work" size="20"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="cell"><b>' . T_('Cell Phone') . '</b></label></div>
                     <div class="field-widget"><input class="frm_text" type="text" name="cell" id="cell" size="20"/></div>
                 </div>
                 <div class="field-row">
                     <div class="field-label"><label for="private"><b>' . T_('Private') . '</b></label></div>
                     <div class="field-widget"><input type="checkbox" name="private" id="private"/></div>
                 </div>
                 <p>
                     <input class="sub1" type="submit" name="addsubmit" value="' . T_('Add') . '"/> 
                     ' . T_('or') . ' 
                     <a href="addressbook.php">' . T_('Cancel') . '</a>
                 </p>
             </fieldset>
             ' . $validator->getJsValidation($this->getProfile('add')) . '
         </form>';
 }
Example #2
0
 /**
  * displayCreateUserForm 
  * 
  * Displays the form for creating a new user to be added to the family tree
  * 
  * @param string $type 
  * @param int    $userId 
  * 
  * @return void
  */
 function displayCreateUserForm($type, $userId)
 {
     $userId = (int) $userId;
     $displayname = getUserDisplayName($userId, 2);
     switch ($type) {
         case 'father':
             $sex = 'M';
             $legend = sprintf(T_('Add New Father for %s'), $displayname);
             $options = $this->getAddFatherMotherAdditionalOptions($userId, $type);
             break;
         case 'mother':
             $sex = 'F';
             $legend = sprintf(T_('Add New Mother for %s'), $displayname);
             $options = $this->getAddFatherMotherAdditionalOptions($userId, $type);
             break;
         case 'brother':
             $sex = 'M';
             $legend = sprintf(T_('Add New Brother for %s'), $displayname);
             $options = $this->getAddBrotherSisterAdditionalOptions($userId);
             break;
         case 'sister':
             $sex = 'F';
             $legend = sprintf(T_('Add New Sister for %s'), $displayname);
             $options = $this->getAddBrotherSisterAdditionalOptions($userId);
             break;
         case 'spouse':
             $sex = '?';
             $legend = sprintf(T_('Add New Spouse for %s'), $displayname);
             $options = $this->getAddSpouseAdditionalOptions($userId);
             break;
         case 'child':
             $sex = '?';
             $legend = sprintf(T_('Add New Child for %s'), $displayname);
             $options = $this->getAddChildAdditionalOptions($userId);
             break;
         default:
             echo '
         <div class="error-alert">' . T_('Invalid Display Type') . '</div>';
             return;
     }
     if ($options === false) {
         $this->fcmsError->displayError();
         return;
     }
     $dayList = array();
     $i = 1;
     while ($i <= 31) {
         $dayList[$i] = $i;
         $i++;
     }
     $monthList = array();
     $i = 1;
     while ($i <= 12) {
         $monthList[$i] = getMonthAbbr($i);
         $i++;
     }
     $validator = new FormValidator();
     echo '
     <form action="familytree.php?create=submit" method="post">
         <fieldset class="relationship-form">
             <legend><span>' . $legend . '</span></legend>
             <div class="cols">
                 <div>
                     <label for="fname"><b>' . T_('First Name') . '</b></label><br/>
                     <input class="frm_text" type="text" name="fname" id="fname" size="25"/>
                 </div>
                 <div>
                     <label for="mname"><b>' . T_('Middle Name') . '</b></label><br/>
                     <input class="frm_text" type="text" name="mname" id="mname" size="25"/>
                 </div>
                 <div>
                     <label for="lname"><b>' . T_('Last Name') . '</b></label><br/>
                     <input class="frm_text" type="text" name="lname" id="lname" size="25"/>
                 </div>
             </div>';
     // don't show maiden name unless it's needed
     if ($sex == 'F' || $sex == '?') {
         echo '
             <p class="maiden-name">
                 <label for="maiden"><b>' . T_('Maiden Name') . '</b></label><br/>
                 <input class="frm_text" type="text" name="maiden" id="maiden" size="25"/>
             </p>';
     }
     // We don't know the sex of the child or spouse, but we do for all other relationships
     if ($sex === '?') {
         echo '
             <p>
                 <label><b>' . T_('Sex') . '</b></label><br/>
                 <select id="sex" name="sex">
                     ' . buildHtmlSelectOptions(array('M' => T_('Male'), 'F' => T_('Female')), '-1') . '
                 </select>
             </p>';
     } else {
         echo '<div><input type="hidden" id="sex" name="sex" value="' . $sex . '"/></div>';
     }
     echo '
             <p id="living_deceased" style="display:none;">
                 <label for="living_option" class="radio_label">
                     <input type="radio" id="living_option" name="living_deceased_options" checked="checked" value="1"/>
                     ' . T_('Living') . '
                 </label>
                 &nbsp; &nbsp; &nbsp;
                 <label for="deceased_option" class="radio_label">
                     <input type="radio" id="deceased_option" name="living_deceased_options" value="1"/>
                     ' . T_('Deceased') . '
                 </label>
             </p>
             <div class="dob_dod">
                 <div class="half">
                     <label for="day"><b>' . T_('Birthday') . '</b></label><br/>
                     <select id="bday" name="bday">
                         <option value="">' . T_('Day') . '</option>
                         ' . buildHtmlSelectOptions($dayList, "") . '
                     </select>
                     <select id="bmonth" name="bmonth">
                         <option value="">' . T_('Month') . '</option>
                         ' . buildHtmlSelectOptions($monthList, "") . '
                     </select>
                     <input class="frm_text" type="text" name="byear" id="byear" size="5" maxlength="4" placeholder="' . T_('Year') . '"/>
                 </div>
                 <div id="deceased" class="half">
                     <label for="day"><b>' . T_('Date Deceased') . '</b></label><br/>
                     <select id="dday" name="dday">
                         <option value="">' . T_('Day') . '</option>
                         ' . buildHtmlSelectOptions($dayList, "") . '
                     </select>
                     <select id="dmonth" name="dmonth">
                         <option value="">' . T_('Month') . '</option>
                         ' . buildHtmlSelectOptions($monthList, "") . '
                     </select>
                     <input class="frm_text" type="text" name="dyear" id="dyear" size="5" maxlength="4" placeholder="' . T_('Year') . '"/>
                 </div>
             </div>
             ' . $options . '
             ' . $validator->getJsValidation($this->getProfile('create')) . '
             <p>
                 <input type="hidden" id="id" name="id" value="' . $userId . '"/>
                 <input type="hidden" id="type" name="type" value="' . cleanOutput($type) . '"/>
                 <input class="sub1" type="submit" id="submit" name="submit" value="' . T_('Add') . '"/> &nbsp;
                 <a href="familytree.php?view=' . $this->currentTreeUserId . '">' . T_('Cancel') . '</a>
             </p>
         </fieldset>
     </form>';
 }