Skip to content

Commit

Permalink
merge db join field, - removed unused vars
Browse files Browse the repository at this point in the history
  • Loading branch information
pollen8 committed Nov 18, 2014
2 parents 3aa3fd1 + d257c81 commit 2a87940
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
4 changes: 4 additions & 0 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,10 @@ public function buildQuery()
// Limit to the current page
$query->where($table->db_primary_key . ' IN (' . implode($mainKeys, ',') . ')');
}
else
{
$query->where('1 = -1');
}
}
else
{
Expand Down
27 changes: 3 additions & 24 deletions plugins/fabrik_element/databasejoin/databasejoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,13 @@ public function getAsField_csv(&$aFields, &$aAsFields, $table = '')

protected function getJoin()
{
$app = JFactory::getApplication();
$input = $app->input;

if (isset($this->join))
{
return $this->join;
}

$params = $this->getParams();
$app = JFactory::getApplication();
$input = $app->input;
$element = $this->getElement();

if ($element->published == 0)
Expand Down Expand Up @@ -511,6 +509,7 @@ public function getJoinsToThisKey(&$table)
protected function evalOptions(&$opts) {
$params = $this->getParams();
$eval = $params->get('dabase_join_label_eval');

if (trim($eval) !== '')
{
foreach ($opts as $key => &$opt)
Expand Down Expand Up @@ -1421,8 +1420,6 @@ public function render($data, $repeatCounter = 0)
$display = $opt->value == $default_val ? '' : 'style="display: none"';
$c = $this->showPleaseSelect() ? $i + 1 : $i;
$html[] = '<div ' . $display . ' class="notice description-' . $c . '">' . $opt->description . '</div>';
//$html[] = '<div $display . '"' . $opt->description . '</div>';

}

$html[] = '</div>';
Expand Down Expand Up @@ -1681,7 +1678,6 @@ protected function renderCheckBoxList($data, $repeatCounter, &$html, $tmp, $defa
protected function getValueFullName($opts)
{
$name = $this->getFullName(true, false);
$params = $this->getParams();

if (!$this->isJoin() && JArrayHelper::getValue($opts, 'valueFormat', 'raw') == 'raw')
{
Expand Down Expand Up @@ -1904,7 +1900,6 @@ public function getEmailValue($value, $data = array(), $repeatCounter = 0)

public function renderListData($data, stdClass &$thisRow)
{
$params = $this->getParams();
$groupModel = $this->getGroupModel();
$labeldata = array();

Expand Down Expand Up @@ -2177,8 +2172,6 @@ protected function filterSelectLabel()

protected function buildFilterJoin()
{
$params = $this->getParams();
//$joinTable = FabrikString::safeColName($params->get('join_db_name'))
$joinTable = FabrikString::safeColName($this->getDbName());
$join = $this->getJoin();
$joinTableName = FabrikString::safeColName($join->table_join_alias);
Expand Down Expand Up @@ -2215,7 +2208,6 @@ protected function filterValueList_All($normal, $tableName = '', $label = '', $i
*/
$listModel = $this->getlistModel();
$table = $listModel->getTable();
$origTable = $table->db_table_name;
$fabrikDb = $listModel->getDb();
$params = $this->getParams();
$joinTable = $params->get('join_db_name');
Expand Down Expand Up @@ -2357,7 +2349,6 @@ protected function getOrderBy($view = '', $query = false)

protected function getJoinValueColumn()
{
$params = $this->getParams();
$join = $this->getJoin();
$db = FabrikWorker::getDbo();

Expand Down Expand Up @@ -2555,7 +2546,6 @@ public function getFilterQuery($key, $condition, $value, $originalValue, $type =

protected function checkboxRows($groupBy = null, $condition = null, $value = null, $where = null, $offset = 0, $limit = 0)
{
$params = $this->getParams();
$db = $this->getDb();
$query = $db->getQuery(true);
$join = $this->getJoinModel()->getJoin();
Expand Down Expand Up @@ -2683,7 +2673,6 @@ public function getFilterLabel($rawval)
{
$db = $this->getDb();
$params = $this->getParams();
$orig = $params->get('database_join_where_sql');
$k = $params->get('join_key_column');
$l = $this->getLabelParamVal();
$t = $params->get('join_db_name');
Expand Down Expand Up @@ -2774,7 +2763,6 @@ public function elementJavascript($repeatCounter)
protected function containerClass($element)
{
$c = explode(' ', parent::containerClass($element));
$params = $this->getParams();
$c[] = 'mode-' . $this->getDisplayType();

return implode(' ', $c);
Expand All @@ -2791,12 +2779,9 @@ protected function containerClass($element)
protected function elementJavascriptOpts($repeatCounter)
{
$params = $this->getParams();
$element = $this->getElement();
$opts = $this->_getOptionVals();
$data = $this->getFormModel()->data;
$arSelected = $this->getValue($data, $repeatCounter);
$arVals = $this->getSubOptionValues();
$arTxt = $this->getSubOptionLabels();
$table = $params->get('join_db_name');
$opts = $this->getElementJSOptions($repeatCounter);
$forms = $this->getLinkedForms();
Expand Down Expand Up @@ -2978,7 +2963,6 @@ protected function updateFabrikJoins($data, $tableJoin, $keyCol, $label)

protected function updateFabrikJoin($data, $elementId, $tableJoin, $keyCol, $label)
{
$params = json_decode($data['params']);
$element = $this->getElement();
$join = FabTable::getInstance('Join', 'FabrikTable');

Expand Down Expand Up @@ -3294,7 +3278,6 @@ private function _autocompleteWhere($how, $field, $search)

public function getOrderByName()
{
$params = $this->getParams();
$join = $this->getJoin();
$joinTable = $join->table_join_alias;
$joinVal = $this->getLabelOrConcatVal();
Expand Down Expand Up @@ -3389,7 +3372,6 @@ public function buildQueryElementConcat($jkey, $addAs = true)
$jointable = $join->table_join;
$params = $this->getParams();
$dbtable = $this->actualTableName();
$db = JFactory::getDbo();
$item = $this->getListModel()->getTable();
$jkey = $this->getLabelOrConcatVal();
$where = $this->buildQueryWhere(array(), true, $params->get('join_db_name'));
Expand Down Expand Up @@ -3469,9 +3451,6 @@ protected function buildQueryElementConcatId()
{
$str = parent::buildQueryElementConcatId();
$jointable = $this->getJoinModel()->getJoin()->table_join;
$dbtable = $this->actualTableName();
$db = JFactory::getDbo();
$table = $this->getListModel()->getTable();
$parentKey = $this->buildQueryParentKey();
$fullElName = $this->getFullName(true, false) . '_id';
$str .= ", (SELECT GROUP_CONCAT(" . $this->element->name . " SEPARATOR '" . GROUPSPLITTER . "') FROM $jointable WHERE " . $jointable
Expand Down

0 comments on commit 2a87940

Please sign in to comment.