コード例 #1
0
 public static function contactForm()
 {
     $form = new \PHPWS_Form('contact-login');
     $form->addHidden('module', 'properties');
     $form->addHidden('cop', 'login');
     $form->addText('c_username');
     $form->setPlaceHolder('c_username', 'Username');
     $form->setSize('c_username', 10);
     $form->setClass('c_username', 'form-control');
     $form->addPassword('c_password');
     $form->setPlaceHolder('c_password', 'Password');
     $form->setSize('c_password', 10);
     $form->setClass('c_password', 'form-control');
     $form->addSubmit('submit', 'Log in to Manager Account');
     $form->setClass('submit', 'btn btn-success');
     return $form;
 }
コード例 #2
0
ファイル: Whatsnew_Forms.php プロジェクト: HaldunA/phpwebsite
 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');
 }
コード例 #3
0
ファイル: Blog_Form.php プロジェクト: HaldunA/phpwebsite
 public static function settings()
 {
     $form = new PHPWS_Form();
     $form->addHidden('module', 'blog');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'post_settings');
     $form->addText('blog_limit', PHPWS_Settings::get('blog', 'blog_limit'));
     $form->setSize('blog_limit', 2, 2);
     $form->setLabel('blog_limit', dgettext('blog', 'Entries shown per page'));
     $form->addCssClass('blog_limit', 'form-control');
     $form->addText('past_entries', PHPWS_Settings::get('blog', 'past_entries'));
     $form->setLabel('past_entries', dgettext('blog', 'Previous entries shown'));
     $form->setSize('past_entries', 2, 2);
     $form->addCssClass('past_entries', 'form-control');
     // Show/hide posted on date
     $form->addCheck('show_posted_date', 1);
     $form->setLabel('show_posted_date', dgettext('blog', 'Show the date the post was made'));
     $form->setMatch('show_posted_date', PHPWS_Settings::get('blog', 'show_posted_date'));
     // Show/hide posted by user full name
     $form->addCheck('show_posted_by', 1);
     $form->setLabel('show_posted_by', dgettext('blog', 'Show the author\'s name'));
     $form->setMatch('show_posted_by', PHPWS_Settings::get('blog', 'show_posted_by'));
     $form->addCheck('simple_image', 1);
     $form->setLabel('simple_image', dgettext('blog', 'Use Image Manager'));
     $form->setMatch('simple_image', PHPWS_Settings::get('blog', 'simple_image'));
     $form->addCheck('mod_folders_only', 1);
     $form->setLabel('mod_folders_only', dgettext('blog', 'Hide general image folders'));
     $form->setMatch('mod_folders_only', PHPWS_Settings::get('blog', 'mod_folders_only'));
     $form->addCheck('home_page_display', 1);
     $form->setLabel('home_page_display', dgettext('blog', 'Show blog on home page'));
     $form->setMatch('home_page_display', PHPWS_Settings::get('blog', 'home_page_display'));
     $form->addCheck('logged_users_only', 1);
     $form->setLabel('logged_users_only', dgettext('blog', 'Logged user view only'));
     $form->setMatch('logged_users_only', PHPWS_Settings::get('blog', 'logged_users_only'));
     PHPWS_Core::initModClass('users', 'Action.php');
     $groups = User_Action::getGroups('group');
     if (!empty($groups)) {
         $group_match = array();
         $group_match_str = PHPWS_Settings::get('blog', 'view_only');
         if (!empty($group_match_str)) {
             $group_match = explode(':', $group_match_str);
         }
         $form->addMultiple('view_only', $groups);
         $form->setLabel('view_only', dgettext('blog', 'Limit blog to specific groups'));
         $form->setMatch('view_only', $group_match);
         $form->addCssClass('view_only', 'form-control');
     }
     $show[0] = dgettext('blog', 'Do not show');
     $show[1] = dgettext('blog', 'Only on home page');
     $show[2] = dgettext('blog', 'Always');
     $form->addSelect('show_recent', $show);
     $form->setLabel('show_recent', dgettext('blog', 'Show recent entries'));
     $form->setMatch('show_recent', PHPWS_Settings::get('blog', 'show_recent'));
     $form->addCssClass('show_recent', 'form-control');
     $form->addTextField('max_width', PHPWS_Settings::get('blog', 'max_width'));
     $form->setLabel('max_width', dgettext('blog', 'Maximum image width (50-2048)'));
     $form->setSize('max_width', 4, 4);
     $form->addCssClass('max_width', 'form-control');
     $form->addTextField('max_height', PHPWS_Settings::get('blog', 'max_height'));
     $form->setLabel('max_height', dgettext('blog', 'Maximum image height (50-2048)'));
     $form->setSize('max_height', 4, 4);
     $form->addCssClass('max_height', 'form-control');
     $form->addTextArea('comment_script', PHPWS_Settings::get('blog', 'comment_script'));
     $form->setLabel('comment_script', dgettext('blog', 'Paste in your comment code here (e.g. Disqus, Livefyre, Facebook, etc.)'));
     $form->addCssClass('comment_script', 'form-control');
     $form->addSubmit(dgettext('blog', 'Save settings'));
     if (Current_User::isDeity()) {
         $date_script = javascript('datetimepicker', array('format' => 'Y/m/d', 'timepicker' => false, 'id' => 'phpws_form_purge_date'), false, true, true);
         $form->addText('purge_date', date('Y/m/d', time() - 31536000));
         $form->setLabel('purge_date', dgettext('blog', 'Purge all entries before this date'));
         $form->addCssClass('purge_date', 'form-control datetimepicker');
         $form->addSubmit('purge_confirm', dgettext('blog', 'Confirm purge'));
         $form->setClass('purge_confirm', 'btn btn-danger');
     } else {
         $date_script = null;
     }
     $template = $form->getTemplate();
     $template['date_script'] = $date_script;
     if (PHPWS_Settings::get('blog', 'allow_anonymous_submits')) {
         $template['MENU_LINK'] = PHPWS_Text::secureLink(dgettext('blog', 'Clip for menu'), 'blog', array('action' => 'admin', 'command' => 'menu_submit_link'));
     }
     $template['VIEW_LABEL'] = dgettext('blog', 'View');
     $template['SUBMISSION_LABEL'] = dgettext('blog', 'Submission');
     $template['PAST_NOTE'] = dgettext('blog', 'Set to zero to prevent display');
     $template['COMMENTS_LABEL'] = dgettext('blog', 'Commenting');
     return PHPWS_Template::process($template, 'blog', 'settings.tpl');
 }
コード例 #4
0
ファイル: Admin.php プロジェクト: HaldunA/phpwebsite
 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;
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: Block_Admin.php プロジェクト: HaldunA/phpwebsite
 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');
 }
