forked from pollen8/fabrik
/
list.php
12118 lines (10292 loc) · 317 KB
/
list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Fabrik List Model
*
* @package Joomla
* @subpackage Fabrik
* @copyright Copyright (C) 2005-2013 fabrikar.com - All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.modelform');
require_once COM_FABRIK_FRONTEND . '/helpers/pagination.php';
require_once COM_FABRIK_FRONTEND . '/helpers/list.php';
/**
* Fabrik List Model
*
* @package Joomla
* @subpackage Fabrik
* @since 3.0
*/
class FabrikFEModelList extends JModelForm
{
/**
* List id
*
* @var int
*/
public $id = null;
/**
* package id
*
* @var int
*/
public $packageId = null;
/**
* Lists connection object
*
* @var object
*/
protected $connection = null;
/**
* List item
*
* @var JTable
*/
protected $table = null;
/**
* List's form model
*
* @var FabrikFEModelForm
*/
protected $formModel = null;
/**
* Joins
*
* @var array
*/
private $joins = null;
/**
* Column calculations
* @var array
*/
protected $runCalculations = array();
/**
* List output format - set to rss to collect correct element data within function getData()
*
* @var string
*/
protected $outputFormat = 'html';
/**
* Is rendered as a J content plugin
*
* @var bool
*/
public $isMambot = false;
/**
* Contain access rights
*
* @var object
*/
protected $access = null;
/**
* Id of the last inserted record (or if updated the last record updated)
*
* @var int
*/
public $lastInsertId = null;
/**
* Database fields
*
* @var array
*/
protected $dbFields = null;
/**
* Used when making custom links to determine if we need to append the rowid to the url
*
* @var bool
*/
protected $rowIdentifierAdded = false;
/**
* Is ajax used
*
* @var bool
*/
public $ajax = null;
/**
* Join sql
*
* @var string
*/
protected $joinsSQL = null;
/**
* Order by column names
*
* @var array
*/
protected $orderByFields = null;
protected $joinsToThisKey = null;
protected $linksToThisKey = null;
/**
* Used to determine which filter action to use.
* If a filter is a range then override lists setting with onsubmit
*
* @var string
*/
protected $real_filter_action = null;
/**
* Internally used when using parseMessageForRowHolder();
*
* @var array
*/
protected $aRow = null;
/**
* Rows to delete
*
* @var array
*/
public $rowsToDelete = null;
/**
* Original list data BEFORE form saved - used to ensure uneditable data is stored
*
* @var array
*/
protected $origData = null;
/**
* Set to true to load records STARTING from a random id (used in the getPageNav func)
*
* @var bool
*/
public $randomRecords = false;
/**
* List data
*
* @var array
*/
protected $data = null;
/**
* Template name
*
* @var string
*/
protected $tmpl = null;
/**
* Pagination
*
* @var FPagination
*/
protected $nav = null;
/**
* List field names
*
* @var array
*/
protected $fields = null;
/**
* Prefilters
*
* @var array
*/
protected $prefilters = null;
/**
* Filters
*
* @var array
*/
public $filters = null;
/**
* Can rows be selected
*
* @var bool
*/
protected $canSelectRows = null;
/**
* As fields - used in query to build list data
*
* @var array
*/
public $asfields = null;
/**
* Has an element, which is the db key, already been added to the list of fields to select
*
* @var bool
*/
public $temp_db_key_addded = false;
/**
* Has the group by statement been added to the list query
*
* @var bool
*/
protected $group_by_added = false;
/**
* List of where conditions added by list plugins
*
* @var array
*/
protected $pluginQueryWhere = array();
/**
* List of group by statements added by list plugins
*
* @var array
*/
public $pluginQueryGroupBy = array();
/**
* Used in views for rendering
*
* @var array
*/
public $groupTemplates = array();
/**
* Is the list a view
*
* @var bool
*/
protected $isView = null;
/**
* Index objects
*
* @var array
*/
protected $indexes = null;
/**
* Previously submitted advanced search data
*
* @var array
*/
protected $advancedSearchRows = null;
/**
* List action url
*
* @var string
*/
protected $tableAction = null;
/**
* Doing CSV import
*
* @var bool
*/
public $importingCSV = false;
/**
* CSV in overwite mode
*
* @var bool
*/
public $csvOverwriting = false;
/**
* Element names to encrypt
*
* @var array
*/
public $encrypt = array();
/**
* Which record number to start showing from
*
* @var int
*/
public $limitStart = null;
/**
* Number of records per page
*
* @var int
*/
public $limitLength = null;
/**
* List rows
*
* @var array
*/
protected $rows = null;
/**
* Should a heading be added for action buttons (returns true if at least one row has buttons)
*
* @deprecated (since 3.0.7)
*
* @var bool
*/
protected $actionHeading = false;
/**
* List of column data - used for filters
*
* @var array
*/
protected $columnData = array();
/**
* Render context used for defining custom css variable for tmpl rendering e.g. module_1
*
* @var string
*/
protected $renderContext = '';
/**
* The max number of buttons that is shown in a row
*
* @var int
*/
protected $rowActionCount = 0;
/**
* Do any of the elements have a required filter, only used through method of same name
*
* @var bool
*/
protected $hasRequiredElementFilters = null;
/**
* Elements which have a required filter
*
* @var array
*/
protected $elementsWithRequiredFilters = array();
/**
* Force formatData() to format all elements, uses formatAll() accessor method
*
* @var bool
*/
protected $format_all = false;
/**
* Array of order by elements
*
* @var array
*/
public $orderEls = array();
/**
* Cached order by statement
*
* @since 3.0.7
*
* @var array - string and/or JQueryBuilder section
*/
public $orderBy = array();
/**
* Tabs field to use
*
* @since 3.1
*
* @var string
*/
protected $tabsField = null;
/**
* Tabs to display
*
* @since 3.1
*
* @var array
*/
protected $tabs = null;
/**
* Filter js code
*
* @var string
*/
public $filterJs = null;
/**
* Load form
*
* @param array $data form data
* @param bool $loadData load in the data
*
* @since 1.5
*
* @return mixed false or form.
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_fabrik.list', 'view', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$usersConfig = JComponentHelper::getParams('com_fabrik');
$app = JFactory::getApplication();
$input = $app->input;
$id = $input->getInt('listid', $usersConfig->get('listid'));
$this->packageId = (int) $input->getInt('packageId', $usersConfig->get('packageId'));
$this->setId($id);
$this->access = new stdClass;
}
/**
* Process the lists plug-ins
*
* @return array of list plug-in result messages
*/
public function processPlugin()
{
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->runPlugins('process', $this, 'list');
return $pluginManager->data;
}
/**
* Code to enable plugins to add a button to the top of the list
*
* @return array button html
*/
public function getPluginTopButtons()
{
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->runPlugins('topButton', $this, 'list');
$buttons = $pluginManager->data;
return $buttons;
}
/**
* Get the html that is outputted by list plug-in buttons
*
* @return array buttons
*/
public function getPluginButtons()
{
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->getPlugInGroup('list');
$pluginManager->runPlugins('button', $this, 'list');
$buttons = $pluginManager->data;
return $buttons;
}
/**
* Get an array of plugin js classes to load
*
* @param array &$r Previously loaded classes
* @param array &$shim Shim object to ini require.js
*
* @return array
*/
public function getPluginJsClasses(&$r = array(), &$shim = array())
{
$r = (array) $r;
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->getPlugInGroup('list');
$src = array();
$pluginManager->runPlugins('loadJavascriptClass', $this, 'list', $src);
foreach ($pluginManager->data as $f)
{
if (is_null($f) || $f == '')
{
continue;
}
if (is_array($f))
{
$r = array_merge($r, $f);
}
else
{
$r[] = $f;
}
}
$pluginManager->runPlugins('requireJSShim', $this, 'list');
foreach ($pluginManager->data as $ashim)
{
$shim = array_merge($shim, $ashim);
}
return $r;
}
/**
* Get plugin js objects
*
* @param string $container list container HTML id
*
* @return mixed
*/
public function getPluginJsObjects($container = null)
{
if (is_null($container))
{
$container = 'listform_' . $this->getId();
}
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->getPlugInGroup('list');
$pluginManager->runPlugins('onLoadJavascriptInstance', $this, 'list', $container);
return $pluginManager->data;
}
/**
* Main query to build table
*
* @return array list data
*/
public function render()
{
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->runPlugins('onBeforeListRender', $this, 'list');
FabrikHelperHTML::debug($_POST, 'render:post');
$app = JFactory::getApplication();
$input = $app->input;
$profiler = JProfiler::getInstance('Application');
$id = $this->getId();
$this->outputFormat = $input->get('format', 'html');
if (is_null($id) || $id == '0')
{
throw new RuntimeException(FText::_('COM_FABRIK_INCORRECT_LIST_ID'), 500);
}
if ($this->outputFormat == 'fabrikfeed')
{
$this->outputFormat = 'feed';
}
$item = $this->getTable();
if ($item->db_table_name == '')
{
throw new RuntimeException(FText::_('COM_FABRIK_INCORRECT_LIST_ID'), 500);
}
// Cant set time limit in safe mode so suppress warning
@set_time_limit(60);
JDEBUG ? $profiler->mark('About to get table filter') : null;
$filters = $this->getFilterArray();
JDEBUG ? $profiler->mark('Got filters') : null;
$this->setLimits();
$this->setElementTmpl();
$data = $this->getData();
JDEBUG ? $profiler->mark('got data') : null;
// Think we really have to do these as the calc isn't updated when the list is filtered
$this->doCalculations();
JDEBUG ? $profiler->mark('done calcs') : null;
$this->getCalculations();
JDEBUG ? $profiler->mark('got calcs') : null;
$item->hit();
return $data;
}
/**
* Set the navigation limit and limitstart
*
* @param int $limitstart_override Specific limitstart to use, if both start and length are specified
* @param int $limitlength_override Specific limitlength to use, if both start and length are specified
*
* @return void
*/
public function setLimits($limitstart_override = null, $limitlength_override = null)
{
$app = JFactory::getApplication();
$input = $app->input;
// Plugins using setLimits - these limits would get overwritten by render() or getData() calls
if (isset($this->limitLength) && isset($this->limitStart) && is_null($limitstart_override) && is_null($limitlength_override))
{
return;
}
/*
* $$$ hugh - added the overrides, so things like visualizations can just turn
* limits off, by passing 0's, without having to go round the houses setting
* the request array before calling this method.
*/
if (!is_null($limitstart_override) && !is_null($limitlength_override))
{
// Might want to set the request vars here?
$limitStart = $limitstart_override;
$limitLength = $limitlength_override;
}
else
{
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$item = $this->getTable();
$params = $this->getParams();
$id = $this->getId();
$this->randomRecords = $input->get('fabrik_random', $this->randomRecords);
// $$$ rob don't make the key list.X as the registry doesn't seem to like keys with just '1' a
$context = 'com_' . $package . '.list' . $this->getRenderContext() . '.';
$limitStart = $this->randomRecords ? $this->getRandomLimitStart() : 0;
// Deal with the fact that you can have more than one list on a page so limitstart has to be specific per table
// If list is rendered as a content plugin don't set the limits in the session
if ($app->scope == 'com_content')
{
$limitLength = $input->getInt('limit' . $id, $item->rows_per_page);
if (!$this->randomRecords)
{
$limitStart = $input->getInt('limitstart' . $id, $limitStart);
}
}
else
{
// If a list (assoc with a menu item) loads a form, with db join & front end select - don't use the orig menu's rows_per_page value.
$mambot = $this->isMambot || ($input->get('tmpl') === 'component' && $input->getInt('ajax') === 1);
$rowsPerPage = FabrikWorker::getMenuOrRequestVar('rows_per_page', $item->rows_per_page, $mambot);
$limitLength = $app->getUserStateFromRequest($context . 'limitlength', 'limit' . $id, $rowsPerPage);
if (!$this->randomRecords)
{
$limitStart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart' . $id, $limitStart, 'int');
}
}
if ($this->outputFormat == 'feed')
{
$limitLength = $input->getInt('limit', $params->get('rsslimit', 150));
$maxLimit = $params->get('rsslimitmax', 2500);
if ($limitLength > $maxLimit)
{
$limitLength = $maxLimit;
}
}
if ($limitStart < 0)
{
$limitStart = 0;
}
}
$this->limitLength = $limitLength;
$this->limitStart = $limitStart;
}
/**
* This merges session data for the fromForm with any request data
* allowing us to filter data results from both search forms and filters
*
* @return array
*/
public function getRequestData()
{
$profiler = JProfiler::getInstance('Application');
JDEBUG ? $profiler->mark('start get Request data') : null;
$f = $this->getFilterModel()->getFilters();
JDEBUG ? $profiler->mark('end get Request data') : null;
return $f;
}
/**
* Get the table's filter model
*
* @return model filter model
*/
public function &getFilterModel()
{
if (!isset($this->filterModel))
{
$this->filterModel = JModelLegacy::getInstance('Listfilter', 'FabrikFEModel');
$this->filterModel->setListModel($this);
}
return $this->filterModel;
}
/**
* Once we have a few table joins, our select statements are
* getting big enough to hit default select length max in MySQL.
* Added per-list setting to enable_big_selects.
*
* 03/10/2012 - Should preserve any old list settings, but this is now set in the global config
* We set it on the main J db in the system plugin setBigSelects() but should do here as well as we
* may not be dealing with the same db.
*
* 2012-10-19 - $$$ hugh - trouble with preserving old list settings is there is no way to change them, without
* directly poking around in the params in the database. Commenting out the per-list checking.
*
* @deprecated now handled in FabrikHelper::getDbo(), as it needs to apply to all queries, including internal / default connection ones.
* @since 3/16/2010
*
* @return void
*/
public function setBigSelects()
{
$fbConfig = JComponentHelper::getParams('com_fabrik');
$bigSelects = $fbConfig->get('enable_big_selects', 0);
/*
$fabrikDb = $this->getDb();
$params = $this->getParams();
if ($params->get('enable_big_selects', $bigSelects))
*/
if ($bigSelects)
{
$fabrikDb = $this->getDb();
// $$$ hugh - added bumping up GROUP_CONCAT_MAX_LEN here, rather than adding YAFO for it
//$fabrikDb->setQuery("SET OPTION SQL_BIG_SELECTS=1, GROUP_CONCAT_MAX_LEN=10240");
if (version_compare($fabrikDb->getVersion(), '5.1.0', '>='))
{
$fabrikDb->setQuery("SET SQL_BIG_SELECTS=1, GROUP_CONCAT_MAX_LEN=10240");
}
else
{
$fabrikDb->setQuery("SET OPTION SQL_BIG_SELECTS=1, GROUP_CONCAT_MAX_LEN=10240");
}
$fabrikDb->execute();
}
}
/**
* Append to the list's data
*
* @param string $groupRef Group by reference (0 for non-grouped)
* @param object $row Row to append to the list
*
* @return array $this->data
*/
public function appendData($groupRef, $row)
{
$data = $this->getData();
if (array_key_exists($groupRef, $data))
{
$data[$groupRef][] = $row;
$this->data = $data;
}
return $this->data;
}
/**
* Get the table's data
*
* @return array of objects (rows)
*/
public function getData()
{
if (isset($this->data) && !is_null($this->data))
{
return $this->data;
}
$profiler = JProfiler::getInstance('Application');
$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->runPlugins('onPreLoadData', $this, 'list');
// Needs to be off for FOUND_ROWS() to work
ini_set('mysql.trace_mode', 'off');
JDEBUG ? $profiler->mark('query build start') : null;
// Ajax call needs to recall this - not sure why
$this->setLimits();
JDEBUG ? $profiler->mark('query build end') : null;
try
{
$this->finesseData();
}
catch (Exception $e)
{
$item = $this->getTable();
$msg = 'Fabrik has generated an incorrect query for the list ' . $item->label . ': <br /><br /><pre>' . $e->getMessage() . '</pre>';
throw new RuntimeException($msg, 500);
}
$nav = $this->getPagination($this->totalRecords, $this->limitStart, $this->limitLength);
// Pass the query as an object property so it can be updated via reference
$args = new stdClass;
$args->data =& $this->data;
$pluginManager->runPlugins('onLoadData', $this, 'list', $args);
return $this->data;
}
/**
* Method to run the getData select query and do our Fabrik magikin'
*
* @return void
*/
public function finesseData()
{
$profiler = JProfiler::getInstance('Application');
$traceModel = ini_get('mysql.trace_mode');
$fabrikDb = $this->getDb();
$this->setBigSelects();
$query = $this->buildQuery();
// $$$ rob - if merging joined data then we don't want to limit
// the query as we have already done so in buildQuery()
if ($this->mergeJoinedData() || $this->limitLength === -1)
{
$fabrikDb->setQuery($query);
}
else
{
$fabrikDb->setQuery($query, $this->limitStart, $this->limitLength);
}
FabrikHelperHTML::debug((string) $fabrikDb->getQuery(), 'list GetData:' . $this->getTable()->label);
JDEBUG ? $profiler->mark('before query run') : null;
/* set 2nd param to false in attempt to stop joomfish db adaptor from translating the original query
* fabrik3 - 2nd param in j16 is now used - guessing that joomfish now uses the third param for the false switch?
* $$$ rob 26/09/2011 note Joomfish not currently released for J1.7
*/
$this->data = $fabrikDb->loadObjectList('', 'stdClass', false);
// $$$ rob better way of getting total records
if ($this->mergeJoinedData())
{
$this->totalRecords = $this->getTotalRecords();
}
else
{
$fabrikDb->setQuery("SELECT FOUND_ROWS()");
$this->totalRecords = $fabrikDb->loadResult();
}
if ($this->randomRecords)
{
shuffle($this->data);
}
ini_set('mysql.trace_mode', $traceModel);
JDEBUG ? $profiler->mark('query run and data loaded') : null;
$this->translateData($this->data);
// Add labels before preformatting - otherwise calc elements on dropdown elements show raw data for {list___element}
$this->addLabels($this->data);
// Run calculations
$this->preFormatFormJoins($this->data);
JDEBUG ? $profiler->mark('start format for joins') : null;
$this->formatForJoins($this->data);
JDEBUG ? $profiler->mark('start format data') : null;
$this->formatData($this->data);
JDEBUG ? $profiler->mark('data formatted') : null;
}
/**
* Part of list model finesseData() replace list___element values with labels for
* things like dropdowns, needed so that calc elements in preFormatFormJoins() have access to the element
* label
*
* @param array &$data List data
*
* @return void
*/
protected function addLabels(&$data)
{
$form = $this->getFormModel();
$groups = $form->getGroupsHiarachy();
$ec = count($data);
foreach ($groups as $groupModel)
{
$elementModels = $this->activeContextElements($groupModel);
foreach ($elementModels as $elementModel)
{
$elementModel->setContext($groupModel, $form, $this);
$col = $elementModel->getFullName(false, true, false);
if (!empty($data) && array_key_exists($col, $data[0]))
{
for ($i = 0; $i < $ec; $i++)
{
$thisRow = $data[$i];
$coldata = $thisRow->$col;
$data[$i]->$col = $elementModel->getLabelForValue($coldata, $coldata);
}
}
}
}
}
/**
* $$$ rob pointless getting elements not shown in the table view?
* $$$ hugh - oops, they might be using elements in group-by template not shown in table
* http://fabrikar.com/forums/showthread.php?p=102600#post102600
* $$$ rob in that case lets test that rather than loading blindly
* $$$ rob 15/02/2011 or out put may be csv in which we want to format any fields not shown in the form
* $$$ hugh 06/05/2012 added formatAll() mechanism, so plugins can force formatting of all elements
*
* @param JModel $groupModel Group model
*
* @return array element models
*/
private function activeContextElements($groupModel)
{
$tableParams = $this->getParams();
if ($this->formatAll() || ($tableParams->get('group_by_template') !== '' && $this->getGroupBy() != '') || $this->outputFormat == 'csv'
|| $this->outputFormat == 'feed')
{
$elementModels = $groupModel->getPublishedElements();
}
else
{
/* $$$ hugh - added 'always render' option to elements, and methods to grab those.