Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/Fabrik/fabrik
Browse files Browse the repository at this point in the history
  • Loading branch information
pollen8 committed Jan 9, 2012
2 parents 6722459 + f38f989 commit e08c522
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 42 deletions.
5 changes: 4 additions & 1 deletion components/com_fabrik/models/form.php
Expand Up @@ -1645,7 +1645,10 @@ function validate()

// $$$ rob for PHP 5.2.1 (and potential up to before 5.2.6) $post is not fully associated with _formData -
// so the above copToRaw does not update $this->_formData.
$this->_formData = $post;
// $$$ hugh - had to add the &, otherwise replace validations weren't work, as modifying
// $post wasn't modifying $this->_formData. Which is weird, as I thought all array assignments
// were by reference?
$this->_formData =& $post;
$this->callElementPreprocess();

// $$$ hugh - add in any encrypted stuff, in case we fail validation ...
Expand Down
36 changes: 20 additions & 16 deletions components/com_fabrik/models/list.php
Expand Up @@ -97,10 +97,10 @@ class FabrikFEModelList extends JModelForm {
public $randomRecords = false;

protected $_data = null;

/** @var string template name */
protected $tmpl = null;

var $nav = null;
var $fields = null;
var $prefilters = null;
Expand Down Expand Up @@ -150,7 +150,7 @@ class FabrikFEModelList extends JModelForm {

/** @var int the max number of buttons that is shown in a row */
protected $rowActionCount = 0;

/**
* Constructor
*
Expand Down Expand Up @@ -1135,7 +1135,7 @@ function viewDataLink($popUp = false, $element, $row = null, $key = '', $val = '
}
$bits[] = "&resetfilters=1";
//$bits[] = "clearfilters=1"; //nope stops url filter form workin on related data :(
$bits[] = '&fabrik_incsessionfilters=0';//test for releated data, filter once, go backt o main list re-filter -
$bits[] = '&fabrik_incsessionfilters=0';//test for releated data, filter once, go backt o main list re-filter -
$url .= implode("&", $bits);
$url = JRoute::_($url);

Expand Down Expand Up @@ -1187,15 +1187,15 @@ public function _addLink($data, &$elementModel, $row, $repeatCounter = 0)
}
//try to remove any previously entered links
$data = preg_replace('/<a(.*?)>|<\/a>/', '', $data);

$class = '';
if ($this->canViewDetails($row)) {
$class = 'fabrik_view';
}
if ($this->canEdit($row)) {
$class = 'fabrik_edit';
}

$data = '<a class="fabrik___rowlink '.$class.'" href="'.$link.'">'.$data.'</a>';
return $data;
}
Expand Down Expand Up @@ -6366,10 +6366,10 @@ function getTableAction()
} else {
//check if its a tag element if it is we want to clear that when we clear the form
// (if the filter was set via the url we generally want to keep it though

// 28/12/2011 $$$ rob testing never keeping querystring filters in the qs but instead always adding them to the filters (if no filter set up in element settings then hidden fields added anyway
// this is to try to get round issue of related data (countries->regions) filter region from country list, then clear filters (ok) but then if you go to 2nd page of results country url filter re-applied

/* if($el->getElement()->plugin !== 'textarea' && $el->getParams()->get('textarea-tagify') !== true) {
$qs[] = "$k=$v";
} */
Expand All @@ -6381,7 +6381,7 @@ function getTableAction()
//$action = preg_replace("/limitstart{$this->getId()}=(.*)?(&|)/", "", $action);
// $$$ hugh - oops, this pattern was removing to end of line, not just the limitstart, trying out fix
$action = preg_replace("/limitstart{$this->getId()}=(\d+)?(&amp;|)/", "", $action);

$action = FabrikString::removeQSVar($action, 'fabrik_incsessionfilters');
$action = FabrikString::rtrimword($action, "&");
$this->tableAction = JRoute::_($action);
Expand Down Expand Up @@ -6890,7 +6890,11 @@ public function getGroupByHeadings()
if (stristr($qs, 'group_by')) {
$qs = FabrikString::removeQSVar($qs, 'group_by');
}
$url = $base.$qs;
$url = $base;
if (!empty($qs)) {
$url .= strpos($url, '?') ? '&amp;' : '?';
$url .= $qs;
}
$url .= strpos($url, '?') ? '&amp;' : '?';
$a = array();
list($h, $x, $b, $c) = $this->getHeadings();
Expand Down Expand Up @@ -6927,7 +6931,7 @@ public function getCsvFields()
}
return $csvFields;
}

