Beispiel #1
0
 private function createQuestions($step, $questions)
 {
     // Takes a multi-dimensional array eg:
     // $q[0]['question'] = "May we collect anonymous usage statistics?";
     // $q[0]['type'] = _CHECKBOX;
     // $q[0]['default'] = true;
     $formFields = array();
     foreach ($questions as $qnum => $question) {
         $title = $step < 80 ? __('Question %d of Step %s', $qnum + 1, $step) : $question['title'];
         if ($question['type'] == _INPUTBOX) {
             $formFields[] = FormManager::AddText($step . '-' . $qnum, $title, $question['default'], $question['question'], 'q');
         } elseif ($question['type'] == _PASSWORD) {
             $formFields[] = FormManager::AddPassword($step . '-' . $qnum, $title, $question['default'], $question['question'], 'q');
         } elseif ($question['type'] == _CHECKBOX) {
             $formFields[] = FormManager::AddCheckbox($step . '-' . $qnum, $title, $question['default'] ? 1 : 0, $question['question'], 'q');
         }
     }
     return $formFields;
 }
Beispiel #2
0
 public function Step4()
 {
     // Form to collect an admin user account and password.
     $formFields = array();
     $formFields[] = FormManager::AddHidden('step', 5);
     $formFields[] = FormManager::AddMessage(sprintf(__("%s needs an administrator user account to be the first user account that has access to the CMS. Please enter your chosen details below."), Theme::GetConfig('app_name')));
     // User name and password
     $formFields[] = FormManager::AddText('admin_username', __('Admin Username'), NULL, __('Please enter a user name for the first administrator account.'), 'n');
     $formFields[] = FormManager::AddPassword('admin_password', __('Admin Password'), NULL, __('Please enter a password for this user. This user will have full access to the system'), 'p');
     // Put up an error message if one has been set (and then unset it)
     if ($this->errorMessage != '') {
         Theme::Set('message', $this->errorMessage);
         Theme::Set('prepend', Theme::RenderReturn('message_box'));
         $this->errorMessage == '';
     }
     // Return a rendered form
     Theme::Set('form_action', 'install.php');
     Theme::Set('form_fields', $formFields);
     Theme::Set('form_buttons', array(FormManager::AddButton(__('Next'))));
     return Theme::RenderReturn('form_render');
 }
Beispiel #3
0
 /**
  * Change my password form
  */
 public function SetPasswordForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $userId = Kit::GetParam('userid', _GET, _INT);
     // Set some information about the form
     Theme::Set('form_id', 'SetPasswordForm');
     Theme::Set('form_action', 'index.php?p=user&q=SetPassword');
     Theme::Set('form_meta', '<input type="hidden" name="UserId" value="' . $userId . '" />');
     $formFields = array();
     $formFields[] = FormManager::AddPassword('newPassword', __('New Password'), NULL, __('The new Password for this user.'), 'p', 'required');
     $formFields[] = FormManager::AddPassword('retypeNewPassword', __('Retype New Password'), NULL, __('Repeat the new Password for this user.'), 'r', 'required');
     Theme::Set('form_fields', $formFields);
     $response->SetFormRequestResponse(NULL, __('Set Password'), '450', '300');
     $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('User', 'SetPassword') . '")');
     $response->AddButton(__('Close'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#SetPasswordForm").submit()');
     $response->Respond();
 }