Пример #1
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $data = parent::renderTableData($data, $oAllRowsData);
     $params =& $this->getParams();
     if ($params->get('textarea-tagify') == true) {
         $data = $this->tagify($data);
     }
     //$$$rob dont strip slashes here - this is done when saving to db now
     if ($params->get('use_wysiwyg', 0) == 0) {
         if (is_array($data)) {
             for ($i = 0; $i < count($data); $i++) {
                 $data[$i] = nl2br($data[$i]);
             }
         } else {
             $data = nl2br($data);
         }
     }
     if (!$params->get('textarea-tagify') && $data !== '' && (int) $params->get('textarea-truncate', 0) !== 0) {
         $opts = array();
         $opts['wordcount'] = (int) $params->get('textarea-truncate', 0);
         $opts['tip'] = $params->get('textarea-hover');
         $data = fabrikString::truncate($data, $opts);
     }
     return $data;
 }
Пример #2
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $element =& $this->getElement();
     $values = explode(GROUPSPLITTER2, $element->sub_values);
     $labels = explode(GROUPSPLITTER2, $element->sub_labels);
     //check if the data is in csv format, if so then the element is a multi drop down
     if (strstr($data, GROUPSPLITTER2)) {
         $aData = explode(GROUPSPLITTER2, $data);
         $sLabels = '';
         foreach ($aData as $tmpVal) {
             if ($params->get('icon_folder') != -1 && $params->get('icon_folder') != '') {
                 $sLabels .= $this->_replaceWithIcons($tmpVal) . "<br />";
             } else {
                 $key = array_search($tmpVal, $values);
                 $sLabels .= $labels[$key] . "<br />";
             }
         }
         return FabrikString::rtrimword($sLabels, "<br />");
     } else {
         if ($params->get('icon_folder') != -1 && $params->get('icon_folder') != '') {
             return $this->_replaceWithIcons($data) . "<br />";
         } else {
             $key = array_search($data, $values);
             return $labels[$key];
         }
     }
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #3
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $fullName = $this->_getQRElement()->getFullName();
     $data = $oAllRowsData->{$fullName};
     $data = $this->_getQRElement()->getQRValue($data, JArrayHelper::fromObject($oAllRowsData));
     $data = $this->_renderTableData($data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #4
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $data = explode(GROUPSPLITTER, $data);
     for ($i = 0; $i < count($data); $i++) {
         $data[$i] = $this->_renderTableData($data[$i], $oAllRowsData);
     }
     $data = implode(GROUPSPLITTER, $data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #5
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $format = $params->get('text_format_string');
     if ($format != '') {
         $data = @eval(sprintf($format, $data));
         FabrikWorker::logEval($data, 'Caught exception on eval in ' . $this->getElement()->name . '::renderTableData() : %s');
     }
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #6
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $lang =& JFactory::getLanguage();
     $langfile = 'com_fabrik.plg.element.fabrikweather';
     $lang->load($langfile, JPATH_ADMINISTRATOR, null, true);
     $tableModel =& $this->getTableModel();
     $params =& $this->getParams();
     $data = explode(GROUPSPLITTER, $data);
     for ($i = 0; $i < count($data); $i++) {
         $data[$i] = $this->_renderTableData($data[$i], $oAllRowsData, $i);
     }
     $data = implode(GROUPSPLITTER, $data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #7
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $tableModel =& $this->getTableModel();
     $params =& $this->getParams();
     $target = $params->get('link_target', '');
     $smart_link = $params->get('link_smart_link', false);
     if ($tableModel->_outPutFormat != 'rss' && ($smart_link || $target == 'mediabox')) {
         FabrikHelperHTML::slimbox();
     }
     $data = explode(GROUPSPLITTER, $data);
     for ($i = 0; $i < count($data); $i++) {
         $data[$i] = $this->_renderTableData($data[$i], $oAllRowsData);
     }
     $data = implode(GROUPSPLITTER, $data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #8
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $meta = array();
     $config = JFactory::getConfig();
     $ex = $_SERVER['SERVER_PORT'] == 80 ? 'http://' : 'https://';
     // $$$ rob no need to get other meta data as we are linking to the details which contains full meta info on what it is
     // you are liking
     $meta['og:url'] = $ex . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $meta['og:site_name'] = $config->getValue('sitename');
     $meta['fb:admins'] = $params->get('fblike_opengraph_applicationid');
     $str = FabrikHelperHTML::facebookGraphAPI($params->get('opengraph_applicationid'), $params->get('fblike_locale', 'en_US'), $meta);
     //in table view we like the detailed record not the table view itself
     $url = $this->getTableModel()->linkHref($this, $oAllRowsData);
     return $str . $this->_render($url);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #9
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $user =& JFactory::getUser();
     $params =& $this->getParams();
     $ext = $params->get('rating-pngorgif', '.png');
     $imagepath = COM_FABRIK_LIVESITE . 'components/com_fabrik/plugins/element/fabrikrating/images/';
     $data = explode(GROUPSPLITTER, $data);
     $url = COM_FABRIK_LIVESITE . 'index.php?option=com_fabrik&amp;format=raw&amp;controller=plugin&amp;task=pluginAjax&amp;g=element&amp;plugin=fabrikrating&amp;method=ajax_rate&amp;element_id=' . $this->getElement()->id;
     $url .= '&amp;row_id=' . $oAllRowsData->__pk_val;
     $url .= '&amp;elementname=' . $this->getElement()->id;
     $url .= '&amp;userid=' . $user->get('id');
     $url .= '&amp;nonajax=1';
     $row_id = isset($oAllRowsData->__pk_val) ? $oAllRowsData->__pk_val : $oAllRowsData->id;
     $ids = JArrayHelper::getColumn($this->getTableModel()->getData(), '__pk_val');
     $canRate = $this->canRate($row_id, $ids);
     for ($i = 0; $i < count($data); $i++) {
         $avg = $this->_renderTableData($data[$i], $oAllRowsData);
         if (!$canRate) {
             $atpl = '';
             $a2 = '';
         } else {
             $atpl = "<a href=\"{$url}&rating={r}\">";
             $a2 = "</a>";
         }
         $str = '<div style="width:100px">';
         for ($s = 0; $s < $avg; $s++) {
             $r = $s + 1;
             $a = str_replace('{r}', $r, $atpl);
             $str .= "{$a}<img src=\"{$imagepath}" . "star_in{$ext}\" style=\"padding-left:1px;\" alt=\"{$r}\" class=\"starRating rate_{$r}\"/>{$a2}";
         }
         for ($s = $avg; $s < 5; $s++) {
             $r = $s + 1;
             $a = str_replace('{r}', $r, $atpl);
             $str .= "{$a}<img src=\"{$imagepath}" . "star_out{$ext}\" style=\"padding-left:1px;\" alt=\"{$r}\" class=\"starRating rate_{$r}\"/>{$a2}";
         }
         if ($params->get('rating-mode') != 'creator-rating') {
             $str .= "<div class=\"ratingMessage\">{$avg}</div>";
         }
         $str .= '</div>';
         $data[$i] = $str;
     }
     $data = implode(GROUPSPLITTER, $data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #10
0
 /**
  * shows the data formatted for the table view
  * @param string data (should be in mySQL format already)
  * @param string element name
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     //@TODO: deal with time options (currently can be defined in date_table_format param).
     $config =& JFactory::getConfig();
     $tzoffset = (int) $config->getValue('config.offset');
     $aNullDates = $this->getNullDates();
     $params =& $this->getParams();
     $store_as_local = (int) $params->get('date_store_as_local', 0);
     $groupModel =& $this->getGroup();
     if ($groupModel->canRepeat()) {
         $data = explode(GROUPSPLITTER, $data);
     } else {
         $data = array($data);
     }
     $f = $params->get('date_table_format', '%Y-%m-%d');
     if ($f == 'Y-m-d') {
         $f = '%Y-%m-%d';
     }
     $format = array();
     foreach ($data as $d) {
         if (!in_array($d, $aNullDates)) {
             $date = JFactory::getDate($d);
             //$$$ rob - if not time selector then the date gets stored as 2009-11-13 00:00:00
             //if we have a -1 timezone then date gets set to 2009-11-12 23:00:00
             //then shown as 2009-11-12 which is wrong
             if ($params->get('date_showtime') && !$store_as_local) {
                 $date->setOffset($tzoffset);
             }
             if ($f == '{age}') {
                 $format[] = date('Y') - $date->toFormat('%Y');
             } else {
                 $format[] = $date->toFormat($f);
             }
         } else {
             $format[] = '';
         }
     }
     $data = implode(GROUPSPLITTER, $format);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #11
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $imagepath = COM_FABRIK_LIVESITE . 'components/com_fabrik/plugins/element/fabrikthumbs/images/';
     $data = explode(GROUPSPLITTER, $data);
     $tableid = $this->getTableModel()->getTable()->id;
     $formid = $this->getTableModel()->getTable()->form_id;
     $row_id = $oAllRowsData->__pk_val;
     $str = '';
     for ($i = 0; $i < count($data); $i++) {
         JRequest::setVar('rowid', $row_id);
         $myThumb = $this->_getMyThumb($tableid, $formid, $row_id);
         $imagefileup = 'thumb_up_out.gif';
         $imagefiledown = 'thumb_down_out.gif';
         if ($myThumb == 'up') {
             $imagefileup = 'thumb_up_in.gif';
             $imagefiledown = 'thumb_down_out.gif';
         } else {
             if ($myThumb == 'down') {
                 $imagefileup = 'thumb_up_out.gif';
                 $imagefiledown = 'thumb_down_in.gif';
             }
         }
         $count = $this->_renderTableData($data[$i], $oAllRowsData);
         $count = explode(GROUPSPLITTER2, $count);
         $countUp = $count[0];
         $countDown = $count[1];
         $countDiff = $countUp - $countDown;
         $str .= "<span style=\"color:#32d723;\" class=\"counter_up\">{$countUp}</span><img src=\"{$imagepath}" . "{$imagefileup}\" style=\"padding:0px 5px 0 1px;\" alt=\"UP\" class=\"thumbup\" id=\"thumbup{$row_id}\"/>";
         $str .= "<span style=\"color:#f82516;\" class=\"counter_down\">{$countDown}</span><img src=\"{$imagepath}" . "{$imagefiledown}\" style=\"padding:0px 5px 0 1px;\" alt=\"DOWN\" class=\"thumbdown\" id=\"thumbdown{$row_id}\"/>";
         //$str .= "</div>";
         $data[$i] = $str;
     }
     $data = implode(GROUPSPLITTER, $data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #12
0
 function renderTableData($data, $oAllRowsData)
 {
     $db =& JFactory::getDBO();
     $params =& $this->getParams();
     $groupModel =& $this->getGroup();
     $data = $groupModel->canRepeat() ? explode(GROUPSPLITTER, $data) : array($data);
     $display_format = $params->get('duration_display_format', 'short');
     $format = array();
     foreach ($data as $d) {
         $format[] = $this->_displayFormat($d);
     }
     $data = implode(GROUPSPLITTER, $format);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #13
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $data = $this->format($data);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #14
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #15
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     static $range;
     static $fullName;
     if (!isset($range)) {
         $range = $this->getRange();
         $fullName = $this->getDataElementFullName();
     }
     $data = $oAllRowsData->{$fullName};
     $data = $this->_renderTableData($data, $range);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #16
0
 function renderTableData($data, $oAllRowsData)
 {
     $db =& JFactory::getDBO();
     $aNullDates = array('0000-00-000000-00-00', '0000-00-00 00:00:00', '0000-00-00', '', $db->getNullDate());
     $params =& $this->getParams();
     $monthlabels = array(JText::_('January'), JText::_('February'), JText::_('March'), JText::_('April'), JText::_('May'), JText::_('June'), JText::_('July'), JText::_('August'), JText::_('September'), JText::_('October'), JText::_('November'), JText::_('December'));
     $monthnumbers = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
     $daysys = array('01', '02', '03', '04', '05', '06', '07', '08', '09');
     $daysimple = array('1', '2', '3', '4', '5', '6', '7', '8', '9');
     $jubileum = array('0', '25', '75');
     $groupModel =& $this->getGroup();
     $data = $groupModel->canRepeat() ? explode(GROUPSPLITTER, $data) : array($data);
     $ft = $params->get('table_day_format', 'd.m.Y');
     $fta = $params->get('table_age_format', 'no');
     $format = array();
     foreach ($data as $d) {
         if (!in_array($d, $aNullDates)) {
             //$date 	= JFactory::getDate($d);
             list($year, $month, $day) = explode('-', $d);
             $daydisp = str_replace($daysys, $daysimple, $day);
             $monthdisp = str_replace($monthnumbers, $monthlabels, $month);
             $nextyear = date('Y') + 1;
             $lastyear = date('Y') - 1;
             $thisyear = date('Y');
             $dmy = $day . '.' . $month . '.' . $year;
             $mdy = $month . '/' . $day . '/' . $year;
             $dmonthyear = $daydisp . '. ' . $monthdisp . ' ' . $year;
             $monthdyear = $monthdisp . ' ' . $daydisp . ', ' . $year;
             if ($ft == "d.m.Y") {
                 $datedisp = $dmy;
             } else {
                 if ($ft == "m.d.Y") {
                     $datedisp = $mdy;
                 }
                 if ($ft == "D. month YYYY") {
                     $datedisp = $dmonthyear;
                 }
                 if ($ft == "Month d, YYYY") {
                     $datedisp = $monthdyear;
                 }
             }
             if ($fta == 'no') {
                 $format[] = $datedisp;
             } else {
                 if (date('m-d') == $month . '-' . $day) {
                     if ($fta == '{age}') {
                         $format[] = "<font color = '#DD0000'><b>" . ($thisyear - $year) . "</b></font>";
                     } else {
                         if ($fta == '{age} date') {
                             $format[] = "<font color = '#DD0000'><b>" . $datedisp . " (" . ($thisyear - $year) . ")</b></font>";
                         }
                         if ($fta == '{age} this') {
                             $format[] = "<font color = '#DD0000'><b>" . ($thisyear - $year) . " (" . $datedisp . ")</b></font>";
                         }
                         if ($fta == '{age} next') {
                             $format[] = "<font color = '#DD0000'><b>" . ($nextyear - $year) . " (" . $datedisp . ")</b></font>";
                         }
                     }
                 } else {
                     if ($fta == '{age} date') {
                         if (date('m-d') > $month . '-' . $day) {
                             $format[] = $datedisp . ' (' . ($thisyear - $year) . ')';
                         } else {
                             $format[] = $datedisp . ' (' . ($lastyear - $year) . ')';
                         }
                     } else {
                         if ($fta == '{age}') {
                             if (date('m-d') > $month . '-' . $day) {
                                 $format[] = $thisyear - $year;
                             } else {
                                 $format[] = $lastyear - $year;
                             }
                         } else {
                             if ($fta == '{age} this') {
                                 if (in_array(substr($thisyear - $year, -1), $jubileum) || in_array(substr($thisyear - $year, -2), $jubileum)) {
                                     $format[] = '<b>' . ($thisyear - $year) . ' (' . $datedisp . ')</b>';
                                 } else {
                                     $format[] = $thisyear - $year . ' (' . $datedisp . ')';
                                 }
                             }
                             if ($fta == '{age} next') {
                                 if (in_array(substr($nextyear - $year, -1), $jubileum) || in_array(substr($nextyear - $year, -2), $jubileum)) {
                                     $format[] = '<b>' . ($nextyear - $year) . ' (' . $datedisp . ')</b>';
                                 } else {
                                     $format[] = $nextyear - $year . ' (' . $datedisp . ')';
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             $format[] = '';
         }
     }
     $data = implode(GROUPSPLITTER, $format);
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #17
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object  current row's data
  * @return string formatted value
  */
 function renderTableData($element_data, &$thisRow)
 {
     $params =& $this->getParams();
     $format = trim($params->get('calc_format_string'));
     // $$$ hugh - the 'calculated value' bit is for legacy data that was created
     // before we started storing a value when row is saved
     if ($params->get('calc_on_save_only', 0) && $element_data != 'calculated value') {
         if ($format != '') {
             $element_data = sprintf($format, $element_data);
         }
         return parent::renderTableData($element_data, $thisRow);
     } else {
         $element =& $this->getElement();
         $cal = $params->get('calc_calculation', '');
         $tableModel =& $this->getTableModel();
         $formModel =& $this->getForm();
         $data = JArrayHelper::fromObject($thisRow);
         $data['rowid'] = $data['__pk_val'];
         $data['fabrik'] = $formModel->getId();
         // $$$ hugh - trying to standardize on $data so scripts know where data is,
         // need $d here for backward compat
         $d =& $data;
         $res = $tableModel->parseMessageForRowHolder($cal, $data, true);
         $res = @eval($res);
         FabrikWorker::logEval($res, 'Caught exception on eval in ' . $element->name . '::renderTableData() : %s');
         if ($format != '') {
             $res = sprintf($format, $res);
         }
         // $$$ hugh - need to set _raw, might be needed if (say) calc is being used as 'use_as_row_class'
         // See comments in formatData() in table model, we might could move this to a renderRawTableData() method.
         $raw_name = $this->getFullName(false, true, false) . '_raw';
         $thisRow->{$raw_name} = str_replace(GROUPSPLITTER, ',', $res);
         return parent::renderTableData($res, $thisRow);
     }
 }
Пример #18
0
 /**
  *
  * child classes can then call this function with
  * return parent::renderTableData($data, $oAllRowsData);
  * to perform rendering that is applicable to all plugins
  *
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $groupModel =& $this->_group;
     $labeldata = array();
     if (!$groupModel->isJoin() && $groupModel->canRepeat()) {
         $opts =& $this->_getOptionVals();
         $name = $this->getFullName(false, true, false) . "_raw";
         //if coming from fabrikemail plugin oAllRowsdata is empty
         if (isset($oAllRowsData->{$name})) {
             $data = $oAllRowsData->{$name};
         }
         if (!is_array($data)) {
             $data = explode(GROUPSPLITTER, $data);
         }
         foreach ($data as $d) {
             foreach ($opts as $opt) {
                 if ($opt->value == $d) {
                     $labeldata[] = $opt->text;
                     break;
                 }
             }
         }
     } else {
         $labeldata[] = $data;
     }
     $data = implode(GROUPSPLITTER, $labeldata);
     // $$$ rob add links and icons done in parent::renderTableData();
     return parent::renderTableData($data, $oAllRowsData);
 }
Пример #19
0
 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $data = explode(GROUPSPLITTER, $data);
     $params =& $this->getParams();
     $selectImage_root_folder = $params->get('selectImage_root_folder', '');
     // $$$ hugh - tidy up a bit so we don't have so many ///'s in the URL's
     $selectImage_root_folder = ltrim($selectImage_root_folder, '/');
     $selectImage_root_folder = rtrim($selectImage_root_folder, '/');
     $showImage = $params->get('show_image_in_table', 0);
     $linkURL = $params->get('link_url', '');
     if ($data[0] == '') {
         $data[0] = $params->get('imagefile');
     }
     for ($i = 0; $i < count($data); $i++) {
         if ($showImage) {
             // $$$ rob 30/06/2011 - say if we import via csv a url to the image check that and use that rather than the relative path
             $src = substr($data[$i], 0, 4) == 'http' ? $data[$i] : COM_FABRIK_LIVESITE . 'images/stories/' . $selectImage_root_folder . '/' . $data[$i];
             $data[$i] = "<img src=\"{$src}\" alt=\"{$data[$i]}\" />";
         }
         if ($linkURL) {
             $data[$i] = "<a href=\"{$linkURL}\" target=\"_blank\">" . $data[$i] . "</a>";
         }
     }
     $data = implode(GROUPSPLITTER, $data);
     return parent::renderTableData($data, $oAllRowsData);
 }