Trying to display file set and now I am not able to

Permalink
Just upgraded to 5.5.2. and when I try to use the following in the PHP block,, I gee the following error message:
[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

kdyer
 
kdyer replied on at Permalink Reply
kdyer
Found the problem line:

$fl->sortByFileSetDisplayOrder($fs);

commenting this line out causes this to work - partly.

//$fl->sortByFileSetDisplayOrder($fs);

Thanks,

Kent
cayercreative replied on at Permalink Reply
cayercreative
I am having the same issue on all 4 sites i have upgraded to 5.5.2

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/...
cayercreative replied on at Permalink Reply
cayercreative
this is the fatal error I get

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
kdyer replied on at Permalink Reply 1 Attachment
kdyer
And now.. My File Sets are messed up too!

What is up with that? I even went back through the upgrade script.

Grr..

Kent
kdyer replied on at Permalink Reply
kdyer
OK.. Fixed the line 515 issue.. Replace with what was in 5.5.1 for line 515..
$args = func_get_args();
      for ($i = 0; $i < count($args); $i++) {
         $this->sortByString .= $args[$i];
         if (($i + 1) < count($args)) { 
            $this->sortByString .= ', ';
         }
      }


HTH,

Kent
Mnkras replied on at Permalink Best Answer Reply
Mnkras
This is an issue with a specific version of php, to fix it,

replace
$this->sortByString = implode(', ', func_get_args());

with
$args = func_get_args();
$this->sortByString = implode(', ', $args);
kdyer replied on at Permalink Reply
kdyer
Awesome! Works great.

Thanks.

Kent
chrisjterrell replied on at Permalink Reply
chrisjterrell
Thanks... worked for me!
ld13 replied on at Permalink Reply
ld13
Worked for me too :)
ThornberryPie replied on at Permalink Reply
ThornberryPie
Here is the solution to get the broken sortByFileSetDisplayOrder() working.

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 :)