Ejemplo n.º 1
0
 /**
  * View this PHAT_Checkbox
  *
  * @return string The HTML content to view the PHAT_Checkbox
  * @access public
  */
 function view()
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label]) && is_array($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '*';
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true);
     $viewTags['CHECK_BOXES'] = '';
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     $value = $this->getValue();
     $viewTags['CHECK_BOXES'] = null;
     for ($i = 0; $i < sizeof($optionText); $i++) {
         if (isset($value[$i])) {
             $match = $value[$i];
         } else {
             $match = null;
         }
         $option_value = $optionValues[$i];
         $element = new Form_CheckBox('PHAT_' . $label . '[' . $i . ']', $option_value);
         $element->setMatch($match);
         $id = preg_replace('/\\W/', '', $option_value) . $i;
         $element->setId($id);
         $label_text = "<label for='{$id}'>" . $optionText[$i] . "</label>";
         $viewTags['CHECK_BOXES'] .= $element->get() . " {$label_text}<br />\n";
     }
     return PHPWS_Template::processTemplate($viewTags, 'phatform', 'checkbox/view.tpl');
 }
Ejemplo n.º 2
0
 public function getContent($format = TRUE)
 {
     if ($format) {
         return PHPWS_Text::parseTag(PHPWS_Text::parseOutput($this->content), null, 'block');
     } else {
         return $this->content;
     }
 }
Ejemplo n.º 3
0
 public function getContent($view_mode = true, $fix_anchor = true)
 {
     if (empty($this->content)) {
         return null;
     }
     if ($view_mode) {
         return PHPWS_Text::parseTag(PHPWS_Text::parseOutput($this->content, ENCODE_PARSED_TEXT, false, false, $fix_anchor));
     } else {
         return PHPWS_Text::decodeText($this->content);
     }
 }
Ejemplo n.º 4
0
 /**
  * View this PHAT_Textarea
  *
  * @return string The HTML to needed view this PHAT_Textarea
  * @access public
  */
 function view()
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '&#42;';
     }
     $viewTags['ID'] = 'textarea' . $this->_id;
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true);
     $viewTags['NAME'] = 'PHAT_' . $this->getLabel();
     $viewTags['ROWS'] = $this->_rows;
     $viewTags['COLS'] = $this->_cols;
     $viewTags['VALUE'] = $this->getValue();
     return PHPWS_Template::processTemplate($viewTags, 'phatform', 'textarea/view.tpl');
 }
Ejemplo n.º 5
0
 /**
  * View this PHAT_Dropobox
  *
  * The view function provides the HTML for a user to view the PHAT_Dropbox.
  *
  * @param  mixed  $value whatever needed to match in the dropbox
  * @return string The HTML to be shown
  */
 function view($value = NULL)
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '&#42;';
     }
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     for ($i = 0; $i < sizeof($optionText); $i++) {
         $options[$optionValues[$i]] = $optionText[$i];
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true);
     $element = new Form_Select('PHAT_' . $label, $options);
     $element->setMatch($this->getValue());
     $element->setId($element->name);
     $viewTags['ID'] = $element->getId();
     $viewTags['DROPBOX'] = $element->get();
     return PHPWS_Template::process($viewTags, 'phatform', 'dropbox/view.tpl');
 }
Ejemplo n.º 6
0
 /**
  * View this PHAT_Radiobutton
  *
  * The view function provides the HTML for a user to view the PHAT_Radiobutton.
  *
  * @return string The HTML to be shown
  * @access public
  */
 function view($value = NULL)
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '&#42;';
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true);
     $viewTags['RADIO_BUTTONS'] = '';
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     for ($i = 0; $i < sizeof($optionText); $i++) {
         $option_value = $optionValues[$i];
         $element = new Form_RadioButton('PHAT_' . $label, $option_value);
         $element->setMatch($this->getValue());
         $id = preg_replace('/\\W/', '', $option_value) . $i;
         $viewTags['RADIO_BUTTONS'] .= '<div class="radio"><label>' . $element->get() . ' ' . $optionText[$i] . "</label></div>\n";
     }
     return PHPWS_Template::processTemplate($viewTags, 'phatform', 'radiobutton/view.tpl');
 }
