Ejemplo n.º 1
0
 public function emailApplicants()
 {
     $email =& $this->signup->email;
     $form = new PHPWS_Form('email');
     $form->addHidden('module', 'signup');
     $form->addHidden('aop', 'post_email');
     $form->addHidden('sheet_id', $this->signup->sheet->id);
     if (!empty($_REQUEST['search'])) {
         $form->addHidden('search', $_REQUEST['search']);
     }
     $form->addText('subject', $email['subject']);
     $form->setLabel('subject', dgettext('signup', 'Subject'));
     $form->setSize('subject', 30);
     $form->addText('from', $email['from']);
     $form->setLabel('from', dgettext('signup', 'From'));
     $form->setSize('from', 30);
     $form->addTextArea('message', $email['message']);
     $form->setLabel('message', dgettext('signup', 'Message'));
     $form->setCols('message', 50);
     $form->addSubmit(dgettext('signup', 'Send emails'));
     $tpl = $form->getTemplate();
     if (!empty($_REQUEST['search'])) {
         $tpl['WARNING_LABEL'] = dgettext('signup', 'Note:');
         $tpl['WARNING'] = dgettext('signup', 'This email will only go out to the people specified by the prior search');
     }
     $this->signup->title = sprintf(dgettext('signup', 'Email %s applicants'), $this->signup->sheet->title);
     $this->signup->content = PHPWS_Template::process($tpl, 'signup', 'email_form.tpl');
 }
Ejemplo n.º 2
0
 /**
  * @param boolean limited   If true, use anonymous submission form
  */
 public static function edit(Blog $blog, $version_id = NULL, $limited = false)
 {
     javascriptMod('blog', 'image_url');
     if ($limited) {
         throw new \Exception('');
     }
     $form = new PHPWS_Form('edit-blog');
     $form->addHidden('module', 'blog');
     $form->addHidden('action', 'admin');
     $form->addHidden('command', 'post_entry');
     if ($blog->id) {
         $form->addHidden('blog_id', $blog->id);
         $form->addSubmit('submit', dgettext('blog', 'Update entry'));
     } else {
         $form->addSubmit('submit', dgettext('blog', 'Add entry'));
     }
     $link_choices['none'] = dgettext('blog', 'No link and ignore image link setting');
     $link_choices['default'] = dgettext('blog', 'No link but allow image link setting');
     $link_choices['readmore'] = dgettext('blog', 'Link to read more');
     $link_choices['parent'] = dgettext('blog', 'Link resized image to parent');
     $link_choices['url'] = dgettext('blog', 'Link the url below');
     $form->addText('title', $blog->title);
     $form->setSize('title', 40);
     $form->setLabel('title', dgettext('blog', 'Title'));
     $form->setRequired('title');
     $form->addTextArea('summary', $blog->getSummaryAndEntry(false));
     if (!$limited) {
         $form->useEditor('summary');
     }
     $form->setRows('summary', '10');
     $form->setCols('summary', '60');
     $form->setLabel('summary', dgettext('blog', 'Content'));
     javascript('datetimepicker', null, false, true, true);
     $form->addText('publish_date', $blog->getPublishDate('%Y/%m/%d %H:%M'));
     $form->setLabel('publish_date', dgettext('blog', 'Publish date/time'));
     $form->setSize('publish_date', 20);
     $form->setClass('publish_date', 'datetimepicker');
     $form->addText('expire_date', $blog->getExpireDate());
     $form->setLabel('expire_date', dgettext('blog', 'Expire date/time'));
     $form->setSize('expire_date', 20);
     $form->setClass('expire_date', 'datetimepicker');
     $template = $form->getTemplate();
     $jscal['date_name'] = 'expire_date';
     $template['EXAMPLE'] = 'YYYY/MM/DD HH:MM';
     if ($blog->_error) {
         $template['MESSAGE'] = implode('<br />', $blog->_error);
     }
     $template['REMINDER'] = dgettext('blog', 'Add a horizontal rule to separate content into summary and body');
     return PHPWS_Template::process($template, 'blog', 'edit.tpl');
 }
