コード例 #1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create the form
     $this->frm = new FrontendForm('unsubscribe', null, null, 'unsubscribeForm');
     // create & add elements
     $this->frm->addText('email');
 }
コード例 #2
0
ファイル: login.php プロジェクト: naujasdizainas/forkcms
 /**
  * Load the form.
  */
 private function loadForm()
 {
     $this->frm = new FrontendForm('login', null, null, 'loginForm');
     $this->frm->addText('email');
     $this->frm->addPassword('password');
     $this->frm->addCheckbox('remember', true);
 }
コード例 #3
0
 /**
  * Load the form.
  */
 private function loadForm()
 {
     $this->frm = new FrontendForm('register', null, null, 'registerForm');
     $this->frm->addText('email');
     $this->frm->addPassword('password', null, null, 'inputText showPasswordInput');
     $this->frm->addCheckbox('show_password');
 }
コード例 #4
0
 /**
  * Load the form
  *
  * @return	void
  */
 private function loadForm()
 {
     // create the form
     $this->frm = new FrontendForm('forgotPassword', null, null, 'forgotPasswordForm');
     // create & add elements
     $this->frm->addText('email');
 }
コード例 #5
0
 /**
  * Load the form.
  *
  * @return	void
  */
 private function loadForm()
 {
     // create the form
     $this->frm = new FrontendForm('updateEmail', null, null, 'updateEmailForm');
     // create & add elements
     $this->frm->addPassword('password');
     $this->frm->addText('email', $this->profile->getEmail());
 }
コード例 #6
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new FrontendForm('own_question', '#' . FL::getAction('OwnQuestion'));
     $this->frm->addText('name')->setAttribute('placeholder', FL::getLabel('YourName'));
     $this->frm->addText('email')->setAttribute('placeholder', FL::getLabel('YourEmail'));
     $this->frm->addTextarea('message')->setAttribute('placeholder', FL::getLabel('YourQuestion'));
 }
コード例 #7
0
ファイル: detail.php プロジェクト: naujasdizainas/forkcms
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new FrontendForm('commentsForm');
     $this->frm->setAction($this->frm->getAction() . '#' . FL::act('Comment'));
     // init vars
     $author = SpoonCookie::exists('comment_author') ? SpoonCookie::get('comment_author') : null;
     $email = SpoonCookie::exists('comment_email') ? SpoonCookie::get('comment_email') : null;
     $website = SpoonCookie::exists('comment_website') ? SpoonCookie::get('comment_website') : 'http://';
     // create elements
     $this->frm->addText('author', $author);
     $this->frm->addText('email', $email);
     $this->frm->addText('website', $website, null);
     $this->frm->addTextarea('message');
 }
コード例 #8
0
 /**
  * Load the form.
  *
  * @return	void
  */
 private function loadForm()
 {
     // gender dropdown values
     $genderValues = array('male' => ucfirst(FL::getLabel('Male')), 'female' => ucfirst(FL::getLabel('Female')));
     // birthdate dropdown values
     $days = range(1, 31);
     $months = SpoonLocale::getMonths(FRONTEND_LANGUAGE);
     $years = range(date('Y'), 1900);
     // get settings
     $birthDate = $this->profile->getSetting('birth_date');
     $nameChanges = (int) $this->profile->getSetting('display_name_changes');
     // get day, month and year
     if ($birthDate) {
         list($birthYear, $birthMonth, $birthDay) = explode('-', $birthDate);
     } else {
         $birthDay = '';
         $birthMonth = '';
         $birthYear = '';
     }
     // create the form
     $this->frm = new FrontendForm('updateSettings', null, null, 'updateSettingsForm');
     // create & add elements
     $this->frm->addImage('avatar');
     $this->frm->addText('display_name', $this->profile->getDisplayName());
     $this->frm->addText('first_name', $this->profile->getSetting('first_name'));
     $this->frm->addText('last_name', $this->profile->getSetting('last_name'));
     $this->frm->addText('email', $this->profile->getEmail());
     $this->frm->addText('city', $this->profile->getSetting('city'));
     $this->frm->addDropdown('country', SpoonLocale::getCountries(FRONTEND_LANGUAGE), $this->profile->getSetting('country'));
     $this->frm->addDropdown('gender', $genderValues, $this->profile->getSetting('gender'));
     $this->frm->addDropdown('day', array_combine($days, $days), $birthDay);
     $this->frm->addDropdown('month', $months, $birthMonth);
     $this->frm->addDropdown('year', array_combine($years, $years), (int) $birthYear);
     // set default elements dropdowns
     $this->frm->getField('gender')->setDefaultElement('');
     $this->frm->getField('day')->setDefaultElement('');
     $this->frm->getField('month')->setDefaultElement('');
     $this->frm->getField('year')->setDefaultElement('');
     $this->frm->getField('country')->setDefaultElement('');
     // set email disabled
     $this->frm->getField('email')->setAttribute('disabled', 'disabled');
     // when user exceeded the number of name changes set field disabled
     if ($nameChanges >= FrontendProfilesModel::MAX_DISPLAY_NAME_CHANGES) {
         $this->frm->getField('display_name')->setAttribute('disabled', 'disabled');
     }
 }
