public function display() { // permissions... if (!\Current_User::isDeity()) { \NQ::simple('intern', NotifyUI::ERROR, 'You cannot edit administrators.'); return false; } // set up some stuff for the page template $tpl = array(); // create the list of admins $adminList = Admin::getAdminPager(); // get the list of departments $depts = Department::getDepartmentsAssoc(); // make the form for adding a new admin $form = new \PHPWS_Form('add_admin'); $form->addSelect('department_id', $depts); $form->setLabel('department_id', 'Department'); $form->addText('username'); $form->setLabel('username', 'Username'); $form->addCheck('all'); $form->setLabel('all', 'All Departments'); $form->addSubmit('submit', 'Create Admin'); $form->setAction('index.php?module=intern&action=edit_admins'); $form->addHidden('add', 1); // TODO: Add Javascript autocomplete for usernames. javascript('jquery'); javascript('jquery_ui'); javascriptMod('intern', 'admin'); $tpl['PAGER'] = $adminList; $form->mergeTemplate($tpl); return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_admin.tpl'); }
public function show() { $username = UserStatus::getUsername(); $currentTerm = Term::getCurrentTerm(); $student = StudentFactory::getStudentByUsername($username, $currentTerm); $applicationTerm = $student->getApplicationTerm(); $tpl = array(); $tpl['TITLE'] = 'Contact Form'; $form = new PHPWS_Form(); $form->addText('name'); $form->setLabel('name', 'Name'); $form->addText('email'); $form->setLabel('email', 'Email Address'); $form->addText('phone'); $form->setLabel('phone', 'Phone number'); $form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning')); $form->setLabel('stype', 'Classification'); $form->addTextArea('comments'); $form->setLabel('comments', 'Question, Comments, or Description of the Problem'); $form->addSubmit('Submit'); $form->mergeTemplate($tpl); $cmd = CommandFactory::getCommand('SubmitContactForm'); $cmd->setUsername($username); $cmd->setApplicationTerm($applicationTerm); $cmd->setStudentType($student->getType()); $cmd->initForm($form); $tpl = $form->getTemplate(); //var_dump($tpl);exit; return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl'); }
public static function display() { /* Check if user can add/edit/hide/delete grad programs. */ if (!Current_User::allow('intern', 'edit_grad_prog') && !Current_User::allow('intern', 'delete_grad_prog')) { NQ::simple('intern', INTERN_WARNING, 'You do not have permission to edit graduate programs.'); return false; } $tpl['PAGER'] = self::doPager(); javascript('/jquery/'); javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => GradProgram::getEditAction())); /* Form for adding new grad program */ $form = new PHPWS_Form('add_prog'); $form->addText('name'); $form->setLabel('name', 'Graduate Program Title'); $form->addSubmit('submit', 'Add Graduate Program'); $form->setAction('index.php?module=intern&action=edit_grad'); $form->addHidden('add', TRUE); $form->mergeTemplate($tpl); return PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_grad.tpl'); }
public static function display() { /* Permission check */ if (!Current_User::allow('intern', Department::getEditPermission())) { NQ::simple('intern', INTERN_ERROR, "Uh Uh Uh! You didn't say the magic word!"); return; } javascript('/jquery/'); javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Department::getEditAction())); // Form for adding new department $form = new PHPWS_Form('add_department'); $form->addText('name'); $form->setLabel('name', 'Department Name'); $form->addSubmit('submit', 'Add Department'); $form->setAction('index.php?module=intern&action=' . DEPT_EDIT); $form->addHidden('add', TRUE); $tpl['PAGER'] = DepartmentUI::doPager(); $form->mergeTemplate($tpl); return PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_department.tpl'); }
public function display() { /* Permission check */ if (!\Current_User::allow('intern', Department::getEditPermission())) { \NQ::simple('intern', NotifyUI::ERROR, "You do not have permission to edit departments."); return; } javascript('/jquery/'); javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Department::getEditAction())); // Form for adding new department $form = new \PHPWS_Form('add_department'); $form->addText('name'); $form->setLabel('name', 'Department Name'); $form->addSubmit('submit', 'Add Department'); $form->setAction('index.php?module=intern&action=edit_dept'); $form->addHidden('add', TRUE); $tpl['PAGER'] = DepartmentUI::doPager(); $form->mergeTemplate($tpl); return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_department.tpl'); }
public function display() { /* Check if user can add/edit/hide/delete majors. */ if (!\Current_User::allow('intern', 'edit_major') && !\Current_User::allow('intern', 'delete_major')) { \NQ::simple('intern', NotifyUI::WARNING, 'You do not have permission to edit undergraduate majors.'); return false; } $tpl['PAGER'] = MajorUI::doPager(); javascript('/jquery/'); javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Major::getEditAction())); /* Form for adding new major */ $form = new \PHPWS_Form('add_major'); $form->addText('name'); $form->setLabel('name', 'Major Title'); $form->addSubmit('submit', 'Add Major'); $form->setAction('index.php?module=intern&action=edit_major'); $form->addHidden('add', TRUE); $form->mergeTemplate($tpl); return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_major.tpl'); }
public function databaseConfig() { $form = new PHPWS_Form(); $form->addHidden('step', '2'); $databases = array('mysqli' => 'MySQL', 'pgsql' => 'PostgreSQL'); $formTpl['DBTYPE_DEF'] = dgettext('core', 'phpWebSite supports MySQL and PostgreSQL. Choose the type your server currently is running.'); $formTpl['DBUSER_DEF'] = dgettext('core', 'This is the user name that phpWebSite will use to access its database.') . ' <br /><i>' . dgettext('core', 'Note: it is a good idea to give each phpWebSite installation its own user.') . '</i>'; if (isset($this->messages['dbuser'])) { $formTpl['DBUSER_ERR'] = $this->messages['dbuser']; } $formTpl['DBPASS_DEF'] = dgettext('core', 'Enter the database\'s user password here.'); if (isset($this->messages['dbpass'])) { $formTpl['DBPASS_ERR'] = $this->messages['dbpass']; } $formTpl['DBPREF_DEF'] = dgettext('core', 'If you are installing phpWebSite in a shared environment, you may assign a prefix to tables.<br />We recommend you run without one.'); if (isset($this->messages['dbpref'])) { $formTpl['DBPREF_ERR'] = $this->messages['dbpref']; } $formTpl['DBHOST_DEF'] = dgettext('core', 'If your database is on the same server as your phpWebSite installation, leave this as "localhost".') . '<br />' . dgettext('core', 'Otherwise, enter the ip or dns to the database server.'); $formTpl['DBPORT_DEF'] = dgettext('core', 'If your host specification requires access via a specific port, enter it here.'); $formTpl['DBNAME_DEF'] = dgettext('core', 'The database\'s name into which you are installing phpWebSite.') . '<br /><i>' . dgettext('core', 'Note: if you have not made this database yet, you should do so before continuing.') . '</i>'; if (isset($this->messages['dbname'])) { $formTpl['DBNAME_ERR'] = $this->messages['dbname']; } $formTpl['TITLE'] = dgettext('core', 'Database configuration'); $form->addSelect('dbtype', $databases); $form->setMatch('dbtype', $this->getConfigSet('dbtype')); $form->setLabel('dbtype', dgettext('core', 'Database Type')); $form->addText('dbuser', $this->getConfigSet('dbuser')); $form->setSize('dbuser', 20); $form->setLabel('dbuser', dgettext('core', 'Database User')); $form->addPassword('dbpass', $this->getConfigSet('dbpass')); $form->allowValue('dbpass'); $form->setSize('dbpass', 20); $form->setLabel('dbpass', dgettext('core', 'Database Password')); $form->addText('dbprefix', $this->getConfigSet('dbprefix')); $form->setSize('dbprefix', 5, 5); $form->setLabel('dbprefix', dgettext('core', 'Table prefix')); $form->addText('dbhost', $this->getConfigSet('dbhost')); $form->setSize('dbhost', 20); $form->setLabel('dbhost', dgettext('core', 'Host Specification')); $form->addText('dbport', $this->getConfigSet('dbport')); $form->setSize('dbport', 6); $form->setLabel('dbport', dgettext('core', 'Host Specification Port')); $form->addText('dbname', $this->getConfigSet('dbname')); $form->setSize('dbname', 20); $form->setLabel('dbname', dgettext('core', 'Database Name')); $form->mergeTemplate($formTpl); $form->addSubmit('default_submit', dgettext('core', 'Continue')); $this->content = $this->createForm($form, 'databaseConfig.tpl'); $this->title = dgettext('core', 'Configure phpWebSite'); $this->display(); }
public function show() { require PHPWS_SOURCE_DIR . 'mod/hms/inc/profile_options.php'; $majors = hms\MajorFactory::getMajorsList(); $tpl = array(); $profile_form = new PHPWS_Form('profile_form'); $profile_form->useRowRepeat(); $none_given = '<span style="color:#CCC;">none given</span>'; /***** Contact Info *****/ $tpl['TITLE'] = $this->student->getName() . '\'s Profile'; $tpl['EMAIL_ADDRESS'] = "<a href=\"mailto:{$this->student->getUsername()}@appstate.edu\">{$this->student->getUsername()}@appstate.edu</a>"; $tpl['ALTERNATE_EMAIL_LABEL'] = 'Alternate email: '; $alt_email = $this->profile->get_text('alternate_email'); if (!empty($alt_email)) { $tpl['ALTERNATE_EMAIL'] = "<a href=\"mailto:{$alt_email}\">{$alt_email}</a>"; } else { $tpl['ALTERNATE_EMAIL'] = $none_given; } $tpl['FB_LINK_LABEL'] = 'Facebook link: '; $fb_link = $this->profile->get_text('fb_link'); if (!empty($fb_link)) { $tpl['FB_LINK'] = $fb_link; } else { $tpl['FB_LINK'] = $none_given; } $tpl['INSTAGRAM_SN_LABEL'] = 'Instagram username: '******'instagram_sn'); if (!empty($instagram_sn)) { $tpl['INSTAGRAM_SN'] = $instagram_sn; } else { $tpl['INSTAGRAM_SN'] = $none_given; } $tpl['TWITTER_SN_LABEL'] = 'Twitter username: '******'twitter_sn'); if (!empty($twitter_sn)) { $tpl['TWITTER_SN'] = $twitter_sn; } else { $tpl['TWITTER_SN'] = $none_given; } $tpl['TUMBLR_SN_LABEL'] = 'Tumblr username: '******'tumblr_sn'); if (!empty($tumblr_sn)) { $tpl['TUMBLR_SN'] = $tumblr_sn; } else { $tpl['TUMBLR_SN'] = $none_given; } $tpl['KIK_SN_LABEL'] = 'Kik username: '******'kik_sn'); if (!empty($kik_sn)) { $tpl['KIK_SN'] = $kik_sn; } else { $tpl['KIK_SN'] = $none_given; } $tpl['ABOUT_ME_LABEL'] = 'Additional information: '; $about_me = $this->profile->get_text('about_me'); if (!empty($about_me)) { $tpl['ABOUT_ME'] = $about_me; } else { $tpl['ABOUT_ME'] = $none_given; } /***** About Me *****/ $profile_form->addCheck('hobbies_checkbox', $hobbies); $profile_form->setLabel('hobbies_checkbox', $hobbies_labels); $profile_form->setDisabled('hobbies_checkbox'); $tpl['HOBBIES_CHECKBOX_QUESTION'] = 'My Hobbies and Interests: '; # set matches on hobby check boxes $hobbies_matches = RoommateProfileFactory::get_hobbies_matches($this->profile); $profile_form->setMatch('hobbies_checkbox', $hobbies_matches); $profile_form->addCheck('music_checkbox', $music); $profile_form->setLabel('music_checkbox', $music_labels); $profile_form->setDisabled('music_checkbox'); $tpl['MUSIC_CHECKBOX_QUESTION'] = 'My Music Preferences: '; # set matches on music check boxes $music_matches = RoommateProfileFactory::get_music_matches($this->profile); $profile_form->setMatch('music_checkbox', $music_matches); $profile_form->addCheck('language_checkbox', $language); $profile_form->setLabel('language_checkbox', $language_labels); $profile_form->setDisabled('language_checkbox'); $tpl['LANGUAGE_CHECKBOX_QUESTION'] = 'Languages I speak: '; # set matches on language check boxes $language_matches = RoommateProfileFactory::get_language_matches($this->profile); $profile_form->setMatch('language_checkbox', $language_matches); $tpl['POLITICAL_VIEWS_LABEL'] = 'Political views: '; $tpl['POLITICAL_VIEWS'] = $political_views[$this->profile->get_text('political_views')]; /***** College Life *****/ $tpl['MAJOR_LABEL'] = 'Intended major: '; $tpl['MAJOR'] = $majors[$this->profile->get_text('major')]; $tpl['EXPERIENCE_LABEL'] = 'I feel the most important part of my college experience is: '; $tpl['EXPERIENCE'] = $experiences[$this->profile->get_text('experience')]; /***** Daily Life *****/ $tpl['SLEEP_TIME_LABEL'] = 'I generally go to sleep: '; $tpl['SLEEP_TIME'] = $sleep_times[$this->profile->get_text('sleep_time')]; $tpl['WAKEUP_TIME_LABEL'] = 'I generally wake up: '; $tpl['WAKEUP_TIME'] = $wakeup_times[$this->profile->get_text('wakeup_time')]; $tpl['OVERNIGHT_GUESTS_LABEL'] = 'I plan on hosting overnight guests: '; $tpl['OVERNIGHT_GUESTS'] = $overnight_guests[$this->profile->get_text('overnight_guests')]; $tpl['LOUDNESS_LABEL'] = 'In my daily activities: '; $tpl['LOUDNESS'] = $loudness[$this->profile->get_text('loudness')]; $tpl['CLEANLINESS_LABEL'] = 'I would describe myself as: '; $tpl['CLEANLINESS'] = $cleanliness[$this->profile->get_text('cleanliness')]; $tpl['FREE_TIME_LABEL'] = 'If I have free time I would rather: '; $tpl['FREE_TIME'] = $free_time[$this->profile->get_text('free_time')]; $profile_form->addCheck('study_times', $study_times); $profile_form->setLabel('study_times', $study_times_labels); $profile_form->setDisabled('study_times'); $tpl['STUDY_TIMES_QUESTION'] = 'I prefer to study: '; # set matches on study times check boxes here, set disabled $study_matches = RoommateProfileFactory::get_study_matches($this->profile); $profile_form->setMatch('study_times', $study_matches); $profile_form->mergeTemplate($tpl); $tpl = $profile_form->getTemplate(); Layout::addPageTitle("Roommate Profile"); return PHPWS_Template::process($tpl, 'hms', 'student/profile_form.tpl'); }
public static function userForm(PHPWS_User $user, $message = NULL) { require_once PHPWS_SOURCE_DIR . 'core/class/Time.php'; javascript('jquery'); $form = new PHPWS_Form(); $form->addHidden('module', 'users'); $form->addHidden('action', 'user'); $form->addHidden('command', 'my_page'); $form->addHidden('subcommand', 'postUser'); if (Current_User::allow('users') || $user->display_name == $user->username) { $form->addText('display_name', $user->display_name); $form->setClass('display_name', 'form-control'); $form->setLabel('display_name', dgettext('users', 'Display Name')); } else { $form->addTplTag('DISPLAY_NAME_LABEL', dgettext('users', 'Display Name')); $tpl['DISPLAY_NAME'] = javascript('slider', array('link' => $user->display_name, 'id' => 'name-info', 'message' => dgettext('users', 'Once you change your display name, you may not change it again until reset by the site administrator.'))); } if ($user->canChangePassword()) { $form->addPassword('password1'); $form->setAutoComplete('password1'); $form->setClass('password1', 'form-control'); $form->addPassword('password2'); $form->setAutoComplete('password2'); $form->setClass('password2', 'form-control'); $form->setTitle('password2', dgettext('users', 'Password confirm')); $form->setLabel('password1', dgettext('users', 'Password')); } else { $tpl['PASSWORD1_LABEL'] = dgettext('users', 'Password'); $tpl['PASSWORD1'] = javascript('slider', array('link' => dgettext('users', 'Why can\'t I change my password?'), 'id' => 'pw-info', 'message' => dgettext('users', 'Your account is authorized external to this site. You will need to update it at the source.'))); } $form->addText('email', $user->getEmail()); $form->setSize('email', 40); $form->setLabel('email', dgettext('users', 'Email Address')); $form->setClass('email', 'form-control'); if (isset($tpl)) { $form->mergeTemplate($tpl); } $tz_list = PHPWS_Time::getTZList(); $timezones['server'] = dgettext('users', '-- Use server\'s time zone --'); foreach ($tz_list as $tz) { if (!empty($tz['codes'])) { $timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['codes'][0]); } elseif (!empty($tz['city'])) { $timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['city'][0]); } else { $timezones[$tz['id']] = $tz['id']; } } if (isset($_REQUEST['timezone'])) { $user_tz = $_REQUEST['timezone']; } else { $user_tz = PHPWS_Cookie::read('user_tz'); } $form->addSelect('timezone', $timezones); $form->setLabel('timezone', dgettext('users', 'Time Zone')); $form->setMatch('timezone', $user_tz); $form->setClass('timezone', 'form-control'); if (isset($_REQUEST['dst']) && $_REQUEST['timezone'] != 'server') { $dst = $_REQUEST['dst']; } else { $dst = PHPWS_Cookie::read('user_dst'); } $form->addCheckbox('dst', 1); $form->setMatch('dst', $dst); $form->setLabel('dst', dgettext('users', 'Use Daylight Savings Time')); if (isset($_POST['cp'])) { $cp = (int) $_POST['cp']; } else { $cp = (int) PHPWS_Cookie::read('user_cp'); } if (Current_User::allowRememberMe()) { // User must authorize locally if ($_SESSION['User']->authorize == 1) { $form->addCheckbox('remember_me', 1); if (PHPWS_Cookie::read('remember_me')) { $form->setMatch('remember_me', 1); } $form->setLabel('remember_me', dgettext('users', 'Remember me')); } } $form->addHidden('userId', $user->getId()); $form->addSubmit('submit', dgettext('users', 'Update my information')); $form->setClass('submit', 'btn btn-primary'); if (!DISABLE_TRANSLATION && !FORCE_DEFAULT_LANGUAGE) { $language_file = PHPWS_Core::getConfigFile('users', 'languages.php'); if ($language_file) { include $language_file; $form->addSelect('language', $languages); $form->setClass('language', 'form-control'); $form->setLabel('language', dgettext('users', 'Language preference')); if (isset($_COOKIE['phpws_default_language'])) { $language = preg_replace('/\\W/', '', $_COOKIE['phpws_default_language']); $form->setMatch('language', $language); } } } $template = $form->getTemplate(); if (isset($message)) { foreach ($message as $tag => $error) { $template[$tag] = $error; } } $template['ACCT_INFO'] = dgettext('users', 'Account Information'); $template['LOCAL_INFO'] = dgettext('users', 'Localization'); $template['PREF'] = dgettext('users', 'Preferences'); return PHPWS_Template::process($template, 'users', 'my_page/user_setting.tpl'); }
/** * Form for adding and choosing default authorization scripts */ public static function authorizationSetup() { $template = array(); PHPWS_Core::initCoreClass('File.php'); $auth_list = User_Action::getAuthorizationList(); $db = new PHPWS_DB('users_groups'); $db->addOrder('name'); $db->addColumn('name'); $db->addColumn('id'); $db->setIndexBy('id'); $db->addWhere('user_id', 0); $groups = $db->select('col'); if (PHPWS_Error::logIfError($groups)) { $groups = array(0 => dgettext('users', '- None -')); } else { $groups = array("0" => dgettext('users', '- None -')) + $groups; } foreach ($auth_list as $auth) { $file_compare[] = $auth['filename']; } $form = new PHPWS_Form(); $form->addHidden('module', 'users'); $form->addHidden('action', 'admin'); $form->addHidden('command', 'postAuthorization'); $file_list = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'mod/users/scripts/', FALSE, TRUE, FALSE, array('php')); if (!empty($file_list)) { $remaining_files = array_diff($file_list, $file_compare); } else { $remaining_files = NULL; } if (empty($remaining_files)) { $template['FILE_LIST'] = dgettext('users', 'No new scripts found'); } else { $form->addSelect('file_list', $remaining_files); $form->reindexValue('file_list'); $form->addSubmit('add_script', dgettext('users', 'Add Script File')); } $form->mergeTemplate($template); $form->addSubmit('submit', dgettext('users', 'Update authorization scripts')); $template = $form->getTemplate(); $template['AUTH_LIST_LABEL'] = dgettext('users', 'Authorization Scripts'); $template['DEFAULT_LABEL'] = dgettext('users', 'Default'); $template['DISPLAY_LABEL'] = dgettext('users', 'Display Name'); $template['FILENAME_LABEL'] = dgettext('users', 'Script Filename'); $template['DEFAULT_GROUP_LABEL'] = dgettext('users', 'Default group'); $template['ACTION_LABEL'] = dgettext('users', 'Action'); $default_authorization = PHPWS_User::getUserSetting('default_authorization'); foreach ($auth_list as $authorize) { $links = array(); extract($authorize); if ($default_authorization == $id) { $checked = 'checked="checked"'; } else { $checked = NULL; } $getVars['module'] = 'users'; $getVars['action'] = 'admin'; $getVars['command'] = 'dropScript'; if ($filename != 'local.php' && $filename != 'global.php') { $vars['QUESTION'] = dgettext('users', 'Are you sure you want to drop this authorization script?'); $vars['ADDRESS'] = sprintf('index.php?module=users&action=admin&command=dropAuthScript&script_id=%s&authkey=%s', $id, Current_User::getAuthKey()); $vars['LINK'] = dgettext('users', 'Drop'); $links[1] = javascript('confirm', $vars); } $getVars['command'] = 'editScript'; // May enable this later. No need for an edit link right now. // $links[2] = PHPWS_Text::secureLink(dgettext('users', 'Edit'), 'users', $getVars); $row['CHECK'] = sprintf('<input type="radio" name="default_authorization" value="%s" %s />', $id, $checked); $form = new PHPWS_Form(); $form->addSelect("default_group[{$id}]", $groups); $form->setMatch("default_group[{$id}]", $default_group); $row['DEFAULT_GROUP'] = $form->get("default_group[{$id}]"); $row['DISPLAY_NAME'] = $display_name; $row['FILENAME'] = $filename; if (!empty($links)) { $row['ACTION'] = implode(' | ', $links); } else { $row['ACTION'] = dgettext('users', 'None'); } $template['auth-rows'][] = $row; } return PHPWS_Template::process($template, 'users', 'forms/authorization.tpl'); }
/** * Get form for approving application for specific community. */ private function getApprovalForm() { $approveForm = new PHPWS_Form('approve_form'); $approveForm->addSubmit('approve', 'Approve'); $approveForm->addCssClass('approve', 'btn btn-md btn-success'); $approveCmd = CommandFactory::getCommand('AssignRlcApplicants'); $tpl = array(); $tpl['RLC_LIST'] = HMS_RLC_Application::generateRLCDropDown(HMS_Learning_Community::getRlcList(), $this->application->id); $approveForm->mergeTemplate($tpl); $approveCmd->initForm($approveForm); return $approveForm; }
/** * DBPager row method for the floor edit pager. * * @return Array */ public function get_row_edit() { javascript('jquery'); $tpl = array(); $tpl['ID'] = $this->id; $tpl['ROOM_NUMBER'] = PHPWS_Text::secureLink($this->room_number, 'hms', array('action' => 'EditRoomView', 'room' => $this->id)); if (Current_User::allow('hms', 'room_structure') && $this->get_number_of_assignees() == 0) { $deleteRoomCmd = CommandFactory::getCommand('DeleteRoom'); $deleteRoomCmd->setRoomId($this->id); $deleteRoomCmd->setFloorId($this->floor_id); $confirm = array(); $confirm['QUESTION'] = 'Are you sure want to delete room ' . $this->room_number . '?'; $confirm['ADDRESS'] = $deleteRoomCmd->getURI(); $confirm['LINK'] = 'Delete'; $tpl['DELETE'] = Layout::getJavascript('confirm', $confirm); } $form = new PHPWS_Form($this->id); $form->addSelect('gender_type', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, COED => COED_DESC, AUTO => AUTO_DESC)); $form->setMatch('gender_type', $this->gender_type); $form->setExtra('gender_type', 'onChange="submit_form(this, true)"'); $form->addSelect('default_gender', array(FEMALE => FEMALE_DESC, MALE => MALE_DESC, AUTO => AUTO_DESC)); $form->setMatch('default_gender', $this->default_gender); $form->setExtra('default_gender', 'onChange="submit_form(this, true)"'); $form->addSelect('rlc_reserved', array('-1' => 'Select RLC') + RlcFactory::getRlcList($this->term)); $form->setMatch('rlc_reserved', $this->getReservedRlcId()); $form->setExtra('rlc_reserved', 'onChange="submit_form(this, true)"'); $form->addCheck('offline', 'yes'); $form->setMatch('offline', $this->offline == 1 ? 'yes' : 0); $form->setExtra('offline', 'onChange="submit_form(this, false)"'); $form->addCheck('reserved', 'yes'); $form->setMatch('reserved', $this->reserved == 1 ? 'yes' : 0); $form->setExtra('reserved', 'onChange="submit_form(this, false)"'); $form->addCheck('ra', 'yes'); $form->setMatch('ra', $this->ra == 1 ? 'yes' : 0); $form->setExtra('ra', 'onChange="submit_form(this, false)"'); $form->addCheck('private', 'yes'); $form->setMatch('private', $this->private == 1 ? 'yes' : 0); $form->setExtra('private', 'onChange="submit_form(this, false)"'); $form->addCheck('overflow', 'yes'); $form->setMatch('overflow', $this->overflow == 1 ? 'yes' : 0); $form->setExtra('overflow', 'onChange="submit_form(this, false)"'); $form->addCheck('ada', 'yes'); $form->setMatch('ada', $this->isAda() ? 'yes' : 0); $form->setExtra('ada', 'onChange="submit_form(this, false)"'); $form->addHidden('action', 'UpdateRoomField'); $form->addHidden('room', $this->id); $form->mergeTemplate($tpl); //test($form->getTemplate(),1); return $form->getTemplate(); }
public function settings() { $form = new PHPWS_Form('ps-settings'); $form->addHidden('module', 'pagesmith'); $form->addHidden('aop', 'post_settings'); $form->addSubmit(dgettext('pagesmith', 'Save')); $form->addCheck('auto_link', 1); $form->setMatch('auto_link', PHPWS_Settings::get('pagesmith', 'auto_link')); $form->setLabel('auto_link', dgettext('pagesmith', 'Add menu link for new pages.')); $form->addCheck('back_to_top', 1); $form->setMatch('back_to_top', PHPWS_Settings::get('pagesmith', 'back_to_top')); $form->setLabel('back_to_top', dgettext('pagesmith', 'Add "Back to top" links at page bottom.')); $form->addCheck('create_shortcuts', 1); $form->setMatch('create_shortcuts', PHPWS_Settings::get('pagesmith', 'create_shortcuts')); $form->setLabel('create_shortcuts', dgettext('pagesmith', 'Create Access shortcuts automatically')); $form->addTplTag('LENGTH_EXAMPLE', 'pagesmith/2 => index.php?module=pagesmith&uop=view_page&id=2'); $this->ps->title = dgettext('pagesmith', 'PageSmith Settings'); $tpl['SHORTEN_MENU_LINKS'] = PHPWS_Text::secureLink(dgettext('pagesmith', 'Shorten all menu links'), 'pagesmith', array('aop' => 'shorten_links')); $tpl['SHORTEN_MENU_LINKS_URI'] = PHPWS_Text::linkAddress('pagesmith', array('aop' => 'shorten_links'), true); $tpl['LENGTHEN_MENU_LINKS'] = PHPWS_Text::secureLink(dgettext('pagesmith', 'Lengthen all menu links'), 'pagesmith', array('aop' => 'lengthen_links')); $tpl['LENGTHEN_MENU_LINKS_URI'] = PHPWS_Text::linkAddress('pagesmith', array('aop' => 'lengthen_links'), true); $form->mergeTemplate($tpl); $this->ps->content = PHPWS_Template::process($form->getTemplate(), 'pagesmith', 'settings.tpl'); }