Ejemplo n.º 1
0
 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');
 }
Ejemplo n.º 2
0
 public function show()
 {
     $form = new PHPWS_Form('room_change_request');
     /* Cell phone */
     $form->addText('cell_num');
     $form->setLabel('cell_num', 'Cell phone Number');
     $form->addCssClass('cell_num', 'form-control');
     $form->addCheck('cell_opt_out');
     /* Preferences */
     $halls = array(0 => 'Choose from below...');
     $halls = $halls + HMS_Residence_Hall::get_halls_array(Term::getSelectedTerm());
     $form->addRadioAssoc('type', array('switch' => 'I want to change to an open bed.', 'swap' => 'I want to swap beds with someone I know.'));
     /* Swap */
     $form->addText('swap_with');
     $form->setLabel('swap_with', 'ASU Email Address');
     $form->addCssClass('swap_with', 'form-control');
     /* Switch */
     $form->addDropBox('first_choice', $halls);
     $form->setLabel('first_choice', 'First Choice');
     $form->addCssClass('first_choice', 'form-control');
     $form->addDropBox('second_choice', $halls);
     $form->setLabel('second_choice', 'Second Choice');
     $form->addCssClass('second_choice', 'form-control');
     /* Reason */
     $form->addTextArea('reason');
     $form->setLabel('reason', 'Reason');
     $form->addCssClass('reason', 'form-control');
     $form->setRows('reason', 5);
     /* POST location */
     $cmd = CommandFactory::getCommand('SubmitRoomChangeRequest');
     $cmd->initForm($form);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'student/roomChangeRequestForm.tpl');
 }
Ejemplo n.º 3
0
 public function show()
 {
     $username = UserStatus::getUsername();
     $currentTerm = Term::getCurrentTerm();
     $student = StudentFactory::getStudentByUsername($username, $currentTerm);
     $applicationTerm = $student->getApplicationTerm();
     $tpl = array();
     $tpl['TITLE'] = 'Contact Form';
     $form = new PHPWS_Form();
     $form->addText('name');
     $form->setLabel('name', 'Name');
     $form->addText('email');
     $form->setLabel('email', 'Email Address');
     $form->addText('phone');
     $form->setLabel('phone', 'Phone number');
     $form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
     $form->setLabel('stype', 'Classification');
     $form->addTextArea('comments');
     $form->setLabel('comments', 'Question, Comments, or Description of the Problem');
     $form->addSubmit('Submit');
     $form->mergeTemplate($tpl);
     $cmd = CommandFactory::getCommand('SubmitContactForm');
     $cmd->setUsername($username);
     $cmd->setApplicationTerm($applicationTerm);
     $cmd->setStudentType($student->getType());
     $cmd->initForm($form);
     $tpl = $form->getTemplate();
     //var_dump($tpl);exit;
     return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
 }
Ejemplo n.º 4
0
 public function addForm(PHPWS_Form &$form)
 {
     $form->addText('piwik_url', $this->getPiwikUrl());
     $form->setLabel('piwik_url', dgettext('analytics', 'Base URL of Piwik (DO NOT specify protocol (http:// or https://), as this is autodetected by the script)'));
     $form->setRequired('piwik_url');
     $form->addText('piwik_id', $this->getPiwikId());
     $form->setLabel('piwik_id', dgettext('analytics', 'Piwik Site ID'));
     $form->setRequired('piwik_id');
 }
Ejemplo n.º 5
0
 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();
     }
 }
Ejemplo n.º 6
0
 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');
 }
Ejemplo n.º 7
0
 public function addForm(PHPWS_Form &$form)
 {
     $form->addText('owa_url', $this->getOwaUrl());
     $form->setLabel('owa_url', dgettext('analytics', 'Base URL of Open Web Analytics (DO specify protocol (http:// or https://)'));
     $form->setRequired('owa_url');
     $form->addText('owa_site_id', $this->getOwaSiteId());
     $form->setLabel('owa_site_id', dgettext('analytics', 'Open Web Analytics Site ID'));
     $form->setRequired('owa_site_id');
     $form->addCheck('owa_track_page_view', 1);
     $form->setMatch('owa_track_page_view', $this->getTrackPageView());
     $form->setLabel('owa_track_page_view', dgettext('analytics', 'Track Page Views (see OWA documentation)'));
     $form->addCheck('owa_track_clicks', 1);
     $form->setMatch('owa_track_clicks', $this->getTrackClicks());
     $form->setLabel('owa_track_clicks', dgettext('analytics', 'Track Clicks (see OWA documentation)'));
     $form->addCheck('owa_track_domstream', 1);
     $form->setMatch('owa_track_domstream', $this->getTrackDomStream());
     $form->setLabel('owa_track_domstream', dgettext('analytics', 'Track DOM Stream (see OWA documentation)'));
 }
 public function show()
 {
     $form = new PHPWS_Form('waiver');
     $form->addTextArea('usernames');
     $form->setLabel('usernames', 'ASU User names (one per line):');
     $form->setExtra('usernames', 'autofocus');
     $form->addSubmit('submit_btn', 'Create');
     $cmd = CommandFactory::getCommand('CreateWaiver');
     $cmd->initForm($form);
     $tpl = array();
     $form->mergeTemplate($tpl);
     Layout::addPageTitle("Lottery Eligibility Waiver");
     return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/eligibility_waiver.tpl');
 }