Ejemplo n.º 3
0
 function editSettings()
 {
     $form = new PHPWS_Form('whatsnew_settings');
     $form->addHidden('module', 'whatsnew');
     $form->addHidden('aop', 'post_settings');
     $form->addCheckbox('enable', 1);
     $form->setMatch('enable', PHPWS_Settings::get('whatsnew', 'enable'));
     $form->setLabel('enable', dgettext('whatsnew', 'Enable whatsnew'));
     $form->addCheckbox('homeonly', 1);
     $form->setMatch('homeonly', PHPWS_Settings::get('whatsnew', 'homeonly'));
     $form->setLabel('homeonly', dgettext('whatsnew', 'Show whatsnew sidebox on home page only'));
     $form->addTextField('title', PHPWS_Settings::get('whatsnew', 'title'));
     $form->setLabel('title', dgettext('whatsnew', 'Sidebox title'));
     $form->setSize('title', 30);
     $form->addTextArea('text', PHPWS_Settings::get('whatsnew', 'text'));
     $form->setRows('text', '4');
     $form->setCols('text', '40');
     $form->setLabel('text', dgettext('whatsnew', 'Sidebox text'));
     $form->addTextField('cache_timeout', PHPWS_Settings::get('whatsnew', 'cache_timeout'));
     $form->setLabel('cache_timeout', dgettext('whatsnew', 'Cache duration for whatsnew list (in seconds, 0-7200)'));
     $form->setSize('cache_timeout', 4, 4);
     $form->addTextField('qty_items', PHPWS_Settings::get('whatsnew', 'qty_items'));
     $form->setLabel('qty_items', dgettext('whatsnew', 'Number of recent items to display (0-50)'));
     $form->setSize('qty_items', 4, 4);
     $form->addCheckbox('show_summaries', 1);
     $form->setMatch('show_summaries', PHPWS_Settings::get('whatsnew', 'show_summaries'));
     $form->setLabel('show_summaries', dgettext('whatsnew', 'Show item summaries'));
     $form->addCheckbox('show_dates', 1);
     $form->setMatch('show_dates', PHPWS_Settings::get('whatsnew', 'show_dates'));
     $form->setLabel('show_dates', dgettext('whatsnew', 'Show item update dates'));
     $form->addCheckbox('show_source_modules', 1);
     $form->setMatch('show_source_modules', PHPWS_Settings::get('whatsnew', 'show_source_modules'));
     $form->setLabel('show_source_modules', dgettext('whatsnew', 'Show item source module names'));
     $form->addSubmit('save', dgettext('whatsnew', 'Save settings'));
     $tpl = $form->getTemplate();
     $tpl['SETTINGS_LABEL'] = dgettext('whatsnew', 'General Settings');
     $tpl['FLUSH_LINK'] = PHPWS_Text::secureLink(dgettext('whatsnew', 'Flush cache'), 'whatsnew', array('aop' => 'flush_cache'));
     $tpl['EXCLUDE'] = $this->whatsnew->getKeyMods(unserialize(PHPWS_Settings::get('whatsnew', 'exclude')), 'exclude');
     $tpl['EXCLUDE_LABEL'] = dgettext('whatsnew', 'Select any modules you wish to exclude from your whatsnew box.');
     $this->whatsnew->title = dgettext('whatsnew', 'Settings');
     $this->whatsnew->content = PHPWS_Template::process($tpl, 'whatsnew', 'edit_settings.tpl');
 }
Ejemplo n.º 4
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');
 }
Ejemplo n.º 5
0
 /**
  * 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;
 }
Ejemplo n.º 6
0
 /**
  * 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');
 }
Ejemplo n.º 7
0
 /**
  * Edit a new or existing PHAT_Dropbox element
  *
  * The edit function provides the HTML form to edit a new or existing
  * PHAT_Dropbox element.
  * g
  * return string The HTML form to edit a PHAT_Dropbox
  */
 function edit()
 {
     $numOptions = sizeof($this->getOptionText());
     if (!$numOptions || $this->getOptionSet()) {
         $numOptions = '';
     }
     $form = new PHPWS_Form();
     $form->addHidden('module', 'phatform');
     $form->addHidden('PHAT_EL_OP', 'SaveElement');
     if (!$this->getLabel()) {
         $num = $_SESSION['PHAT_FormManager']->form->numElements();
         $this->setLabel('Element' . ($num + 1));
     }
     $form->addTextArea('PHAT_ElementBlurb', $this->getBlurb());
     $form->setRows('PHAT_ElementBlurb', PHAT_DEFAULT_ROWS);
     $form->setCols('PHAT_ElementBlurb', PHAT_DEFAULT_COLS);
     $form->setLabel('PHAT_ElementBlurb', dgettext('phatform', 'Associated Text'));
     $form->addText('PHAT_ElementName', $this->getLabel());
     $form->setSize('PHAT_ElementName', PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
     $form->setLabel('PHAT_ElementName', dgettext('phatform', 'Name'));
     $form->addText('PHAT_ElementNumOptions', $numOptions);
     $form->setSize('PHAT_ElementNumOptions', 5, 3);
     $form->setLabel('PHAT_ElementNumOptions', dgettext('phatform', 'Number of Options'));
     $options = $this->getOptionSets();
     if (is_array($options)) {
         $editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set');
         $form->addSelect('PHAT_OptionSet', $options);
         $form->setMatch('PHAT_OptionSet', $this->getOptionSet());
     }
     $form->addCheck('PHAT_ElementRequired', 1);
     $form->setMatch('PHAT_ElementRequired', $this->isRequired());
     $form->setLabel('PHAT_ElementRequired', dgettext('phatform', 'Required'));
     $form->addSubmit('PHAT_ElementBack', dgettext('phatform', 'Back'));
     $form->addSubmit('NEXT_BUTTON', dgettext('phatform', 'Next'));
     $template = $form->getTemplate();
     return PHPWS_Template::processTemplate($template, 'phatform', 'dropbox/edit.tpl');
 }