Пример #1
0
 function showJoinForm()
 {
     //echoDbg( $this -> aValues );exit;
     $aFormAttrs = array('id' => 'join_form', 'onsubmit' => 'return validateJoinForm(this);');
     $aTableAttrs = array('id' => 'join_form_table');
     $aFormParams = array('hidden' => $this->genHiddenFieldsArray());
     $aTableParams = array('double' => $this->bCoupleEnabled, 'second_enabled' => $this->bCouple);
     $aTableParams['headers'] = array('', _t('_First Person'), _t('_Second Person'));
     $aTableParams['headers_add'] = 'class="header form_second_col"' . ($this->bCouple ? '' : ' style="display: none;"');
     $aButtons = array(array('type' => 'submit', 'value' => _t('_Submit'), 'class' => 'input_submit'));
     /* @var $oForm BxTemplFormView */
     $oForm = new BxTemplFormView('join_form');
     $oForm->begin($aFormAttrs, $aTableAttrs, $aFormParams, $aTableParams);
     $aBlocks = $this->oPF->aArea[$this->iPage];
     foreach ($aBlocks as $aBlock) {
         $oForm->beginBlock(_t($aBlock['Caption']));
         foreach ($aBlock['Items'] as $aItem) {
             $aCol0 = array();
             $aCol0['Type'] = $aItem['Type'];
             $aCol0['Name'] = $aItem['Type'] == 'system' ? $aItem['Name'] : $aItem['Name'] . '[0]';
             $aCol0['Mandatory'] = $aItem['Mandatory'];
             $aCol0['Control'] = $aItem['Control'];
             $aCol0['Values'] = $aItem['Values'];
             $aCol0['UseLKey'] = $aItem['UseLKey'];
             $aCol0['Caption'] = _t($aItem['Caption']);
             $aCol0['Desc'] = _t($aItem['Desc'], $aItem['Min'], $aItem['Max']);
             if ($aCol0['Desc'] == $aItem['Desc']) {
                 $aCol0['Desc'] = '';
             }
             // set value
             if (isset($this->aValues[0][$aItem['Name']])) {
                 $aCol0['Value'] = $this->aValues[0][$aItem['Name']];
             } elseif ($aItem['Name'] == 'Couple') {
                 $aCol0['Value'] = $this->bCouple;
             }
             // set error
             if (isset($this->aErrors[0][$aItem['Name']])) {
                 $aCol0['Error'] = $this->aErrors[0][$aItem['Name']];
             }
             // check second person's field
             if ($this->bCoupleEnabled and !in_array($aItem['Name'], $this->aCoupleMutualItems)) {
                 $aCol1 = array();
                 $aCol1['Type'] = $aItem['Type'];
                 $aCol1['Name'] = $aItem['Name'] . '[1]';
                 $aCol1['Control'] = $aItem['Control'];
                 $aCol1['Values'] = $aItem['Values'];
                 $aCol1['UseLKey'] = $aItem['UseLKey'];
                 // set value
                 if (isset($this->aValues[1][$aItem['Name']])) {
                     $aCol1['Value'] = $this->aValues[1][$aItem['Name']];
                 }
                 // set error
                 if (isset($this->aErrors[1][$aItem['Name']])) {
                     $aCol1['Error'] = $this->aValues[1][$aItem['Name']];
                 }
                 $oForm->addRow($aCol0, $aCol1);
             } else {
                 $oForm->addRow($aCol0);
             }
         }
         $oForm->endBlock();
     }
     $oForm->end($aButtons);
     echo $oForm->getCode();
     //boonex id
     /* if( getParam( 'enable_get_boonex_id' ) )
     		{
     			global $tmpl;
     			
     			echo "<div class=\"import_boonex_id\">";
     			$action = "boonex";
     			$text = '<div class="boonex_id">' . _t( '_Import BoonEx ID' ) . '</div>';
     			$table       = "Profiles";
     			$login_page  = "{$site['url']}member.php";
     			$join_page   = "{$site['url']}join_form.php";
     			$forgot_page = '';
     			$template    = "{$dir['root']}templates/tmpl_{$tmpl}/join_login_form.html";
     
     			echo LoginForm( $text,$action,$table,$login_page,$forgot_page,$template );
     
     			echo "</div>";
     		} */
 }