Ejemplo n.º 7
0
 /**
  * View this PHAT_Multiselect
  *
  * @return string The HTML content to view the PHAT_Multiselect
  * @access public
  */
 function view()
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label]) && is_array($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '&#42;';
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->_blurb, ENCODE_PARSED_TEXT, false, true);
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     for ($i = 0; $i < sizeof($optionText); $i++) {
         $options[$optionValues[$i]] = $optionText[$i];
     }
     $multiselect = new Form_Multiple('PHAT_' . $label, $options);
     $multiselect->setMatch($this->getValue());
     $multiselect->setId($multiselect->name);
     $viewTags['ID'] = $multiselect->getId();
     $viewTags['MULTISELECT'] = $multiselect->get();
     return PHPWS_Template::processTemplate($viewTags, 'phatform', 'multiselect/view.tpl');
 }
 function testEditors($text)
 {
     if ($_SESSION["OBJ_user"]->allow_access("xwysiwyg", "settings")) {
         $this->content .= "<a href=\"" . $this->linkRef . "&amp;action=admin" . "\">" . $_SESSION['translate']->it("Back to administration") . "</a>";
         $tags = array();
         $tags["TESTAREA"] = PHPWS_WizardBag::js_insert("wysiwyg", "xw_test_form", "xw_testarea") . PHPWS_Form::formTextArea("xw_testarea", $text, 10, 70);
         $tags["SUBMIT_BUTTON"] = PHPWS_Form::formSubmit($_SESSION["translate"]->it("Save"));
         $elements[0] = PHPWS_Form::formHidden("module", "xwysiwyg");
         $elements[0] .= PHPWS_Form::formHidden("action", "testEditor");
         $elements[0] .= PHPWS_Template::processTemplate($tags, "xwysiwyg", "test_editor.tpl");
         $this->content .= PHPWS_Form::makeForm("xw_test_form", "index.php", $elements, "post", FALSE, TRUE);
         $this->content .= "<hr /><br />" . PHPWS_Text::parseOutput($text);
     } else {
         $this->content .= $_SESSION['translate']->it("Access was denied due to lack of proper permissions.");
     }
     // End of ADMINISTRATOR condition
 }
Ejemplo n.º 9
0
 public function getDescription()
 {
     return PHPWS_Text::parseOutput($this->description);
 }
