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 execute(CommandContext $context) { $options = array(ASSIGN_ADMIN => 'Administrative', ASSIGN_LOTTERY => 'Lottery', ASSIGN_FR => 'Freshmen', ASSIGN_TRANSFER => 'Transfer', ASSIGN_APH => 'APH', ASSIGN_RLC_FRESHMEN => 'RLC Freshmen', ASSIGN_RLC_TRANSFER => 'RLC Transfer', ASSIGN_RLC_CONTINUING => 'RLC Continuing', ASSIGN_HONORS_FRESHMEN => 'Honors Freshmen', ASSIGN_HONORS_CONTINUING => 'Honors Continuing', ASSIGN_LLC_FRESHMEN => 'LLC Freshmen', ASSIGN_LLC_CONTINUING => 'LLC Continuing', ASSIGN_INTL => 'International', ASSIGN_RA => 'RA', ASSIGN_RA_ROOMMATE => 'RA Roommate', ASSIGN_MEDICAL => 'Medical', ASSIGN_SPECIAL => 'Special Needs', ASSIGN_RHA => 'RHA/NRHH', ASSIGN_SCHOLARS => 'Diversity & Plemmons Scholars'); $form = new PHPWS_Form('select_assignment'); $form->addSelect('type', $options); $form->setMatch('type', ASSIGN_ADMIN); $form->setClass('type', 'form-control'); $template = $form->getTemplate(); echo \PHPWS_Template::process($template, 'hms', 'admin/assignment_type_dropbox.tpl'); exit; }
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(); } }
public function execute(CommandContext $context) { $options = array(BANNER_MEAL_LOW => 'Low', BANNER_MEAL_STD => 'Standard', BANNER_MEAL_HIGH => 'High', BANNER_MEAL_SUPER => 'Super', BANNER_MEAL_5WEEK => 'Summer (5 Weeks)', BANNER_MEAL_NONE => 'None'); $form = new PHPWS_Form('select_meal'); $form->addSelect('mealplan', $options); // If summer term, set default as Summer 5Week $term = Term::getSelectedTerm(); if (strlen($term) >= 2 && (substr($term, -2) == TERM_SUMMER1 || substr($term, -2) == TERM_SUMMER2)) { $form->setMatch('mealplan', BANNER_MEAL_5WEEK); } else { $form->setMatch('mealplan', BANNER_MEAL_STD); } $form->setClass('mealplan', 'form-control'); $template = $form->getTemplate(); echo \PHPWS_Template::process($template, 'hms', 'admin/get_meal_plan_dropbox.tpl'); exit; }
public static function newTracker() { $form = new PHPWS_Form('tracker'); $form->addHidden('module', 'analytics'); $form->addHidden('command', 'create'); $form->addSubmit('submit', dgettext('analytics', 'Next')); $classes = TrackerFactory::getAvailableClasses(); $trackers = array(); foreach ($classes as $class) { $trackers[$class] = $class; } $form->addSelect('tracker', $trackers); $form->setLabel('tracker', dgettext('analytics', 'Tracker')); $form->setRequired('tracker'); $tpl = $form->getTemplate(); return PHPWS_Template::process($tpl, 'analytics', 'select.tpl'); }
public function schedulePick() { $schedules = $this->calendar->getScheduleList('brief'); if (count($schedules) < 2) { return null; } $form = new PHPWS_Form('schedule_pick'); $form->setMethod('get'); $form->addHidden('module', 'calendar'); $form->addHidden('view', $this->current_view); $form->addHidden('date', $this->calendar->current_date); $form->addSelect('sch_id', $schedules); $form->setMatch('sch_id', $this->calendar->schedule->id); $form->addSubmit('go', dgettext('calendar', 'Change schedule')); $tpl = $form->getTemplate(); return $tpl['START_FORM'] . $tpl['SCH_ID'] . $tpl['GO'] . $tpl['END_FORM']; }
/** * Called from the three file type managers. Adds a file listing * to move files from one folder to another */ public static function moveToForm(PHPWS_Form $form, $folder) { $db = new PHPWS_DB('folders'); $db->addWhere('id', $folder->id, '!='); $db->addWhere('ftype', $folder->ftype); $db->addColumn('id'); $db->addColumn('title'); $db->setIndexBy('id'); $folders = $db->select('col'); if (!empty($folders)) { $folders = array(0 => '') + $folders; $form->addSelect('move_to_folder', $folders); $form->setLabel('move_to_folder', dgettext('filecabinet', 'Move to folder')); } }
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'); }
public function display() { // Set up search fields $form = new \PHPWS_Form(); $form->setMethod('get'); $form->addHidden('module', 'intern'); $form->addHidden('action', 'results'); $form->useRowRepeat(); // Student name or Banner ID $form->addText('name'); $form->setLabel('name', "Name or Banner ID"); /*************** * Course Info * ***************/ $terms = Term::getTermsAssoc(); $form->addSelect('term_select', $terms); $form->setLabel('term_select', 'Term'); $form->setClass('term_select', 'form-control'); $subjects = array('-1' => 'Select subject ') + Subject::getSubjects(); $form->addSelect('course_subj', $subjects); $form->setLabel('course_subj', 'Subject'); $form->setClass('course_subj', 'form-control'); $form->addText('course_no'); $form->setLabel('course_no', 'Course Number'); $form->setSize('course_no', 6); $form->setMaxSize('course_no', 4); $form->setClass('course_no', 'form-control'); $form->addText('course_sect'); $form->setLabel('course_sect', 'Section'); $form->setSize('course_sect', 6); $form->setMaxSize('course_sect', 4); $form->setClass('course_sect', 'form-control'); /**************** * Faculty Info * ****************/ // Deity can search for any department. Other users are restricted. if (\Current_User::isDeity()) { $depts = Department::getDepartmentsAssoc(); } else { $depts = Department::getDepartmentsAssocForUsername(\Current_User::getUsername()); } $depts = array('-1' => 'Select Department') + $depts; $form->addSelect('dept', $depts); $form->setLabel('dept', 'Department'); //$form->setClass('', 'form-control'); $form->setClass('dept', 'form-control'); // If the user only has one department, select it for them // sizeof($depts) == 2 because of the 'Select Deparmtnet' option if (sizeof($depts) == 2) { $keys = array_keys($depts); $form->setMatch('dept', $keys[1]); } // Student level radio button javascript('jquery'); javascriptMod('intern', 'majorSelector', array('form_id' => $form->id)); // Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected) $levels = array('-1' => 'Choose student level first'); $form->addDropBox('student_major', $levels); $form->setLabel('student_major', 'Major / Program'); $form->addCssClass('student_major', 'form-control'); // Get the majors list $majorsList = MajorsProviderFactory::getProvider()->getMajors(Term::timeToTerm(time())); // Undergrad major drop down $undergradMajors = array('-1' => 'Select Undergraduate Major') + $majorsList->getUndergradMajorsAssoc(); $form->addSelect('undergrad_major', $undergradMajors); $form->setMatch('undergrad_major', '-1'); $form->setClass('undergrad_major', 'form-control'); // Graduate major drop down $graduateMajors = array('-1' => 'Select Graduate Major') + $majorsList->getGraduateMajorsAssoc(); $form->addSelect('graduate_major', $graduateMajors); $form->setMatch('graduate_major', '-1'); $form->setClass('graduate_major', 'form-control'); /******************* * Internship Type * *******************/ // Handeled directly in the html template /************ * Location * ************/ // Campus Handeled directly in the html template // International vs Domestic - Handeled directly in the html template // State search /******************* * Workflow States * *******************/ $workflowStates = WorkflowStateFactory::getStatesAssoc(); unset($workflowStates['Intern\\WorkflowState\\CreationState']); // Remove this state, since it's not valid (internal only state for initial creation) $form->addCheckAssoc('workflow_state', $workflowStates); $form->addSubmit('submit', 'Search'); // Javascript... javascriptMod('intern', 'resetSearch'); return \PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl'); }
/** * Form to create or edit a branch */ public function edit_db($force = false) { $this->title = dgettext('branch', 'Setup branch database'); $form = new PHPWS_Form('branch-form'); $form->addHidden('module', 'branch'); $form->addHidden('command', 'post_db'); $form->addHidden('force', (int) $force); $form->addCheck('createdb', $this->createdb); $form->setLabel('createdb', dgettext('branch', 'Create new database')); $form->addSelect('dbtype', $this->db_list); $form->setMatch('dbtype', $this->dbtype); $form->setLabel('dbtype', dgettext('branch', 'Database syntax')); $form->addText('dbname', $this->dbname); $form->setLabel('dbname', dgettext('branch', 'Database name')); $form->addText('dbuser', $this->dbuser); $form->setLabel('dbuser', dgettext('branch', 'Permission user')); $form->addPassword('dbpass', $this->dbpass); $form->allowValue('dbpass'); $form->setLabel('dbpass', dgettext('branch', 'User password')); $form->addText('dbprefix', $this->dbprefix); $form->setLabel('dbprefix', dgettext('branch', 'Table prefix')); $form->setSize('dbprefix', 5, 5); $form->addText('dbhost', $this->dbhost); $form->setLabel('dbhost', dgettext('branch', 'Database Host')); $form->setSize('dbhost', 40); $form->addText('dbport', $this->dbport); $form->setLabel('dbport', dgettext('branch', 'Connection Port')); $form->addTplTag('DB_LEGEND', dgettext('branch', 'Database information')); $form->addSubmit('plug', dgettext('branch', 'Use hub values')); $form->addSubmit('submit', dgettext('branch', 'Continue...')); $template = $form->getTemplate(); $this->content = PHPWS_Template::process($template, 'branch', 'edit_db.tpl'); }
/** * 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 getForm($name = null) { javascript('datepicker'); \Layout::addStyle('properties', 'forms.css'); $form = new \PHPWS_Form($name); $form->addHidden('module', 'properties'); $form->addCheck('appalcart', 1); $form->setLabel('appalcart', 'On Appalcart route'); $form->setMatch('appalcart', $this->appalcart); $form->addSelect('campus_distance', array(0 => '0 to 5', 5 => '5 to 10', 10 => '10 to 25', 25 => 'More than 25')); $form->setLabel('campus_distance', 'Miles from campus'); $form->setMatch('campus_distance', $this->campus_distance); $form->addCheck('clubhouse', 1); $form->setLabel('clubhouse', 'Clubhouse'); $form->setMatch('clubhouse', $this->clubhouse); \PHPWS_Core::initModClass('properties', 'User.php'); $contracts = User::getContracts(); $form->addSelect('contract_length', $contracts); $form->setLabel('contract_length', 'Contract length'); $form->setMatch('contract_length', $this->contract_length); $form->addTextarea('description', $this->description); $form->setLabel('description', 'Other property information'); $form->addCheck('airconditioning', 1); $form->setLabel('airconditioning', 'Air Conditioning'); $form->setMatch('airconditioning', $this->airconditioning); $form->addCheck('dishwasher', 1); $form->setLabel('dishwasher', 'Dishwasher'); $form->setMatch('dishwasher', $this->dishwasher); $itypes[NET_DIALUP] = 'Dial Up'; $itypes[NET_CABLE] = 'Cable'; $itypes[NET_DSL] = 'DSL'; $itypes[NET_WIRELESS] = 'Wireless'; $itypes[NET_SATELLITE] = 'Satellite'; $itypes[NET_FIBER] = 'Fiber'; $itypes[NET_BOTH] = 'DSL/Cable'; $form->addSelect('internet_type', $itypes); $form->setLabel('internet_type', 'Internet'); $form->setMatch('internet_type', $this->internet_type); $form->addSelect('laundry_type', array(LAUNDRY_NONE => 'No laundry', LAUNDRY_ON_PREMISES => 'Laundry room on premises', LAUNDRY_HOOKUP => 'Washer/Dryer hook ups in unit', LAUNDRY_IN_UNIT => 'Washer/Dryer in unit')); $form->setLabel('laundry_type', 'Laundry'); $form->setMatch('laundry_type', $this->laundry_type); $form->addText('monthly_rent', $this->getMonthlyRent()); $form->setLabel('monthly_rent', 'Monthly rent'); $form->setSize('monthly_rent', 8, 8); $form->setRequired('monthly_rent'); $form->addText('move_in_date', $this->getMoveInDate()); $form->setLabel('move_in_date', 'Move-in date'); $form->setExtra('move_in_date', 'class="datepicker"'); $form->addText('name', $this->name); $form->setLabel('name', 'Name of property'); $form->setRequired('name'); $form->setSize('name', 50); $form->addCheck('pets_allowed', 1); $form->setLabel('pets_allowed', 'Pets allowed'); $form->setMatch('pets_allowed', $this->pets_allowed); $form->addCheck('sublease', 1); $form->setMatch('sublease', $this->sublease); $form->setLabel('sublease', 'Sublease'); $toptions[TV_NONE] = 'Antenna'; $toptions[TV_CABLE] = 'Cable'; $toptions[TV_SATELLITE] = 'Satellite'; $toptions[TV_FIBER] = 'Fiber'; $form->addSelect('tv_type', $toptions); $form->setLabel('tv_type', 'Television'); $form->setMatch('tv_type', $this->tv_type); $form->addSelect('trash_type', array(TRASH_ON_YOUR_OWN => 'Trash and recycling receptacles not provided', TRASH_ON_PREMISES_NO_RECYCLE => 'Trash receptacles on site. Recycling not provided', TRASH_ON_PREMISES_WITH_RECYCLE => 'Trash and recycling receptacles provided on site', TRASH_PICKUP => 'Curbside pickup for trash and recycling')); $form->setMatch('trash_type', $this->trash_type); $form->setLabel('trash_type', 'Trash removal'); $form->addCheck('workout_room', 1); $form->setMatch('workout_room', $this->workout_room); $form->setLabel('workout_room', 'Workout room'); return $form; }
public static function ignore() { PHPWS_Core::initCoreClass('DBPager.php'); $tpl['TITLE'] = dgettext('search', 'Ignored'); PHPWS_Core::initModClass('search', 'Stats.php'); $pager = new DBPager('search_stats', 'Search_Stats'); $pager->setModule('search'); $pager->setTemplate('ignore.tpl'); $pager->addRowTags('getTplTags'); $options['keyword'] = ''; $options['delete_keyword'] = dgettext('search', 'Delete'); // if entered in search box, remove $options['remove_ignore'] = dgettext('search', 'Allow'); $form = new PHPWS_Form(); $form->setMethod('get'); $form->addHidden('module', 'search'); $form->addSelect('command', $options); $template = $form->getTemplate(); $js_vars['value'] = dgettext('search', 'Go'); $js_vars['select_id'] = 'command'; $js_vars['action_match'] = 'delete_keyword'; $js_vars['message'] = dgettext('search', 'Are you sure you want to delete the checked item(s)?'); $template['SUBMIT'] = javascript('select_confirm', $js_vars); $template['CHECK_ALL'] = javascript('check_all', array('checkbox_name' => 'keyword[]')); $template['KEYWORD_LABEL'] = dgettext('search', 'Keyword'); $template['TOTAL_QUERY_LABEL'] = dgettext('search', 'Total queries'); $template['LAST_CALL_DATE_LABEL'] = dgettext('search', 'Last called'); $pager->addPageTags($template); $pager->addToggle('class="bgcolor1"'); $pager->setSearch('keyword'); $pager->addWhere('ignored', 1); $tpl['CONTENT'] = $pager->get(); return $tpl; }
/** * Edit form for a schedule */ public function form() { $key = $this->getKey(); $form = new PHPWS_Form('schedule_form'); if (isset($_REQUEST['js'])) { $form->addHidden('js', 1); } $form->addHidden('module', 'calendar'); $form->addHidden('aop', 'post_schedule'); $form->addHidden('sch_id', $this->id); $form->addText('title', $this->title); $form->setLabel('title', dgettext('calendar', 'Title')); $form->setSize('title', 40); $form->addTextArea('summary', $this->summary); $form->setLabel('summary', dgettext('calendar', 'Summary')); $form->useEditor('summary'); if (PHPWS_Settings::get('calendar', 'personal_schedules')) { if (Current_User::allow('calendar', 'edit_public')) { $form->addRadio('public', array(0, 1)); $form->setLabel('public', array(dgettext('calendar', 'Private'), dgettext('calendar', 'Public'))); $form->setMatch('public', (int) $this->public); } else { $form->addTplTag('PUBLIC', dgettext('calendar', 'Private')); $form->addHidden('public', 0); } } else { $form->addTplTag('PUBLIC', dgettext('calendar', 'Public')); $form->addHidden('public', 1); } $upcoming[0] = dgettext('calendar', 'Do not show upcoming events'); $upcoming[1] = dgettext('calendar', 'Show upcoming week'); $upcoming[2] = dgettext('calendar', 'Show next two weeks'); $upcoming[3] = dgettext('calendar', 'Show upcoming month'); $form->addSelect('show_upcoming', $upcoming); $form->setLabel('show_upcoming', dgettext('calendar', 'Show upcoming events')); $form->setMatch('show_upcoming', $this->show_upcoming); $form->addSubmit(dgettext('calendar', 'Save')); $template = $form->getTemplate(); if (isset($_REQUEST['js'])) { $template['CLOSE'] = javascript('close_window', array('value' => dgettext('calendar', 'Cancel'))); } $template['PUBLIC_LABEL'] = dgettext('calendar', 'Availability'); return PHPWS_Template::process($template, 'calendar', 'admin/forms/edit_schedule.tpl'); }
public static function display() { PHPWS_Core::initModClass('intern', 'Term.php'); PHPWS_Core::initModClass('intern', 'Department.php'); PHPWS_Core::initModClass('intern', 'Major.php'); PHPWS_Core::initModClass('intern', 'GradProgram.php'); PHPWS_Core::initModClass('intern', 'Internship.php'); PHPWS_Core::initModClass('intern', 'Agency.php'); PHPWS_Core::initModClass('intern', 'Subject.php'); PHPWS_Core::initModClass('intern', 'WorkflowStateFactory.php'); // Set up search fields $form = new PHPWS_Form(); $form->setMethod('get'); $form->addHidden('module', 'intern'); $form->addHidden('action', 'results'); $form->useRowRepeat(); $form->addText('name'); $form->setLabel('name', "Name or Banner ID"); $terms = Term::getTermsAssoc(); //$thisTerm = Term::timeToTerm(time()); $form->addSelect('term_select', $terms); $form->setLabel('term_select', 'Term'); $form->setClass('term_select', 'form-control'); //$form->setMatch('term_select', $thisTerm); // Deity can search for any department. Other users are restricted. if (Current_User::isDeity()) { $depts = Department::getDepartmentsAssoc(); } else { $depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername()); } $form->addSelect('dept', $depts); $form->setLabel('dept', 'Department'); //$form->setClass('', 'form-control'); $form->setClass('dept', 'form-control'); // If the user only has one department, select it for them // sizeof($depts) == 2 because of the 'Select Deparmtnet' option if (sizeof($depts) == 2) { $keys = array_keys($depts); $form->setMatch('dept', $keys[1]); } // Student level radio button javascript('jquery'); javascriptMod('intern', 'majorSelector', array('form_id' => $form->id)); $levels = array('-1' => 'Any Level', 'ugrad' => 'Undergraduate', 'grad' => 'Graduate'); $form->addSelect('student_level', $levels); $form->setLabel('student_level', 'Level'); $form->setClass('student_level', 'form-control'); // Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected) $levels = array('-1' => 'Choose student level first'); $form->addDropBox('student_major', $levels); $form->setLabel('student_major', 'Major / Program'); $form->addCssClass('student_major', 'form-control'); // Undergrad major drop down if (isset($s)) { $majors = Major::getMajorsAssoc($s->ugrad_major); } else { $majors = Major::getMajorsAssoc(); } $form->addSelect('ugrad_major', $majors); $form->setLabel('ugrad_major', 'Undergraduate Majors & Certificate Programs'); $form->setClass('ugrad_major', 'form-control'); // Graduate major drop down if (isset($s)) { $progs = GradProgram::getGradProgsAssoc($s->grad_prog); } else { $progs = GradProgram::getGradProgsAssoc(); } $form->addSelect('grad_prog', $progs); $form->setLabel('grad_prog', 'Graduate Majors & Certificate Programs'); $form->setClass('grad_prog', 'form-control'); // Campus $campuses = array('main_campus' => 'Main Campus', 'distance_ed' => 'Distance Ed'); $form->addRadioAssoc('campus', $campuses); /*************** * Course Info * ***************/ $subjects = Subject::getSubjects(); $form->addSelect('course_subj', $subjects); $form->setLabel('course_subj', 'Subject'); $form->setClass('course_subj', 'form-control'); $form->addText('course_no'); $form->setLabel('course_no', 'Course Number'); $form->setSize('course_no', 6); $form->setMaxSize('course_no', 4); $form->setClass('course_no', 'form-control'); $form->addText('course_sect'); $form->setLabel('course_sect', 'Section'); $form->setSize('course_sect', 6); $form->setMaxSize('course_sect', 4); $form->setClass('course_sect', 'form-control'); // Internship types. $types = Internship::getTypesAssoc(); $form->addRadioAssoc('type', $types); // Location $loc = array('domestic' => 'Domestic', 'internat' => 'International'); $form->addRadioAssoc('loc', $loc); /* State search */ $db = new PHPWS_DB('intern_state'); $db->addWhere('active', 1); $db->addColumn('abbr'); $db->addColumn('full_name'); $db->setIndexBy('abbr'); // get backwards because we flip it $db->addOrder('full_name desc'); $states = $db->select('col'); if (empty($states)) { NQ::simple('intern', INTERN_ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>'); NQ::close(); PHPWS_Core::goBack(); } $states[-1] = 'Select state'; $states = array_reverse($states, true); $form->addSelect('state', $states); $form->setLabel('state', 'State'); $form->setClass('state', 'form-control'); /* Province search */ $form->addText('prov'); $form->setLabel('prov', 'Province/Territory'); $form->setClass('prov', 'form-control'); // Workflow states $workflowStates = WorkflowStateFactory::getStatesAssoc(); unset($workflowStates['CreationState']); // Remove this state, since it's not valid (internal only state for initial creation) $form->addCheckAssoc('workflow_state', $workflowStates); unset($_REQUEST['module']); unset($_REQUEST['action']); unset($_REQUEST['submit']); //test($_REQUEST,1); $form->plugIn($_REQUEST); $form->addSubmit('submit', 'Search'); // Javascript... javascript('jquery'); javascriptMod('intern', 'resetSearch'); return PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl'); }
/** * Displays the page layout and lets user enter text fields, blocks, etc. */ public function pageLayout() { javascript('jquery'); javascript('jquery_ui'); javascript('ckeditor'); Layout::addStyle('pagesmith', 'admin.css'); Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/pagesmith/javascript/pageedit/script.js"></script>', 'pageedit'); Layout::addStyle('pagesmith'); $page = $this->ps->page; $pg_tpl_name =& $page->_tpl->name; $this->ps->killSaved($page->id); if (!empty($page->_content)) { foreach ($page->_content as $key => $cnt) { if (!PageSmith::checkLorum($cnt)) { $_SESSION['PS_Page'][$page->id][$key] = $cnt; } } } $form = new PHPWS_Form('pagesmith'); $form->addHidden('module', 'pagesmith'); $form->addHidden('aop', 'post_page'); $form->addHidden('tpl', $page->template); $form->addHidden('pid', $page->parent_page); $template_list = $this->ps->getTemplateList(); $form->addSelect('template_list', $template_list); $form->setMatch('template_list', $page->template); $form->addSubmit('change_tpl', dgettext('pagesmith', 'Change template')); if ($page->id) { $form->addHidden('id', $page->id); } if (empty($page->_tpl) || $page->_tpl->error) { $this->ps->content = dgettext('pagesmith', 'Unable to load page template.'); return; } $form->addSubmit('submit', dgettext('pagesmith', 'Save page')); $form->setClass('submit', 'btn btn-success'); $page->loadKey(); if ($page->_key->id && $page->_key->show_after) { $publish_date = $page->_key->show_after; } else { $publish_date = time(); } $this->pageTemplateForm($form); $tpl = $form->getTemplate(); $tpl['PUBLISH_DATE_LABEL'] = 'Show page after this date and time'; $tpl['PUBLISH_VALUE'] = strftime('%Y-%m-%dT%H:%M:%S', $publish_date); $tpl['PAGE_TITLE'] = $page->title; $jsvars['page_title_input'] = 'pagesmith_title'; $jsvars['page_title_id'] = sprintf('%s-page-title', $pg_tpl_name); javascriptMod('pagesmith', 'pagetitle', $jsvars); $tpl['HIDE_CHECK'] = $page->hide_title ? 'checked="checked"' : null; if (!empty($page->_orphans)) { $tpl['ORPHAN_LINK'] = sprintf('<a href="%s#orphans">%s</a>', PHPWS_Core::getCurrentUrl(), dgettext('pagesmith', 'Orphans')); $tpl['ORPHANS'] = $this->listOrphans($page->_orphans); } // We wrap the textarea in a form just so ckeditor will allow use of the "Save" button. $modal = new \Modal('edit-section', '<form><textarea id="block-edit-textarea"></textarea></form>', dgettext('pagesmith', 'Edit text area')); $modal->addButton('<button id="save-page" class="btn btn-success">' . dgettext('pagesmith', 'Save') . '</button>'); $modal->setWidthPercentage(90); $tpl['CONTENT_MODAL'] = $modal->__toString(); $title_modal = new \Modal('edit-title', '<input class="form-control" type="text" id="page-title-input" name="page_title" value="" />', dgettext('pagesmith', 'Edit page title')); $title_modal->addButton('<button id="save-title" class="btn btn-success">' . dgettext('pagesmith', 'Save') . '</button>'); $tpl['TITLE_MODAL'] = $title_modal->__toString(); $this->ps->content = PHPWS_Template::process($tpl, 'pagesmith', 'page_form.tpl'); }
public function blogEvent() { $event = $this->calendar->schedule->loadEvent(); $form = new PHPWS_Form('blog_event'); $form->addHidden('module', 'calendar'); $form->addHidden('aop', 'post_blog'); $form->addHidden('event_id', $event->id); $form->addHidden('sch_id', $this->calendar->schedule->id); $advance[0] = dgettext('calendar', 'Date of occurence'); $advance[1] = dgettext('calendar', 'A day prior'); $advance[2] = dgettext('calendar', 'Two days prior'); $advance[3] = dgettext('calendar', 'Three days prior'); $advance[7] = dgettext('calendar', 'A week prior'); $advance[14] = dgettext('calendar', 'Two weeks prior'); $advance[30] = dgettext('calendar', 'One month prior'); $form->addSelect('advance_post', $advance); $form->setLabel('advance_post', dgettext('calendar', 'When should it post?')); $form->addSubmit(dgettext('calendar', 'Post to Blog')); $tpl = $form->getTemplate(); $tpl['CLOSE'] = javascript('close_window'); $this->title = dgettext('calendar', 'Post Event to Blog'); $this->content = PHPWS_Template::process($tpl, 'calendar', 'admin/forms/blog.tpl'); }
public function classifyFile($files) { $tpl = null; $this->cabinet->title = dgettext('filecabinet', 'Classify Files'); $classify_dir = $this->cabinet->getClassifyDir(); if (empty($classify_dir) || !is_dir($classify_dir)) { $this->cabinet->content = dgettext('filecabinet', 'Unable to locate the classify directory. Please check your File Cabinet settings, configuration file and directory permissions.'); return; } if (!is_array($files)) { $files = array($files); } // image folders $image_folders = Cabinet::listFolders(IMAGE_FOLDER, true); // document folders $document_folders = Cabinet::listFolders(DOCUMENT_FOLDER, true); // multimedia folders $multimedia_folders = Cabinet::listFolders(MULTIMEDIA_FOLDER, true); $count = 0; $image_types = $this->cabinet->getAllowedTypes('image'); $document_types = $this->cabinet->getAllowedTypes('document'); $media_types = $this->cabinet->getAllowedTypes('media'); foreach ($files as $file) { if (!is_file($classify_dir . $file) || !PHPWS_File::checkMimeType($classify_dir . $file) || !$this->cabinet->fileTypeAllowed($file)) { continue; } $form = new PHPWS_Form('file_form_' . $count); $ext = PHPWS_File::getFileExtension($file); if (in_array($ext, $image_types)) { $folders =& $image_folders; } elseif (in_array($ext, $media_types)) { $folders =& $multimedia_folders; } elseif (in_array($ext, $document_types)) { $folders =& $document_folders; } else { continue; } $form->addSelect("folder[{$count}]", $folders); $form->setTag("folder[{$count}]", 'folder'); $form->setLabel("folder[{$count}]", dgettext('filecabinet', 'Folder')); $form->addText("file_title[{$count}]", $file); $form->setLabel("file_title[{$count}]", dgettext('filecabinet', 'Title')); $form->setTag("file_title[{$count}]", 'file_title'); $form->setSize("file_title[{$count}]", 40); $form->addTextarea("file_description[{$count}]"); $form->setLabel("file_description[{$count}]", dgettext('filecabinet', 'Description')); $form->setTag("file_description[{$count}]", 'file_description'); $form->addSubmit('submit', dgettext('filecabinet', 'Classify files')); $subtpl = $form->getTemplate(); $subtpl['HIDDEN'] = sprintf('<input type="hidden" name="file_count[%s]" value="%s" />', $count, $file); $subtpl['FILE_NAME'] = $file; $subtpl['FILE_NAME_LABEL'] = dgettext('filecabinet', 'File name'); unset($subtpl['START_FORM']); unset($subtpl['END_FORM']); $tpl['files'][] = $subtpl; $count++; } $form = new PHPWS_Form('classify_files'); $form->addHidden('module', 'filecabinet'); $form->addHidden('aop', 'post_classifications'); if (!empty($tpl)) { $form_template = $form->getTemplate(true, true, $tpl); $this->cabinet->content = PHPWS_Template::process($form_template, 'filecabinet', 'Forms/classify_file.tpl'); } else { $this->cabinet->content = dgettext('filecabinet', 'Unable to classify files.'); } }
public function getPageDrop() { if (empty($this->total_pages)) { $page_list[1] = 1; } else { for ($i = 1; $i <= $this->total_pages; $i++) { $page_list[$i] = $i; } } $form = new PHPWS_Form('page_list'); $form->setMethod('get'); $values = $this->getLinkValues(); $form->addHidden($values); $form->addSelect('change_page', $page_list); $form->setExtra('change_page', 'onchange="this.form.submit()"'); $form->setMatch('change_page', $this->current_page); if (!function_exists('javascriptEnabled') || !javascriptEnabled()) { $form->addSubmit('go', _('Go')); } $template = $form->getTemplate(); if (PHPWS_Error::isError($template)) { PHPWS_Error::log($template); return null; } return $template['START_FORM'] . $template['CHANGE_PAGE'] . $template['END_FORM']; }
public static function searchPost() { if (isset($_GET['search'])) { $search_phrase = $_GET['search']; } else { $search_phrase = ''; } $search_phrase = str_replace('+', ' ', $search_phrase); $search_phrase = Search::filterWords($search_phrase); if (isset($_GET['alternate']) && $_GET['alternate'] != 'local') { Search_User::sendToAlternate($_GET['alternate'], $search_phrase); exit; } // hi + keep search terms for further use (like hilite for js) $_SESSION['search']['search_phrase'] = $search_phrase; // hi / $form = new PHPWS_Form('search_for'); $form->setMethod('get'); $form->addHidden('module', 'search'); $form->addHidden('user', 'search'); $form->addSubmit(dgettext('search', 'Search')); $form->addText('search', $search_phrase); $form->setSize('search', 40); $form->setLabel('search', dgettext('search', 'Search for:')); $form->addCheck('exact_only', 1); $form->setLabel('exact_only', dgettext('search', 'Exact matches only')); if (isset($_GET['exact_only'])) { $exact_match = TRUE; $form->setMatch('exact_only', 1); } else { $exact_match = FALSE; } $mod_list = Search_User::getModList(); $form->addSelect('mod_title', $mod_list); $form->setLabel('mod_title', dgettext('search', 'Module list')); if (isset($_GET['mod_title'])) { $form->setMatch('mod_title', $_GET['mod_title']); } Search_User::addAlternates($form); $template = $form->getTemplate(); if (isset($_GET['mod_title']) && $_GET['mod_title'] != 'all') { $module = preg_replace('/\\W/', '', $_GET['mod_title']); } else { $module = NULL; } $template['SEARCH_LOCATION'] = dgettext('search', 'Search location'); $template['ADVANCED_LABEL'] = dgettext('search', 'Advanced Search'); $result = Search_User::getResults($search_phrase, $module, $exact_match); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $template['SEARCH_RESULTS'] = dgettext('search', 'A problem occurred during your search.'); } elseif (empty($result)) { $template['SEARCH_RESULTS'] = dgettext('search', 'No results found.'); } else { $template['SEARCH_RESULTS'] = $result; } $template['SEARCH_RESULTS_LABEL'] = dgettext('search', 'Search Results'); $content = PHPWS_Template::process($template, 'search', 'search_page.tpl'); Layout::add($content); }
/** * Returns the html for the toolbar * * This function creates the toolbar which is used in edit mode to do * operations on this form (i.e.: Add Element, Settings, Save). It is * templated according to the form/toolbar.tpl template. * * @return string The html needed to display the toolbar * @access private * @see view() */ function _toolbar() { $elementTypes = array('PHAT_Dropbox' => dgettext('phatform', 'Dropbox'), 'PHAT_Textfield' => dgettext('phatform', 'Textfield'), 'PHAT_Textarea' => dgettext('phatform', 'Textarea'), 'PHAT_Multiselect' => dgettext('phatform', 'Multiple Select'), 'PHAT_Radiobutton' => dgettext('phatform', 'Radio Button'), 'PHAT_Checkbox' => dgettext('phatform', 'Checkbox')); for ($i = 1; $i <= $this->numPages(); $i++) { $pageNumber[$i] = $i; } $form = new PHPWS_Form(); $form->addSelect('PHAT_PageNumber', $pageNumber); $form->setMatch('PHAT_PageNumber', $this->currentPage()); $form->setLabel('PHAT_PageNumber', dgettext('phatform', 'Page')); $form->addSelect('PHAT_ElementType', $elementTypes); $form->addSubmit('PHAT_Go', dgettext('phatform', 'Go!')); $form->addSubmit('PHAT_Add', dgettext('phatform', 'Add')); $form->addSubmit('PHAT_Settings', dgettext('phatform', 'Form Settings')); if ($this->isApproved()) { $form->addSubmit('PHAT_Save', dgettext('phatform', 'Save Form')); } $form->addHidden('module', 'phatform'); $form->addHidden('PHAT_FORM_OP', 'ToolbarAction'); $template = $form->getTemplate(); return PHPWS_Template::process($template, 'phatform', 'form/toolbar.tpl'); }
function getKeyMods($match = null, $select_name = 'exclude', $multiple = true, $count = true) { PHPWS_Core::initCoreClass('Key.php'); $db = new PHPWS_DB('phpws_key'); $db->addOrder('module asc'); $result = $db->getObjects('Key'); if ($result) { foreach ($result as $item) { if ($count) { $db = new PHPWS_DB('phpws_key'); $db->addWhere('module', $item->module); $qty = $db->count(); if ($qty == 1) { $qty_label = dgettext('whatsnew', 'item'); } else { $qty_label = dgettext('whatsnew', 'items'); } $items[$item->module] = $item->module . ' (' . $qty . ' ' . $qty_label . ')'; } else { $items[$item->module] = $item->module; } } } if ($items) { if ($multiple) { $form = new PHPWS_Form(); $form->addMultiple($select_name, $items); if (!empty($match) && is_array($match)) { $form->setMatch($select_name, $match); } return $form->get($select_name); } else { $form = new PHPWS_Form(); $form->addSelect($select_name, $items); if (!empty($match) && is_string($match)) { $form->setMatch($select_name, $match); } return $form->get($select_name); } } else { return dgettext('whatsnew', 'No keyed items.'); } }
public static function adminThemes() { $form = new PHPWS_Form('themes'); $form->addHidden('module', 'layout'); $form->addHidden('action', 'admin'); $form->addHidden('command', 'postTheme'); $form->addSubmit('update', dgettext('layout', 'Update Theme Settings')); $themeList = Layout_Admin::getThemeList(); if (PHPWS_Error::isError($themeList)) { PHPWS_Error::log($themeList); return dgettext('layout', 'There was a problem reading the theme directories.'); } $form->addSelect('default_theme', $themeList); $form->reindexValue('default_theme'); $form->setMatch('default_theme', Layout::getDefaultTheme()); $form->setLabel('default_theme', dgettext('layout', 'Default Theme')); $include_order[0] = dgettext('layout', 'Do not include module style sheets'); $include_order[1] = dgettext('layout', 'Modules before theme'); $include_order[2] = dgettext('layout', 'Theme before modules'); $form->addSelect('include_css_order', $include_order); $form->setMatch('include_css_order', PHPWS_Settings::get('layout', 'include_css_order')); $form->setLabel('include_css_order', dgettext('layout', 'CSS inclusion order')); $template = $form->getTemplate(); return PHPWS_Template::process($template, 'layout', 'themes.tpl'); }
public function showPeeps() { $sheet = new Signup_Sheet($this->sheet_id); $total_slots = $sheet->totalSlotsFilled(); $all_slots = $sheet->getAllSlots(); foreach ($all_slots as $slot) { if ($slot->id == $this->id) { continue; } elseif (!isset($total_slots[$slot->id]) || $slot->openings != $total_slots[$slot->id]) { $options[$slot->id] = $slot->title; } } $ex1 = sprintf('<abbr title="%s"><strong>1:</strong></abbr> ', $sheet->extra1); $ex2 = sprintf('<abbr title="%s"><strong>2:</strong></abbr> ', $sheet->extra2); $ex3 = sprintf('<abbr title="%s"><strong>3:</strong></abbr> ', $sheet->extra3); if ($this->_peeps) { $jsconf['QUESTION'] = dgettext('signup', 'Are you sure you want to delete this person from their signup slot?'); $jsconf['LINK'] = Icon::show('delete'); $jspop['label'] = Icon::show('edit'); foreach ($this->_peeps as $peep) { $links = array(); $subtpl = array(); $subtpl['FIRST_NAME'] = $peep->first_name; $subtpl['LAST_NAME'] = $peep->last_name; $subtpl['EMAIL'] = $peep->getEmail(); $subtpl['PHONE'] = $peep->getPhone(); if (!empty($sheet->extra1)) { $subtpl['EXTRA1'] = $ex1 . $peep->getExtra1(); } if (!empty($sheet->extra2)) { $subtpl['EXTRA2'] = $ex2 . $peep->getExtra2(); } if (!empty($sheet->extra3)) { $subtpl['EXTRA3'] = $ex3 . $peep->getExtra3(); } $vars['peep_id'] = $peep->id; $vars['aop'] = 'edit_slot_peep'; $jspop['address'] = PHPWS_Text::linkAddress('signup', $vars, true); $jspop['width'] = 300; $jspop['height'] = 600; $links[] = javascript('open_window', $jspop); $vars['aop'] = 'delete_slot_peep'; $jsconf['ADDRESS'] = PHPWS_Text::linkAddress('signup', $vars, true); $links[] = javascript('confirm', $jsconf); $subtpl['ACTION'] = implode('', $links); if (!empty($options)) { $form = new PHPWS_Form(); $form->addHidden('module', 'signup'); $form->addHidden('aop', 'move_peep'); $form->addHidden('peep_id', $peep->id); $form->addSelect('mv_slot', $options); $form->addSubmit(dgettext('signup', 'Go')); $tmptpl = $form->getTemplate(); $subtpl['MOVE'] = $tmptpl['START_FORM'] . $tmptpl['MV_SLOT'] . $tmptpl['SUBMIT'] . $tmptpl['END_FORM']; } else { $subtpl['MOVE'] = dgettext('signup', 'Other slots full'); } $tpl['peep-row'][] = $subtpl; } $tpl['NAME_LABEL'] = dgettext('signup', 'Name'); $tpl['EMAIL_LABEL'] = dgettext('signup', 'Email'); $tpl['PHONE_LABEL'] = dgettext('signup', 'Phone'); $tpl['ACTION_LABEL'] = dgettext('signup', 'Action'); $tpl['ORGANIZATION_LABEL'] = dgettext('signup', 'Organization'); $tpl['MOVE_LABEL'] = dgettext('signup', 'Move'); $tpl['EXTRA1_LABEL'] = 'Extra info'; return PHPWS_Template::process($tpl, 'signup', 'peeps.tpl'); } }
public static function edit(Block_Item $block, $js = FALSE) { javascript('jquery'); javascript('ckeditor'); $form = new PHPWS_Form('block-form'); $form->addHidden('module', 'block'); $form->addCheck('hide_title', 1); $form->setMatch('hide_title', $block->hide_title); $form->setLabel('hide_title', dgettext('block', 'Hide title')); $form->addCheck('hide_narrow', 1); $form->setMatch('hide_narrow', $block->hide_narrow); $form->setLabel('hide_narrow', dgettext('block', 'Hide when width < 768px')); $form->addTextArea('block_content', $block->getContent(false)); $form->setRows('block_content', '10'); $form->setWidth('block_content', '80%'); $form->setLabel('block_content', dgettext('block', 'Entry')); if ($js) { if (isset($_REQUEST['key_id']) && is_numeric($_REQUEST['key_id'])) { $key_id = (int) $_REQUEST['key_id']; } else { $key_id = 0; } $form->addHidden('key_id', $key_id); $form->addHidden('action', 'postJSBlock'); $pdb = Database::newDB(); $pdb->addTable('block_pinned'); $all_pinned = $pdb->select(); if (!empty($all_pinned)) { $pinned = new \Variable\Arr($all_pinned); $pinned->indexByColumn('block_id', true, 'key_id'); $pinned_keys = $pinned->get(); } else { $pinned_keys = null; } $db = Database::newDB(); $blocks = $db->addTable('block'); $blocks->addField('id'); $blocks->addOrderBy($blocks->addField('title')); $db->loadSelectStatement(); while ($b = $db->fetch()) { /** * Checking here to see if this block is already set for the current * key OR is this block is set to show everywhere. If either, * then don't add to select list. */ if (!empty($pinned_keys)) { if (isset($pinned_keys[$b['id']])) { if (in_array($key_id, $pinned_keys[$b['id']]) || in_array('-1', $pinned_keys[$b['id']])) { continue; } } } $block_options[$b['id']] = $b['title']; } if (!empty($block_options)) { $form->addSelect('block_list', $block_options); $form->addSubmit('pick_block', 'Add this block to the page'); } } else { $form->useEditor('block_content'); $form->addHidden('action', 'postBlock'); if (empty($block->id)) { $form->addSubmit('submit', dgettext('block', 'Save New Block')); } else { $form->addHidden('block_id', $block->getId()); $form->addSubmit('submit', dgettext('block', 'Update Current Block')); } } $form->addText('title', $block->getTitle()); $form->setLabel('title', dgettext('block', 'Title')); $form->setSize('title', 50); $template = $form->getTemplate(); if ($js) { if (!empty($block_options)) { $template['ALTERNATIVE'] = t('or create new block below'); } $content = PHPWS_Template::process($template, 'block', 'js_edit.tpl'); } else { $content = PHPWS_Template::process($template, 'block', 'edit.tpl'); } return $content; }
/** * Edit a new or existing PHAT_Dropbox element * * The edit function provides the HTML form to edit a new or existing * PHAT_Dropbox element. * g * return string The HTML form to edit a PHAT_Dropbox */ function edit() { $numOptions = sizeof($this->getOptionText()); if (!$numOptions || $this->getOptionSet()) { $numOptions = ''; } $form = new PHPWS_Form(); $form->addHidden('module', 'phatform'); $form->addHidden('PHAT_EL_OP', 'SaveElement'); if (!$this->getLabel()) { $num = $_SESSION['PHAT_FormManager']->form->numElements(); $this->setLabel('Element' . ($num + 1)); } $form->addTextArea('PHAT_ElementBlurb', $this->getBlurb()); $form->setRows('PHAT_ElementBlurb', PHAT_DEFAULT_ROWS); $form->setCols('PHAT_ElementBlurb', PHAT_DEFAULT_COLS); $form->setLabel('PHAT_ElementBlurb', dgettext('phatform', 'Associated Text')); $form->addText('PHAT_ElementName', $this->getLabel()); $form->setSize('PHAT_ElementName', PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE); $form->setLabel('PHAT_ElementName', dgettext('phatform', 'Name')); $form->addText('PHAT_ElementNumOptions', $numOptions); $form->setSize('PHAT_ElementNumOptions', 5, 3); $form->setLabel('PHAT_ElementNumOptions', dgettext('phatform', 'Number of Options')); $options = $this->getOptionSets(); if (is_array($options)) { $editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set'); $form->addSelect('PHAT_OptionSet', $options); $form->setMatch('PHAT_OptionSet', $this->getOptionSet()); } $form->addCheck('PHAT_ElementRequired', 1); $form->setMatch('PHAT_ElementRequired', $this->isRequired()); $form->setLabel('PHAT_ElementRequired', dgettext('phatform', 'Required')); $form->addSubmit('PHAT_ElementBack', dgettext('phatform', 'Back')); $form->addSubmit('NEXT_BUTTON', dgettext('phatform', 'Next')); $template = $form->getTemplate(); return PHPWS_Template::processTemplate($template, 'phatform', 'dropbox/edit.tpl'); }
/** * View of files in current folder */ public function folderContentView() { javascript('jquery'); PHPWS_Core::initModClass('filecabinet', 'Image.php'); javascript('confirm'); // needed for deletion Layout::addStyle('filecabinet'); if (empty($this->current_folder) || empty($this->folder_type)) { javascript('alert', array('content' => dgettext('filecabinet', 'Problem with opening browser page. Closing File Manager window.'))); javascript('close_refresh', array('timeout' => 3, 'refresh' => 0)); return; } $tpl = array(); $this->folderIcons($tpl); if (Current_User::allow('filecabinet', 'edit_folders')) { $tpl['FOLDER_TITLE'] = $this->current_folder->editLink('title', $this->current_folder->module_created); } else { $tpl['FOLDER_TITLE'] =& $this->current_folder->title; } $img_dir = PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/file_manager/'; $image_string = '<img src="%s" title="%s" alt="%s" />'; $link_info = $this->linkInfo(); switch ($this->folder_type) { case IMAGE_FOLDER: $js = $link_info; $js['authkey'] = Current_User::getAuthKey(); $js['failure_message'] = dgettext('filecabinet', 'Unable to resize image.'); $js['confirmation'] = sprintf(dgettext('filecabinet', 'This image is larger than the %s x %s limit. Do you want to resize the image to fit?'), $this->max_width, $this->max_height); javascriptMod('filecabinet', 'pick_file', $js); $db = new PHPWS_DB('images'); $class_name = 'PHPWS_Image'; $file_type = FC_IMAGE; $altvars = $link_info; // check unset($altvars['mw']); unset($altvars['mh']); unset($altvars['fr']); $img1 = 'folder_random.png'; $img2 = 'thumbnails.png'; $img3 = 'lightbox.png'; $img1_alt = dgettext('filecabinet', 'Random image icon'); $img2_alt = dgettext('filecabinet', 'Thumbnail icon'); $img3_alt = dgettext('filecabinet', 'Lightbox icon'); if (!$this->reserved_folder) { if ($this->current_folder->public_folder) { $altvars['id'] = $this->current_folder->id; $altvars['fop'] = 'pick_file'; $altvars['file_type'] = FC_IMAGE_RANDOM; $not_allowed = dgettext('filecabinet', 'Action not allowed'); if (!$this->lock_type || in_array(FC_IMAGE_RANDOM, $this->lock_type)) { $img1_title = dgettext('filecabinet', 'Show a random image from this folder'); $image1 = sprintf($image_string, $img_dir . $img1, $img1_title, $img1_alt); $tpl['ALT1'] = PHPWS_Text::secureLink($image1, 'filecabinet', $altvars); if ($this->file_assoc->file_type == FC_IMAGE_RANDOM && $this->current_folder->id == $this->file_assoc->file_id) { $tpl['ALT_HIGH1'] = ' alt-high'; } } else { $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } if (!$this->lock_type || in_array(FC_IMAGE_FOLDER, $this->lock_type)) { /** start new * */ if ($this->file_assoc->file_type == FC_IMAGE_FOLDER) { $tpl['ALT_HIGH2'] = ' alt-high'; } $img2_title = dgettext('filecabinet', 'Show block of thumbnails'); $image2 = sprintf($image_string, $img_dir . $img2, $img2_title, $img2_alt); $form = new PHPWS_Form('carousel-options'); $form->setMethod('get'); $altvars['file_type'] = FC_IMAGE_FOLDER; $form->addHidden($altvars); $form->addHidden('module', 'filecabinet'); $form->addRadioAssoc('direction', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical'))); $match = $this->file_assoc->vertical; $form->setMatch('direction', $match); $num = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8); $form->addSelect('num_visible', $num); $form->setLabel('num_visible', dgettext('filecabinet', 'Number shown')); $form->setMatch('num_visible', $this->file_assoc->num_visible); $form->addSubmit('go', dgettext('filecabinet', 'Go')); $subtpl = $form->getTemplate(); $subtpl['DIRECTION_DESC'] = dgettext('filecabinet', 'Carousel direction'); $subtpl['LINK'] = sprintf('<a href="#" onclick="return carousel_pick();">%s</a>', $image2); $subtpl['CANCEL'] = dgettext('filecabinet', 'Cancel'); $tpl['ALT2'] = PHPWS_Template::process($subtpl, 'filecabinet', 'file_manager/carousel_pick.tpl'); } else { $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt); $tpl['ALT2'] = $image2; $tpl['ALT_HIGH2'] = ' no-use'; } if (!$this->lock_type || in_array(FC_IMAGE_LIGHTBOX, $this->lock_type)) { /** start VV * */ if ($this->file_assoc->file_type == FC_IMAGE_LIGHTBOX) { $tpl['ALT_HIGH3'] = ' alt-high'; } $img3_title = dgettext('filecabinet', 'Show lightbox slideshow'); $image3 = sprintf($image_string, $img_dir . $img3, $img3_title, $img3_alt); $altvars['file_type'] = FC_IMAGE_LIGHTBOX; $form = new PHPWS_Form('lightbox-options'); $form->setMethod('get'); $form->addHidden($altvars); $form->addHidden('module', 'filecabinet'); $form->addRadioAssoc('direction', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical'))); $match = $this->file_assoc->vertical; $form->setMatch('direction', $match); $num = array(3 => 3, 6 => 6, 9 => 9, 12 => 12, 15 => 15, 18 => 18, 21 => 21, 99 => 'unlimited'); $form->addSelect('num_visible', $num); $form->setLabel('num_visible', dgettext('filecabinet', 'Number shown')); $form->setMatch('num_visible', $this->file_assoc->num_visible); $form->addSubmit('go', dgettext('filecabinet', 'Go')); $subtpl = $form->getTemplate(); $subtpl['DIRECTION_DESC'] = dgettext('filecabinet', 'Thumbnail direction'); $subtpl['LINK'] = sprintf('<a href="#" onclick="return lightbox_pick();">%s</a>', $image3); $subtpl['CANCEL'] = dgettext('filecabinet', 'Cancel'); $tpl['ALT3'] = PHPWS_Template::process($subtpl, 'filecabinet', 'file_manager/lightbox_pick.tpl'); } else { $image3 = sprintf($image_string, $img_dir . $img3, $not_allowed, $img3_alt); $tpl['ALT3'] = $image3; $tpl['ALT_HIGH3'] = ' no-use'; } } else { $not_allowed = dgettext('filecabinet', 'Action not allowed - private folder'); $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt); $image3 = sprintf($image_string, $img_dir . $img3, $not_allowed, $img3_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; $tpl['ALT2'] = $image2; $tpl['ALT_HIGH2'] = ' no-use'; $tpl['ALT3'] = $image3; $tpl['ALT_HIGH3'] = ' no-use'; } } break; case DOCUMENT_FOLDER: PHPWS_Core::initModClass('filecabinet', 'Document.php'); $db = new PHPWS_DB('documents'); $class_name = 'PHPWS_Document'; $file_type = FC_DOCUMENT; $img1 = 'all_files.png'; $img1_alt = dgettext('filecabinet', 'All files icon'); if ($this->current_folder->public_folder) { if (!$this->lock_type || in_array(FC_DOCUMENT_FOLDER, $this->lock_type)) { $altvars = $link_info; $altvars['id'] = $this->current_folder->id; $altvars['fop'] = 'pick_file'; $altvars['file_type'] = FC_DOCUMENT_FOLDER; $img1_title = dgettext('filecabinet', 'Show all files in the folder'); $image1 = sprintf($image_string, $img_dir . $img1, $img1_title, $img1_alt); $tpl['ALT1'] = PHPWS_Text::secureLink($image1, 'filecabinet', $altvars); if ($this->file_assoc->file_type == FC_DOCUMENT_FOLDER && $this->current_folder->id == $this->file_assoc->file_id) { $tpl['ALT_HIGH1'] = ' alt-high'; } } else { $not_allowed = dgettext('filecabinet', 'Action not allowed'); $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } } else { $not_allowed = dgettext('filecabinet', 'Action not allowed - private folder'); $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } break; case MULTIMEDIA_FOLDER: $js = $link_info; $js['authkey'] = Current_User::getAuthKey(); $js['failure_message'] = dgettext('filecabinet', 'Unable to resize media.'); $js['confirmation'] = sprintf(dgettext('filecabinet', 'This media is larger than the %s x %s limit. Do you want to resize the media to fit?'), $this->max_width, $this->max_height); javascriptMod('filecabinet', 'pick_file', $js); PHPWS_Core::initModClass('filecabinet', 'Multimedia.php'); $db = new PHPWS_DB('multimedia'); $class_name = 'PHPWS_Multimedia'; $file_type = FC_MEDIA; //$tpl['ADD_EMBED'] = $this->current_folder->embedLink(true); break; } $db->addWhere('folder_id', $this->current_folder->id); $db->addOrder('title'); $items = $db->getObjects($class_name); if ($items) { foreach ($items as $item) { $stpl = $item->managerTpl($this); $tpl['items'][] = $stpl; } } else { $not_allowed = dgettext('filecabinet', 'No files in folder'); if (isset($tpl['ALT1'])) { $image1 = sprintf($image_string, $img_dir . $img1, $not_allowed, $img1_alt); $tpl['ALT1'] = $image1; $tpl['ALT_HIGH1'] = ' no-use'; } if (isset($tpl['ALT2'])) { $image2 = sprintf($image_string, $img_dir . $img2, $not_allowed, $img2_alt); $tpl['ALT2'] = $image2; $tpl['ALT_HIGH2'] = ' no-use'; } } if (Current_User::allow('filecabinet', 'edit_folders', $this->current_folder->id, 'folder')) { if ($this->force_upload_dimensions) { $tpl['ADD_FILE'] = $this->current_folder->uploadLink(true, $this->max_width, $this->max_height); } else { $tpl['ADD_FILE'] = $this->current_folder->uploadLink(true); } } $tpl['CLOSE'] = javascript('close_window'); return PHPWS_Template::process($tpl, 'filecabinet', 'file_manager/folder_content_view.tpl'); }
public function userSignup() { if (!$this->signup->sheet->id) { PHPWS_Core::errorPage('404'); } $sheet = $this->signup->sheet; $peep = $this->signup->peep; if (Current_User::isLogged() && empty($peep->email)) { $peep->email = Current_User::getEmail(); } if ($sheet->end_time < time()) { $this->signup->title = dgettext('signup', 'Sorry'); $this->signup->content = dgettext('signup', 'We are no longer accepting applications.'); return; } $slots = $sheet->getAllSlots(); $slots_filled = $sheet->totalSlotsFilled(); if (empty($slots)) { $this->signup->title = dgettext('signup', 'Sorry'); $this->signup->content = dgettext('signup', 'There is a problem with this signup sheet. Please check back later.'); return; } $this->signup->title =& $sheet->title; foreach ($slots as $slot) { // if the slots are filled, don't offer it if ($slots_filled && isset($slots_filled[$slot->id])) { $filled =& $slots_filled[$slot->id]; if ($filled >= $slot->openings) { continue; } else { $openings_left = $slot->openings - $filled; } } else { $openings_left =& $slot->openings; } $options[$slot->id] = sprintf(dngettext('signup', '%s (%s opening)', '%s (%s openings)', $openings_left), $slot->title, $openings_left); } if (!isset($options)) { $this->signup->content = dgettext('signup', 'Sorry, but all available slots are full. Please check back later for possible cancellations.'); return; } else { $form = new PHPWS_Form('slots'); $form->useFieldset(); $form->setLegend(dgettext('signup', 'Signup form')); $form->addHidden('module', 'signup'); $form->addHidden('uop', 'slot_signup'); $form->addHidden('sheet_id', $this->signup->sheet->id); $form->addSelect('slot_id', $options); $form->setLabel('slot_id', dgettext('signup', 'Available slots')); $form->setMatch('slot_id', $peep->slot_id); $form->addText('first_name', $peep->first_name); $form->setLabel('first_name', dgettext('signup', 'First name')); $form->addText('last_name', $peep->last_name); $form->setLabel('last_name', dgettext('signup', 'Last name')); $form->addText('email', $peep->email); $form->setSize('email', 30); $form->setLabel('email', dgettext('signup', 'Email address')); $form->addText('phone', $peep->getPhone()); $form->setSize('phone', 15); $form->setLabel('phone', dgettext('signup', 'Phone number')); if (!empty($this->signup->sheet->extra1)) { $form->addText('extra1', $peep->extra1); $form->setLabel('extra1', $this->signup->sheet->extra1); } if (!empty($this->signup->sheet->extra2)) { $form->addText('extra2', $peep->extra2); $form->setLabel('extra2', $this->signup->sheet->extra2); } if (!empty($this->signup->sheet->extra3)) { $form->addText('extra3', $peep->extra3); $form->setLabel('extra3', $this->signup->sheet->extra3); } $form->addSubmit(dgettext('signup', 'Submit')); $tpl = $form->getTemplate(); } $tpl['DESCRIPTION'] = $sheet->getDescription(); $this->signup->content = PHPWS_Template::process($tpl, 'signup', 'signup_form.tpl'); $this->signup->sheet->flag(); }
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 static function settings() { $content = array(); $form = new PHPWS_Form('user_settings'); $form->addHidden('module', 'users'); $form->addHidden('action', 'admin'); $form->addHidden('command', 'update_settings'); $form->addSubmit('submit', dgettext('users', 'Update Settings')); $form->addText('site_contact', PHPWS_User::getUserSetting('site_contact')); $form->setLabel('site_contact', dgettext('users', 'Site contact email')); $form->setSize('site_contact', 40); if (Current_User::isDeity()) { $signup_modes = array(0, AUTO_SIGNUP, CONFIRM_SIGNUP); $signup_labels = array(dgettext('users', 'Not allowed'), dgettext('users', 'Immediate'), dgettext('users', 'Email Verification')); $form->addRadio('user_signup', $signup_modes); $form->setLabel('user_signup', $signup_labels); $form->addTplTag('USER_SIGNUP_LABEL', dgettext('users', 'User Signup Mode')); $form->setMatch('user_signup', PHPWS_User::getUserSetting('new_user_method')); if (extension_loaded('gd')) { $form->addCheckbox('graphic_confirm'); $form->setLabel('graphic_confirm', dgettext('users', 'New user CAPTCHA confirmation')); $form->setMatch('graphic_confirm', PHPWS_User::getUserSetting('graphic_confirm')); } $included_usermenu = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'mod/users/templates/usermenus/', FALSE, TRUE, FALSE, array('tpl')); $theme_usermenu = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . Layout::getThemeDir() . 'templates/users/usermenus/', FALSE, TRUE, FALSE, array('tpl')); if ($theme_usermenu) { $options = array_unique(array_merge($included_usermenu, $theme_usermenu)); } else { $options = $included_usermenu; } $menu_options = array_combine($options, $options); // Replace below with a directory read $menu_options['none'] = dgettext('users', 'None'); $menu_options['css.tpl'] = 'css.tpl'; $menu_options['Default.tpl'] = 'Default.tpl'; $menu_options['top.tpl'] = 'top.tpl'; $form->addSelect('user_menu', $menu_options); $form->setMatch('user_menu', PHPWS_User::getUserSetting('user_menu')); $form->setLabel('user_menu', dgettext('users', 'User Menu')); $form->addCheckBox('show_login', 1); $form->setMatch('show_login', PHPWS_Settings::get('users', 'show_login')); $form->setLabel('show_login', dgettext('users', 'Show login box')); $form->addTplTag('AFFIRM', dgettext('users', 'Yes')); $form->addCheckBox('allow_remember', 1); $form->setMatch('allow_remember', PHPWS_Settings::get('users', 'allow_remember')); $form->setLabel('allow_remember', dgettext('users', 'Allow Remember Me')); $form->addRadioAssoc('allow_new_users', array(1 => 'Yes', 0 => 'No')); $form->setMatch('allow_new_users', PHPWS_Settings::get('users', 'allow_new_users')); $form->addTplTag('ALLOW_NEW_USERS_LABEL', dgettext('users', 'Allow new user creation?')); } $form->addTextArea('forbidden_usernames', PHPWS_Settings::get('users', 'forbidden_usernames')); $form->setLabel('forbidden_usernames', dgettext('users', 'Forbidden usernames (one per line)')); $form->addCheckbox('session_warning', 1); $form->setMatch('session_warning', PHPWS_Settings::get('users', 'session_warning')); $form->setlabel('session_warning', 'Show session warning'); $template = $form->getTemplate(); if (Current_User::isDeity()) { $vars['action'] = 'admin'; $vars['command'] = 'check_permission_tables'; $template['VERIFY_PERMISSIONS'] = PHPWS_Text::secureLink(dgettext('users', 'Register user permissions'), 'users', $vars); $template['VERIFY_EXPLAIN'] = dgettext('users', 'Users module will re-register each module\'s permissions.'); } return PHPWS_Template::process($template, 'users', 'forms/settings.tpl'); }