b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.10) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Class: Filelist

Source Location: /blogs/inc/MODEL/files/_filelist.class.php

Class Filelist

Property Summary
mixed   $flatmode   Flat mode? (all files recursive without dirs)
boolean   $include_dirs  
boolean   $include_files  
boolean|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.
NULL|string   $_filter   Filename filter pattern
NULL|boolean   $_filter_is_regexp   Is the filter a regular expression?
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|NULL   $_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  
integer   $_total_dirs  
integer   $_total_entries   Number of entries in the $_entries array
integer   $_total_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.
false|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
string   get_filter()   Return the current filter
boolean|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 63]

Flat mode? (all files recursive without dirs)

API Tags:
Usedby:  Filelist::load()


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

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

[ Top ]
boolean|string   $_ads_list_path = false [line 92]

Path to list with trailing slash.

false if we are constructing an arbitrary list (i-e not tied to a single directory)

API Tags:
Access:  protected


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

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 237]

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 82]

The root of the file list.

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


[ Top ]
NULL|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 ]
NULL|boolean   $_filter_is_regexp = NULL [line 128]

Is the filter a regular expression?

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 220]

What column is the list ordered on?

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

API Tags:
Access:  protected


[ Top ]
boolean|NULL   $_order_asc = NULL [line 230]

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)

API Tags:
Access:  protected


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

User preference: Load and show hidden files?

"Hidden files" are prefixed with a dot .


[ Top ]
integer   $_total_bytes = 0 [line 200]
API Tags:
Access:  protected


[ Top ]
integer   $_total_dirs = 0 [line 188]
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 194]
API Tags:
Access:  protected


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

User preference: recursive size of dirs?

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

API Tags:
Access:  protected


[ Top ]
Methods
Constructor Filelist  [line 266]

  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 376]

  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 461]

  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 744]

  boolean contains( File &$File  )

Does the list contain a specific File?

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


[ Top ]
count  [line 786]

  integer count( )

Get the total number of entries in the list.



[ Top ]
count_bytes  [line 819]

  integer count_bytes( )

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



[ Top ]
count_dirs  [line 797]

  integer count_dirs( )

Get the total number of directories in the list



[ Top ]
count_files  [line 808]

  integer count_files( )

Get the total number of files in the list



[ Top ]
get_ads_list_path  [line 990]

  void get_ads_list_path( )

Get absolute path to list.



[ Top ]
get_array  [line 1077]

  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 898]

  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 940]

  false|File &get_by_idx( integer $index  )

Get a file by index.

Parameters:
integer   $index:  Index of the entries (starting with 0)


[ Top ]
get_by_md5_ID  [line 920]

  mixed &get_by_md5_ID( string $md5id  )

Get a file by it's ID.

Parameters:
string   $md5id:  the ID (MD5 of path and name)

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


[ Top ]
get_by_rdfs_path  [line 876]

  mixed &get_by_rdfs_path( string $rdfs_path  )

Get a file by its relative (to root) path.

Parameters:
string   $rdfs_path:  the RELATIVE path (with ending slash for directories)

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


[ Top ]
get_cwd_clickable  [line 1171]

  string get_cwd_clickable( [ $clickableOnly = true]  )

Returns cwd, where the accessible directories (below root) are clickable

Parameters:
   $clickableOnly: 

API Tags:
Return:  cwd as clickable html


[ Top ]
get_FileRoot  [line 959]

  FileRoot &get_FileRoot( )

Get the FileLists FileRoot



[ Top ]
get_filter  [line 756]

  string get_filter( [boolean $verbose = true]  )

Return the current filter

Parameters:
boolean   $verbose:  add a note when it's a regexp or no filter?

API Tags:
Return:  the filter


[ Top ]
get_next  [line 831]

  boolean|File &get_next( [string $type = '']  )

Get the next entry and increment internal counter.

Parameters:
string   $type:  can be used to query only 'file's or 'dir's.

API Tags:
Return:  object (by reference) on success, false on end of list


