Trying to display file set and now I am not able to
Permalink[quote]Fatal error: func_get_args(): Can't be used as a function in /home/cpctech/public_html/concrete/libaries/list_item on line 515[/quote]
And here is the code:
Loader::model("file_set"); Loader::model('file_list'); $fs = FileSet::getByName('Hilltop Notes 2012'); $fl = new FileList(); $fl->filterBySet($fs); $fl->sortByFileSetDisplayOrder($gs); $files = $fl->get(); //CHANGE SORT ORDER? Comment out the next line to show the first file in set $files = array_reverse($files); //It is possible to do this by Date, Title, etc. but willl do this by set $i=0; foreach($files as $f) if ($i < 1) { $url = View::url('/download_file/view_inline', $f->getFileID(),$cID); //$url = View::url('/download_file', $f->getFileID(),$cID); //$url = 'http://docs.google.com/viewer?url=' . urlencode(BASE_URL . DIR_REL . $url);
This worked great until we upgraded to 5.5.2.
Thanks,
Kent
When I go to sort the fileset I get an error. It worked great in 5.5.1
dashboard> fileset >
http://site.com/index.php/dashboard/files/sets/...
http://site.com/index.php/dashboard/files/sets/view_detail/1/...
Fatal error: func_get_args(): Can't be used as a function parameter in /home/cayercre/public_html/crane/concrete/libraries/item_list.php on line 515
What is up with that? I even went back through the upgrade script.
Grr..
Kent
$args = func_get_args(); for ($i = 0; $i < count($args); $i++) { $this->sortByString .= $args[$i]; if (($i + 1) < count($args)) { $this->sortByString .= ', '; } }
HTH,
Kent
replace
$this->sortByString = implode(', ', func_get_args());
with
$args = func_get_args(); $this->sortByString = implode(', ', $args);
Thanks.
Kent
The problem is that it's looking for the fsDisplayOrder column which doesn't exist. This column can be found in the FileSetFiles table so we just need to join them in the query with this line of code:
->leftJoin('f', 'FileSetFiles', 'fsf', 'f.fID = fsf.fID')
Easiest way is to make a custom class which extends the FileList class like this:
class Custom_FileList extends FileList { public function createQuery() { $this->query->select('f.fID') ->from('Files', 'f') ->innerJoin('f', 'FileVersions', 'fv', 'f.fID = fv.fID and fv.fvIsApproved = 1') ->leftJoin('f', 'FileSearchIndexAttributes', 'fsi', 'f.fID = fsi.fID') ->leftJoin('f', 'FileSetFiles', 'fsf', 'f.fID = fsf.fID') ->leftJoin('f', 'Users', 'u', 'f.uID = u.uID'); } }
Hope this helps :)
$fl->sortByFileSetDisplayOrder($fs);
commenting this line out causes this to work - partly.
//$fl->sortByFileSetDisplayOrder($fs);
Thanks,
Kent