Esempio n. 1
0
 /**
  * Overrides the getItems method to attach additional metrics to the list.
  *
  * @return  mixed  An array of data items on success, false on failure.
  *
  * @since   1.6.1
  */
 public function getItems()
 {
     // Get a storage key.
     $store = $this->getStoreId('getItems');
     // Try to load the data from internal storage.
     if (!empty($this->cache[$store])) {
         return $this->cache[$store];
     }
     // Load the list items.
     $items = parent::getItems();
     // If emtpy or an error, just return.
     if (empty($items)) {
         return array();
     }
     // Getting the following metric by joins is WAY TOO SLOW.
     // Faster to do three queries for very large menu trees.
     // Get the menu types of menus in the list.
     $db = $this->getDbo();
     $menuTypes = ArrayHelper::getColumn((array) $items, 'menutype');
     // Quote the strings.
     $menuTypes = implode(',', array_map(array($db, 'quote'), $menuTypes));
     // Get the published menu counts.
     $query = $db->getQuery(true)->select('m.menutype, COUNT(DISTINCT m.id) AS count_published')->from('#__menu AS m')->where('m.published = 1')->where('m.menutype IN (' . $menuTypes . ')')->group('m.menutype');
     $db->setQuery($query);
     try {
         $countPublished = $db->loadAssocList('menutype', 'count_published');
     } catch (RuntimeException $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Get the unpublished menu counts.
     $query->clear('where')->where('m.published = 0')->where('m.menutype IN (' . $menuTypes . ')');
     $db->setQuery($query);
     try {
         $countUnpublished = $db->loadAssocList('menutype', 'count_published');
     } catch (RuntimeException $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Get the trashed menu counts.
     $query->clear('where')->where('m.published = -2')->where('m.menutype IN (' . $menuTypes . ')');
     $db->setQuery($query);
     try {
         $countTrashed = $db->loadAssocList('menutype', 'count_published');
     } catch (RuntimeException $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Inject the values back into the array.
     foreach ($items as $item) {
         $item->count_published = isset($countPublished[$item->menutype]) ? $countPublished[$item->menutype] : 0;
         $item->count_unpublished = isset($countUnpublished[$item->menutype]) ? $countUnpublished[$item->menutype] : 0;
         $item->count_trashed = isset($countTrashed[$item->menutype]) ? $countTrashed[$item->menutype] : 0;
     }
     // Add the items to the internal cache.
     $this->cache[$store] = $items;
     return $this->cache[$store];
 }
 /**
  * Extracts a column from an array of arrays or objects
  *
  * @param   array   &$array  The source array
  * @param   string  $index   The index of the column or name of object property
  *
  * @return  array  Column of values from the source array
  *
  * @since   11.1
  * @deprecated  4.0 Use Joomla\Utilities\ArrayHelper::getColumn instead
  */
 public static function getColumn(&$array, $index)
 {
     $result = array();
     if (is_array($array)) {
         $result = ArrayHelper::getColumn($array, $index);
     } else {
         JLog::add('This method is typehinted to be an array in \\Joomla\\Utilities\\ArrayHelper::getColumn.', JLog::WARNING, 'deprecated');
     }
     return $result;
 }
    /**
     * @covers Windwalker\DataMapper\AbstractDataMapper::delete
     * @todo   Implement testDelete().
     */
    public function testDelete()
    {
        $dataset = $this->object->find(array(new Compare('title', 'Rose%', 'LIKE')));
        $this->object->delete(array(new Compare('title', 'Rose%', 'LIKE')));
        $ids = implode(',', ArrayHelper::getColumn((array) $dataset, 'id'));
        $compareContent = $this->db->setQuery(<<<SQL
SELECT *
FROM ww_content
WHERE id IN ({$ids})
SQL
)->loadObjectList();
        $compareContent2 = $this->db->setQuery(<<<SQL
SELECT *
FROM ww_content2
WHERE content_id IN ({$ids})
SQL
)->loadObjectList();
        $this->assertEmpty($compareContent, 'Records not deleted.');
        $this->assertEmpty($compareContent2, 'Records not deleted.');
    }
Esempio n. 4
0
 /**
  * Get JS
  *
  * @param array $res
  */
 private function js($res = array())
 {
     $at = (string) $this->getAttribute('at', 'false');
     if ($at === 'true') {
         FabrikHelperHTML::atWHo('textarea[data-at]', ArrayHelper::getColumn($res, 'value'));
     }
     $connection = $this->getAttribute('connection');
     $repeat = FabrikWorker::toBoolean($this->getAttribute('repeat', false), false);
     $repeat = FabrikAdminElementHelper::getRepeat($this) || $repeat;
     $c = (int) FabrikAdminElementHelper::getRepeatCounter($this);
     $mode = $this->getAttribute('mode');
     $connectionDd = $repeat ? $connection . '-' . $c : $connection;
     $highlightPk = FabrikWorker::toBoolean($this->getAttribute('highlightpk', false), false);
     $tableDd = $this->getAttribute('table');
     $opts = new stdClass();
     $opts->table = $repeat ? 'jform_' . $tableDd . '-' . $c : 'jform_' . $tableDd;
     $opts->conn = 'jform_' . $connectionDd;
     $opts->value = $this->value;
     $opts->repeat = $repeat;
     $opts->showAll = (int) $this->getAttribute('showall', '1');
     $opts->highlightpk = (int) $highlightPk;
     $opts->mode = $mode;
     $opts->defaultOpts = $res;
     $opts->addBrackets = FabrikWorker::toBoolean($this->getAttribute('addbrackets', false), false);
     $opts = json_encode($opts);
     $script = array();
     $script[] = "if (typeOf(FabrikAdmin.model.fields.listfields) === 'null') {";
     $script[] = "FabrikAdmin.model.fields.listfields = {};";
     $script[] = "}";
     $script[] = "if (FabrikAdmin.model.fields.listfields['{$this->id}'] === undefined) {";
     $script[] = "FabrikAdmin.model.fields.listfields['{$this->id}'] = new ListFieldsElement('{$this->id}', {$opts});";
     $script[] = "}";
     $script = implode("\n", $script);
     $srcs = array('Fabrik' => 'media/com_fabrik/js/fabrik.js', 'ListFields' => 'administrator/components/com_fabrik/models/fields/listfields.js');
     FabrikHelperHTML::script($srcs, $script);
 }
Esempio n. 5
0
 /**
  * List model has loaded its data, lets pivot it!
  *
  * @param   &$args  Array  Additional options passed into the method when the plugin is called
  *
  * @return bool currently ignored
  */
 public function onLoadData(&$args)
 {
     $data =& $args[0]->data;
     $params = $this->getParams();
     $sums = $params->get('pivot_sum');
     list($xCol, $yCol) = $this->getCols();
     $rawSums = $sums . '_raw';
     // Get distinct areas?
     $xCols = array();
     foreach ($data as $group) {
         foreach ($group as $row) {
             if (!in_array($row->{$xCol}, $xCols)) {
                 $xCols[] = $row->{$xCol};
             }
         }
     }
     // Order headings
     asort($xCols);
     // Get distinct dates
     $yCols = array();
     foreach ($data as $group) {
         foreach ($group as $row) {
             if (!in_array($row->{$yCol}, $yCols)) {
                 $yCols[] = $row->{$yCol};
             }
         }
     }
     $new = array();
     foreach ($yCols as $yColData) {
         $newRow = new stdClass();
         $newRow->{$yCol} = $yColData;
         $total = 0;
         // Set default values
         foreach ($xCols as $xColData) {
             $newRow->{$xColData} = '';
         }
         foreach ($data as $group) {
             foreach ($group as $row) {
                 foreach ($xCols as $xColData) {
                     if ($row->{$xCol} === $xColData && $row->{$yCol} === $yColData) {
                         $newRow->{$xColData} = $row->{$sums};
                         $total += (double) $this->unNumberFormat($row->{$sums}, $params);
                         //$total += (float) $row->$rawSums;
                     }
                 }
             }
         }
         $newRow->pivot_total = $total;
         $new[] = $newRow;
     }
     /**
      * Optionally order by the sum column. I'm sure there's some more elegant way of doing this,
      * but for now, two usort functions will do it.
      */
     $order = $params->get('pivot_sort', '0');
     if ($order == '1') {
         usort($new, function ($a, $b) {
             if ($a->pivot_total == $b->pivot_total) {
                 return 0;
             } else {
                 if ($a->pivot_total > $b->pivot_total) {
                     return -1;
                 } else {
                     return 1;
                 }
             }
         });
     } else {
         if ($order == '2') {
             usort($new, function ($a, $b) {
                 if ($a->pivot_total == $b->pivot_total) {
                     return 0;
                 } else {
                     if ($a->pivot_total < $b->pivot_total) {
                         return -1;
                     } else {
                         return 1;
                     }
                 }
             });
         }
     }
     // Add totals @ bottom
     $yColTotals = new stdClass();
     $yColTotals->{$yCol} = FText::_('PLG_LIST_PIVOT_LIST_Y_TOTAL');
     $total = 0;
     foreach ($xCols as $x) {
         if (!empty($x)) {
             $c = ArrayHelper::getColumn($new, $x);
             $yColTotals->{$x} = 0;
             foreach ($c as &$cc) {
                 $cc = strip_tags($cc);
                 $yColTotals->{$x} += $this->unNumberFormat($cc, $params);
             }
             $total += (double) $yColTotals->{$x};
         }
     }
     foreach ($yColTotals as $yKey => &$y) {
         if ($yKey == $yCol) {
             continue;
         }
         $y = $this->numberFormat($y, $params);
     }
     $yColTotals->pivot_total = $total;
     $new[] = $yColTotals;
     foreach ($new as $newRow) {
         if (isset($newRow->pivot_total)) {
             $newRow->pivot_total = $this->numberFormat($newRow->pivot_total, $params);
         }
     }
     $data[0] = $new;
     return true;
 }
Esempio n. 6
0
<?php

if (!empty($categories)) {
    ?>
<div class="max-height-200 list-group-item">
    
    <?php 
    $current = \Joomla\Utilities\ArrayHelper::getColumn((array) $flash->old('categories'), 'id');
    ?>
    <?php 
    foreach ($categories as $one) {
        ?>
    <div class="checkbox">
        <label>
            <input type="checkbox" name="category_ids[]" class="icheck-input" value="<?php 
        echo $one->_id;
        ?>
" <?php 
        if (in_array($one->_id, $current)) {
            echo "checked='checked'";
        }
        ?>
>
            <?php 
        echo @str_repeat("&ndash;", substr_count(@$one->path, "/") - 1) . " " . $one->title;
        ?>
        </label>
    </div>
    <?php 
    }
    ?>
Esempio n. 7
0
 /**
  * get query to make records
  *
  * @return  string	sql
  */
 public function buildQuery()
 {
     $profiler = JProfiler::getInstance('Application');
     $input = $this->app->input;
     JDEBUG ? $profiler->mark('buildQuery: start') : null;
     $db = $this->getDb();
     $query = $db->getQuery(true);
     $table = $this->getTable();
     if ($this->mergeJoinedData()) {
         /* $$$ rob - get a list of the main table's ids limited on the navigation
          * this will then be used to filter the main query,
          * by modifying the where part of the query
          */
         $db = $this->getDb();
         $table = $this->getTable();
         /* $$$ rob 23/05/2012 if the search data is in the joined records we want to get the id's for the joined records and not the master record
         			 see http://fabrikar.com/forums/showthread.php?t=26400. This is a partial hack as I can't see how we know which joined record is really last
         			$$$ rob 25/05/2012 - slight change so that we work our way up the pk/fk list until we find some ids.
         			$$$ hugh, later in the day 25/05/2012 - big OOOOPS, see comment below about table_key vs table_join_key!
         			erm no not a mistake!?! reverted as no example of what was wrong with original code
         			*/
         $joins = $this->getJoins();
         // Default to the primary key as before this fix
         $lookupC = 0;
         $tmpPks = array();
         foreach ($joins as $join) {
             // $$$ hugh - added repeatElement, as _makeJoinAliases() is going to set canUse to false for those,
             // so they won't get included in the query ... so will blow up if we reference them with __pk_calX selection
             if ($join->params->get('type') !== 'element' && $join->params->get('type') !== 'repeatElement') {
                 // $$$ hugh - need to be $lookupC + 1, otherwise we end up with two 0's, 'cos we added main table above
                 /**
                  * [non-merged data]
                  *
                  * country	towm
                  * ------------------------------
                  * france	la rochelle
                  * france	paris
                  * france	bordeaux
                  *
                  * [merged data]
                  *
                  * country	town
                  * -------------------------------
                  * france	la rochelle
                  * 			paris
                  * 			bordeaux
                  *
                  * [now search on town = 'la rochelle']
                  *
                  * If we don't use this new code then the search results show all three towns.
                  * By getting the lowest set of complete primary keys (in this example the town ids) we set our query to be:
                  *
                  * where town_id IN (1)
                  *
                  * which gives a search result of
                  *
                  * country	town
                  * -------------------------------
                  * france	la rochelle
                  *
                  */
                 $pk = $join->params->get('pk');
                 if (!array_key_exists($pk, $tmpPks) || !is_array($tmpPks[$pk])) {
                     $tmpPks[$pk] = array($pk);
                 } else {
                     if (count($tmpPks[$pk]) == 1) {
                         $v = str_replace('`', '', $tmpPks[$pk][0]);
                         $v = explode('.', $v);
                         $v[0] = $v[0] . '_0';
                         $tmpPks[$pk][0] = $db->qn($v[0] . '.' . $v[1]);
                     }
                     $v = str_replace('`', '', $pk);
                     $v = explode('.', $v);
                     $v[0] = $v[0] . '_' . count($tmpPks[$pk]);
                     $tmpPks[$pk][] = $db->qn($v[0] . '.' . $v[1]);
                 }
             }
         }
         // Check for duplicate pks if so we can presume that they are aliased with _X in from query
         $lookupC = 0;
         $lookUps = array('DISTINCT ' . $table->db_primary_key . ' AS __pk_val' . $lookupC);
         $lookUpNames = array($table->db_primary_key);
         foreach ($tmpPks as $pks) {
             foreach ($pks as $pk) {
                 $lookUps[] = $pk . ' AS __pk_val' . ($lookupC + 1);
                 $lookUpNames[] = $pk;
                 $lookupC++;
             }
         }
         // $$$ rob if no ordering applied i had results where main record (e.g. UK) was shown in 2 lines not next to each other
         // causing them not to be merged and a 6 rows shown when limit set to 5. So below, if no order by set then order by main pk asc
         $by = trim($table->order_by) === '' ? array() : (array) json_decode($table->order_by);
         if (empty($by)) {
             $dir = (array) json_decode($table->order_dir);
             array_unshift($dir, 'ASC');
             $table->order_dir = json_encode($dir);
             $by = (array) json_decode($table->order_by);
             array_unshift($by, $table->db_primary_key);
             $table->order_by = json_encode($by);
         }
         // $$$ rob build order first so that we know of any elements we need to include in the select statement
         $query = $this->buildQueryOrder($query);
         $this->selectedOrderFields = (array) $this->selectedOrderFields;
         $this->selectedOrderFields = array_unique(array_merge($lookUps, $this->selectedOrderFields));
         $query->select(implode(', ', $this->selectedOrderFields) . ' FROM ' . $db->qn($table->db_table_name));
         $query = $this->buildQueryJoin($query);
         $query = $this->buildQueryWhere($input->get('incfilters', 1), $query);
         $query = $this->buildQueryGroupBy($query);
         // Can't limit the query here as this gives incorrect _data array.
         // $db->setQuery($query, $this->limitStart, $this->limitLength);
         $db->setQuery($query);
         FabrikHelperHTML::debug((string) $query, 'table:mergeJoinedData get ids');
         $ids = array();
         $idRows = $db->loadObjectList();
         $maxPossibleIds = count($idRows);
         // An array of the lists pk values
         $mainKeys = array();
         foreach ($idRows as $r) {
             $mainKeys[] = $db->q($r->__pk_val0);
         }
         // Chop up main keys for list limitstart, length to cull the data down to the correct length as defined by the page nav/ list settings
         $mainKeys = array_unique($mainKeys);
         if ($this->limitLength > 0) {
             $mainKeys = array_slice($mainKeys, $this->limitStart, $this->limitLength);
         }
         /**
          * $$$ rob get an array containing the PRIMARY key values for each joined tables data.
          * Stop as soon as we have a set of ids totaling the sum of records contained in $idRows
          */
         while (count($ids) < $maxPossibleIds && $lookupC >= 0) {
             $ids = ArrayHelper::getColumn($idRows, '__pk_val' . $lookupC);
             for ($idx = count($ids) - 1; $idx >= 0; $idx--) {
                 if ($ids[$idx] == '') {
                     unset($ids[$idx]);
                 } else {
                     $ids[$idx] = $db->q($ids[$idx]);
                 }
             }
             if (count($ids) < $maxPossibleIds) {
                 $lookupC--;
             }
         }
     }
     // Now lets actually construct the query that will get the required records:
     $query->clear();
     unset($this->orderBy);
     $query = $this->buildQuerySelect('list', $query);
     JDEBUG ? $profiler->mark('queryselect: got') : null;
     $query = $this->buildQueryJoin($query);
     JDEBUG ? $profiler->mark('queryjoin: got') : null;
     if ($this->mergeJoinedData()) {
         /* $$$ rob We've already used buildQueryWhere to get our list of main pk ids.
          * so lets use that list of ids to create the where statement. This will return 5/10/20 etc
          * records from our main table, as per our page nav, even if a main record has 3 rows of joined
          * data. If no ids found then do where "2 = -2" to return no records (was "1 = -1", changed to make
          * it easier to know where this is coming form when debugging)
          */
         if (!empty($ids)) {
             if ($lookUpNames[$lookupC] !== $table->db_primary_key) {
                 $query->where($lookUpNames[$lookupC] . ' IN (' . implode(array_unique($ids), ',') . ')');
             }
             if (!empty($mainKeys)) {
                 // Limit to the current page
                 $query->where($table->db_primary_key . ' IN (' . implode($mainKeys, ',') . ')');
             } else {
                 $query->where('2 = -2');
             }
         } else {
             $query->where('2 = -2');
         }
     } else {
         // $$$ rob we aren't merging joined records so lets just add the standard where query
         // Incfilters set when exporting as CSV
         $query = $this->buildQueryWhere($input->get('incfilters', 1), $query);
     }
     $query = $this->buildQueryGroupBy($query);
     $query = $this->buildQueryOrder($query);
     $query = $this->pluginQuery($query);
     $this->mainQuery = $query;
     /*
     $params = $this->getParams();
     
     if ($params->get('force_collate', '') !== '')
     {
     	$query .= ' COLLATE ' . $params->get('force_collate', '') . ' ';
     }
     */
     return (string) $query;
 }
Esempio n. 8
0
</a></legend>
		                        		</div>
                        			</div>
                        			<div class="row">
		                        		<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
		                        			<div>
		                        				<label>Slug:</label> <a target="_blank" href="./striper/plan/<?php 
        echo $item->id;
        ?>
"><?php 
        echo $item->id;
        ?>
 <i class="fa fa-external-link"></i></a>
		                        			</div>
		                        			<?php 
        $categories = \Joomla\Utilities\ArrayHelper::getColumn((array) $item->categories, 'title');
        ?>
		                        			<?php 
        if ($categories) {
            ?>
		                        			<div>			                        			
		                        				<label>Categories:</label>
												<span class='label label-warning'><?php 
            echo implode("</span> <span class='label label-warning'>", (array) $categories);
            ?>
</span>
		                        			</div>
		                        			<?php 
        }
        ?>
		                        			<?php 
 /**
  * Run when the component is updated
  *
  * @param   object $parent installer object
  *
  * @return  bool
  */
 public function update($parent)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $app = JFactory::getApplication();
     $msg = array();
     // Fabrik 3.5 Uninstalled plugins.
     $plugins = array('fabrik_element' => array('fbactivityfeed', 'fblikebox', 'fbrecommendations'), 'fabrik_form' => array('vbforum'));
     // Deprecated - 'timestamp', 'exif'
     $query->select('*')->from('#__extensions');
     foreach ($plugins as $folder => $plugs) {
         $query->where('(folder = ' . $db->q($folder) . ' AND element IN (' . implode(', ', $db->q($plugs)) . '))', 'OR');
         foreach ($plugs as $plug) {
             $path = JPATH_PLUGINS . '/' . $folder . '/' . $plug;
             if (JFolder::exists($path)) {
                 JFolder::delete($path);
             }
         }
     }
     $deprecatedPlugins = $db->setQuery($query)->loadObjectList();
     if (!empty($deprecatedPlugins)) {
         $ids = ArrayHelper::getColumn($deprecatedPlugins, 'extension_id');
         $ids = ArrayHelper::toInteger($ids);
         $query->clear()->delete('#__extensions')->where('extension_id IN ( ' . implode(',', $ids) . ')');
         $db->setQuery($query)->execute();
         // Un-publish elements
         $query->clear()->select('id, name, label')->from('#__fabrik_elements')->where('plugin IN (' . implode(', ', $db->q($plugins['fabrik_element'])) . ')')->where('published = 1');
         $db->setQuery($query);
         $unpublishedElements = $db->loadObjectList();
         $unpublishedIds = ArrayHelper::getColumn($unpublishedElements, 'id');
         if (!empty($unpublishedIds)) {
             $msg[] = 'The following elements have been unpublished as their plug-ins have been uninstalled. : ' . implode(', ', $unpublishedIds);
             $query->clear()->update('#__fabrik_elements')->set('published = 0')->where('id IN (' . implode(',', $db->q($unpublishedIds)) . ')');
             $db->setQuery($query)->execute();
         }
     }
     // Un-publish form plug-ins
     $query->clear()->select('id, params')->from('#__fabrik_forms');
     $forms = $db->setQuery($query)->loadObjectList();
     foreach ($forms as $form) {
         $params = json_decode($form->params);
         $found = false;
         if (isset($params->plugins)) {
             for ($i = 0; $i < count($params->plugins); $i++) {
                 if (in_array($params->plugins[$i], $plugins['fabrik_form'])) {
                     $msg[] = 'Form ' . $form->id . '\'s plugin \'' . $params->plugins[$i] . '\' has been unpublished';
                     $params->plugin_state[$i] = 0;
                     $found = true;
                 }
             }
             if ($found) {
                 $query->clear()->update('#__fabrik_forms')->set('params = ' . $db->q(json_encode($params)))->where('id = ' . (int) $form->id);
                 $db->setQuery($query)->execute();
             }
         }
     }
     if (!empty($msg)) {
         $app->enqueueMessage(implode('<br>', $msg), 'warning');
     }
     return true;
 }
Esempio n. 10
0
 /**
  * Test pulling data from a single column (by index or association).
  *
  * @param   array   $input    Input array
  * @param   mixed   $index    Column to pull, either by association or number
  * @param   array   $expect   The expected results
  * @param   string  $message  The failure message
  *
  * @return  void
  *
  * @dataProvider  seedTestGetColumn
  * @covers        Joomla\Utilities\ArrayHelper::getColumn
  * @since         1.0
  */
 public function testGetColumn($input, $index, $expect, $message)
 {
     $this->assertEquals($expect, ArrayHelper::getColumn($input, $index), $message);
 }
Esempio n. 11
0
 /**
  * @covers Windwalker\DataMapper\AbstractDataMapper::updateAll
  * @todo   Implement testUpdateAll().
  */
 public function testFlush()
 {
     $mapper = new DataMapper('ww_content_tags');
     $dataset = new DataSet();
     $dataset[] = new Data(array('content_id' => 4, 'tag_id' => 1));
     $dataset[] = new Data(array('content_id' => 4, 'tag_id' => 2));
     $dataset[] = new Data(array('content_id' => 4, 'tag_id' => 4));
     $dataset[] = new Data(array('content_id' => 4, 'tag_id' => 5));
     $mapper->flush($dataset, array('content_id' => 4));
     $tagMaps = $mapper->find(array('content_id' => 4));
     $this->assertEquals(array(1, 2, 4, 5), ArrayHelper::getColumn((array) $tagMaps, 'tag_id'), 'Flush data wrong.');
 }
Esempio n. 12
0
 /**
  * Display the file in the table
  *
  * @param   string  $data     current cell data
  * @param   array   $thisRow  current row data
  *
  * @return	string
  */
 private function _renderListData($data, $thisRow)
 {
     $params = $this->getParams();
     if ($params->get('rating-mode') == 'creator-rating') {
         return $data;
     } else {
         $list = $this->getlistModel()->getTable();
         $listId = $list->id;
         $formId = $list->form_id;
         $d = $this->getListModel()->getData();
         $ids = ArrayHelper::getColumn($d, '__pk_val');
         $rowId = isset($thisRow->__pk_val) ? $thisRow->__pk_val : $thisRow->id;
         list($avg, $total) = $this->getRatingAverage($data, $listId, $formId, $rowId, $ids);
         return $avg;
     }
 }