[ Top ]
get_rds_list_path  [line 998]

  void get_rds_list_path( )

Get path to list relative to root.



[ Top ]
get_root_ID  [line 981]

  FileRoot get_root_ID( )

Get the FileLists root ID (in_type_ID).



[ Top ]
get_root_type  [line 970]

  string get_root_type( )

Get the FileLists root type.



[ Top ]
get_sort_link  [line 623]

  string get_sort_link( string $type, string $atext  )

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.

Parameters:
string   $type:  The type (name, path, size, ..)
string   $atext:  The text for the anchor.

Information Tags:
Todo:  get this outta here. This is NOT a displayable object. We might want to have a "FileListResults" object that derives from Widget/Results/FilteredResults (the more the better) This object is what the SQL or the ItemQuery object is to Results or to ItemList2. The model and the display should not be mixed. IF NOT doing the clean objects, move this at least to file.funcs.

[ Top ]
get_sort_order  [line 603]

  string get_sort_order( )

Get the used order.



[ Top ]
is_filtering  [line 732]

  boolean is_filtering( )

Is a filter active?



[ Top ]
is_filter_regexp  [line 775]

  NULL|boolean is_filter_regexp( )

Is the current Filter a regexp?


API Tags:
Return:  true if regexp, NULL if no filter set


[ Top ]
is_sorting_asc  [line 676]

  integer is_sorting_asc( [string $col = '']  )

Are we sorting ascending?

Parameters:
string   $col:  The type (empty for current order type)

API Tags:
Return:  1 for ascending sorting, 0 for descending


[ Top ]
load  [line 298]

  boolean load( )

Loads or reloads the filelist entries.

NOTE: this does not work for arbitrary lists!


API Tags:
Return:  True on sucess, false on failure (not accessible)
Uses:  Filelist::$flatmode


[ Top ]
load_meta  [line 1117]

  void load_meta( )

Attempt to load meta data for all files in the list.

Will attempt only once per file and cache the result.



[ Top ]
md5_checksum  [line 1106]

  string md5_checksum( )

Get a MD5 checksum over the entries.

Used to identify a unique filelist.


API Tags:
Return:  md5 hash


[ Top ]
rdfs_relto_root_from_adfs  [line 1010]

  string rdfs_relto_root_from_adfs( string $adfs_path  )

Get the path (and name) of a File relative to the Filelist::_FileRoot->ads_path.

Parameters:
string   $adfs_path: 


[ Top ]
remove  [line 1030]

  boolean remove( &$File  )

Removes a File from the entries list.

This handles indexes and number of total entries, bytes, files/dirs.

Parameters:
   &$File: 

API Tags:
Return:  true on success, false if not found in list.


[ Top ]
restart  [line 664]

  void restart( )

Reset the iterator



[ Top ]
set_filter  [line 699]

  void set_filter( string $filter_string, boolean $filter_is_regexp  )

Set the filter.

Parameters:
string   $filter_string:  Filter string (for regular expressions, if no delimiter/modifiers are included, we try magically adding them)
boolean   $filter_is_regexp:  Is the filter a regular expression? (it's a glob pattern otherwise)


[ Top ]
sort  [line 478]

  void sort( [string $order = NULL], [boolean $orderasc = NULL], [boolean $dirsattop = NULL]  )

Sort the entries by sorting the internal $_order_index array.

Parameters:
string   $order:  The order to use ('name', 'type', 'lastmod', .. )
boolean   $orderasc:  Ascending (true) or descending
boolean   $dirsattop:  Sort directories at top?


[ Top ]
update_caches  [line 434]

  void update_caches( )

Update the name dependent caches

This is especially useful after a name change of one of the files in the list



[ Top ]
_sort_callback  [line 521]

  integer _sort_callback( $a, $b  )

usort callback function for Filelist::sort()

Parameters:
   $a: 
   $b: 

API Tags:
Access:  protected


[ Top ]

Documentation generated on Tue, 20 May 2008 01:39:52 +0200 by phpDocumentor 1.4.2