phpDocumentor files
[ class tree: files ] [ index: files ] [ all elements ]

Class: Filelist

Source Location: /qp_inc/files/model/_filelist.class.php

Class Filelist

Property Summary
mixed   $flatmode   Flat mode? (all files recursive without dirs)
boolean   $include_dirs   Do we want to include directories? (This gets used by load()).
boolean   $include_files   Do we want to include files? (This gets used by load()).
string   $_ads_list_path   Path to list with trailing slash.
integer   $_current_idx   Index of the current iterator position.
boolean   $_dirs_not_at_top   User preference: Sort dirs not at top
array   $_entries   The list of Files.
FileRoot   $_FileRoot   The root of the file list.
string   $_filter   Filename filter pattern
boolean   $_filter_is_regexp   Is the filter a regular expression? NULL if unknown
array   $_full_path_index   Index on full paths (path => $_entries key).
array   $_md5_ID_index   Index on File IDs (id => $_entries key).
string   $_order   What column is the list ordered on?
boolean   $_order_asc   Are we sorting ascending (or descending)?
array   $_order_index   Index on sort order (order # => $_entries key).
array   $_rdfs_rel_path_index   Index on (r)elative (s)lash terminated (f)ile/(d)irectory paths (rdfs_path => key into $_entries).
mixed   $_rds_list_path   Path to list reltive to root, with trailing slash
boolean   $_show_hidden_files   User preference: Load and show hidden files?
integer   $_total_bytes   Number of bytes
integer   $_total_dirs   Number of directories
integer   $_total_entries   Number of entries in the $_entries array
integer   $_total_files   Number of files
boolean   $_use_recursive_dirsize   User preference: recursive size of dirs?

[ Top ]
Method Summary
Filelist   Filelist()   Constructor
boolean   add()   Add a File object to the list (by reference).
boolean   add_by_subpath()   Add a file to the list, by filename.
boolean   contains()   Does the list contain a specific File?
integer   count()   Get the total number of entries in the list.
integer   count_bytes()   Get the total number of bytes of all files in the list
integer   count_dirs()   Get the total number of directories in the list
integer   count_files()   Get the total number of files in the list
void   get_ads_list_path()   Get absolute path to list.
array   get_array()   Get the list of File entries.
mixed   &get_by_full_path()   Get a file by its full path.
File   &get_by_idx()   Get a file by index.
mixed   &get_by_md5_ID()   Get a file by it's ID.
mixed   &get_by_rdfs_path()   Get a file by its relative (to root) path.
string   get_cwd_clickable()   Returns cwd, where the accessible directories (below root) are clickable
FileRoot   &get_FileRoot()   Get the FileLists FileRoot
int   get_File_size()   Get the size of a given File, according to $_use_recursive_dirsize.
string   get_File_size_formatted()   Get size of the file/dir, formatted to nearest unit (kb, mb, etc.)
string   get_filter()   Return the current filter
File   &get_next()   Get the next entry and increment internal counter.
void   get_rds_list_path()   Get path to list relative to root.
FileRoot   get_root_ID()   Get the FileLists root ID (in_type_ID).
string   get_root_type()   Get the FileLists root type.
string   get_sort_link()   Get the link to sort by a column. Handle current order and appends an icon to reflect the current state (ascending/descending), if the column is the same we're sorting by.
string   get_sort_order()   Get the used order.
boolean   is_filtering()   Is a filter active?
NULL|boolean   is_filter_regexp()   Is the current Filter a regexp?
integer   is_sorting_asc()   Are we sorting ascending?
boolean   load()   Loads or reloads the filelist entries.
void   load_meta()   Attempt to load meta data for all files in the list.
string   md5_checksum()   Get a MD5 checksum over the entries.
string   rdfs_relto_root_from_adfs()   Get the path (and name) of a File relative to the Filelist::$_FileRoot::$ads_path.
boolean   remove()   Removes a File from the entries list.
void   restart()   Reset the iterator
void   set_filter()   Set the filter.
void   sort()   Sort the entries by sorting the internal $_order_index array.
void   update_caches()   Update the name dependent caches
integer   _sort_callback()   usort callback function for Filelist::sort()

[ Top ]
Properties
mixed   $flatmode [line 59]

Flat mode? (all files recursive without dirs)

API Tags:
Usedby:  Filelist::load()


[ Top ]
boolean   $include_dirs = true [line 65]

Do we want to include directories? (This gets used by load()).


[ Top ]
boolean   $include_files = true [line 71]

Do we want to include files? (This gets used by load()).


[ Top ]
string   $_ads_list_path = false [line 91]

Path to list with trailing slash.

false if we are constructing an arbitrary list (i-e not tied to a single directory) fp> should use NULL instead of false

API Tags:
Access:  protected


[ Top ]
integer   $_current_idx = -1 [line 213]

Index of the current iterator position.

This is the key of $_order_index

API Tags:
Access:  protected


[ Top ]
boolean   $_dirs_not_at_top = false [line 240]

User preference: Sort dirs not at top


[ Top ]
array   $_entries = array() [line 135]

The list of Files.

API Tags:
Access:  protected


[ Top ]
FileRoot   $_FileRoot [line 80]

The root of the file list.

All files in this list MUST have that same FileRoot. Adding will fail otherwise.


[ Top ]
string   $_filter = NULL [line 117]

Filename filter pattern

Will be matched against the filename part (not the path) NULL if disabled

Can be a regular expression (see Filelist::$_filter_is_regexp), internally with delimiters/modifiers!

Use set_filter() to set it.

API Tags:
Access:  protected


[ Top ]
boolean   $_filter_is_regexp = NULL [line 128]

Is the filter a regular expression? NULL if unknown

Use set_filter() to set it.

API Tags:
See:  Filelist::$_filter
Access:  protected


[ Top ]
array   $_full_path_index = array() [line 154]

Index on full paths (path => $_entries key).

API Tags:
Access:  protected

Information Tags:
Todo:  make these direct links to &File objects

[ Top ]
array   $_md5_ID_index = array() [line 146]

Index on File IDs (id => $_entries key).

Note: fplanque>> what's the purpose of the md5 IDs??

API Tags:
Access:  protected

Information Tags:
Todo:  make these direct links to &File objects

[ Top ]
string   $_order = NULL [line 223]

What column is the list ordered on?

Possible values are: 'name', 'path', 'type', 'size', 'lastmod', 'perms'

API Tags:
Access:  protected


[ Top ]
boolean   $_order_asc = NULL [line 233]

Are we sorting ascending (or descending)?

NULL is default and means ascending for 'name', descending for the rest

API Tags:
Access:  protected


[ Top ]
array   $_order_index = array() [line 172]

Index on sort order (order # => $_entries key).

API Tags:
Access:  protected

Information Tags:
Todo:  make these direct links to &File objects

[ Top ]
array   $_rdfs_rel_path_index = array() [line 164]

Index on (r)elative (s)lash terminated (f)ile/(d)irectory paths (rdfs_path => key into $_entries).

API Tags:
Access:  protected

Information Tags:
Todo:  make these direct links to &File objects

[ Top ]
mixed   $_rds_list_path = false [line 102]

Path to list reltive to root, with trailing slash

false if we are constructing an arbitrary list (i-e not tied to a single directory) fp> should use NULL instead of false

API Tags:
Access:  protected


[ Top ]
boolean   $_show_hidden_files = false [line 249]

User preference: Load and show hidden files?

"Hidden files" are prefixed with a dot .


[ Top ]
integer   $_total_bytes = 0 [line 203]

Number of bytes

API Tags:
Access:  protected


[ Top ]
integer   $_total_dirs = 0 [line 189]

Number of directories

API Tags:
Access:  protected


[ Top ]
integer   $_total_entries = 0 [line 182]

Number of entries in the $_entries array

Note: $_total_entries = $_total_dirs + $_total_files

API Tags:
Access:  protected


[ Top ]
integer   $_total_files = 0 [line 196]

Number of files

API Tags:
Access:  protected


[ Top ]
boolean   $_use_recursive_dirsize = false [line 259]

User preference: recursive size of dirs?

The load() & sort() methods use this.

API Tags:
Access:  protected


[ Top ]
Methods
Constructor Filelist  [line 269]

  Filelist Filelist( FileRoot $FileRoot, [boolean|string $path = NULL], integer 2  )

Constructor

Parameters:
integer   2:  ID of the user, the group or the collection the file belongs to...
FileRoot   $FileRoot:  See FileRootCache::get_by_type_and_ID()
boolean|string   $path:  Default path for the files, false if you want to create an arbitrary list; NULL for the Fileroot's ads_path.


[ Top ]
add  [line 383]

  boolean add( File &$File, [boolean $mustExist = false]  )

Add a File object to the list (by reference).

Parameters:
File   &$File:  File object (by reference)
boolean   $mustExist:  Has the file to exist to get added?

API Tags:
Return:  true on success, false on failure


[ Top ]
add_by_subpath  [line 496]

  boolean add_by_subpath( string $rel_path, [boolean $mustExist = false]  )

Add a file to the list, by filename.

This is a stub for Filelist::add().

Parameters:
string   $rel_path:  Subpath for this file/folder, relative the associated root, including trailing slash (if directory)
boolean   $mustExist:  Has the file to exist to get added?

API Tags:
Return:  true on success, false on failure (path not allowed, file does not exist)


[ Top ]
contains  [line 776]

  boolean contains( File &$File  )

Does the list contain a specific File?

Parameters:
File   &$File:  the File object to look for


[ Top ]
count  [line 818]

  integer count( )

Get the total number of entries in the list.



[ Top ]
count_bytes  [line 851]

  integer count_bytes( )

Get the total number of bytes of all files in the list



[ Top ]
count_dirs  [line 829]

  integer count_dirs( )

Get the total number of directories in the list



[ Top ]
count_files  [line 840]

  integer count_files( )

Get the total number of files in the list



[ Top ]
get_ads_list_path  [line 1025]

  void get_ads_list_path( )

Get absolute path to list.



[ Top ]
get_array  [line 1112]

  array get_array( [string $method = NULL]  )

Get the list of File entries.

You can use a method on each object to get this as result instead of the object itself.

Parameters:
string   $method:  Use this method on every File and put the result into the list.

API Tags:
Return:  The array with the File objects or method results


[ Top ]
get_by_full_path  [line 930]

  mixed &get_by_full_path( string $adfs_path  )

Get a file by its full path.

Parameters:
string   $adfs_path:  the full/absolute path (with ending slash for directories)

API Tags:
Return:  File object (by reference) on success, false on failure.


[ Top ]
get_by_idx  [line 973]

  File &get_by_idx( integer $index, [boolean $halt_on_error = true]  )

Get a file by index.

Parameters:
integer   $index:  Index of the entries (starting with 0)
boolean   $halt_on_error:  added by fp (set to false when it's a problem)


[ Top ]
get_by_md5_ID  [line 952]

  mixed &get_by_md5_ID( string $md5id  )

Get a file by it's ID.

Parameters:
s