コード例 #9
0
ファイル: form.php プロジェクト: naujasdizainas/forkcms
 /**
  * Load the form.
  */
 private function loadForm()
 {
     // create form
     $this->frm = new FrontendForm('form' . $this->item['id']);
     // exists and has fields
     if (!empty($this->item) && !empty($this->item['fields'])) {
         // loop fields
         foreach ($this->item['fields'] as $field) {
             // init
             $item['name'] = 'field' . $field['id'];
             $item['type'] = $field['type'];
             $item['label'] = isset($field['settings']['label']) ? $field['settings']['label'] : '';
             $item['required'] = isset($field['validations']['required']);
             $item['html'] = '';
             // form values
             $values = isset($field['settings']['values']) ? $field['settings']['values'] : null;
             $defaultValues = isset($field['settings']['default_values']) ? $field['settings']['default_values'] : null;
             // dropdown
             if ($field['type'] == 'dropdown') {
                 // values and labels are the same
                 $values = array_combine($values, $values);
                 // get index of selected item
                 $defaultIndex = array_search($defaultValues, $values, true);
                 if ($defaultIndex === false) {
                     $defaultIndex = null;
                 }
                 // create element
                 $ddm = $this->frm->addDropdown($item['name'], $values, $defaultIndex);
                 // empty default element
                 $ddm->setDefaultElement('');
                 // get content
                 $item['html'] = $ddm->parse();
             } elseif ($field['type'] == 'radiobutton') {
                 // reset
                 $newValues = array();
                 // rebuild values
                 foreach ($values as $value) {
                     $newValues[] = array('label' => $value, 'value' => $value);
                 }
                 // create element
                 $rbt = $this->frm->addRadiobutton($item['name'], $newValues, $defaultValues);
                 // get content
                 $item['html'] = $rbt->parse();
             } elseif ($field['type'] == 'checkbox') {
                 // reset
                 $newValues = array();
                 // rebuild values
                 foreach ($values as $value) {
                     $newValues[] = array('label' => $value, 'value' => $value);
                 }
                 // create element
                 $chk = $this->frm->addMultiCheckbox($item['name'], $newValues, $defaultValues);
                 // get content
                 $item['html'] = $chk->parse();
             } elseif ($field['type'] == 'textbox') {
                 // create element
                 $txt = $this->frm->addText($item['name'], $defaultValues);
                 // get content
                 $item['html'] = $txt->parse();
             } elseif ($field['type'] == 'textarea') {
                 // create element
                 $txt = $this->frm->addTextarea($item['name'], $defaultValues);
                 $txt->setAttribute('cols', 30);
                 // get content
                 $item['html'] = $txt->parse();
             } elseif ($field['type'] == 'heading') {
                 $item['html'] = '<h3>' . $values . '</h3>';
             } elseif ($field['type'] == 'paragraph') {
                 $item['html'] = $values;
             } elseif ($field['type'] == 'submit') {
                 $item['html'] = $values;
             }
             // add to list
             $this->fieldsHTML[] = $item;
         }
     }
 }
コード例 #10
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->frm = new FrontendForm('forgotPassword', null, null, 'forgotPasswordForm');
     $this->frm->addText('email');
 }
コード例 #11
0
 /**
  * Load the form.
  */
 private function loadForm()
 {
     $this->frm = new FrontendForm('updateEmail', null, null, 'updateEmailForm');
     $this->frm->addPassword('password');
     $this->frm->addText('email', $this->profile->getEmail());
 }