Пример #2
0
 function showEditForm($sStatusText)
 {
     //echoDbg( $this -> aValues );exit;
     $aFormAttrs = array('id' => 'edit_form', 'onsubmit' => 'return validateEditForm(this);');
     $aTableAttrs = array('id' => 'edit_form_table', 'action' => $_SERVER['PHP_SELF']);
     $aFormParams = array('hidden' => array('ID' => $this->iProfileID, 'do_submit' => '1'));
     $aTableParams = array('double' => $this->bCouple, 'second_enabled' => $this->bCouple);
     $aTableParams['headers'] = array('', _t('_First Person'), _t('_Second Person'));
     $aTableParams['headers_add'] = 'class="header form_second_col"' . ($this->bCouple ? '' : ' style="display: none;"');
     $aButtons = array(array('type' => 'submit', 'value' => _t('_Save'), 'class' => 'input_submit'));
     /* @var $oForm BxTemplFormView */
     $oForm = new BxTemplFormView('edit_form');
     $oForm->begin($aFormAttrs, $aTableAttrs, $aFormParams, $aTableParams);
     foreach ($this->aBlocks as $aBlock) {
         $oForm->beginBlock(_t($aBlock['Caption']));
         foreach ($aBlock['Items'] as $aItem) {
             $aCol0 = array();
             $aCol0['Type'] = $aItem['Type'];
             $aCol0['Name'] = $aItem['Type'] == 'system' ? $aItem['Name'] : $aItem['Name'] . '[0]';
             $aCol0['Mandatory'] = $aItem['Type'] == 'pass' ? false : $aItem['Mandatory'];
             $aCol0['Control'] = $aItem['Control'];
             $aCol0['Values'] = $aItem['Values'];
             $aCol0['UseLKey'] = $aItem['UseLKey'];
             $aCol0['Caption'] = _t($aItem['Caption']);
             $aCol0['Desc'] = _t($aItem['Desc']);
             if ($aCol0['Desc'] == $aItem['Desc']) {
                 $aCol0['Desc'] = '';
             }
             // set value
             if (isset($this->aValues[0][$aItem['Name']])) {
                 $aCol0['Value'] = $this->aValues[0][$aItem['Name']];
             } elseif ($aItem['Name'] == 'Couple') {
                 $aCol0['Value'] = $this->bCouple;
             }
             // set error
             if (isset($this->aErrors[0][$aItem['Name']])) {
                 $aCol0['Error'] = $this->aErrors[0][$aItem['Name']];
             }
             // check second person's field
             if ($this->bCouple and !in_array($aItem['Name'], $this->aCoupleMutualFields)) {
                 $aCol1 = array();
                 $aCol1['Type'] = $aItem['Type'];
                 $aCol1['Name'] = $aItem['Name'] . '[1]';
                 $aCol1['Control'] = $aItem['Control'];
                 $aCol1['Values'] = $aItem['Values'];
                 $aCol1['UseLKey'] = $aItem['UseLKey'];
                 // set value
                 if (isset($this->aValues[1][$aItem['Name']])) {
                     $aCol1['Value'] = $this->aValues[1][$aItem['Name']];
                 }
                 // set error
                 if (isset($this->aErrors[1][$aItem['Name']])) {
                     $aCol1['Error'] = $this->aValues[1][$aItem['Name']];
                 }
                 //echoDbg( $aCol0 );
                 $oForm->addRow($aCol0, $aCol1);
             } else {
                 $oForm->addRow($aCol0);
             }
         }
         $oForm->endBlock();
     }
     $oForm->end($aButtons);
     if ($sStatusText) {
         echo '<div class="notice_text">' . _t($sStatusText) . "</div>";
     }
     echo $oForm->getCode();
 }