コード例 #7
0
ファイル: Form.php プロジェクト: HaldunA/phpwebsite
 /**
  * Creates the user interface for editing this form's settings
  *
  * @return string $content The templated string containing the html to display
  *                         a user interface for editing this form's settings.
  * @access public
  */
 function editSettings()
 {
     unset($this->report);
     if ($this->getId()) {
         /* If not a new form get the templated form info */
         $formTags['FORM_INFORMATION'] = $this->getFormInfo();
     }
     $form = new PHPWS_Form('edit_settings');
     /* Setup all editable values and their labels */
     $form->addTextField('PHAT_FormName', $this->getLabel());
     $form->setSize('PHAT_FormName', PHAT_DEFAULT_SIZE);
     $form->setMaxSize('PHAT_FormName', PHAT_DEFAULT_MAXSIZE);
     $form->setLabel('PHAT_FormName', dgettext('phatform', 'Name'));
     $form->addTextField('PHAT_FormPageLimit', $this->_pageLimit);
     $form->setSize('PHAT_FormPageLimit', 3, 3);
     $form->setLabel('PHAT_FormPageLimit', dgettext('phatform', 'Item limit per page'));
     $form->addTextArea('PHAT_FormBlurb0', $this->_blurb0);
     $form->setCols('PHAT_FormBlurb0', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb0', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_FormBlurb0', dgettext('phatform', 'Instructions'));
     $form->addTextArea('PHAT_FormBlurb1', $this->_blurb1);
     $form->setCols('PHAT_FormBlurb1', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb1', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_FormBlurb1', dgettext('phatform', 'Submission Message'));
     /* RBW Added a section to hold the post processing code 1/3/04 */
     $form->addTextArea('PHAT_PostProcess', $this->getPostProcessCode());
     $form->setCols('PHAT_FormBlurb1', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb1', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_PostProcess', dgettext('phatform', 'Post Process Code'));
     //$formTags['POSTPROCESS_HELP']  = PHPWS_Help::show_link('phatform', 'post_process_code');
     $form->addTextArea('PHAT_FormEmails', $this->getAdminEmails());
     $form->setCols('PHAT_FormBlurb1', PHAT_DEFAULT_COLS);
     $form->setRows('PHAT_FormBlurb1', PHAT_DEFAULT_ROWS);
     $form->setLabel('PHAT_FormEmails', dgettext('phatform', 'Admin Email (comma delimited)'));
     $form->addCheckbox('PHAT_FormMultiSubmit', 1);
     $form->setMatch('PHAT_FormMultiSubmit', $this->_multiSubmit);
     $form->setLabel('PHAT_FormMultiSubmit', dgettext('phatform', 'Allow multiple submissions'));
     $form->addCheckbox('PHAT_FormAnonymous', 1);
     $form->setMatch('PHAT_FormAnonymous', $this->_anonymous);
     $form->setLabel('PHAT_FormAnonymous', dgettext('phatform', 'Allow anonymous submissions'));
     $form->addCheckBox('PHAT_FormEditData', 1);
     $form->setMatch('PHAT_FormEditData', $this->_editData);
     $form->setLabel('PHAT_FormEditData', dgettext('phatform', 'Allow users to edit their form data'));
     $form->addCheckBox('PHAT_FormShowElementNumbers', 1);
     $form->setMatch('PHAT_FormShowElementNumbers', $this->_showElementNumbers);
     $form->setLabel('PHAT_FormShowElementNumbers', dgettext('phatform', 'Show numbers for form elements (eg: 1, 2, 3)'));
     $form->addCheckBox('PHAT_FormShowPageNumbers', 1);
     $form->setMatch('PHAT_FormShowPageNumbers', $this->_showPageNumbers);
     $form->setLabel('PHAT_FormShowPageNumbers', dgettext('phatform', 'Show form page numbers (eg: page 1 of 6)'));
     $form->addCheckBox('PHAT_FormHidden', 1);
     $form->setMatch('PHAT_FormHidden', $this->isHidden());
     $form->setLabel('PHAT_FormHidden', dgettext('phatform', 'Hide this form'));
     /* Can't forget the save button */
     $form->addSubmit('PHAT_SaveSettings', dgettext('phatform', 'Save Settings'));
     if ($this->getId()) {
         $form->addSubmit('PHAT_EditElements', dgettext('phatform', 'Edit Elements'));
         $GLOBALS['CNT_phatform']['title'] = $this->getLabel();
     } else {
         $GLOBALS['CNT_phatform']['title'] = PHAT_TITLE;
     }
     /* Add needed hiddens */
     $form->addHidden('module', 'phatform');
     $form->addHidden('PHAT_FORM_OP', 'SaveFormSettings');
     $form->addHidden('PHAT_FormId', $this->getId());
     $template = $form->getTemplate();
     $content = PHPWS_Template::process($template, 'phatform', 'form/settings.tpl');
     return $content;
 }
コード例 #8
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 /**
  * Creates the edit form for an event
  */
 public static function event_form(Calendar_Event $event, $suggest = false)
 {
     Layout::addStyle('calendar');
     javascript('datetimepicker');
     // the form id is linked to the check_date javascript
     $form = new PHPWS_Form('event_form');
     if (isset($_REQUEST['js'])) {
         $form->addHidden('js', 1);
     }
     $form->addHidden('module', 'calendar');
     if ($suggest) {
         $form->addHidden('uop', 'post_suggestion');
     } else {
         $form->addHidden('aop', 'post_event');
     }
     $form->addHidden('event_id', $event->id);
     $form->addHidden('sch_id', $event->_schedule->id);
     $form->addText('summary', $event->summary);
     $form->setLabel('summary', dgettext('calendar', 'Summary'));
     $form->setSize('summary', 60);
     $form->addText('location', $event->location);
     $form->setLabel('location', dgettext('calendar', 'Location'));
     $form->setSize('location', 60);
     $form->addText('loc_link', $event->loc_link);
     $form->setLabel('loc_link', dgettext('calendar', 'Location link'));
     $form->setSize('loc_link', 60);
     $form->addTextArea('description', $event->description);
     if ($suggest) {
         $form->setRows('description', 8);
         $form->setCols('description', 55);
     } else {
         $form->useEditor('description');
     }
     $form->setLabel('description', dgettext('calendar', 'Description'));
     $form->addText('start_date', $event->getStartTime('%Y/%m/%d'));
     $form->setLabel('start_date', dgettext('calendar', 'Start time'));
     $form->setExtra('start_date', 'onblur="check_start_date()"');
     $form->addText('end_date', $event->getEndTime('%Y/%m/%d'));
     $form->setLabel('end_date', dgettext('calendar', 'End time'));
     $form->setExtra('end_date', 'onblur="check_end_date()" onfocus="check_start_date()"');
     $event->timeForm('start_time', $event->start_time, $form);
     $event->timeForm('end_time', $event->end_time, $form);
     $form->setExtra('start_time_hour', 'onchange="check_start_date()"');
     $form->setExtra('end_time_hour', 'onchange="check_end_date()"');
     $form->addCheck('all_day', 1);
     $form->setMatch('all_day', $event->all_day);
     $form->setLabel('all_day', dgettext('calendar', 'All day event'));
     $form->setExtra('all_day', 'onchange="alter_date(this)"');
     if (!$suggest) {
         $form->addCheck('show_busy', 1);
         $form->setMatch('show_busy', $event->show_busy);
         $form->setLabel('show_busy', dgettext('calendar', 'Show busy'));
     }
     if ($suggest) {
         $form->addSubmit('save', dgettext('calendar', 'Suggest event'));
     } else {
         // Suggested events are not allowed repeats
         /**
          * Repeat form elements
          */
         $form->addCheck('repeat_event', 1);
         $form->setLabel('repeat_event', dgettext('calendar', 'Make a repeating event'));
         $form->addText('end_repeat_date', $event->getEndRepeat('%Y/%m/%d'));
         $form->setLabel('end_repeat_date', dgettext('calendar', 'Repeat event until:'));
         $modes = array('daily', 'weekly', 'monthly', 'yearly', 'every');
         $modes_label = array(dgettext('calendar', 'Daily'), dgettext('calendar', 'Weekly'), dgettext('calendar', 'Monthly'), dgettext('calendar', 'Yearly'), dgettext('calendar', 'Every'));
         $form->addRadio('repeat_mode', $modes);
         $form->setLabel('repeat_mode', $modes_label);
         $weekdays = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7);
         $weekday_labels = array(1 => strftime('%A', mktime(0, 0, 0, 1, 5, 1970)), 2 => strftime('%A', mktime(0, 0, 0, 1, 6, 1970)), 3 => strftime('%A', mktime(0, 0, 0, 1, 7, 1970)), 4 => strftime('%A', mktime(0, 0, 0, 1, 8, 1970)), 5 => strftime('%A', mktime(0, 0, 0, 1, 9, 1970)), 6 => strftime('%A', mktime(0, 0, 0, 1, 10, 1970)), 7 => strftime('%A', mktime(0, 0, 0, 1, 11, 1970)));
         $form->addCheck('weekday_repeat', $weekdays);
         $form->setLabel('weekday_repeat', $weekday_labels);
         $monthly = array('begin' => dgettext('calendar', 'Beginning of each month'), 'end' => dgettext('calendar', 'End of each month'), 'start' => dgettext('calendar', 'Every month on start date'));
         $form->addSelect('monthly_repeat', $monthly);
         $every_repeat_week = array(1 => dgettext('calendar', '1st'), 2 => dgettext('calendar', '2nd'), 3 => dgettext('calendar', '3rd'), 4 => dgettext('calendar', '4th'), 5 => dgettext('calendar', 'Last'));
         $frequency = array('every_month' => dgettext('calendar', 'Every month'), 1 => strftime('%B', mktime(0, 0, 0, 1, 1, 1970)), 2 => strftime('%B', mktime(0, 0, 0, 2, 1, 1970)), 3 => strftime('%B', mktime(0, 0, 0, 3, 1, 1970)), 4 => strftime('%B', mktime(0, 0, 0, 4, 1, 1970)), 5 => strftime('%B', mktime(0, 0, 0, 5, 1, 1970)), 6 => strftime('%B', mktime(0, 0, 0, 6, 1, 1970)), 7 => strftime('%B', mktime(0, 0, 0, 7, 1, 1970)), 8 => strftime('%B', mktime(0, 0, 0, 8, 1, 1970)), 9 => strftime('%B', mktime(0, 0, 0, 9, 1, 1970)), 10 => strftime('%B', mktime(0, 0, 0, 10, 1, 1970)), 11 => strftime('%B', mktime(0, 0, 0, 11, 1, 1970)), 12 => strftime('%B', mktime(0, 0, 0, 12, 1, 1970)));
         $form->addSelect('every_repeat_number', $every_repeat_week);
         $form->addSelect('every_repeat_weekday', $weekday_labels);
         $form->addSelect('every_repeat_frequency', $frequency);
         /* set repeat form matches */
         if (!empty($event->repeat_type)) {
             $repeat_info = explode(':', $event->repeat_type);
             $repeat_mode_match = $repeat_info[0];
             if (isset($repeat_info[1])) {
                 $repeat_vars = explode(';', $repeat_info[1]);
             } else {
                 $repeat_vars = null;
             }
             $form->setMatch('repeat_mode', $repeat_mode_match);
             switch ($repeat_mode_match) {
                 case 'weekly':
                     $form->setMatch('weekday_repeat', $repeat_vars);
                     break;
                 case 'monthly':
                     $form->setMatch('monthly_repeat', $repeat_vars[0]);
                     break;
                 case 'every':
                     $form->setMatch('every_repeat_number', $repeat_vars[0]);
                     $form->setMatch('every_repeat_weekday', $repeat_vars[1]);
                     $form->setMatch('every_repeat_frequency', $repeat_vars[2]);
                     break;
             }
             $form->setMatch('repeat_event', 1);
         }
         if ($event->pid) {
             $form->addHidden('pid', $event->pid);
             // This is a repeat copy, if saved it removes it from the copy list
             $form->addSubmit('save', dgettext('calendar', 'Save and remove repeat'));
             $form->setExtra('save', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Remove event from repeat list?')));
         } elseif ($event->id && $event->repeat_type) {
             // This is event is a source repeating event
             // Save this
             // Not sure if coding this portion. commenting for now
             // $form->addSubmit('save_source', dgettext('calendar', 'Save this event only'));
             $form->addSubmit('save_copy', dgettext('calendar', 'Save and apply to repeats'));
             $form->setExtra('save_copy', sprintf('onclick="return confirm(\'%s\')"', dgettext('calendar', 'Apply changes to repeats?')));
         } else {
             // this is a non-repeating event
             $form->addSubmit('save', dgettext('calendar', 'Save event'));
         }
     }
     $tpl = $form->getTemplate();
     if (!$suggest) {
         $tpl['EVENT_TAB'] = dgettext('calendar', 'Event');
         $tpl['REPEAT_TAB'] = dgettext('calendar', 'Repeat');
     }
     if (isset($event->_error)) {
         $tpl['ERROR'] = implode('<br />', $event->_error);
     }
     if ($event->pid) {
         $linkvar['aop'] = 'edit_event';
         $linkvar['sch_id'] = $event->_schedule->id;
         $linkvar['event_id'] = $event->pid;
         if (javascriptEnabled()) {
             $linkvar['js'] = 1;
         }
         $source_link = PHPWS_Text::moduleLink(dgettext('calendar', 'Click here if you would prefer to edit the source event.'), 'calendar', $linkvar);
         $tpl['REPEAT_WARNING'] = dgettext('calendar', 'This is a repeat of another event.') . '<br />' . $source_link;
     }
     $tpl['SYNC'] = sprintf('<input type="button" style="display : none" id="sync-dates" onclick="sync_dates(); return false;" name="sync-dates" value="%s" />', dgettext('calendar', 'Sync dates'));
     if (javascriptEnabled()) {
         Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/edit_event/head.js"></script>');
         Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'mod/calendar/javascript/check_date/head.js"></script>');
     }
     return PHPWS_Template::process($tpl, 'calendar', 'admin/forms/edit_event.tpl');
 }
