public function show() { require PHPWS_SOURCE_DIR . 'mod/hms/inc/profile_options.php'; $majors = hms\MajorFactory::getMajorsList(); $tpl = array(); $profile_form = new PHPWS_Form('profile_form'); $profile_form->useRowRepeat(); $none_given = '<span style="color:#CCC;">none given</span>'; /***** Contact Info *****/ $tpl['TITLE'] = $this->student->getName() . '\'s Profile'; $tpl['EMAIL_ADDRESS'] = "<a href=\"mailto:{$this->student->getUsername()}@appstate.edu\">{$this->student->getUsername()}@appstate.edu</a>"; $tpl['ALTERNATE_EMAIL_LABEL'] = 'Alternate email: '; $alt_email = $this->profile->get_text('alternate_email'); if (!empty($alt_email)) { $tpl['ALTERNATE_EMAIL'] = "<a href=\"mailto:{$alt_email}\">{$alt_email}</a>"; } else { $tpl['ALTERNATE_EMAIL'] = $none_given; } $tpl['FB_LINK_LABEL'] = 'Facebook link: '; $fb_link = $this->profile->get_text('fb_link'); if (!empty($fb_link)) { $tpl['FB_LINK'] = $fb_link; } else { $tpl['FB_LINK'] = $none_given; } $tpl['INSTAGRAM_SN_LABEL'] = 'Instagram username: '******'instagram_sn'); if (!empty($instagram_sn)) { $tpl['INSTAGRAM_SN'] = $instagram_sn; } else { $tpl['INSTAGRAM_SN'] = $none_given; } $tpl['TWITTER_SN_LABEL'] = 'Twitter username: '******'twitter_sn'); if (!empty($twitter_sn)) { $tpl['TWITTER_SN'] = $twitter_sn; } else { $tpl['TWITTER_SN'] = $none_given; } $tpl['TUMBLR_SN_LABEL'] = 'Tumblr username: '******'tumblr_sn'); if (!empty($tumblr_sn)) { $tpl['TUMBLR_SN'] = $tumblr_sn; } else { $tpl['TUMBLR_SN'] = $none_given; } $tpl['KIK_SN_LABEL'] = 'Kik username: '******'kik_sn'); if (!empty($kik_sn)) { $tpl['KIK_SN'] = $kik_sn; } else { $tpl['KIK_SN'] = $none_given; } $tpl['ABOUT_ME_LABEL'] = 'Additional information: '; $about_me = $this->profile->get_text('about_me'); if (!empty($about_me)) { $tpl['ABOUT_ME'] = $about_me; } else { $tpl['ABOUT_ME'] = $none_given; } /***** About Me *****/ $profile_form->addCheck('hobbies_checkbox', $hobbies); $profile_form->setLabel('hobbies_checkbox', $hobbies_labels); $profile_form->setDisabled('hobbies_checkbox'); $tpl['HOBBIES_CHECKBOX_QUESTION'] = 'My Hobbies and Interests: '; # set matches on hobby check boxes $hobbies_matches = RoommateProfileFactory::get_hobbies_matches($this->profile); $profile_form->setMatch('hobbies_checkbox', $hobbies_matches); $profile_form->addCheck('music_checkbox', $music); $profile_form->setLabel('music_checkbox', $music_labels); $profile_form->setDisabled('music_checkbox'); $tpl['MUSIC_CHECKBOX_QUESTION'] = 'My Music Preferences: '; # set matches on music check boxes $music_matches = RoommateProfileFactory::get_music_matches($this->profile); $profile_form->setMatch('music_checkbox', $music_matches); $profile_form->addCheck('language_checkbox', $language); $profile_form->setLabel('language_checkbox', $language_labels); $profile_form->setDisabled('language_checkbox'); $tpl['LANGUAGE_CHECKBOX_QUESTION'] = 'Languages I speak: '; # set matches on language check boxes $language_matches = RoommateProfileFactory::get_language_matches($this->profile); $profile_form->setMatch('language_checkbox', $language_matches); $tpl['POLITICAL_VIEWS_LABEL'] = 'Political views: '; $tpl['POLITICAL_VIEWS'] = $political_views[$this->profile->get_text('political_views')]; /***** College Life *****/ $tpl['MAJOR_LABEL'] = 'Intended major: '; $tpl['MAJOR'] = $majors[$this->profile->get_text('major')]; $tpl['EXPERIENCE_LABEL'] = 'I feel the most important part of my college experience is: '; $tpl['EXPERIENCE'] = $experiences[$this->profile->get_text('experience')]; /***** Daily Life *****/ $tpl['SLEEP_TIME_LABEL'] = 'I generally go to sleep: '; $tpl['SLEEP_TIME'] = $sleep_times[$this->profile->get_text('sleep_time')]; $tpl['WAKEUP_TIME_LABEL'] = 'I generally wake up: '; $tpl['WAKEUP_TIME'] = $wakeup_times[$this->profile->get_text('wakeup_time')]; $tpl['OVERNIGHT_GUESTS_LABEL'] = 'I plan on hosting overnight guests: '; $tpl['OVERNIGHT_GUESTS'] = $overnight_guests[$this->profile->get_text('overnight_guests')]; $tpl['LOUDNESS_LABEL'] = 'In my daily activities: '; $tpl['LOUDNESS'] = $loudness[$this->profile->get_text('loudness')]; $tpl['CLEANLINESS_LABEL'] = 'I would describe myself as: '; $tpl['CLEANLINESS'] = $cleanliness[$this->profile->get_text('cleanliness')]; $tpl['FREE_TIME_LABEL'] = 'If I have free time I would rather: '; $tpl['FREE_TIME'] = $free_time[$this->profile->get_text('free_time')]; $profile_form->addCheck('study_times', $study_times); $profile_form->setLabel('study_times', $study_times_labels); $profile_form->setDisabled('study_times'); $tpl['STUDY_TIMES_QUESTION'] = 'I prefer to study: '; # set matches on study times check boxes here, set disabled $study_matches = RoommateProfileFactory::get_study_matches($this->profile); $profile_form->setMatch('study_times', $study_matches); $profile_form->mergeTemplate($tpl); $tpl = $profile_form->getTemplate(); Layout::addPageTitle("Roommate Profile"); return PHPWS_Template::process($tpl, 'hms', 'student/profile_form.tpl'); }
public function display() { // Set up search fields $form = new \PHPWS_Form(); $form->setMethod('get'); $form->addHidden('module', 'intern'); $form->addHidden('action', 'results'); $form->useRowRepeat(); // Student name or Banner ID $form->addText('name'); $form->setLabel('name', "Name or Banner ID"); /*************** * Course Info * ***************/ $terms = Term::getTermsAssoc(); $form->addSelect('term_select', $terms); $form->setLabel('term_select', 'Term'); $form->setClass('term_select', 'form-control'); $subjects = array('-1' => 'Select subject ') + Subject::getSubjects(); $form->addSelect('course_subj', $subjects); $form->setLabel('course_subj', 'Subject'); $form->setClass('course_subj', 'form-control'); $form->addText('course_no'); $form->setLabel('course_no', 'Course Number'); $form->setSize('course_no', 6); $form->setMaxSize('course_no', 4); $form->setClass('course_no', 'form-control'); $form->addText('course_sect'); $form->setLabel('course_sect', 'Section'); $form->setSize('course_sect', 6); $form->setMaxSize('course_sect', 4); $form->setClass('course_sect', 'form-control'); /**************** * Faculty Info * ****************/ // Deity can search for any department. Other users are restricted. if (\Current_User::isDeity()) { $depts = Department::getDepartmentsAssoc(); } else { $depts = Department::getDepartmentsAssocForUsername(\Current_User::getUsername()); } $depts = array('-1' => 'Select Department') + $depts; $form->addSelect('dept', $depts); $form->setLabel('dept', 'Department'); //$form->setClass('', 'form-control'); $form->setClass('dept', 'form-control'); // If the user only has one department, select it for them // sizeof($depts) == 2 because of the 'Select Deparmtnet' option if (sizeof($depts) == 2) { $keys = array_keys($depts); $form->setMatch('dept', $keys[1]); } // Student level radio button javascript('jquery'); javascriptMod('intern', 'majorSelector', array('form_id' => $form->id)); // Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected) $levels = array('-1' => 'Choose student level first'); $form->addDropBox('student_major', $levels); $form->setLabel('student_major', 'Major / Program'); $form->addCssClass('student_major', 'form-control'); // Get the majors list $majorsList = MajorsProviderFactory::getProvider()->getMajors(Term::timeToTerm(time())); // Undergrad major drop down $undergradMajors = array('-1' => 'Select Undergraduate Major') + $majorsList->getUndergradMajorsAssoc(); $form->addSelect('undergrad_major', $undergradMajors); $form->setMatch('undergrad_major', '-1'); $form->setClass('undergrad_major', 'form-control'); // Graduate major drop down $graduateMajors = array('-1' => 'Select Graduate Major') + $majorsList->getGraduateMajorsAssoc(); $form->addSelect('graduate_major', $graduateMajors); $form->setMatch('graduate_major', '-1'); $form->setClass('graduate_major', 'form-control'); /******************* * Internship Type * *******************/ // Handeled directly in the html template /************ * Location * ************/ // Campus Handeled directly in the html template // International vs Domestic - Handeled directly in the html template // State search /******************* * Workflow States * *******************/ $workflowStates = WorkflowStateFactory::getStatesAssoc(); unset($workflowStates['Intern\\WorkflowState\\CreationState']); // Remove this state, since it's not valid (internal only state for initial creation) $form->addCheckAssoc('workflow_state', $workflowStates); $form->addSubmit('submit', 'Search'); // Javascript... javascriptMod('intern', 'resetSearch'); return \PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl'); }
public function fileTypes() { $known_images = null; $known_media = null; $known_documents = null; include PHPWS_SOURCE_DIR . 'mod/filecabinet/inc/known_types.php'; $image_types = explode(',', PHPWS_Settings::get('filecabinet', 'image_files')); $media_types = explode(',', PHPWS_Settings::get('filecabinet', 'media_files')); $doc_types = explode(',', PHPWS_Settings::get('filecabinet', 'document_files')); $all_file_types = PHPWS_File::getAllFileTypes(); $form = new PHPWS_Form('allowed-file-types'); $form->addHidden('module', 'filecabinet'); $form->addHidden('aop', 'post_allowed_files'); $img_checks = $this->sortType($known_images, $all_file_types); if (!empty($img_checks)) { $form->addCheckAssoc('allowed_images', $img_checks); $form->setMatch('allowed_images', $image_types); } $media_checks = $this->sortType($known_media, $all_file_types); if (isset($media_checks)) { $form->addCheckAssoc('allowed_media', $media_checks); $form->setMatch('allowed_media', $media_types); } $doc_checks = $this->sortType($known_documents, $all_file_types); if (isset($doc_checks)) { $form->addCheckAssoc('allowed_documents', $doc_checks); $form->setMatch('allowed_documents', $doc_types); } $form->useRowRepeat(); $form->addSubmit(dgettext('filecabinet', 'Save allowed files')); $tpl = $form->getTemplate(); $tpl['CHECK_IMAGES'] = javascript('check_all', array('checkbox_name' => 'allowed_images')); $tpl['CHECK_MEDIA'] = javascript('check_all', array('checkbox_name' => 'allowed_media')); $tpl['CHECK_DOCUMENTS'] = javascript('check_all', array('checkbox_name' => 'allowed_documents')); return PHPWS_Template::process($tpl, 'filecabinet', 'Forms/allowed_types.tpl'); }
public function show() { require_once PHPWS_SOURCE_DIR . 'mod/hms/inc/profile_options.php'; PHPWS_Core::initModClass('hms', 'RoommateProfile.php'); $template = array(); $template['TITLE'] = 'My Profile'; if (isset($this->profile) && !is_null($this->profile)) { $profile_exists = TRUE; } else { $profile_exists = FALSE; } $submitCmd = CommandFactory::getCommand('SubmitRoommateProfile'); $submitCmd->setTerm($this->term); $profile_form = new PHPWS_Form('profile_form'); $profile_form->useRowRepeat(); $submitCmd->initForm($profile_form); /***** About Me *****/ $profile_form->addCheck('hobbies_checkbox', $hobbies); $profile_form->setLabel('hobbies_checkbox', $hobbies_labels); //test($profile_form,1); $template['HOBBIES_CHECKBOX_QUESTION'] = 'My Hobbies and Interests (check all that apply):'; if ($profile_exists) { $profile_form->setMatch('hobbies_checkbox', RoommateProfileFactory::get_hobbies_matches($this->profile)); } $profile_form->addCheck('music_checkbox', $music); $profile_form->setLabel('music_checkbox', $music_labels); $template['MUSIC_CHECKBOX_QUESTION'] = 'My Music Preferences (check all that apply):'; if ($profile_exists) { $profile_form->setMatch('music_checkbox', RoommateProfileFactory::get_music_matches($this->profile)); } $profile_form->addCheck('language_checkbox', $language); $profile_form->setLabel('language_checkbox', $language_labels); $template['LANGUAGE_CHECKBOX_QUESTION'] = 'I can speak (check all that apply):'; if ($profile_exists) { $profile_form->setMatch('language_checkbox', RoommateProfileFactory::get_language_matches($this->profile)); } $profile_form->addDropBox('political_views', $political_views); $profile_form->setLabel('political_views', 'I consider myself: '); if ($profile_exists) { $profile_form->setMatch('political_views', $this->profile->get_text('political_views')); } $profile_form->addCssClass('political_views', 'form-control'); $profile_form->addText('alternate_email'); $profile_form->setLabel('alternate_email', 'Alternate email: '); if ($profile_exists) { $profile_form->setValue('alternate_email', $this->profile->get_text('alternate_email')); } $profile_form->addCssClass('alternate_email', 'form-control'); $profile_form->addText('fb_link'); $profile_form->setLabel('fb_link', 'Facebook link:'); if ($profile_exists) { $profile_form->setValue('fb_link', $this->profile->get_text('fb_link')); } $profile_form->addCssClass('fb_link', 'form-control'); $profile_form->addText('instagram_sn'); $profile_form->setLabel('instagram_sn', 'Instagram username: '******'instagram_sn', $this->profile->get_text('instagram_sn')); } $profile_form->addCssClass('instagram_sn', 'form-control'); $profile_form->addText('twitter_sn'); $profile_form->setLabel('twitter_sn', 'Twitter username:'******'twitter_sn', $this->profile->get_text('twitter_sn')); } $profile_form->addCssClass('twitter_sn', 'form-control'); $profile_form->addText('tumblr_sn'); $profile_form->setLabel('tumblr_sn', 'Tumblr username:'******'tumblr_sn', $this->profile->get_text('tumblr_sn')); } $profile_form->addCssClass('tumblr_sn', 'form-control'); $profile_form->addText('kik_sn'); $profile_form->setLabel('kik_sn', 'Kik username:'******'kik_sn', $this->profile->get_text('kik_sn')); } $profile_form->addCssClass('kik_sn', 'form-control'); $profile_form->addTextArea('about_me'); $profile_form->setLabel('about_me', 'Additional information: '); $profile_form->setCols('about_me', 50); $profile_form->setRows('about_me', 15); //$profile_form->setMaxSize('about_me',4096); if ($profile_exists) { $profile_form->setValue('about_me', $this->profile->get_text('about_me')); } $profile_form->addCssClass('about_me', 'form-control'); /***** College Life *****/ $profile_form->addDropBox('major', hms\MajorFactory::getMajorsList()); $profile_form->setLabel('major', 'My intended academic major: '); if ($profile_exists) { $profile_form->setMatch('major', $this->profile->get_text('major')); } $profile_form->addCssClass('major', 'form-control'); $profile_form->addDropBox('experience', $experiences); $profile_form->setLabel('experience', 'I feel the following is the most important part of my college experience: '); if ($profile_exists) { $profile_form->setMatch('experience', $this->profile->get_text('experience')); } $profile_form->addCssClass('experience', 'form-control'); /***** My Daily Life *****/ $profile_form->addDropBox('sleep_time', $sleep_times); $profile_form->setLabel('sleep_time', 'I generally go to sleep: '); if ($profile_exists) { $profile_form->setMatch('sleep_time', $this->profile->get_text('sleep_time')); } $profile_form->addCssClass('sleep_time', 'form-control'); $profile_form->addDropBox('wakeup_time', $wakeup_times); $profile_form->setLabel('wakeup_time', 'I generally wake up: '); if ($profile_exists) { $profile_form->setMatch('wakeup_time', $this->profile->get_text('wakeup_time')); } $profile_form->addCssClass('wakeup_time', 'form-control'); $profile_form->addDropBox('overnight_guests', $overnight_guests); $profile_form->setLabel('overnight_guests', 'I plan on hosting overnight guests: '); if ($profile_exists) { $profile_form->setMatch('overnight_guests', $this->profile->get_text('overnight_guests')); } $profile_form->addCssClass('overnight_guests', 'form-control'); $profile_form->addDropBox('loudness', $loudness); $profile_form->setLabel('loudness', 'In my daily activities (music, conversations, etc.): '); if ($profile_exists) { $profile_form->setMatch('loudness', $this->profile->get_text('loudness')); } $profile_form->addCssClass('loudness', 'form-control'); $profile_form->addDropBox('cleanliness', $cleanliness); $profile_form->setLabel('cleanliness', 'I would describe myself as: '); if ($profile_exists) { $profile_form->setMatch('cleanliness', $this->profile->get_text('cleanliness')); } $profile_form->addCssClass('cleanliness', 'form-control'); $profile_form->addCheck('study_times', $study_times); $profile_form->setLabel('study_times', $study_times_labels); $template['STUDY_TIMES_QUESTION'] = 'I prefer to study (check all that apply):'; if ($profile_exists) { $profile_form->setMatch('study_times', RoommateProfileFactory::get_study_matches($this->profile)); } $profile_form->addDropBox('free_time', $free_time); $profile_form->setLabel('free_time', 'If I have free time I would rather: '); if ($profile_exists) { $profile_form->setMatch('free_time', $this->profile->get_text('free_time')); } $profile_form->addCssClass('free_time', 'form-control'); // Dummy tag to show save button $template['SAVE_BTN'] = ''; //$profile_form->addSubmit('Save Profile'); $profile_form->mergeTemplate($template); $template = $profile_form->getTemplate(); Layout::addPageTitle("Roommate Profile Form"); javascript('jquery'); return PHPWS_Template::process($template, 'hms', 'student/profile_form.tpl'); }
public static function display() { PHPWS_Core::initModClass('intern', 'Term.php'); PHPWS_Core::initModClass('intern', 'Department.php'); PHPWS_Core::initModClass('intern', 'Major.php'); PHPWS_Core::initModClass('intern', 'GradProgram.php'); PHPWS_Core::initModClass('intern', 'Internship.php'); PHPWS_Core::initModClass('intern', 'Agency.php'); PHPWS_Core::initModClass('intern', 'Subject.php'); PHPWS_Core::initModClass('intern', 'WorkflowStateFactory.php'); // Set up search fields $form = new PHPWS_Form(); $form->setMethod('get'); $form->addHidden('module', 'intern'); $form->addHidden('action', 'results'); $form->useRowRepeat(); $form->addText('name'); $form->setLabel('name', "Name or Banner ID"); $terms = Term::getTermsAssoc(); //$thisTerm = Term::timeToTerm(time()); $form->addSelect('term_select', $terms); $form->setLabel('term_select', 'Term'); $form->setClass('term_select', 'form-control'); //$form->setMatch('term_select', $thisTerm); // Deity can search for any department. Other users are restricted. if (Current_User::isDeity()) { $depts = Department::getDepartmentsAssoc(); } else { $depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername()); } $form->addSelect('dept', $depts); $form->setLabel('dept', 'Department'); //$form->setClass('', 'form-control'); $form->setClass('dept', 'form-control'); // If the user only has one department, select it for them // sizeof($depts) == 2 because of the 'Select Deparmtnet' option if (sizeof($depts) == 2) { $keys = array_keys($depts); $form->setMatch('dept', $keys[1]); } // Student level radio button javascript('jquery'); javascriptMod('intern', 'majorSelector', array('form_id' => $form->id)); $levels = array('-1' => 'Any Level', 'ugrad' => 'Undergraduate', 'grad' => 'Graduate'); $form->addSelect('student_level', $levels); $form->setLabel('student_level', 'Level'); $form->setClass('student_level', 'form-control'); // Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected) $levels = array('-1' => 'Choose student level first'); $form->addDropBox('student_major', $levels); $form->setLabel('student_major', 'Major / Program'); $form->addCssClass('student_major', 'form-control'); // Undergrad major drop down if (isset($s)) { $majors = Major::getMajorsAssoc($s->ugrad_major); } else { $majors = Major::getMajorsAssoc(); } $form->addSelect('ugrad_major', $majors); $form->setLabel('ugrad_major', 'Undergraduate Majors & Certificate Programs'); $form->setClass('ugrad_major', 'form-control'); // Graduate major drop down if (isset($s)) { $progs = GradProgram::getGradProgsAssoc($s->grad_prog); } else { $progs = GradProgram::getGradProgsAssoc(); } $form->addSelect('grad_prog', $progs); $form->setLabel('grad_prog', 'Graduate Majors & Certificate Programs'); $form->setClass('grad_prog', 'form-control'); // Campus $campuses = array('main_campus' => 'Main Campus', 'distance_ed' => 'Distance Ed'); $form->addRadioAssoc('campus', $campuses); /*************** * Course Info * ***************/ $subjects = Subject::getSubjects(); $form->addSelect('course_subj', $subjects); $form->setLabel('course_subj', 'Subject'); $form->setClass('course_subj', 'form-control'); $form->addText('course_no'); $form->setLabel('course_no', 'Course Number'); $form->setSize('course_no', 6); $form->setMaxSize('course_no', 4); $form->setClass('course_no', 'form-control'); $form->addText('course_sect'); $form->setLabel('course_sect', 'Section'); $form->setSize('course_sect', 6); $form->setMaxSize('course_sect', 4); $form->setClass('course_sect', 'form-control'); // Internship types. $types = Internship::getTypesAssoc(); $form->addRadioAssoc('type', $types); // Location $loc = array('domestic' => 'Domestic', 'internat' => 'International'); $form->addRadioAssoc('loc', $loc); /* State search */ $db = new PHPWS_DB('intern_state'); $db->addWhere('active', 1); $db->addColumn('abbr'); $db->addColumn('full_name'); $db->setIndexBy('abbr'); // get backwards because we flip it $db->addOrder('full_name desc'); $states = $db->select('col'); if (empty($states)) { NQ::simple('intern', INTERN_ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>'); NQ::close(); PHPWS_Core::goBack(); } $states[-1] = 'Select state'; $states = array_reverse($states, true); $form->addSelect('state', $states); $form->setLabel('state', 'State'); $form->setClass('state', 'form-control'); /* Province search */ $form->addText('prov'); $form->setLabel('prov', 'Province/Territory'); $form->setClass('prov', 'form-control'); // Workflow states $workflowStates = WorkflowStateFactory::getStatesAssoc(); unset($workflowStates['CreationState']); // Remove this state, since it's not valid (internal only state for initial creation) $form->addCheckAssoc('workflow_state', $workflowStates); unset($_REQUEST['module']); unset($_REQUEST['action']); unset($_REQUEST['submit']); //test($_REQUEST,1); $form->plugIn($_REQUEST); $form->addSubmit('submit', 'Search'); // Javascript... javascript('jquery'); javascriptMod('intern', 'resetSearch'); return PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl'); }