コード例 #1
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');
 }
コード例 #2
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
    public function settings()
    {
        $sizes = Cabinet::getMaxSizes();
        $form = new PHPWS_Form('settings');
        $form->addHidden('module', 'filecabinet');
        $form->addHidden('aop', 'save_settings');
        $form->addTplTag('DOCUMENT_SETTINGS', dgettext('filecabinet', 'Document settings'));
        $form->addTplTag('IMAGE_SETTINGS', dgettext('filecabinet', 'Image settings'));
        $form->addTplTag('MULTIMEDIA_SETTINGS', dgettext('filecabinet', 'Multimedia settings'));
        $form->addText('base_doc_directory', PHPWS_Settings::get('filecabinet', 'base_doc_directory'));
        $form->setSize('base_doc_directory', '50');
        $form->setLabel('base_doc_directory', dgettext('filecabinet', 'Base document directory'));
        $form->addCheckBox('autofloat', 1);
        $form->setMatch('autofloat', PHPWS_Settings::get('filecabinet', 'autofloat'));
        $form->setLabel('autofloat', dgettext('filecabinet', 'Float new images under 300px to the right of content'));
        $form->addText('max_image_dimension', PHPWS_Settings::get('filecabinet', 'max_image_dimension'));
        $form->setLabel('max_image_dimension', dgettext('filecabinet', 'Maximum image pixel dimension'));
        $form->setSize('max_image_dimension', 4, 4);
        $form->addText('max_image_size', $sizes['image']);
        $form->setLabel('max_image_size', dgettext('filecabinet', 'Maximum image file size (in bytes)'));
        $form->setSize('max_image_size', 10, 10);
        $form->addText('max_document_size', $sizes['document']);
        $form->setLabel('max_document_size', dgettext('filecabinet', 'Maximum document file size (in bytes)'));
        $form->setSize('max_document_size', 10, 10);
        $form->addText('max_multimedia_size', $sizes['multimedia']);
        $form->setLabel('max_multimedia_size', dgettext('filecabinet', 'Maximum multimedia file size (in bytes)'));
        $form->setSize('max_multimedia_size', 10, 10);
        $form->addText('max_pinned_images', PHPWS_Settings::get('filecabinet', 'max_pinned_images'));
        $form->setLabel('max_pinned_images', dgettext('filecabinet', 'Maximum pinned images shown (0 for all)'));
        $form->setSize('max_pinned_images', 3, 3);
        $form->addText('max_pinned_documents', PHPWS_Settings::get('filecabinet', 'max_pinned_documents'));
        $form->setLabel('max_pinned_documents', dgettext('filecabinet', 'Maximum pinned documents shown (0 for all)'));
        $form->setSize('max_pinned_documents', 3, 3);
        $form->addText('crop_threshold', PHPWS_Settings::get('filecabinet', 'crop_threshold'));
        $form->setLabel('crop_threshold', dgettext('filecabinet', 'Crop pixel threshold'));
        $form->setSize('crop_threshold', 4, 4);
        $form->addCheck('use_ffmpeg', 1);
        $form->setMatch('use_ffmpeg', PHPWS_Settings::get('filecabinet', 'use_ffmpeg'));
        $form->addCheck('caption_images', 1);
        $form->setMatch('caption_images', PHPWS_Settings::get('filecabinet', 'caption_images'));
        $form->setLabel('caption_images', dgettext('filecabinet', 'Caption images'));
        $form->addCheck('allow_direct_links', 1);
        $form->setMatch('allow_direct_links', PHPWS_Settings::get('filecabinet', 'allow_direct_links'));
        $form->setLabel('allow_direct_links', dgettext('filecabinet', 'Allow direct links to documents'));
        $form->addCheck('force_thumbnail_dimensions', 1);
        $form->setMatch('force_thumbnail_dimensions', PHPWS_Settings::get('filecabinet', 'force_thumbnail_dimensions'));
        $form->setLabel('force_thumbnail_dimensions', dgettext('filecabinet', 'Force thumbnail dimensions on display'));
        $form->addCheck('popup_image_navigation', 1);
        $form->setMatch('popup_image_navigation', PHPWS_Settings::get('filecabinet', 'popup_image_navigation'));
        $form->setLabel('popup_image_navigation', dgettext('filecabinet', 'Popup images allow folder navigation'));
        $form->addText('max_thumbnail_size', PHPWS_Settings::get('filecabinet', 'max_thumbnail_size'));
        $form->setLabel('max_thumbnail_size', dgettext('filecabinet', 'Maximum thumbnail pixel dimension'));
        $form->setSize('max_thumbnail_size', 3, 3);
        $ffmpeg_directory = PHPWS_Settings::get('filecabinet', 'ffmpeg_directory');
        if (empty($ffmpeg_directory) || !is_file($ffmpeg_directory . 'ffmpeg')) {
            $form->setDisabled('use_ffmpeg');
            $form->setLabel('use_ffmpeg', dgettext('filecabinet', 'Enable FFMpeg thumbnails (enabled on ffmpeg confirmation)'));
        } else {
            $form->setLabel('use_ffmpeg', dgettext('filecabinet', 'Enable FFMpeg thumbnails'));
        }
        $form->addTplTag('CLASSIFY_SETTINGS', dgettext('filecabinet', 'Classify settings'));
        $form->addText('ffmpeg_directory', $ffmpeg_directory);
        $form->setLabel('ffmpeg_directory', dgettext('filecabinet', 'FFMpeg directory'));
        $form->setSize('ffmpeg_directory', 40);
        if (FC_ALLOW_CLASSIFY_DIR_SETTING) {
            $form->addText('classify_directory', PHPWS_Settings::get('filecabinet', 'classify_directory'));
            $form->setLabel('classify_directory', dgettext('filecabinet', 'Incoming classify directory'));
            $form->setSize('classify_directory', 50, 255);
        }
        $form->addRadioAssoc('jcaro_type', array(0 => dgettext('filecabinet', 'Horizontal'), 1 => dgettext('filecabinet', 'Vertical')));
        $form->setMatch('jcaro_type', (int) PHPWS_Settings::get('filecabinet', 'vertical_folder'));
        $num = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8);
        $form->addSelect('number_visible', $num);
        $form->setMatch('number_visible', PHPWS_Settings::get('filecabinet', 'number_visible'));
        $form->setLabel('number_visible', dgettext('filecabinet', 'Number of thumbnails visible'));
        $form->addSubmit(dgettext('filecabinet', 'Save settings'));
        $tpl = $form->getTemplate();
        $tpl['CAROUSEL'] = dgettext('filecabinet', 'Carousel defaults');
        $tpl['SYSTEM_SIZE'] = dgettext('filecabinet', 'System upload limits');
        $tpl['SYSTEM_LABEL'] = dgettext('filecabinet', 'Server upload limit');
        $tpl['FORM_LABEL'] = dgettext('filecabinet', 'Form upload limit');
        $tpl['ABSOLUTE_LABEL'] = dgettext('filecabinet', 'Absolute upload limit');
        $tpl['MAX_SYSTEM_SIZE'] = File_Common::humanReadable($sizes['system']);
        $tpl['MAX_FORM_SIZE'] = File_Common::humanReadable($sizes['form']);
        $tpl['ABSOLUTE_SIZE'] = File_Common::humanReadable($sizes['absolute']);
        if (Current_User::isDeity()) {
            $link = new PHPWS_Link(null, 'filecabinet', array('aop' => 'fix_document_dir'), true);
            $js = array('question' => dgettext('filecabinet', 'This process will update all of your document files with the current base directory.
Do not run this process unless you are sure it will fix download problems.
If you are sure, type Y-E-S below.'), 'address' => $link->getAddress(), 'value_name' => 'confirm', 'link' => dgettext('filecabinet', 'Reindex document directories'));
            $tpl['FIX_DIRECTORIES'] = javascript('prompt', $js);
        }
        return PHPWS_Template::process($tpl, 'filecabinet', 'Forms/settings.tpl');
    }