コード例 #9
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
 public function classifyFile($files)
 {
     $tpl = null;
     $this->cabinet->title = dgettext('filecabinet', 'Classify Files');
     $classify_dir = $this->cabinet->getClassifyDir();
     if (empty($classify_dir) || !is_dir($classify_dir)) {
         $this->cabinet->content = dgettext('filecabinet', 'Unable to locate the classify directory. Please check your File Cabinet settings, configuration file and directory permissions.');
         return;
     }
     if (!is_array($files)) {
         $files = array($files);
     }
     // image folders
     $image_folders = Cabinet::listFolders(IMAGE_FOLDER, true);
     // document folders
     $document_folders = Cabinet::listFolders(DOCUMENT_FOLDER, true);
     // multimedia folders
     $multimedia_folders = Cabinet::listFolders(MULTIMEDIA_FOLDER, true);
     $count = 0;
     $image_types = $this->cabinet->getAllowedTypes('image');
     $document_types = $this->cabinet->getAllowedTypes('document');
     $media_types = $this->cabinet->getAllowedTypes('media');
     foreach ($files as $file) {
         if (!is_file($classify_dir . $file) || !PHPWS_File::checkMimeType($classify_dir . $file) || !$this->cabinet->fileTypeAllowed($file)) {
             continue;
         }
         $form = new PHPWS_Form('file_form_' . $count);
         $ext = PHPWS_File::getFileExtension($file);
         if (in_array($ext, $image_types)) {
             $folders =& $image_folders;
         } elseif (in_array($ext, $media_types)) {
             $folders =& $multimedia_folders;
         } elseif (in_array($ext, $document_types)) {
             $folders =& $document_folders;
         } else {
             continue;
         }
         $form->addSelect("folder[{$count}]", $folders);
         $form->setTag("folder[{$count}]", 'folder');
         $form->setLabel("folder[{$count}]", dgettext('filecabinet', 'Folder'));
         $form->addText("file_title[{$count}]", $file);
         $form->setLabel("file_title[{$count}]", dgettext('filecabinet', 'Title'));
         $form->setTag("file_title[{$count}]", 'file_title');
         $form->setSize("file_title[{$count}]", 40);
         $form->addTextarea("file_description[{$count}]");
         $form->setLabel("file_description[{$count}]", dgettext('filecabinet', 'Description'));
         $form->setTag("file_description[{$count}]", 'file_description');
         $form->addSubmit('submit', dgettext('filecabinet', 'Classify files'));
         $subtpl = $form->getTemplate();
         $subtpl['HIDDEN'] = sprintf('<input type="hidden" name="file_count[%s]" value="%s" />', $count, $file);
         $subtpl['FILE_NAME'] = $file;
         $subtpl['FILE_NAME_LABEL'] = dgettext('filecabinet', 'File name');
         unset($subtpl['START_FORM']);
         unset($subtpl['END_FORM']);
         $tpl['files'][] = $subtpl;
         $count++;
     }
     $form = new PHPWS_Form('classify_files');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('aop', 'post_classifications');
     if (!empty($tpl)) {
         $form_template = $form->getTemplate(true, true, $tpl);
         $this->cabinet->content = PHPWS_Template::process($form_template, 'filecabinet', 'Forms/classify_file.tpl');
     } else {
         $this->cabinet->content = dgettext('filecabinet', 'Unable to classify files.');
     }
 }