/**
* helper function for view to determine if filters should be shown
* @return boolean
Expand All @@ -6940,20 +6944,20 @@ public function getShowFilters()
$filterMode = (int)$params->get('show-table-filters');
return (count($filters) > 0 && $filterMode !== 0) && JRequest::getVar('showfilters', 1) == 1 ? true : false;
}

protected function getButtonCount()
{
$buttonCount = 0;

return $buttonCount;
}

/**
*
*
* helper view function to determine if any buttons are shown
* @return boolean
*/

public function getHasButtons()
{
$params = $this->getParams();
Expand Down
Expand Up @@ -21,6 +21,7 @@
#listform_$c .fabrikDataContainer{
overflow-y:auto;
clear:left;
width:100%;
}
#listform_$c a,
Expand Down
52 changes: 27 additions & 25 deletions plugins/fabrik_visualization/fusionchart/models/fusionchart.php
Expand Up @@ -315,8 +315,8 @@ function getFusionchart()
$glabels = array();
$gcolours = array();
$gfills = array();
$max = 0;
$min = 0;
$max =array();
$min = array();

$calculationLabels = array();
$calculationData = array();
Expand All @@ -325,14 +325,18 @@ function getFusionchart()
$tmodels = array();

foreach ($listid as $tid) {
if (!array_key_exists($tid, $tmodels)) {
$min[$c] = 0;
$max[$c] = 0;

if (!array_key_exists($tid, $tmodels)) {
$listModel = null;
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId($tid);
$tmodels[$tid] = $listModel;
} else {
$listModel = $tmodels[$tid];
}
}
else {
$listModel = $tmodels[$tid];
}

$table = $listModel->getTable();
$form = $listModel->getForm();
Expand Down Expand Up @@ -376,11 +380,9 @@ function getFusionchart()
$calculationLabels[] = trim(strip_tags($o->label));
}
}
if (!empty($calculationData) && max($calculationData) > $max) {
$max = max($calculationData);
}
if(!empty($calculationData) && min($calculationData) < $min) {
$min = min($calculationData);
if (!empty($calculationData)) {
$max[$c] = max($calculationData);
$min[$c] = min($calculationData);
}

$gdata[$c] = implode(',', $tmpgdata);
Expand Down Expand Up @@ -409,11 +411,9 @@ function getFusionchart()
}
$tmpglabels[] = !empty($label) ? strip_tags($row->$label) : '';
}
if (!empty($tmpgdata) && max($tmpgdata) > $max) {
$max = max($tmpgdata);
}
if(!empty($tmpgdata) && min($tmpgdata) < $min) {
$min = min($tmpgdata);
if (!empty($tmpgdata)) {
$max[$c] = max($tmpgdata);
$min[$c] = min($tmpgdata);
}
$gdata[$c] = implode(',', $tmpgdata);
$glabels[$c] = implode('|', $tmpglabels);
Expand Down Expand Up @@ -469,7 +469,7 @@ function getFusionchart()
}
$arrData = array();
$i = 0;

foreach ($gsums as $gd) {
$arrData[$i][0] = $axisLabels[$i];
$arrData[$i][1] = $gd;
Expand Down Expand Up @@ -593,13 +593,14 @@ function getFusionchart()
// Trendline Start & End values
$trendstart = $params->get('fusionchart_trendstartvalue', '');
$trendend = $params->get('fusionchart_trendendvalue', '');
if ($trendstart[$nbe]) {
$startval = $trendstart[$nbe];
$endval = $trendend[$nbe];
if ($trendstart) {
$startval = $trendstart;
$endval = $trendend;
} else if ($eltype[$nbe] == 'trendline') {
// If Start & End values are not specifically defined, use the element's min & max values
$startval = $min;
$endval = $max;
var_dump($min, $max, $c, $nbe);
$startval = $min[$nbe];
$endval = $max[$nbe];
}
$strAddTrend = "startValue=$startval;endValue=$endval";
// Label
Expand All @@ -608,13 +609,14 @@ function getFusionchart()
$iszone = $params->get('fusionchart_trendiszone', '0');
$elcolour = $params->get('fusionchart_elcolour', '');
$elalpha = $params->get('fusionchart_elalpha', '');
$strAddTrend .= ";displayvalue=".$displayval[$nbe];
$strAddTrend .= ";showOnTop=".$showontop[$nbe];
$strAddTrend .= ";displayvalue=".$displayval;
$strAddTrend .= ";showOnTop=".$showontop;
if ($startval < $endval) {
$strAddTrend .= ";isTrendZone=".$iszone[$nbe];
$strAddTrend .= ";isTrendZone=".$iszone;
}
$strAddTrend .= ";color=".$elcolour[$nbe];
$strAddTrend .= ";alpha=".$elalpha[$nbe];
var_dump($strAddTrend);
$FC->addTrendLine("$strAddTrend");
unset($axisLabels[$nbe]);
unset($gdata[$nbe]);
Expand Down

0 comments on commit e08c522

Please sign in to comment.