Example #1
0
 function initForm(PHPWS_Form &$form)
 {
     $moduleElement = $form->get('module');
     if (PEAR::isError($moduleElement)) {
         $form->addHidden('module', 'events');
     }
     foreach ($this->getRequestVars() as $key => $val) {
         $form->addHidden($ket, $val);
     }
 }
Example #2
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');
 }
 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;
 }
Example #4
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');
 }
Example #5
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');
 }
 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'LotteryApplication.php');
     $this->setTitle('Special Interest Group');
     javascript('jquery');
     $tpl = array();
     $groups = HMS_Lottery::getSpecialInterestGroupsMap();
     // If a group was selected
     if (!is_null($this->group) && $this->group != 'none') {
         $tpl['GROUP_PAGER'] = LotteryApplication::specialInterestPager($this->group, PHPWS_Settings::get('hms', 'lottery_term'));
         $tpl['GROUP'] = $groups[$this->group];
     }
     // Show the drop down box of groups
     $form = new PHPWS_Form('special_interest');
     $form->setMethod('get');
     $form->addDropBox('group', $groups);
     $form->setClass('group', 'form-control');
     $form->setMatch('group', $this->group);
     $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval');
     $cmd->initForm($form);
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/special_interest_approval.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');
 }
Example #8
0
 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;
 }
Example #9
0
 /**
  * Edit a new or existing PHAT_Dropbox element
  *
  * The edit function provides the HTML form to edit a new or existing
  * PHAT_Dropbox element.
  * g
  * return string The HTML form to edit a PHAT_Dropbox
  */
 function edit()
 {
     $numOptions = sizeof($this->getOptionText());
     if (!$numOptions || $this->getOptionSet()) {
         $numOptions = '';
     }
     $form = new PHPWS_Form();
     $form->addHidden('module', 'phatform');
     $form->addHidden('PHAT_EL_OP', 'SaveElement');
     if (!$this->getLabel()) {
         $num = $_SESSION['PHAT_FormManager']->form->numElements();
         $this->setLabel('Element' . ($num + 1));
     }
     $form->addTextArea('PHAT_ElementBlurb', $this->getBlurb());
     $form->setRows('PHAT_ElementBlurb', PHAT_DEFAULT_ROWS);
     $form->setCols('PHAT_ElementBlurb', PHAT_DEFAULT_COLS);
     $form->setLabel('PHAT_ElementBlurb', dgettext('phatform', 'Associated Text'));
     $form->addText('PHAT_ElementName', $this->getLabel());
     $form->setSize('PHAT_ElementName', PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
     $form->setLabel('PHAT_ElementName', dgettext('phatform', 'Name'));
     $form->addText('PHAT_ElementNumOptions', $numOptions);
     $form->setSize('PHAT_ElementNumOptions', 5, 3);
     $form->setLabel('PHAT_ElementNumOptions', dgettext('phatform', 'Number of Options'));
     $options = $this->getOptionSets();
     if (is_array($options)) {
         $editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set');
         $form->addSelect('PHAT_OptionSet', $options);
         $form->setMatch('PHAT_OptionSet', $this->getOptionSet());
     }
     $form->addCheck('PHAT_ElementRequired', 1);
     $form->setMatch('PHAT_ElementRequired', $this->isRequired());
     $form->setLabel('PHAT_ElementRequired', dgettext('phatform', 'Required'));
     $form->addSubmit('PHAT_ElementBack', dgettext('phatform', 'Back'));
     $form->addSubmit('NEXT_BUTTON', dgettext('phatform', 'Next'));
     $template = $form->getTemplate();
     return PHPWS_Template::processTemplate($template, 'phatform', 'dropbox/edit.tpl');
 }
 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 static function display()
 {
     /* Permission check */
     if (!Current_User::allow('intern', Department::getEditPermission())) {
         NQ::simple('intern', INTERN_ERROR, "Uh Uh Uh! You didn't say the magic word!");
         return;
     }
     javascript('/jquery/');
     javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Department::getEditAction()));
     // Form for adding new department
     $form = new PHPWS_Form('add_department');
     $form->addText('name');
     $form->setLabel('name', 'Department Name');
     $form->addSubmit('submit', 'Add Department');
     $form->setAction('index.php?module=intern&action=' . DEPT_EDIT);
     $form->addHidden('add', TRUE);
     $tpl['PAGER'] = DepartmentUI::doPager();
     $form->mergeTemplate($tpl);
     return PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_department.tpl');
 }
 public function display()
 {
     /* Permission check */
     if (!\Current_User::allow('intern', Department::getEditPermission())) {
         \NQ::simple('intern', NotifyUI::ERROR, "You do not have permission to edit departments.");
         return;
     }
     javascript('/jquery/');
     javascriptMod('intern', 'editMajor', array('EDIT_ACTION' => Department::getEditAction()));
     // Form for adding new department
     $form = new \PHPWS_Form('add_department');
     $form->addText('name');
     $form->setLabel('name', 'Department Name');
     $form->addSubmit('submit', 'Add Department');
     $form->setAction('index.php?module=intern&action=edit_dept');
     $form->addHidden('add', TRUE);
     $tpl['PAGER'] = DepartmentUI::doPager();
     $form->mergeTemplate($tpl);
     return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_department.tpl');
 }
 public 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');
 }
Example #14
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');
 }
 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');
 }
 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;
 }
Example #17
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;
 }
Example #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');
 }
Example #19
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');
 }
 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);
 }
Example #21
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');
 }
Example #22
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');
 }
Example #23
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');
 }
Example #24
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;
 }
Example #25
0
 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'];
 }
Example #26
0
 /**
  * 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;
 }
Example #27
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');
 }
 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');
 }
Example #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();
 }
Example #30
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');
 }