コード例 #10
0
ファイル: Room_Base.php プロジェクト: HaldunA/phpwebsite
 public function getForm($name = null)
 {
     javascript('datepicker');
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form($name);
     $form->addHidden('module', 'properties');
     $form->addCheck('appalcart', 1);
     $form->setLabel('appalcart', 'On Appalcart route');
     $form->setMatch('appalcart', $this->appalcart);
     $form->addSelect('campus_distance', array(0 => '0 to 5', 5 => '5 to 10', 10 => '10 to 25', 25 => 'More than 25'));
     $form->setLabel('campus_distance', 'Miles from campus');
     $form->setMatch('campus_distance', $this->campus_distance);
     $form->addCheck('clubhouse', 1);
     $form->setLabel('clubhouse', 'Clubhouse');
     $form->setMatch('clubhouse', $this->clubhouse);
     \PHPWS_Core::initModClass('properties', 'User.php');
     $contracts = User::getContracts();
     $form->addSelect('contract_length', $contracts);
     $form->setLabel('contract_length', 'Contract length');
     $form->setMatch('contract_length', $this->contract_length);
     $form->addTextarea('description', $this->description);
     $form->setLabel('description', 'Other property information');
     $form->addCheck('airconditioning', 1);
     $form->setLabel('airconditioning', 'Air Conditioning');
     $form->setMatch('airconditioning', $this->airconditioning);
     $form->addCheck('dishwasher', 1);
     $form->setLabel('dishwasher', 'Dishwasher');
     $form->setMatch('dishwasher', $this->dishwasher);
     $itypes[NET_DIALUP] = 'Dial Up';
     $itypes[NET_CABLE] = 'Cable';
     $itypes[NET_DSL] = 'DSL';
     $itypes[NET_WIRELESS] = 'Wireless';
     $itypes[NET_SATELLITE] = 'Satellite';
     $itypes[NET_FIBER] = 'Fiber';
     $itypes[NET_BOTH] = 'DSL/Cable';
     $form->addSelect('internet_type', $itypes);
     $form->setLabel('internet_type', 'Internet');
     $form->setMatch('internet_type', $this->internet_type);
     $form->addSelect('laundry_type', array(LAUNDRY_NONE => 'No laundry', LAUNDRY_ON_PREMISES => 'Laundry room on premises', LAUNDRY_HOOKUP => 'Washer/Dryer hook ups in unit', LAUNDRY_IN_UNIT => 'Washer/Dryer in unit'));
     $form->setLabel('laundry_type', 'Laundry');
     $form->setMatch('laundry_type', $this->laundry_type);
     $form->addText('monthly_rent', $this->getMonthlyRent());
     $form->setLabel('monthly_rent', 'Monthly rent');
     $form->setSize('monthly_rent', 8, 8);
     $form->setRequired('monthly_rent');
     $form->addText('move_in_date', $this->getMoveInDate());
     $form->setLabel('move_in_date', 'Move-in date');
     $form->setExtra('move_in_date', 'class="datepicker"');
     $form->addText('name', $this->name);
     $form->setLabel('name', 'Name of property');
     $form->setRequired('name');
     $form->setSize('name', 50);
     $form->addCheck('pets_allowed', 1);
     $form->setLabel('pets_allowed', 'Pets allowed');
     $form->setMatch('pets_allowed', $this->pets_allowed);
     $form->addCheck('sublease', 1);
     $form->setMatch('sublease', $this->sublease);
     $form->setLabel('sublease', 'Sublease');
     $toptions[TV_NONE] = 'Antenna';
     $toptions[TV_CABLE] = 'Cable';
     $toptions[TV_SATELLITE] = 'Satellite';
     $toptions[TV_FIBER] = 'Fiber';
     $form->addSelect('tv_type', $toptions);
     $form->setLabel('tv_type', 'Television');
     $form->setMatch('tv_type', $this->tv_type);
     $form->addSelect('trash_type', array(TRASH_ON_YOUR_OWN => 'Trash and recycling receptacles not provided', TRASH_ON_PREMISES_NO_RECYCLE => 'Trash receptacles on site.  Recycling not provided', TRASH_ON_PREMISES_WITH_RECYCLE => 'Trash and recycling receptacles provided on site', TRASH_PICKUP => 'Curbside pickup for trash and recycling'));
     $form->setMatch('trash_type', $this->trash_type);
     $form->setLabel('trash_type', 'Trash removal');
     $form->addCheck('workout_room', 1);
     $form->setMatch('workout_room', $this->workout_room);
     $form->setLabel('workout_room', 'Workout room');
     return $form;
 }
コード例 #11
0
ファイル: User.php プロジェクト: HaldunA/phpwebsite
 public function searchPanel()
 {
     $form = new \PHPWS_Form('search-properties');
     $form->addHidden('uop', 'search');
     $form->addHidden('module', 'properties');
     $form->setMethod('get');
     $form->addText('manager');
     $form->setSize('manager', 15);
     $form->addSubmit('manager_submit', 'Add');
     $form->addText('property_name');
     $form->setSize('property_name', 15);
     $form->addSubmit('property_name_submit', 'Add');
     $tpl = $form->getTemplate();
     //javascriptMod('properties', 'search');
     $vars['uop'] = 'search';
     $vars['d'] = 'any';
     $distances[] = \PHPWS_Text::moduleLink('Any', 'properties', $vars);
     $vars['d'] = '0';
     $distances[] = \PHPWS_Text::moduleLink('0 - 5 miles', 'properties', $vars);
     $vars['d'] = '5';
     $distances[] = \PHPWS_Text::moduleLink('5 - 10 miles', 'properties', $vars);
     $vars['d'] = '10';
     $distances[] = \PHPWS_Text::moduleLink('10 - 25 miles', 'properties', $vars);
     $vars['d'] = '25';
     $distances[] = \PHPWS_Text::moduleLink('Over 25 miles', 'properties', $vars);
     $tpl['DISTANCE_OPTIONS'] = '<ul><li>' . implode('</li><li>', $distances) . '</li></ul>';
     unset($vars['d']);
     $vars['a'] = UNDERGRAD;
     $age1 = \PHPWS_Text::moduleLink('Undergraduate', 'properties', $vars);
     $vars['a'] = GRAD_STUDENT;
     $age2 = \PHPWS_Text::moduleLink('Graduate', 'properties', $vars);
     $tpl['STUDENT_TYPE'] = $age1 . '<br />' . $age2;
     unset($vars['a']);
     $vars['p'] = 'any';
     $prices[] = \PHPWS_Text::moduleLink('Any', 'properties', $vars);
     $vars['p'] = '0-100';
     $prices[] = \PHPWS_Text::moduleLink('$100 and under', 'properties', $vars);
     $vars['p'] = '100-200';
     $prices[] = \PHPWS_Text::moduleLink('$100 to $200', 'properties', $vars);
     $vars['p'] = '200-300';
     $prices[] = \PHPWS_Text::moduleLink('$200 to $300', 'properties', $vars);
     $vars['p'] = '300-400';
     $prices[] = \PHPWS_Text::moduleLink('$300 to $400', 'properties', $vars);
     $vars['p'] = '400-500';
     $prices[] = \PHPWS_Text::moduleLink('$400 to $500', 'properties', $vars);
     $vars['p'] = '500-600';
     $prices[] = \PHPWS_Text::moduleLink('$500 to $600', 'properties', $vars);
     $vars['p'] = '600-750';
     $prices[] = \PHPWS_Text::moduleLink('$600 to $750', 'properties', $vars);
     $vars['p'] = '750-1000';
     $prices[] = \PHPWS_Text::moduleLink('$750 to $1000', 'properties', $vars);
     $vars['p'] = '1000-9999';
     $prices[] = \PHPWS_Text::moduleLink('$1000 and above', 'properties', $vars);
     $tpl['PRICE_OPTIONS'] = '<ul><li>' . implode('</li><li>', $prices) . '</li></ul>';
     unset($vars['p']);
     $vars['eff'] = '1';
     $rooms[] = \PHPWS_Text::moduleLink('One room efficiency', 'properties', $vars);
     unset($vars['eff']);
     $vars['beds'] = '1';
     $rooms[] = \PHPWS_Text::moduleLink('1+', 'properties', $vars);
     $vars['beds'] = '2';
     $rooms[] = \PHPWS_Text::moduleLink('2+', 'properties', $vars);
     $vars['beds'] = '3';
     $rooms[] = \PHPWS_Text::moduleLink('3+', 'properties', $vars);
     $vars['beds'] = '4';
     $rooms[] = \PHPWS_Text::moduleLink('4+', 'properties', $vars);
     $vars['beds'] = '5';
     $rooms[] = \PHPWS_Text::moduleLink('5+', 'properties', $vars);
     $tpl['BEDROOM_CHOICE'] = '<ul><li>' . implode('</li><li>', $rooms) . '</li></ul>';
     unset($vars['beds']);
     $vars['bath'] = '1';
     $bath[] = \PHPWS_Text::moduleLink('1+', 'properties', $vars);
     $vars['bath'] = '1.5';
     $bath[] = \PHPWS_Text::moduleLink('1 1/2+', 'properties', $vars);
     $vars['bath'] = '2';
     $bath[] = \PHPWS_Text::moduleLink('2+', 'properties', $vars);
     $vars['bath'] = '2.5';
     $bath[] = \PHPWS_Text::moduleLink('2 1/2+', 'properties', $vars);
     $vars['bath'] = '3';
     $bath[] = \PHPWS_Text::moduleLink('3+', 'properties', $vars);
     $vars['bath'] = '3.5';
     $bath[] = \PHPWS_Text::moduleLink('3 1/2+', 'properties', $vars);
     $tpl['BATHROOM_CHOICE'] = '<ul><li>' . implode('</li><li>', $bath) . '</li></ul>';
     unset($vars['bath']);
     $vars['sub'] = 1;
     $tpl['SUBLEASE'] = \PHPWS_Text::moduleLink('Sublease only', 'properties', $vars);
     unset($vars['sub']);
     $vars['nosub'] = 1;
     $tpl['NOSUB'] = \PHPWS_Text::moduleLink('No subleases', 'properties', $vars);
     unset($vars['nosub']);
     $features = null;
     $search = $this->loadSearchParameters();
     if (!isset($search['amenities']['ac'])) {
         $vars['amen'] = 'ac';
         $features[] = \PHPWS_Text::moduleLink('AppalCart', 'properties', $vars);
     }
     if (!isset($search['amenities']['ch'])) {
         $vars['amen'] = 'ch';
         $features[] = \PHPWS_Text::moduleLink('Clubhouse', 'properties', $vars);
     }
     if (!isset($search['amenities']['dish'])) {
         $vars['amen'] = 'dish';
         $features[] = \PHPWS_Text::moduleLink('Dishwasher', 'properties', $vars);
     }
     if (!isset($search['amenities']['furn'])) {
         $vars['amen'] = 'furn';
         $features[] = \PHPWS_Text::moduleLink('Furnished', 'properties', $vars);
     }
     if (!isset($search['amenities']['pet'])) {
         $vars['amen'] = 'pet';
         $features[] = \PHPWS_Text::moduleLink('Pet allowed', 'properties', $vars);
     }
     if (!isset($search['amenities']['tr'])) {
         $vars['amen'] = 'tr';
         $features[] = \PHPWS_Text::moduleLink('Trash pickup', 'properties', $vars);
     }
     if (!isset($search['amenities']['wo'])) {
         $vars['amen'] = 'wo';
         $features[] = \PHPWS_Text::moduleLink('Workout room', 'properties', $vars);
     }
     if (!isset($search['amenities']['wash'])) {
         $vars['amen'] = 'wash';
         $features[] = \PHPWS_Text::moduleLink('Washer/Dryer', 'properties', $vars);
     }
     if ($features) {
         $tpl['FEATURES'] = '<ul><li>' . implode('</li><li>', $features) . '</li></ul>';
     }
     $tpl['CRITERIA'] = $this->getCriteria();
     unset($vars['amen']);
     $vars['clear'] = 1;
     $tpl['CLEAR'] = \PHPWS_Text::moduleLink('Clear all criteria', 'properties', $vars, null, 'Clear all criteria', 'btn btn-danger');
     $content = \PHPWS_Template::process($tpl, 'properties', 'search.tpl');
     \Layout::add($content, 'properties', 'search_settings');
 }
