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() { // Setup form $form = new \PHPWS_Form('addthis_settings'); $form->setMethod('POST'); // Hidden fields for directing this request after submission $form->addHidden('module', 'addthis'); $form->addHidden('action', 'SaveSettings'); // List of checkboxes and their labels for settings $settingList = array('enabled', 'fb_like_enabled', 'google_plus_enabled', 'share_bar_enabled'); $settingLabels = array('Enabled', 'Facebook Like Enabled', 'Google+ Enabled', 'Share Bar Enabled'); // Add checkboxes, set labels $form->addCheck('enabled_check', $settingList); $form->setLabel('enabled_check', $settingLabels); // If a setting is enabled, then check its box $toCheck = array(); foreach ($this->settings->getAll() as $key => $value) { if ($value == 1) { $toCheck[] = $key; } } // NB: Have to set the checked elements all at once $form->setMatch('enabled_check', $toCheck); $form->addSubmit('submit', 'Submit'); $tpl = $form->getTemplate(); return \PHPWS_Template::process($tpl, 'addthis', 'settings.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(); } }
/** * Main method for creating the view */ public function show() { javascript('jquery'); javascript('jquery_ui'); javascriptMod('hms', 'jqueryCookie'); //javascriptMod('packageDesk'); Layout::addPageTitle('Package Desk'); $form = new PHPWS_Form('pd'); // Package desk drop down $form->addDropBox('desk', array('Select a Package Desk...') + $this->packageDesks); $form->setLabel('desk', 'Package Desk'); $form->addHidden('desk_hidden'); $tpl = $form->getTemplate(); return PHPWS_Template::process($tpl, 'hms', 'admin/packageDesk.tpl'); }
public function show() { PHPWS_Core::initCoreClass('Form.php'); $form = new PHPWS_Form(); $form->addDropBox('rlc', HMS_Learning_Community::getRlcList()); $form->setClass('rlc', 'form-control'); $form->addHidden('module', 'hms'); $form->addHidden('action', 'ShowSearchByRlc'); $form->addSubmit('submit', _('Search')); $form->setClass('submit', 'btn btn-primary pull-right'); $tags = $form->getTemplate(); $tags['TITLE'] = "RLC Search"; Layout::addPageTitle("RLC Search"); $final = PHPWS_Template::processTemplate($tags, 'hms', 'admin/search_by_rlc.tpl'); return $final; }
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 function show() { // Setup form $form = new PHPWS_Form('likebox_settings'); $form->setMethod('POST'); // Hidden fields for directing this request after submission $form->addHidden('module', 'likebox'); $form->addHidden('action', 'SaveSettings'); // Enabled Checkbox $form->addCheck('enabled', 'enabled'); $form->setLabel('enabled', 'Enabled'); // URL $form->addText('fb_url', $this->settings->get('fb_url')); $form->setLabel('fb_url', 'Facebook Page URL:'); // Width $form->addText('width', $this->settings->get('width')); $form->setLabel('width', 'Width'); // Height $form->addText('height', $this->settings->get('height')); $form->setLabel('height', 'Height'); // Show header bar i.e. "Find us on Facebook" $form->addCheck('small_header', 'small_header'); $form->setLabel('small_header', 'Use Small header'); // Show border $form->addCheck('hide_cover', 'hide_cover'); $form->setLabel('hide_cover', 'Hide Cover Photo'); // Show stream $form->addCheck('show_posts', 'show_posts'); $form->setLabel('show_posts', 'Show Page Posts'); // Show faces $form->addCheck('show_faces', 'show_faces'); $form->setLabel('show_faces', 'Show Friend\'s faces'); // Submit button $form->addSubmit('submit', 'Submit'); $checkBoxes = array('enabled', 'small_header', 'hide_cover', 'show_posts', 'show_faces'); foreach ($checkBoxes as $key) { $value = $this->settings->get($key); if (isset($value) && $value == 1) { $form->setMatch($key, $key); } } $tpl = $form->getTemplate(); return PHPWS_Template::process($tpl, 'likebox', 'settings.tpl'); }
function editSettings() { $form = new PHPWS_Form('whatsnew_settings'); $form->addHidden('module', 'whatsnew'); $form->addHidden('aop', 'post_settings'); $form->addCheckbox('enable', 1); $form->setMatch('enable', PHPWS_Settings::get('whatsnew', 'enable')); $form->setLabel('enable', dgettext('whatsnew', 'Enable whatsnew')); $form->addCheckbox('homeonly', 1); $form->setMatch('homeonly', PHPWS_Settings::get('whatsnew', 'homeonly')); $form->setLabel('homeonly', dgettext('whatsnew', 'Show whatsnew sidebox on home page only')); $form->addTextField('title', PHPWS_Settings::get('whatsnew', 'title')); $form->setLabel('title', dgettext('whatsnew', 'Sidebox title')); $form->setSize('title', 30); $form->addTextArea('text', PHPWS_Settings::get('whatsnew', 'text')); $form->setRows('text', '4'); $form->setCols('text', '40'); $form->setLabel('text', dgettext('whatsnew', 'Sidebox text')); $form->addTextField('cache_timeout', PHPWS_Settings::get('whatsnew', 'cache_timeout')); $form->setLabel('cache_timeout', dgettext('whatsnew', 'Cache duration for whatsnew list (in seconds, 0-7200)')); $form->setSize('cache_timeout', 4, 4); $form->addTextField('qty_items', PHPWS_Settings::get('whatsnew', 'qty_items')); $form->setLabel('qty_items', dgettext('whatsnew', 'Number of recent items to display (0-50)')); $form->setSize('qty_items', 4, 4); $form->addCheckbox('show_summaries', 1); $form->setMatch('show_summaries', PHPWS_Settings::get('whatsnew', 'show_summaries')); $form->setLabel('show_summaries', dgettext('whatsnew', 'Show item summaries')); $form->addCheckbox('show_dates', 1); $form->setMatch('show_dates', PHPWS_Settings::get('whatsnew', 'show_dates')); $form->setLabel('show_dates', dgettext('whatsnew', 'Show item update dates')); $form->addCheckbox('show_source_modules', 1); $form->setMatch('show_source_modules', PHPWS_Settings::get('whatsnew', 'show_source_modules')); $form->setLabel('show_source_modules', dgettext('whatsnew', 'Show item source module names')); $form->addSubmit('save', dgettext('whatsnew', 'Save settings')); $tpl = $form->getTemplate(); $tpl['SETTINGS_LABEL'] = dgettext('whatsnew', 'General Settings'); $tpl['FLUSH_LINK'] = PHPWS_Text::secureLink(dgettext('whatsnew', 'Flush cache'), 'whatsnew', array('aop' => 'flush_cache')); $tpl['EXCLUDE'] = $this->whatsnew->getKeyMods(unserialize(PHPWS_Settings::get('whatsnew', 'exclude')), 'exclude'); $tpl['EXCLUDE_LABEL'] = dgettext('whatsnew', 'Select any modules you wish to exclude from your whatsnew box.'); $this->whatsnew->title = dgettext('whatsnew', 'Settings'); $this->whatsnew->content = PHPWS_Template::process($tpl, 'whatsnew', 'edit_settings.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 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 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 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 show() { $approveCmd = CommandFactory::getCommand('RoomChangeStudentApprove'); $approveCmd->setParticipantId($this->thisParticipant->getId()); $approveCmd->setRequestId($this->request->getId()); $declineCmd = CommandFactory::getCommand('RoomChangeStudentDecline'); $declineCmd->setParticipantId($this->thisParticipant->getId()); $declineCmd->setRequestId($this->request->getId()); $form = new PHPWS_Form('roomchange_student_approve'); $form->addHidden('foo', 'bar'); $tpl = $form->getTemplate(); $tpl['APPROVE_URI'] = $approveCmd->getURI(); $tpl['DECLINE_URI'] = $declineCmd->getURI(); $requestor = StudentFactory::getStudentByUsername($this->request->getState()->getCommittedBy(), $this->term); $tpl['REQUESTOR'] = $requestor->getName(); // Build the table showing who is moving from/to which beds $participantRows = array(); foreach ($this->participants as $p) { $row = array(); $student = StudentFactory::getStudentByBannerId($p->getBannerId(), $this->term); $row['NAME'] = $student->getName(); // If this participant is the person logged in, bold their name if ($student->getBannerId() == $this->thisParticipant->getBannerId()) { $row['STRONG_STYLE'] = 'success'; } else { $row['STRONG_STYLE'] = ''; } $fromBed = new HMS_Bed($p->getFromBed()); $toBed = new HMS_Bed($p->getToBed()); $row['FROM_BED'] = $fromBed->where_am_i(); $row['TO_BED'] = $toBed->where_am_i(); $participantRows[] = $row; } $tpl['PARTICIPANTS'] = $participantRows; PHPWS_Core::initCoreClass('Captcha.php'); $tpl['CAPTCHA'] = Captcha::get(); return PHPWS_Template::process($tpl, 'hms', 'student/roomChangeRequestStudentApprove.tpl'); }
/** * 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'); }
/** * 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 static function editFeed(RSS_Feed $feed) { $form = new PHPWS_Form(); if ($feed->id) { $form->addHidden('feed_id', $feed->id); } $form->addHidden('module', 'rss'); $form->addHidden('command', 'save_feed'); $form->addText('address', $feed->address); $form->setLabel('address', dgettext('rss', 'Address')); $form->setSize('address', '30'); $form->addText('title', $feed->title); $form->setLabel('title', dgettext('rss', 'Title')); $form->setSize('title', '30'); $form->addSubmit('submit', dgettext('rss', 'Save')); $form->addButton('cancel', dgettext('rss', 'Cancel')); $form->setExtra('cancel', 'onclick="window.close()"'); $form->addText('item_limit', $feed->item_limit); $form->setSize('item_limit', 2); $form->setLabel('item_limit', dgettext('rss', 'Item limit')); $form->addText('refresh_time', $feed->refresh_time); $form->setSize('refresh_time', 5); $form->setLabel('refresh_time', dgettext('rss', 'Refresh time')); $template = $form->getTemplate(); $template['TITLE_WARNING'] = dgettext('rss', 'Feed title will be used if left empty'); $template['REFRESH_WARNING'] = dgettext('rss', 'In seconds'); $content = PHPWS_Template::process($template, 'rss', 'add_feed.tpl'); $tpl['TITLE'] = dgettext('rss', 'Add Feed'); $tpl['CONTENT'] = $content; return $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']; }
/** * Row tags for waiting list pager. * * @return Array Array of row tags for this LotteryApplication. */ public function getRowTags() { PHPWS_Core::initModClass('hms', 'StudentFactory.php'); $student = StudentFactory::getStudentByUsername($this->username, $this->term); $template = array(); $template['ASU_USERNAME'] = $student->getProfileLink(); $template['PHYSICAL_DISABILITY'] = $this->physical_disability == 1 ? 'Yes' : 'No'; $template['PSYCH_DISABILITY'] = $this->psych_disability == 1 ? 'Yes' : 'No'; $template['MEDICAL_NEED'] = $this->medical_need == 1 ? 'Yes' : 'No'; $template['GENDER_NEED'] = $this->gender_need == 1 ? 'Yes' : 'No'; $form = new PHPWS_Form('clear_disabilities'); $form->addHidden('da_clear', $this->asu_username); $form->addHidden('type', 'lottery'); $form->addHidden('op', 'view_lottery_needs'); $form->addSubmit('clear', 'Clear Disabilities'); $tpl = $form->getTemplate(); $template = array_merge($template, $tpl); return $template; }
public static function settings() { $form = new PHPWS_Form('block-form'); $form->addHidden('module', 'block'); $form->addHidden('action', 'post_settings'); $form->addText('max_image_width', PHPWS_Settings::get('block', 'max_image_width')); $form->setLabel('max_image_width', dgettext('block', 'Max image width (50 - 1024)')); $form->setSize('max_image_width', 4, 4); $form->addText('max_image_height', PHPWS_Settings::get('block', 'max_image_height')); $form->setLabel('max_image_height', dgettext('block', 'Max image height (50 - 3000)')); $form->setSize('max_image_height', 4, 4); $form->addSubmit(dgettext('block', 'Save settings')); $tpl = $form->getTemplate(); return PHPWS_Template::process($tpl, 'block', 'settings.tpl'); }
public function changeTN() { $form = new PHPWS_Form('thumbnail'); $form->addHidden('module', 'filecabinet'); $form->addHidden('aop', 'post_thumbnail'); $form->addHidden('type', $_REQUEST['type']); $form->addHidden('id', $_REQUEST['id']); $form->addFile('thumbnail'); $form->setLabel('thumbnail', dgettext('filecabinet', 'Upload thumbnail')); $form->addSubmit(dgettext('filecabinet', 'Upload')); if ($_REQUEST['type'] == 'mm') { PHPWS_Core::initModClass('filecabinet', 'Multimedia.php'); $mm = new PHPWS_Multimedia($_REQUEST['id']); if (!$mm->id) { return false; } } $tpl = $form->getTemplate(); $tpl['CLOSE'] = javascript('close_window'); $thumb = PHPWS_Settings::get('filecabinet', 'max_thumbnail_size'); $warnings[] = sprintf(dgettext('filecabinet', 'Max thumbnail size : %sx%s.'), $thumb, $thumb); if ($mm->isVideo()) { $warnings[] = dgettext('filecabinet', 'Image must be a jpeg file.'); } $tpl['WARNINGS'] = implode('<br />', $warnings); $this->title = dgettext('filecabinet', 'Upload new thumbnail'); $this->content = PHPWS_Template::process($tpl, 'filecabinet', 'thumbnail.tpl'); }
public static function editFeed($feed = null, $add_submit = false) { if (empty($feed)) { $feed = new RSS_Feed(); } $form = new PHPWS_Form(); $form->addHidden('feed_id', $feed->id); $form->addHidden('module', 'rss'); $form->addHidden('command', 'save_feed'); $form->addTextArea('address', $feed->address); $form->setClass('address', 'form-control'); $form->setLabel('address', dgettext('rss', 'Address')); $form->addText('title', $feed->title); $form->setClass('title', 'form-control'); $form->setLabel('title', dgettext('rss', 'Title')); $form->addText('item_limit', $feed->item_limit); $form->setClass('item_limit', 'form-control'); $form->setSize('item_limit', 2); $form->setLabel('item_limit', dgettext('rss', 'Item limit')); $form->addText('refresh_time', $feed->refresh_time); $form->setClass('refresh_time', 'form-control'); $form->setSize('refresh_time', 5); $form->setLabel('refresh_time', dgettext('rss', 'Refresh time')); if ($add_submit) { $form->addSubmit('submit', dgettext('rss', 'Save')); $form->setClass('submit', 'btn btn-primary'); } $template = $form->getTemplate(); $template['TITLE_WARNING'] = dgettext('rss', 'Feed title will be used if left empty'); $template['REFRESH_WARNING'] = dgettext('rss', 'In seconds'); $content = PHPWS_Template::process($template, 'rss', 'add_feed.tpl'); return $content; }
/** */ public function editRTMP() { $form = new PHPWS_Form(); $form->setFormId('file-form'); $form->addHidden('multimedia_id', $this->multimedia->id); $form->addHidden('module', 'filecabinet'); $form->addHidden('mop', 'post_rtmp'); $form->addHidden('folder_id', $this->multimedia->folder_id); $form->addText('title', $this->multimedia->getTitle()); $form->setLabel('title', 'Stream title'); $form->setClass('title', 'form-control'); $form->addText('rtmp_server', $this->multimedia->file_directory); $form->setLabel('rtmp_server', 'RTMP server'); $form->setClass('rtmp_server', 'form-control'); $form->addText('rtmp_file', $this->multimedia->file_name); $form->setLabel('rtmp_file', 'Stream/File name'); $form->setClass('rtmp_file', 'form-control'); $form->addText('width', $this->multimedia->width); $form->setLabel('width', 'Width'); $form->setClass('width', 'form-control'); $form->addText('height', $this->multimedia->height); $form->setLabel('height', 'Height'); $form->setClass('height', 'form-control'); $tpl = $form->getTemplate(); $this->title = dgettext('filecabinet', 'Create/Update RTMP Stream'); $this->content = PHPWS_Template::process($tpl, 'filecabinet', 'Forms/rtmp_edit.tpl'); }
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 getSearchBox() { static $id_count = 0; if ($id_count) { $id = 'search_list_' . $id_count; } else { $id = 'search_list'; $id_count++; } $form = new PHPWS_Form($id); $form->setMethod('get'); $values = $this->getLinkValues(); unset($values['pager_search']); unset($values['go']); $form->addHidden($values); $form->addText('pager_c_search', $this->search); $form->setSize('pager_c_search', 20); if ($this->search_label) { $form->setLabel('pager_c_search', _('Search')); } if ($this->clear_button) { $form->addButton('clear', _('Clear')); $form->setExtra('clear', 'onclick="this.form.search_list_pager_c_search.value=\'\'"'); } if ($this->search_button) { $form->addSubmit('go', _('Search')); } $template = $form->getTemplate(); if (PHPWS_Error::isError($template)) { PHPWS_Error::log($template); return null; } return implode("\n", $template); }
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 form() { javascript('jquery'); javascriptMod('properties', 'generate'); \Layout::addStyle('properties', 'forms.css'); $form = new \PHPWS_Form('contact'); $form->addHidden('module', 'properties'); if (!empty($this->id)) { $form->addHidden('cid', $this->id); $form->addSubmit('Update contact'); } else { $form->addSubmit('Add contact'); } if (isset($_SESSION['Contact_User']) && !\Current_User::allow('properties')) { $form->addHidden('cop', 'save_contact'); $form->addHidden('k', $_SESSION['Contact_User']->getKey()); } else { $form->addHidden('aop', 'save_contact'); $form->addText('username', $this->username); $form->setClass('username', 'form-control'); $form->setLabel('username', 'User name'); $form->setSize('username', '20', '20'); $form->setRequired('username'); $form->addButton('make_password', 'Create'); $form->setId('make_password', 'make-password'); $form->setClass('make_password', 'btn btn-default'); $form->addCheck('contact_contact', 1); $form->setLabel('contact_contact', 'Send contact email'); if (!$this->id) { $form->setMatch('contact_contact', 1); } } $form->addPassword('password'); $form->setLabel('password', 'Password'); $form->setClass('password', 'form-control'); $form->addPassword('pw_check'); $form->setLabel('pw_check', 'Retype password below'); $form->setClass('pw_check', 'form-control'); $form->addText('first_name', $this->first_name); $form->setLabel('first_name', 'Contact first name'); $form->setRequired('first_name'); $form->setClass('first_name', 'form-control'); $form->addText('last_name', $this->last_name); $form->setLabel('last_name', 'Contact last name'); $form->setRequired('last_name'); $form->setClass('last_name', 'form-control'); $form->addText('phone', $this->getPhone()); $form->setLabel('phone', 'Phone number'); $form->setRequired('phone'); $form->setClass('phone', 'form-control'); $form->addText('email_address', $this->email_address); $form->setLabel('email_address', 'Email address'); $form->setRequired('email_address'); $form->setSize('email_address', 40); $form->setClass('email_address', 'form-control'); $form->addText('company_name', $this->company_name); $form->setLabel('company_name', 'Company name'); $form->setRequired('company_name'); $form->setSize('company_name', 40); $form->setClass('company_name', 'form-control'); $form->addText('company_url', $this->company_url); $form->setLabel('company_url', 'Company url'); $form->setSize('company_url', 40); $form->setClass('company_url', 'form-control'); $form->addText('company_address', $this->company_address); $form->setLabel('company_address', 'Company (or renter) address'); $form->setClass('company_address', 'form-control'); $form->addTextArea('times_available', $this->times_available); $form->setLabel('times_available', 'Days and hours available for contact'); $form->setRows('times_available', 4); $form->setCols('times_available', 20); $form->setClass('times_available', 'form-control'); $tpl = $form->getTemplate(); if (!empty($this->errors)) { foreach ($this->errors as $key => $message) { $new_key = strtoupper($key) . '_ERROR'; $tpl[$new_key] = $message; } } return \PHPWS_Template::process($tpl, 'properties', 'edit_contact.tpl'); }
/** * Form for meta tags. Used for site mata tags and individual key * meta tags. */ public static function metaForm($key_id = 0) { $meta_description = $meta_keywords = $page_title = null; $meta_robots = '11'; if (!$key_id) { $vars = $_SESSION['Layout_Settings']->getMetaTags(); } else { $vars = $_SESSION['Layout_Settings']->getPageMetaTags($key_id); if (empty($vars)) { $vars = $_SESSION['Layout_Settings']->getMetaTags(); $key = new Key($key_id); $vars['page_title'] = $key->title; } } if (is_array($vars)) { extract($vars); } $index = substr($meta_robots, 0, 1); $follow = substr($meta_robots, 1, 1); $form = new PHPWS_Form('metatags'); if ($key_id) { $form->addHidden('key_id', $key_id); $form->addSubmit('reset', dgettext('layout', 'Restore to default')); } $form->addHidden('module', 'layout'); $form->addHidden('action', 'admin'); $form->addHidden('command', 'postMeta'); $form->addText('page_title', $page_title); $form->setClass('page_title', 'form-control'); $form->setLabel('page_title', dgettext('layout', 'Site Name')); $form->addTextArea('meta_keywords', $meta_keywords); $form->setLabel('meta_keywords', dgettext('layout', 'Keywords')); $form->setClass('meta_keywords', 'form-control'); $form->addTextArea('meta_description', $meta_description); $form->setLabel('meta_description', dgettext('layout', 'Description')); $form->setClass('meta_description', 'form-control'); $form->addCheckBox('index', 1); $form->setMatch('index', $index); $form->setLabel('index', dgettext('layout', 'Allow indexing')); $form->addCheckBox('follow', 1); $form->setMatch('follow', $follow); $form->setLabel('follow', dgettext('layout', 'Allow link following')); $form->addCheckBox('use_key_summaries', 1); $form->setMatch('use_key_summaries', PHPWS_Settings::get('layout', 'use_key_summaries')); $form->setLabel('use_key_summaries', dgettext('layout', 'Use Key summaries for meta description')); $form->addSubmit('submit', dgettext('layout', 'Update')); $template = $form->getTemplate(); $template['ROBOT_LABEL'] = dgettext('layout', 'Default Robot Settings'); return PHPWS_Template::process($template, 'layout', 'metatags.tpl'); }
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'); }
function userForm(&$user, $errors = NULL) { PHPWS_Core::initCoreClass('Form.php'); PHPWS_Core::initModClass('users', 'User_Form.php'); $form = new PHPWS_Form(); if (isset($_REQUEST['module'])) { $form->addHidden('module', $_REQUEST['module']); } else { $form->addHidden('step', 3); $form->addHidden('display_name', 'Install'); } $form->addHidden('mod_title', 'users'); $form->addText('username', $user->getUsername()); $form->addText('email', $user->getEmail()); $form->addPassword('password1'); $form->addPassword('password2'); $form->setLabel('username', dgettext('users', 'Username')); $form->setLabel('password1', dgettext('users', 'Password')); $form->setLabel('email', dgettext('users', 'Email')); $form->addSubmit('go', dgettext('users', 'Add User')); $template = $form->getTemplate(); if (!empty($errors)) { foreach ($errors as $tag => $message) { $template[$tag] = $message; } } $result = PHPWS_Template::process($template, 'users', 'forms/userForm.tpl'); $content[] = $result; return implode("\n", $content); }