Beispiel #1
0
 /**
  * Edit this PHAT_Radiobutton
  *
  * This function provides the HTML form to edit or create a new PHAT_Radiobutton
  *
  * @return string The HTML form for editing
  * @access public
  */
 function edit()
 {
     $numOptions = sizeof($this->getOptionText());
     if (!$numOptions) {
         $numOptions = '';
     }
     $elements[0] = PHPWS_Form::formHidden('module', 'phatform') . PHPWS_Form::formHidden('PHAT_EL_OP', 'SaveElement');
     if (!$this->getLabel()) {
         $num = $_SESSION['PHAT_FormManager']->form->numElements();
         $this->setLabel('Element' . ($num + 1));
     }
     if (PHAT_SHOW_INSTRUCTIONS) {
         $GLOBALS['CNT_phatform']['title'] = dgettext('phatform', 'Radiobutton Element Instructions');
     }
     $editTags['BLURB_LABEL'] = dgettext('phatform', 'Associated Text');
     $editTags['BLURB_INPUT'] = PHPWS_Form::formTextArea('PHAT_ElementBlurb', $this->getBlurb(), PHAT_DEFAULT_ROWS, PHAT_DEFAULT_COLS);
     $editTags['NAME_LABEL'] = dgettext('phatform', 'Name');
     $editTags['NAME_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementName', $this->getLabel(), PHAT_DEFAULT_SIZE, PHAT_DEFAULT_MAXSIZE);
     $editTags['OPTIONS_LABEL'] = dgettext('phatform', 'Number of Options');
     $editTags['OPTIONS_INPUT'] = PHPWS_Form::formTextField('PHAT_ElementNumOptions', $numOptions, 5, 3);
     $options = $this->getOptionSets();
     if (is_array($options)) {
         $editTags['OPTION_SET_LABEL'] = dgettext('phatform', 'Predefined Option Set');
         $editTags['OPTION_SET_INPUT'] = PHPWS_Form::formSelect('PHAT_OptionSet', $options, $this->getOptionSet(), FALSE, TRUE);
     }
     $editTags['REQUIRE_LABEL'] = dgettext('phatform', 'Required');
     $editTags['REQUIRE_INPUT'] = PHPWS_Form::formCheckBox('PHAT_ElementRequired', 1, $this->isRequired());
     $editTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_ElementBack');
     $editTags['NEXT_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Next'));
     $elements[0] .= PHPWS_Template::processTemplate($editTags, 'phatform', 'radiobutton/edit.tpl');
     return PHPWS_Form::makeForm('PHAT_RadiobuttonEdit', 'index.php', $elements, 'post', NULL, NULL);
 }
Beispiel #2
0
 /**
  * Returns the html for a simple dropbox with element actions and a Go! button.
  *
  * @param  integer $key    The index of the element in this form's elements array.
  * @return string  $editor The html needed to display the editor within a form.
  * @access private
  * @see    view()
  */
 function _elementEditor($key)
 {
     $actions['edit'] = dgettext('phatform', 'Edit');
     $actions['remove'] = dgettext('phatform', 'Remove');
     $actions['moveUp'] = dgettext('phatform', 'Move Up');
     $actions['moveDown'] = dgettext('phatform', 'Move Down');
     $editor = PHPWS_Form::formSelect("PHAT_Action_{$key}", $actions);
     $editor .= PHPWS_Form::formSubmit(dgettext('phatform', 'Go'), "go_{$key}");
     return $editor;
 }