コード例 #12
0
ファイル: InterWiki.php プロジェクト: Jopperi/wiki
 /**
  * Edit interwiki link form
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function edit()
 {
     $form = new PHPWS_Form();
     $form->addHidden('module', 'wiki');
     $form->addHidden('op', 'saveinterwiki');
     $form->addHidden('id', $this->getId());
     $form->addText('label', $this->getLabel());
     $form->setSize('label', 35, 100);
     $form->addText('url', $this->getUrl());
     $form->setSize('url', 50);
     $form->addSubmit('save', dgettext('wiki', 'Edit'));
     $tags = $form->getTemplate();
     $tags['LABEL_LABEL'] = dgettext('wiki', 'Site Name');
     $tags['URL_LABEL'] = dgettext('wiki', 'URL');
     $tags['URL_NOTE'] = dgettext('wiki', 'Use %s in the URL string to represent the page name');
     $tags['TOP_LABEL'] = dgettext('wiki', 'Edit interwiki link');
     return $tags;
 }
コード例 #13
0
ファイル: Schedule.php プロジェクト: HaldunA/phpwebsite
 /**
  * Edit form for a schedule
  */
 public function form()
 {
     $key = $this->getKey();
     $form = new PHPWS_Form('schedule_form');
     if (isset($_REQUEST['js'])) {
         $form->addHidden('js', 1);
     }
     $form->addHidden('module', 'calendar');
     $form->addHidden('aop', 'post_schedule');
     $form->addHidden('sch_id', $this->id);
     $form->addText('title', $this->title);
     $form->setLabel('title', dgettext('calendar', 'Title'));
     $form->setSize('title', 40);
     $form->addTextArea('summary', $this->summary);
     $form->setLabel('summary', dgettext('calendar', 'Summary'));
     $form->useEditor('summary');
     if (PHPWS_Settings::get('calendar', 'personal_schedules')) {
         if (Current_User::allow('calendar', 'edit_public')) {
             $form->addRadio('public', array(0, 1));
             $form->setLabel('public', array(dgettext('calendar', 'Private'), dgettext('calendar', 'Public')));
             $form->setMatch('public', (int) $this->public);
         } else {
             $form->addTplTag('PUBLIC', dgettext('calendar', 'Private'));
             $form->addHidden('public', 0);
         }
     } else {
         $form->addTplTag('PUBLIC', dgettext('calendar', 'Public'));
         $form->addHidden('public', 1);
     }
     $upcoming[0] = dgettext('calendar', 'Do not show upcoming events');
     $upcoming[1] = dgettext('calendar', 'Show upcoming week');
     $upcoming[2] = dgettext('calendar', 'Show next two weeks');
     $upcoming[3] = dgettext('calendar', 'Show upcoming month');
     $form->addSelect('show_upcoming', $upcoming);
     $form->setLabel('show_upcoming', dgettext('calendar', 'Show upcoming events'));
     $form->setMatch('show_upcoming', $this->show_upcoming);
     $form->addSubmit(dgettext('calendar', 'Save'));
     $template = $form->getTemplate();
     if (isset($_REQUEST['js'])) {
         $template['CLOSE'] = javascript('close_window', array('value' => dgettext('calendar', 'Cancel')));
     }
     $template['PUBLIC_LABEL'] = dgettext('calendar', 'Availability');
     return PHPWS_Template::process($template, 'calendar', 'admin/forms/edit_schedule.tpl');
 }
コード例 #14
0
 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 &amp; 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 &amp; 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');
 }
コード例 #15
0
 public function editPageHeader()
 {
     $section_name = $_GET['section'];
     $pid = $_GET['id'];
     $content = @$_SESSION['PS_Page'][$pid][$section_name];
     $form = new PHPWS_Form('edit');
     $form->addHidden('pid', $pid);
     $form->addHidden('tpl', $_GET['tpl']);
     $form->addHidden('module', 'pagesmith');
     $form->addHidden('aop', 'post_header');
     $form->addHidden('section_name', $section_name);
     $form->addText('header', $content);
     $form->setLabel('header', dgettext('pagesmith', 'Header'));
     $form->setSize('header', 40);
     $form->addSubmit(dgettext('pagesmith', 'Update'));
     $tpl = $form->getTemplate();
     $tpl['CANCEL'] = javascript('close_window');
     $this->ps->title = dgettext('pagesmith', 'Edit header');
     $this->ps->content = PHPWS_Template::process($tpl, 'pagesmith', 'edit_header.tpl');
 }
コード例 #16
0
 public static function forgotForm()
 {
     PHPWS_Core::initCoreClass('Captcha.php');
     $form = new PHPWS_Form('forgot-password');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'post_forgot');
     $form->addText('fg_username');
     $form->setLabel('fg_username', dgettext('users', 'Enter your user name.'));
     $form->addText('fg_email');
     $form->setSize('fg_email', 40);
     $form->setLabel('fg_email', dgettext('users', 'Forgotten your user name? Enter your email address instead.'));
     if (ALLOW_CAPTCHA) {
         $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     }
     $form->addSubmit(dgettext('users', 'Send reminder'));
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'users', 'forms/forgot.tpl');
 }
