src/Mgallegos/DecimaFile/File/Services/FileManagement/FileManager.php
public function getFolderChildrens(array $input)
  {
    $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id');
    $file = $this->File->byId($input['id']);
    $fileTree = array('text' => $file->name, 'state' => array('opened' => true) ,  'icon' => $file->icon, 'children' => array());
    $this->File->byParentId($input['id'], $organizationId)->each(function($file) use (&$fileTree)
    {
      if($file->type == 'C')
      {
        array_push($fileTree['children'], array('text' => $file->name, 'icon' => $file->icon));
      }
      else
      {
        array_push($fileTree['children'], array('text' => $file->name, 'icon' => $file->icon));
      }
    });
    //return json_encode(array('fileTree' => $FileTree, 'balanceTypeName' => $this->Lang->get('decima-Fileing::File-management.' . $File->balance_type), 'balanceTypeValue' => $File->balance_type, 'FileTypeName' => $FileType->name, 'FileTypeValue' => $File->File_type_id));
    return json_encode(array('fileTree' => $fileTree));
  }
public function getFolderChildrens(array $input)
  {
    $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id');
    $file = $this->File->byId($input['id']);
    $fileTree = array('text' => $file->name, 'state' => array('opened' => true) ,  'icon' => $file->icon, 'children' => array());
    $this->File->byParentId($input['id'], $organizationId)->each(function($file) use (&$fileTree)
    {
      if($file->type == 'C')
      {
        array_push($fileTree['children'], array('text' => $file->name, 'icon' => $file->icon));
      }
      else
      {
        array_push($fileTree['children'], array('text' => $file->name, 'icon' => $file->icon));
      }
    });
    //return json_encode(array('fileTree' => $FileTree, 'balanceTypeName' => $this->Lang->get('decima-Fileing::File-management.' . $File->balance_type), 'balanceTypeValue' => $File->balance_type, 'FileTypeName' => $FileType->name, 'FileTypeValue' => $File->File_type_id));
    return json_encode(array('fileTree' => $fileTree));
  }
public function getFolderChildrens ( array $ input ) { $ organizationId = $ this -> AuthenticationManager -> getCurrentUserOrganization ( 'id' ) ; $ file = $ this -> File -> byId ( $ input [ 'id' ] ) ; $ fileTree = array ( 'text' => $ file -> name , 'state' => array ( 'opened' => true ) , 'icon' => $ file -> icon , 'children' => array ( ) ) ; $ this -> File -> byParentId ( $ input [ 'id' ] , $ organizationId ) -> each ( function ( $ file ) use ( & $ fileTree ) { if ( $ file -> type == 'C' ) { array_push ( $ fileTree [ 'children' ] , array ( 'text' => $ file -> name , 'icon' => $ file -> icon ) ) ; } else { array_push ( $ fileTree [ 'children' ] , array ( 'text' => $ file -> name , 'icon' => $ file -> icon ) ) ; } } ) ; //return json_encode(array('fileTree' => $FileTree, 'balanceTypeName' => $this->Lang->get('decima-Fileing::File-management.' . $File->balance_type), 'balanceTypeValue' => $File->balance_type, 'FileTypeName' => $FileType->name, 'FileTypeValue' => $File->File_type_id)); return json_encode ( array ( 'fileTree' => $ fileTree ) ) ; }
Get Files children

@param array $input
An array as follows: array(id => $id);

@return JSON encoded string
A string as follows: [{"text" : $FileKey . " " . $accountName, "state" : {"opened" : true }, "icon" : $icon, "children" : [{"text" : $childAccountKey0 . " " . $childAccountName0, "icon" : $childIcon0}, …]}]
Get Files children