Ejemplo n.º 9
0
 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');
 }
Ejemplo n.º 10
0
 /**
  * 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');
 }
Ejemplo n.º 11
0
 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');
 }
Ejemplo n.º 12
0
 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');
 }
Ejemplo n.º 13
0
 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 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');
 }
Ejemplo n.º 15
0
 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');
 }
Ejemplo n.º 16
0
 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');
 }
Ejemplo n.º 17
0
 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');
 }
Ejemplo n.º 18
0
 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');
 }
 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);
 }
Ejemplo n.º 20
0
 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;
 }
Ejemplo n.º 21
0
 /**
  * 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');
 }
Ejemplo n.º 22
0
 /**
  * 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');
 }
Ejemplo n.º 23
0
 public static function showEditForm(Tracker $tracker)
 {
     $tpl = array();
     $tpl['TRACKER_TYPE'] = $tracker->trackerType();
     $form = new PHPWS_Form('tracker');
     $form->addHidden('module', 'analytics');
     $form->addHidden('command', 'save_tracker');
     $form->addSubmit('submit', dgettext('analytics', 'Save Tracker'));
     if (isset($_REQUEST['tracker'])) {
         $form->addHidden('tracker', $_REQUEST['tracker']);
     }
     if ($tracker->getId() > 0) {
         $form->addHidden('tracker_id', $tracker->getId());
     }
     $form->addText('name', $tracker->getName());
     $form->setLabel('name', dgettext('analytics', 'Friendly Name'));
     $form->setRequired('name');
     $form->addCheck('active', 1);
     $form->setMatch('active', $tracker->isActive());
     $form->setLabel('active', dgettext('analytics', 'Currently Active'));
     $form->addCheck('disable_if_logged', 1);
     $form->setMatch('disable_if_logged', $tracker->getDisableIfLogged());
     $form->setLabel('disable_if_logged', dgettext('analytics', 'Disable Analytics if a user is logged in'));
     $tracker->addForm($form);
     $tpl = array_merge($tpl, $form->getTemplate());
     $tpl['TRACKER_FORM'] = PHPWS_Template::process($tpl, 'analytics', $tracker->getFormTemplate());
     return PHPWS_Template::process($tpl, 'analytics', 'edit.tpl');
 }
Ejemplo n.º 24
0
 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');
 }
Ejemplo n.º 25
0
 /**
  */
 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');
 }
Ejemplo n.º 26
0
 /**
  * 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');
 }
Ejemplo n.º 27
0
 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;
 }
Ejemplo n.º 28
0
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);
}
Ejemplo n.º 29
0
 public function createUser()
 {
     if (!isset($_SESSION['User'])) {
         $_SESSION['User'] = new PHPWS_User();
     }
     $form = new PHPWS_Form();
     $form->addHidden('step', 5);
     $form->addText('username', $_SESSION['User']->username);
     $form->setLabel('username', dgettext('users', 'Username'));
     $form->addText('email', $_SESSION['User']->email);
     $form->setLabel('email', dgettext('users', 'Email'));
     $form->addPassword('pass1');
     $form->setLabel('pass1', dgettext('users', 'Password'));
     $form->addPassword('pass2');
     $form->setLabel('pass2', dgettext('users', 'Confirm'));
     $form->addSubmit(dgettext('core', 'Create my account'));
     $this->title = dgettext('core', 'Please create your new user account');
     $this->content[] = $this->createForm($form, 'new_user.html');
     $this->display();
 }
Ejemplo n.º 30
0
 /**
  * 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'));
     }
 }