コード例 #17
0
ファイル: WikiImage.php プロジェクト: Jopperi/wiki
 /**
  * Add image form
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function add()
 {
     $form = new PHPWS_Form();
     $form->addHidden('module', 'wiki');
     $form->addHidden('op', 'doimageupload');
     $form->addFile('filename');
     $form->setSize('filename', 50);
     $form->setLabel('filename', dgettext('wiki', 'Filename'));
     $form->addText('summary');
     $form->setSize('summary', 50, 200);
     $form->setLabel('summary', dgettext('wiki', 'Summary'));
     $form->addSubmit('save', dgettext('wiki', 'Upload'));
     return $form->getTemplate();
 }
コード例 #18
0
ファイル: User.php プロジェクト: HaldunA/phpwebsite
 public static function searchPost()
 {
     if (isset($_GET['search'])) {
         $search_phrase = $_GET['search'];
     } else {
         $search_phrase = '';
     }
     $search_phrase = str_replace('+', ' ', $search_phrase);
     $search_phrase = Search::filterWords($search_phrase);
     if (isset($_GET['alternate']) && $_GET['alternate'] != 'local') {
         Search_User::sendToAlternate($_GET['alternate'], $search_phrase);
         exit;
     }
     // hi + keep search terms for further use (like hilite for js)
     $_SESSION['search']['search_phrase'] = $search_phrase;
     // hi /
     $form = new PHPWS_Form('search_for');
     $form->setMethod('get');
     $form->addHidden('module', 'search');
     $form->addHidden('user', 'search');
     $form->addSubmit(dgettext('search', 'Search'));
     $form->addText('search', $search_phrase);
     $form->setSize('search', 40);
     $form->setLabel('search', dgettext('search', 'Search for:'));
     $form->addCheck('exact_only', 1);
     $form->setLabel('exact_only', dgettext('search', 'Exact matches only'));
     if (isset($_GET['exact_only'])) {
         $exact_match = TRUE;
         $form->setMatch('exact_only', 1);
     } else {
         $exact_match = FALSE;
     }
     $mod_list = Search_User::getModList();
     $form->addSelect('mod_title', $mod_list);
     $form->setLabel('mod_title', dgettext('search', 'Module list'));
     if (isset($_GET['mod_title'])) {
         $form->setMatch('mod_title', $_GET['mod_title']);
     }
     Search_User::addAlternates($form);
     $template = $form->getTemplate();
     if (isset($_GET['mod_title']) && $_GET['mod_title'] != 'all') {
         $module = preg_replace('/\\W/', '', $_GET['mod_title']);
     } else {
         $module = NULL;
     }
     $template['SEARCH_LOCATION'] = dgettext('search', 'Search location');
     $template['ADVANCED_LABEL'] = dgettext('search', 'Advanced Search');
     $result = Search_User::getResults($search_phrase, $module, $exact_match);
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $template['SEARCH_RESULTS'] = dgettext('search', 'A problem occurred during your search.');
     } elseif (empty($result)) {
         $template['SEARCH_RESULTS'] = dgettext('search', 'No results found.');
     } else {
         $template['SEARCH_RESULTS'] = $result;
     }
     $template['SEARCH_RESULTS_LABEL'] = dgettext('search', 'Search Results');
     $content = PHPWS_Template::process($template, 'search', 'search_page.tpl');
     Layout::add($content);
 }
コード例 #19
0
ファイル: Branch_Admin.php プロジェクト: HaldunA/phpwebsite
 /**
  * Form to create or edit a branch
  */
 public function edit_db($force = false)
 {
     $this->title = dgettext('branch', 'Setup branch database');
     $form = new PHPWS_Form('branch-form');
     $form->addHidden('module', 'branch');
     $form->addHidden('command', 'post_db');
     $form->addHidden('force', (int) $force);
     $form->addCheck('createdb', $this->createdb);
     $form->setLabel('createdb', dgettext('branch', 'Create new database'));
     $form->addSelect('dbtype', $this->db_list);
     $form->setMatch('dbtype', $this->dbtype);
     $form->setLabel('dbtype', dgettext('branch', 'Database syntax'));
     $form->addText('dbname', $this->dbname);
     $form->setLabel('dbname', dgettext('branch', 'Database name'));
     $form->addText('dbuser', $this->dbuser);
     $form->setLabel('dbuser', dgettext('branch', 'Permission user'));
     $form->addPassword('dbpass', $this->dbpass);
     $form->allowValue('dbpass');
     $form->setLabel('dbpass', dgettext('branch', 'User password'));
     $form->addText('dbprefix', $this->dbprefix);
     $form->setLabel('dbprefix', dgettext('branch', 'Table prefix'));
     $form->setSize('dbprefix', 5, 5);
     $form->addText('dbhost', $this->dbhost);
     $form->setLabel('dbhost', dgettext('branch', 'Database Host'));
     $form->setSize('dbhost', 40);
     $form->addText('dbport', $this->dbport);
     $form->setLabel('dbport', dgettext('branch', 'Connection Port'));
     $form->addTplTag('DB_LEGEND', dgettext('branch', 'Database information'));
     $form->addSubmit('plug', dgettext('branch', 'Use hub values'));
     $form->addSubmit('submit', dgettext('branch', 'Continue...'));
     $template = $form->getTemplate();
     $this->content = PHPWS_Template::process($template, 'branch', 'edit_db.tpl');
 }
コード例 #20
0
ファイル: WikiPage.php プロジェクト: Jopperi/wiki
 function move()
 {
     if (!Current_User::authorized('wiki', 'edit_page') && !(PHPWS_Settings::get('wiki', 'allow_page_edit') && Current_User::isLogged()) || !$this->allow_edit) {
         Current_User::disallow(dgettext('wiki', 'User attempted access to wiki page move.'));
         return;
     }
     $form = new PHPWS_Form();
     $form->addHidden('module', 'wiki');
     $form->addHidden('page_op', 'do_move');
     $form->addHidden('page', $this->getTitle(FALSE));
     $form->addText('newpage');
     $form->setSize('newpage', 40, 100);
     $form->setLabel('newpage', dgettext('wiki', 'New title'));
     $form->addSubmit('move', dgettext('wiki', 'Move'));
     $form->addTplTag('BACK_PAGE', PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Page'), 'wiki', array('page' => $this->getTitle(FALSE))));
     $form->addTplTag('MESSAGE', WikiManager::getMessage());
     $form->addTplTag('INSTRUCTIONS', dgettext('wiki', 'Using the form below will rename a page, moving all of its history
                      to the new name. The old title will become a redirect page to the new title. Links to the old page
                      title will not be changed. You are responsible for making sure that links continue to point where they
                      are supposed to go. Note that the page will not be moved if there is already a page at the new title.'));
     return PHPWS_Template::process($form->getTemplate(), 'wiki', 'move.tpl');
 }
コード例 #21
0
 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');
 }
コード例 #22
0
ファイル: Dropbox.php プロジェクト: HaldunA/phpwebsite
 /**
  * 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');
 }
コード例 #23
0
ファイル: my_page.php プロジェクト: HaldunA/phpwebsite
 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');
 }
コード例 #24
0
ファイル: Faxmaster.php プロジェクト: sinkdb/faxserv
 /**
  * Allows users with sufficient privileges to change the settings associated
  * with the faxmaster module.
  */
 private function changeSettings()
 {
     // Check user's permissions
     if (!Current_User::allow('faxmaster', 'settings')) {
         PHPWS_Core::initModClass('faxmaster', 'exception/PermissionException.php');
         throw new PermissionException('Permission denied');
     }
     $content = array();
     $form = new PHPWS_Form('faxmaster_settings');
     // If $_REQUEST data has been given, set the paths
     if (isset($_REQUEST['fax_path']) && !is_null($_REQUEST['fax_path']) && isset($_REQUEST['archive_path']) && !is_null($_REQUEST['archive_path'])) {
         clearstatcache(true);
         // is_readable and is_writable cache results, so you need to clear the cache
         $faxRead = is_readable($_REQUEST['fax_path']);
         $faxWrite = is_writable($_REQUEST['fax_path']);
         $archiveRead = is_readable($_REQUEST['archive_path']);
         $archiveWrite = is_writable($_REQUEST['archive_path']);
         if (!$faxRead || !$faxWrite || !$archiveRead || !$archiveWrite) {
             // Show warnings for invalid paths
             PHPWS_Core::initModClass('faxmaster', 'FaxmasterNotificationView.php');
             if (!$faxRead) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The fax directory you specified is not readable or does not exist.");
             }
             if (!$faxWrite) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The fax directory you specified is not writable or does not exist.");
             }
             if (!$archiveRead) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The archive directory you specified is not readable or does not exist.");
             }
             if (!$archiveWrite) {
                 NQ::simple('faxmaster', FAX_NOTIFICATION_ERROR, "The archive directory you specified is not writable or does not exist.");
             }
             $nv = new FaxmasterNotificationView();
             $nv->popNotifications();
             Layout::add($nv->show());
             // Show supplied paths
             $form->setAction('index.php?module=faxmaster&op=settings');
             $form->addTplTag('FAX_PATH', $_REQUEST['fax_path']);
             $form->addTplTag('ARCHIVE_PATH', $_REQUEST['archive_path']);
             $form->addSubmit('Try Again');
             $tpl = $form->getTemplate();
             Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl'));
         } else {
             // new paths were valid, so update settings
             PHPWS_Settings::set('faxmaster', 'fax_path', $_REQUEST['fax_path']);
             PHPWS_Settings::set('faxmaster', 'archive_path', $_REQUEST['archive_path']);
             PHPWS_Settings::save('faxmaster');
             // Show new paths
             $form->setAction('index.php?module=faxmaster&op=go_home');
             $form->addTplTag('SAVED', 'New Settings Saved!');
             $form->addTplTag('FAX_PATH', PHPWS_Settings::get('faxmaster', 'fax_path'));
             $form->addTplTag('ARCHIVE_PATH', PHPWS_Settings::get('faxmaster', 'archive_path'));
             $form->addSubmit('Return to Fax List');
             $tpl = $form->getTemplate();
             Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl'));
         }
     } else {
         // Show initial form to change paths
         $form->setAction('index.php?module=faxmaster&op=settings');
         $form->addTplTag('WARNING', '<strong>WARNING: </strong> Changing paths does not move files. Files must be moved manually.<br /><br \\>');
         $form->addText('fax_path', PHPWS_Settings::get('faxmaster', 'fax_path'));
         $form->setSize('fax_path', 45);
         $form->addText('archive_path', PHPWS_Settings::get('faxmaster', 'archive_path'));
         $form->setSize('archive_path', 45);
         $form->addSubmit('Save Settings');
         $tpl = $form->getTemplate();
         Layout::add(PHPWS_Template::process($tpl, 'faxmaster', 'settings.tpl'));
     }
     $this->addNavLinks();
 }