Ejemplo n.º 10
0
 /**
  *
  *
  *
  *
  */
 function view($showLinks = TRUE)
 {
     /* Find the key into the entries array for the selected entry */
     foreach ($this->_entries as $entryKey => $entryValue) {
         if ($entryValue['id'] == $_REQUEST['PHAT_ENTRY_ID']) {
             break;
         }
     }
     /* Get the data for the selected entry from the database */
     $sql = 'SELECT * FROM ' . $this->getFormTable() . " WHERE id='" . $_REQUEST['PHAT_ENTRY_ID'] . "'";
     $entry = PHPWS_DB::getRow($sql);
     $rowClass = NULL;
     $entryTags = array();
     $entryTags['ENTRY_DATA'] = NULL;
     /* Step through the entries values and feed them through the entryRow template */
     $toggle = 1;
     foreach ($entry as $key => $value) {
         $rowTags = array();
         if ($key == 'position') {
             continue;
         } elseif ($key == 'updated') {
             $value = date(PHPWS_DATE_FORMAT . ' ' . PHPWS_TIME_FORMAT, $value);
         }
         $attribute = ' class="bgcolor1" ';
         /* Toggle the row colors for better visability */
         if ($toggle % 2) {
             $rowClass = $attribute;
         } else {
             $rowClass = null;
         }
         $toggle++;
         if (isset($rowClass)) {
             $rowTags['ROW_CLASS'] = $rowClass;
         }
         $rowTags['ENTRY_LABEL'] = $key;
         if (preg_match('/a:\\d+:{/', $value)) {
             $rowTags['ENTRY_VALUE'] = implode(', ', unserialize($value));
         } else {
             $rowTags['ENTRY_VALUE'] = PHPWS_Text::parseOutput($value, ENCODE_PARSED_TEXT, false, true);
         }
         $entryTags['ENTRY_DATA'] .= PHPWS_Template::processTemplate($rowTags, 'phatform', 'report/entryRow.tpl');
     }
     if (isset($this->archive)) {
         $entryTags['BACK_LINK'] = $_SESSION['PHAT_advViews']->getArchiveViewLink();
     }
     if ($showLinks && !isset($_REQUEST['lay_quiet'])) {
         $entryTags['PRINT'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $_REQUEST['PHAT_ENTRY_ID'] . '&amp;lay_quiet=1" target="_blank">' . dgettext('phatform', 'Print View') . '</a>';
         /* Show the next and/or previous links to step through entries */
         if ($entryKey < sizeof($this->_entries) - 1) {
             $entryTags['NEXT'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $this->_entries[$entryKey + 1]['id'] . '">' . dgettext('phatform', 'Next Entry') . '</a>';
         }
         if ($entryKey > 0) {
             $entryTags['PREVIOUS'] = '<a href="index.php?module=phatform&amp;PHAT_REPORT_OP=view&amp;PHAT_ENTRY_ID=' . $this->_entries[$entryKey - 1]['id'] . '">' . dgettext('phatform', 'Previous Entry') . '</a>';
         }
     }
     $GLOBALS['CNT_phatform']['title'] = $_SESSION['PHAT_FormManager']->form->getLabel();
     /* Return the entire processed entry */
     if (isset($_REQUEST['lay_quiet'])) {
         echo PHPWS_Template::processTemplate($entryTags, 'phatform', 'report/entry.tpl');
     } else {
         return PHPWS_Template::processTemplate($entryTags, 'phatform', 'report/entry.tpl');
     }
 }
Ejemplo n.º 11
0
 public function postHeader()
 {
     PHPWS_Core::initModClass('pagesmith', 'PS_Text.php');
     $header = strip_tags($_POST['header'], PS_ALLOWED_HEADER_TAGS);
     $section = new PS_Text();
     $section->pid = $_POST['pid'];
     $section->secname = $_POST['section_name'];
     $section->content = PHPWS_Text::parseInput($header);
     $section->setSaved();
     $vars['cnt_section_name'] = $_POST['tpl'] . '-' . $_POST['section_name'];
     //$vars['hdn_section_name'] = sprintf('pagesmith_%s', $_POST['section_name']);
     $vars['content'] = addslashes(PHPWS_Text::parseOutput($section->content));
     $vars['hidden_value'] = $section->content;
     Layout::nakedDisplay(javascriptMod('pagesmith', 'update', $vars));
 }
Ejemplo n.º 12
0
 public static function whatsnewBlock()
 {
     if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0) {
         $cache_key = 'whatsnew_cache_key';
         $content = PHPWS_Cache::get($cache_key, PHPWS_Settings::get('whatsnew', 'cache_timeout'));
         if (!empty($content)) {
             return $content;
         }
     }
     $link = null;
     $summary = null;
     $date = null;
     $module_name = null;
     $exclude = unserialize(PHPWS_Settings::get('whatsnew', 'exclude'));
     $db = new PHPWS_DB('phpws_key');
     $db->addJoin('left', 'phpws_key', 'modules', 'module', 'title');
     $db->addWhere('active', 1);
     $db->addWhere('restricted', 0);
     if ($exclude) {
         foreach ($exclude as $module) {
             $db->addWhere('module', $module, '!=');
         }
     }
     $db->addOrder('update_date desc');
     $db->setLimit(PHPWS_Settings::get('whatsnew', 'qty_items'));
     $db->setIndexBy('id');
     $db->addColumn('phpws_key.url');
     $db->addColumn('phpws_key.title');
     $db->addColumn('phpws_key.summary');
     $db->addColumn('phpws_key.update_date');
     $db->addColumn('modules.title', null, 'module_title');
     $db->addColumn('modules.proper_name');
     //        $db->setTestMode();
     $result = $db->select();
     $tpl['TITLE'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'title'));
     $tpl['TEXT'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'text'));
     if (!PHPWS_Error::logIfError($result) && !empty($result)) {
         foreach ($result as $item) {
             $link = '<a href="' . $item['url'] . '">' . $item['title'] . '</a>';
             if (PHPWS_Settings::get('whatsnew', 'show_summaries')) {
                 $summary = PHPWS_Text::parseOutput($item['summary']);
             }
             if (PHPWS_Settings::get('whatsnew', 'show_dates')) {
                 $date = strftime(WHATSNEW_DATE_FORMAT, $item['update_date']);
             }
             if (PHPWS_Settings::get('whatsnew', 'show_source_modules')) {
                 $module_name = dgettext($item['module_title'], PHPWS_Text::parseOutput($item['proper_name']));
             }
             $tpl['new-items'][] = array('LINK' => $link, 'SUMMARY' => $summary, 'DATE' => $date, 'MODULE_NAME' => $module_name);
         }
     } else {
         $tpl['new-items'][] = array('LINK' => dgettext('whatsnew', 'Sorry, no results'));
     }
     $content = PHPWS_Template::process($tpl, 'whatsnew', 'block.tpl');
     if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0 && !Current_User::isLogged() && !Current_User::allow('whatsnew')) {
         PHPWS_Cache::save($cache_key, $content);
     }
     return $content;
 }
