コード例 #1
0
ファイル: User.php プロジェクト: HaldunA/phpwebsite
 public static function searchBox()
 {
     if (SEARCH_DEFAULT) {
         $onclick = sprintf('onclick="if(this.value == \'%s\')this.value = \'\';"', SEARCH_DEFAULT);
     }
     PHPWS_Core::initCoreClass('Form.php');
     $form = new PHPWS_Form('search_box');
     $form->setProtected(false);
     $form->setMethod('get');
     $form->addHidden('module', 'search');
     $form->addHidden('user', 'search');
     $form->addText('search', SEARCH_DEFAULT);
     $form->setLabel('search', dgettext('search', 'Search'));
     if (PHPWS_Settings::get('search', 'show_alternates')) {
         Search_User::addAlternates($form);
     }
     if (isset($onclick)) {
         $form->setExtra('search', $onclick);
     }
     $form->addSubmit('go', dgettext('search', 'Search'));
     $mod_list = Search_User::getModList();
     $form->addSelect('mod_title', $mod_list);
     $key = Key::getCurrent();
     if (!empty($key) && !$key->isDummy()) {
         $form->setMatch('mod_title', $key->module);
     } elseif (isset($_REQUEST['mod_title'])) {
         $form->setMatch('mod_title', $_REQUEST['mod_title']);
     }
     $template = $form->getTemplate();
     $content = PHPWS_Template::process($template, 'search', 'search_box.tpl');
     Layout::add($content, 'search', 'search_box');
 }
コード例 #2
0
ファイル: Checkin_User.php プロジェクト: HaldunA/phpwebsite
 public function checkinForm()
 {
     $form = new PHPWS_Form('checkin');
     $form->turnOffAutoComplete();
     $form->setProtected(false);
     $form->addHidden('module', 'checkin');
     $form->addHidden('uop', 'post_checkin');
     $form->addText('first_name', isset($_POST['first_name']) ? trim($_POST['first_name']) : null);
     $form->setLabel('first_name', dgettext('checkin', 'First name'));
     $form->setRequired('first_name');
     $form->addText('last_name', isset($_POST['last_name']) ? trim($_POST['last_name']) : null);
     $form->setLabel('last_name', dgettext('checkin', 'Last name'));
     $form->setRequired('last_name');
     if (PHPWS_Settings::get('checkin', 'email')) {
         $form->addText('email', isset($_POST['email']) ? trim($_POST['email']) : null);
         $form->setLabel('email', dgettext('checkin', 'Email address'));
         $form->setRequired('email');
     }
     // If gender is requested
     if (PHPWS_Settings::get('checkin', 'gender')) {
         $sex = array('male' => 'Male', 'female' => 'Female');
         $form->addRadioAssoc('gender', $sex);
         $form->addTplTag('GENDER_LABEL', dgettext('checkin', 'Gender'));
     }
     // If birthdate is requested
     if (PHPWS_Settings::get('checkin', 'birthdate')) {
         /*
          * Minimum representable date is 12-13-1901, and instead of doing 
          * lots of math to ensure that all selected dates in 1901 are after
          * 12-13-1901, just make the minimum year always be 1902
          */
         $yearsPrior = date('Y', time()) - 1902;
         // current year - minimum full year (1902)
         $form->dateSelect('birthdate', 0, '%B', $yearsPrior, 0);
         $form->addTplTag('BIRTHDATE_LABEL', dgettext('checkin', 'Date of birth'));
     }
     $reasons = $this->getReasons();
     if (!empty($reasons)) {
         $reasons = array_reverse($reasons, true);
         $reasons[0] = dgettext('checkin', '-- Please choose a reason from the list below --');
         $reasons = array_reverse($reasons, true);
         $form->addSelect('reason_id', $reasons);
         $form->setLabel('reason_id', dgettext('checkin', 'Reason for visit'));
     }
     $form->addSubmit(dgettext('checkin', 'Check in'));
     $tpl = $form->getTemplate();
     $this->title = dgettext('checkin', 'Please check in using the form below');
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'signin.tpl');
     if (!Current_User::isLogged() && PHPWS_Settings::get('checkin', 'collapse_signin')) {
         Layout::collapse();
     }
 }
コード例 #3
0
 public static function loggedOut()
 {
     if (isset($_REQUEST['phpws_username'])) {
         $username = $_REQUEST['phpws_username'];
     } else {
         $username = NULL;
     }
     $form = new PHPWS_Form('User_Login_Box');
     $form->setProtected(false);
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'login');
     $form->addText('phpws_username', $username);
     $form->setSize('phpws_username', 10);
     $form->setClass('phpws_username', 'form-control');
     $form->addPassword('phpws_password');
     $form->setSize('phpws_password', 10);
     $form->setClass('phpws_password', 'form-control');
     $form->addSubmit('submit', LOGIN_BUTTON);
     $form->setLabel('phpws_username', dgettext('users', 'Username'));
     $form->setLabel('phpws_password', dgettext('users', 'Password'));
     $form->setPlaceholder('phpws_username', dgettext('users', 'Username'));
     $form->setPlaceholder('phpws_password', dgettext('users', 'Password'));
     $template = $form->getTemplate();
     $template = array();
     $signup_vars = array('action' => 'user', 'command' => 'signup_user');
     $template['HOME_LOGIN'] = PHPWS_Text::moduleLink(dgettext('users', 'Home'));
     if (PHPWS_Settings::get('users', 'new_user_method')) {
         $template['NEW_ACCOUNT'] = PHPWS_Text::moduleLink(USER_SIGNUP_QUESTION, 'users', $signup_vars);
     }
     $fg_vars = array('action' => 'user', 'command' => 'forgot_password');
     $template['FORGOT'] = PHPWS_Text::moduleLink(dgettext('users', 'Forgot password?'), 'users', $fg_vars);
     $usermenu = PHPWS_User::getUserSetting('user_menu');
     $user = Current_User::getUserObj();
     $authorization = $user->getAuthorization();
     $template['LOGIN_VIEW'] = $authorization->getView();
     return PHPWS_Template::process($template, 'users', 'usermenus/' . $usermenu);
 }