コード例 #25
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 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;
 }
コード例 #26
0
ファイル: Admin.php プロジェクト: par-orillonsoft/phpwebsite
 private function settingsForm()
 {
     \Layout::addStyle('properties', 'forms.css');
     $form = new \PHPWS_Form();
     $form->addHidden('module', 'properties');
     $form->addHidden('aop', 'post_settings');
     $form->addText('login_link', \PHPWS_Settings::get('properties', 'login_link'));
     $form->setLabel('login_link', 'Alternate authentication link');
     $form->setSize('login_link', 30);
     $form->addText('email', \PHPWS_Settings::get('properties', 'email'));
     $form->setLabel('email', 'Site email');
     $form->setSize('email', 30);
     $form->addCheck('roommate_only');
     $form->setMatch('roommate_only', \PHPWS_Settings::get('properties', 'roommate_only'));
     $form->setLabel('roommate_only', 'Only use the roommate functionality');
     $form->addSubmit('Save settings');
     $tpl = $form->getTemplate();
     if (!empty($this->errors)) {
         foreach ($this->errors as $key => $message) {
             $new_key = strtoupper($key) . '_ERROR';
             $tpl[$new_key] = $message;
         }
     }
     $this->title = 'Settings';
     $this->content = \PHPWS_Template::process($tpl, 'properties', 'settings.tpl');
 }
コード例 #27
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');
 }
コード例 #28
0
ファイル: Forms.php プロジェクト: HaldunA/phpwebsite
 public function userSignup()
 {
     if (!$this->signup->sheet->id) {
         PHPWS_Core::errorPage('404');
     }
     $sheet = $this->signup->sheet;
     $peep = $this->signup->peep;
     if (Current_User::isLogged() && empty($peep->email)) {
         $peep->email = Current_User::getEmail();
     }
     if ($sheet->end_time < time()) {
         $this->signup->title = dgettext('signup', 'Sorry');
         $this->signup->content = dgettext('signup', 'We are no longer accepting applications.');
         return;
     }
     $slots = $sheet->getAllSlots();
     $slots_filled = $sheet->totalSlotsFilled();
     if (empty($slots)) {
         $this->signup->title = dgettext('signup', 'Sorry');
         $this->signup->content = dgettext('signup', 'There is a problem with this signup sheet. Please check back later.');
         return;
     }
     $this->signup->title =& $sheet->title;
     foreach ($slots as $slot) {
         // if the slots are filled, don't offer it
         if ($slots_filled && isset($slots_filled[$slot->id])) {
             $filled =& $slots_filled[$slot->id];
             if ($filled >= $slot->openings) {
                 continue;
             } else {
                 $openings_left = $slot->openings - $filled;
             }
         } else {
             $openings_left =& $slot->openings;
         }
         $options[$slot->id] = sprintf(dngettext('signup', '%s (%s opening)', '%s (%s openings)', $openings_left), $slot->title, $openings_left);
     }
     if (!isset($options)) {
         $this->signup->content = dgettext('signup', 'Sorry, but all available slots are full. Please check back later for possible cancellations.');
         return;
     } else {
         $form = new PHPWS_Form('slots');
         $form->useFieldset();
         $form->setLegend(dgettext('signup', 'Signup form'));
         $form->addHidden('module', 'signup');
         $form->addHidden('uop', 'slot_signup');
         $form->addHidden('sheet_id', $this->signup->sheet->id);
         $form->addSelect('slot_id', $options);
         $form->setLabel('slot_id', dgettext('signup', 'Available slots'));
         $form->setMatch('slot_id', $peep->slot_id);
         $form->addText('first_name', $peep->first_name);
         $form->setLabel('first_name', dgettext('signup', 'First name'));
         $form->addText('last_name', $peep->last_name);
         $form->setLabel('last_name', dgettext('signup', 'Last name'));
         $form->addText('email', $peep->email);
         $form->setSize('email', 30);
         $form->setLabel('email', dgettext('signup', 'Email address'));
         $form->addText('phone', $peep->getPhone());
         $form->setSize('phone', 15);
         $form->setLabel('phone', dgettext('signup', 'Phone number'));
         if (!empty($this->signup->sheet->extra1)) {
             $form->addText('extra1', $peep->extra1);
             $form->setLabel('extra1', $this->signup->sheet->extra1);
         }
         if (!empty($this->signup->sheet->extra2)) {
             $form->addText('extra2', $peep->extra2);
             $form->setLabel('extra2', $this->signup->sheet->extra2);
         }
         if (!empty($this->signup->sheet->extra3)) {
             $form->addText('extra3', $peep->extra3);
             $form->setLabel('extra3', $this->signup->sheet->extra3);
         }
         $form->addSubmit(dgettext('signup', 'Submit'));
         $tpl = $form->getTemplate();
     }
     $tpl['DESCRIPTION'] = $sheet->getDescription();
     $this->signup->content = PHPWS_Template::process($tpl, 'signup', 'signup_form.tpl');
     $this->signup->sheet->flag();
 }