Ejemplo n.º 13
0
 function getSummary($parse = TRUE)
 {
     if ($parse) {
         return PHPWS_Text::parseOutput($this->summary);
     }
     return $this->summary;
 }
Ejemplo n.º 14
0
 public function getSummary($print = false)
 {
     if (empty($this->summary)) {
         return null;
     }
     if ($print) {
         return PHPWS_Text::parseOutput($this->summary);
     } else {
         return $this->summary;
     }
 }
Ejemplo n.º 15
0
 public function getExtra3()
 {
     return PHPWS_Text::parseOutput($this->extra3);
 }
Ejemplo n.º 16
0
 function emailBodyHtml($content)
 {
     $entryTags = array();
     $entryTags['ENTRY_DATA'] = array();
     /* Step through the entries values and feed them through the entryRow template */
     $rowClass = NULL;
     $tog = 1;
     foreach ($content as $key => $value) {
         $rowTags = array();
         if ($key == 'position') {
             continue;
         } elseif ($key == 'updated') {
             $value = date(PHPWS_DATE_FORMAT . ' ' . PHPWS_TIME_FORMAT, $value);
         }
         /* Toggle the row colors for better visability */
         if ($tog % 2) {
             $rowClass = PHAT_SECTION_HEX;
         } else {
             $rowClass = null;
         }
         $tog++;
         if (isset($rowClass)) {
             $rowTags['ROW_CLASS'] = " bgcolor=\"{$rowClass}\"";
         }
         $rowTags['ENTRY_LABEL'] = $key;
         if (preg_match('/a:.:{/', $value)) {
             $rowTags['ENTRY_VALUE'] = implode(', ', unserialize(stripslashes($value)));
         } else {
             $rowTags['ENTRY_VALUE'] = PHPWS_Text::parseOutput($value, ENCODE_PARSED_TEXT, false, true);
         }
         $entryTags['ENTRY_DATA'][] = PHPWS_Template::processTemplate($rowTags, 'phatform', 'report/entryRow.tpl');
     }
     $entryTags['ENTRY_DATA'] = implode('', $entryTags['ENTRY_DATA']);
     $message = PHPWS_Template::processTemplate($entryTags, 'phatform', 'report/entry.tpl');
     return $message;
 }
Ejemplo n.º 17
0
 function getComment()
 {
     return PHPWS_Text::parseOutput($this->comment);
 }