Beispiel #3
0
 /**
  *
  *
  *
  *
  */
 function listEntries()
 {
     if (isset($_REQUEST['PHAT_EntrySearch'])) {
         $this->_searchQuery = PHPWS_Text::parseInput($_REQUEST['PHAT_EntrySearch']);
         $this->_listFilter = $_REQUEST['PHAT_ListFilter'];
         $this->setEntries();
         $this->pageStart = 0;
         $this->pageSection = 1;
         $this->pageLimit = $_REQUEST['PDA_limit'];
     } elseif (isset($_REQUEST['PHAT_FullList'])) {
         $this->_searchQuery = NULL;
         $this->_listFilter = 1;
         $this->setEntries();
         $this->pageStart = 0;
         $this->pageSection = 1;
     } else {
         if (isset($_REQUEST['PDA_start'])) {
             $this->pageStart = $_REQUEST['PDA_start'];
         } else {
             $_REQUEST['PDA_start'] = $this->pageStart;
         }
         if (isset($_REQUEST['PDA_section'])) {
             $this->pageSection = $_REQUEST['PDA_section'];
         } else {
             $_REQUEST['PDA_section'] = $this->pageSection;
         }
         if (isset($_REQUEST['PDA_limit'])) {
             $this->pageLimit = $_REQUEST['PDA_limit'];
         } else {
             $_REQUEST['PDA_limit'] = $this->pageLimit;
         }
     }
     $listTags = array();
     $listTags['ID_LABEL'] = dgettext('phatform', 'ID');
     $listTags['USER_LABEL'] = dgettext('phatform', 'User');
     $listTags['UPDATED_LABEL'] = dgettext('phatform', 'Updated');
     $listTags['ACTION_LABEL'] = dgettext('phatform', 'Action');
     $highlight = ' class="bgcolor1"';
     if (sizeof($this->_entries) > 0) {
         $data = PHAT_Report::paginateDataArray($this->_entries, 'index.php?module=phatform&amp;PHAT_REPORT_OP=list', $this->pageLimit, TRUE, array('<b>[ ', ' ]</b>'), NULL, 10, TRUE);
     }
     $count = 1;
     if (isset($data) && is_array($data[0]) && sizeof($data[0]) > 0) {
         $listTags['LIST_ITEMS'] = NULL;
         foreach ($data[0] as $entry) {
             $highlight = null;
             $rowTags = array();
             $rowTags['HIGHLIGHT'] = $highlight;
             $rowTags['ID'] = $entry['id'];
             $rowTags['USER'] = $entry['user'];
             $rowTags['UPDATED'] = date(PHPWS_DATE_FORMAT . ' ' . PHPWS_TIME_FORMAT, $entry['updated']);
             $rowTags['VIEW'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $entry['id'] . '">' . dgettext('phatform', 'View') . '</a>';
             if (!isset($this->archive)) {
                 $rowTags['EDIT'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=edit&amp;PHAT_ENTRY_ID=' . $entry['id'] . '">' . dgettext('phatform', 'Edit') . '</a>';
                 $rowTags['DELETE'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=confirmDelete&amp;PHAT_ENTRY_ID=' . $entry['id'] . '">' . dgettext('phatform', 'Delete') . '</a>';
             }
             if ($count % 2) {
                 $highlight = ' class="bgcolor1"';
             }
             $count++;
             $listTags['LIST_ITEMS'] .= PHPWS_Template::processTemplate($rowTags, 'phatform', 'report/row.tpl');
         }
         if (!isset($_REQUEST['lay_quiet'])) {
             if ($this->_totalEntries > $this->pageLimit) {
                 $listTags['NAVIGATION_LINKS'] = $data[1];
             }
             $listTags['SECTION_INFO'] = $data[2];
             $listTags['SECTION_INFO_LABEL'] = dgettext('phatform', 'Entries');
         }
     } else {
         $listTags['LIST_ITEMS'] = '<tr><td colspan="4" class="smalltext">' . dgettext('phatform', 'No entries were found matching your search query.') . '</td></tr>';
     }
     if (!isset($_REQUEST['lay_quiet'])) {
         $filterOptions = array(1 => dgettext('phatform', 'All'), 2 => dgettext('phatform', 'Incomplete'), 3 => dgettext('phatform', 'Complete'));
         $limitOptions = array(10 => 10, 20 => 20, 30 => 30, 40 => 40, 50 => 50);
         $elements[0] = PHPWS_Form::formHidden('module', 'phatform');
         $elements[0] .= PHPWS_Form::formHidden('PHAT_REPORT_OP', 'list');
         $elements[0] .= PHPWS_Form::formSelect('PHAT_ListFilter', $filterOptions, $this->_listFilter, FALSE, TRUE);
         $elements[0] .= PHPWS_Form::formSelect('PDA_limit', $limitOptions, $this->pageLimit, TRUE);
         if (!$_SESSION['PHAT_FormManager']->form->isAnonymous()) {
             $elements[0] .= PHPWS_Form::formTextField('PHAT_EntrySearch', $this->_searchQuery, 20, 255);
         }
         $elements[0] .= PHPWS_Form::formSubmit(dgettext('phatform', 'Search'));
         $listTags['SEARCH_FORM'] = PHPWS_Form::makeForm('PHAT_SearchEntries', 'index.php', $elements);
     }
     $GLOBALS['CNT_phatform']['title'] = $_SESSION['PHAT_FormManager']->form->getLabel();
     return PHPWS_Template::processTemplate($listTags, 'phatform', 'report/list.tpl');
 }