コード例 #29
0
ファイル: Setup.php プロジェクト: HaldunA/phpwebsite
 public function databaseConfig()
 {
     $form = new PHPWS_Form();
     $form->addHidden('step', '2');
     $databases = array('mysqli' => 'MySQL', 'pgsql' => 'PostgreSQL');
     $formTpl['DBTYPE_DEF'] = dgettext('core', 'phpWebSite supports MySQL and PostgreSQL. Choose the type your server currently is running.');
     $formTpl['DBUSER_DEF'] = dgettext('core', 'This is the user name that phpWebSite will use to access its database.') . ' <br /><i>' . dgettext('core', 'Note: it is a good idea to give each phpWebSite installation its own user.') . '</i>';
     if (isset($this->messages['dbuser'])) {
         $formTpl['DBUSER_ERR'] = $this->messages['dbuser'];
     }
     $formTpl['DBPASS_DEF'] = dgettext('core', 'Enter the database\'s user password here.');
     if (isset($this->messages['dbpass'])) {
         $formTpl['DBPASS_ERR'] = $this->messages['dbpass'];
     }
     $formTpl['DBPREF_DEF'] = dgettext('core', 'If you are installing phpWebSite in a shared environment, you may assign a prefix to tables.<br />We recommend you run without one.');
     if (isset($this->messages['dbpref'])) {
         $formTpl['DBPREF_ERR'] = $this->messages['dbpref'];
     }
     $formTpl['DBHOST_DEF'] = dgettext('core', 'If your database is on the same server as your phpWebSite installation, leave this as &#x22;localhost&#x22;.') . '<br />' . dgettext('core', 'Otherwise, enter the ip or dns to the database server.');
     $formTpl['DBPORT_DEF'] = dgettext('core', 'If your host specification requires access via a specific port, enter it here.');
     $formTpl['DBNAME_DEF'] = dgettext('core', 'The database\'s name into which you are installing phpWebSite.') . '<br /><i>' . dgettext('core', 'Note: if you have not made this database yet, you should do so before continuing.') . '</i>';
     if (isset($this->messages['dbname'])) {
         $formTpl['DBNAME_ERR'] = $this->messages['dbname'];
     }
     $formTpl['TITLE'] = dgettext('core', 'Database configuration');
     $form->addSelect('dbtype', $databases);
     $form->setMatch('dbtype', $this->getConfigSet('dbtype'));
     $form->setLabel('dbtype', dgettext('core', 'Database Type'));
     $form->addText('dbuser', $this->getConfigSet('dbuser'));
     $form->setSize('dbuser', 20);
     $form->setLabel('dbuser', dgettext('core', 'Database User'));
     $form->addPassword('dbpass', $this->getConfigSet('dbpass'));
     $form->allowValue('dbpass');
     $form->setSize('dbpass', 20);
     $form->setLabel('dbpass', dgettext('core', 'Database Password'));
     $form->addText('dbprefix', $this->getConfigSet('dbprefix'));
     $form->setSize('dbprefix', 5, 5);
     $form->setLabel('dbprefix', dgettext('core', 'Table prefix'));
     $form->addText('dbhost', $this->getConfigSet('dbhost'));
     $form->setSize('dbhost', 20);
     $form->setLabel('dbhost', dgettext('core', 'Host Specification'));
     $form->addText('dbport', $this->getConfigSet('dbport'));
     $form->setSize('dbport', 6);
     $form->setLabel('dbport', dgettext('core', 'Host Specification Port'));
     $form->addText('dbname', $this->getConfigSet('dbname'));
     $form->setSize('dbname', 20);
     $form->setLabel('dbname', dgettext('core', 'Database Name'));
     $form->mergeTemplate($formTpl);
     $form->addSubmit('default_submit', dgettext('core', 'Continue'));
     $this->content = $this->createForm($form, 'databaseConfig.tpl');
     $this->title = dgettext('core', 'Configure phpWebSite');
     $this->display();
 }
コード例 #30
0
ファイル: Checkin_Admin.php プロジェクト: HaldunA/phpwebsite
 private function summaryReport()
 {
     javascript('datepicker');
     $form = new PHPWS_Form('report-date');
     $form->setMethod('get');
     $form->addHidden('module', 'checkin');
     $form->addHidden('aop', 'report');
     $form->addHidden('summary_report', 1);
     $form->addText('start_date', $_GET['start_date']);
     $form->setLabel('start_date', 'Start date');
     $form->setSize('start_date', 10);
     $form->setExtra('start_date', 'class="datepicker"');
     $form->addText('end_date', $_GET['end_date']);
     $form->setLabel('end_date', 'End date');
     $form->setSize('end_date', 10);
     $form->setExtra('end_date', 'class="datepicker"');
     if (!empty($_GET['visitor_name'])) {
         $name = trim(strip_tags($_GET['visitor_name']));
     } else {
         $name = null;
     }
     $form->addText('visitor_name', $name);
     $form->setLabel('visitor_name', 'Visitor name');
     $form->addSubmit(dgettext('checkin', 'Summary report'));
     $db = new PHPWS_DB('checkin_staff');
     $db->addColumn('checkin_staff.id');
     $db->addColumn('users.display_name');
     $db->addWhere('checkin_staff.user_id', 'users.id');
     $db->setIndexBy('id');
     $db->addOrder('users.display_name desc');
     $assigned = $db->select('col');
     $assigned[0] = dgettext('checkin', 'Show all');
     $assigned = array_reverse($assigned, true);
     $form->addSelect('assigned', $assigned);
     $form->setLabel('assigned', 'By staff');
     if (isset($_GET['assigned'])) {
         $staff_id = (int) $_GET['assigned'];
         $form->setMatch('assigned', $staff_id);
     } else {
         $staff_id = 0;
     }
     $tpl = $form->getTemplate();
     $start_date = strtotime($_GET['start_date']);
     $end_date = strtotime($_GET['end_date']);
     if (empty($start_date) || empty($end_date) || $start_date > $end_date) {
         $tpl['EMPTY'] = 'Please enter your date range again.';
     } else {
         $this->title = 'Visitors from ' . $_GET['start_date'] . ' to ' . $_GET['end_date'];
         $db = new PHPWS_DB('checkin_visitor');
         $db->addWhere('arrival_time', $start_date, '>=');
         $db->addWhere('arrival_time', $end_date, '<=');
         $db->addColumn('id');
         $db->addColumn('arrival_time');
         $db->addColumn('firstname');
         $db->addColumn('lastname');
         $db->addColumn('start_meeting');
         $db->addColumn('end_meeting');
         if ($staff_id) {
             $db->addWhere('assigned', $staff_id);
         }
         if (!empty($name)) {
             $name = strtolower($name);
             if (strlen($name) == 1) {
                 $db->addWhere('firstname', "{$name}%", 'like', 'and', 'name');
                 $db->addWhere('lastname', "{$name}%", 'like', 'or', 'name');
             } else {
                 $db->addWhere('firstname', "%{$name}%", 'like', 'and', 'name');
                 $db->addWhere('lastname', "%{$name}%", 'like', 'or', 'name');
             }
         }
         $result = $db->select();
         $total_visits = 0;
         $total_wait = 0;
         $total_meeting = 0;
         $total_days = 0;
         $incomplete_visits = 0;
         $current_day = null;
         foreach ($result as $visit) {
             extract($visit);
             $arrival_day = date('MdY', $arrival_time);
             if ($current_day != $arrival_day) {
                 $current_day = $arrival_day;
                 $total_days++;
             }
             $row = array();
             if (!$start_meeting || !$end_meeting) {
                 $incomplete_visits++;
                 continue;
             }
             $total_visits++;
             $twaited = $start_meeting - $arrival_time;
             $waited = Checkin::timeWaiting($twaited);
             if ($end_meeting) {
                 $tmeeting = $end_meeting - $start_meeting;
             }
             $meeting = Checkin::timeWaiting($tmeeting);
             $row['VISIT'] = $total_visits;
             $row['VISITOR'] = "{$firstname} {$lastname}";
             $row['DATE'] = date('g:ia m.d.Y', $arrival_time);
             $row['WAITED'] = $waited;
             $row['MEETING'] = $meeting;
             $tpl['rows'][] = $row;
             $total_wait += $twaited;
             $total_meeting += $tmeeting;
         }
         if ($total_visits) {
             $tpl['TOTAL_DAYS'] = $total_days;
             $tpl['TOTAL_VISITS'] = $total_visits;
             $tpl['AVG_VISITS'] = round($total_visits / $total_days, 1);
             $tpl['TOTAL_WAIT'] = Checkin::timeWaiting($total_wait);
             $tpl['TOTAL_MEETING'] = Checkin::timeWaiting($total_meeting);
             $tpl['AVG_WAIT'] = Checkin::timeWaiting(round($total_wait / $total_visits));
             $tpl['AVG_MEETING'] = Checkin::timeWaiting(round($total_meeting / $total_visits));
             $tpl['INCOMPLETE_MEETINGS'] = $incomplete_visits;
         } else {
             $tpl['EMPTY'] = 'No visits made in this date range.';
         }
     }
     $this->content = PHPWS_Template::process($tpl, 'checkin', 'summary_report.tpl');
 }