.

DAOJcsscompressedfiles Class Reference

Inheritance diagram for DAOJcsscompressedfiles:
DataObjectBase IDataObject IActionSource ISearchAdapter IDBTable IDBWhereHolder

List of all members.

Public Member Functions

  get_versioned_filename ()
  Returns versioned filename.
  substitute ($arr_files)
  Substitute any of the files given in $arr_files.

Public Attributes

  $filename
  $hash
  $num_sources
  $sources
  $type
  $version

Protected Member Functions

  create_table_object ()
  Create the table object describing this dataobejcts table.

Detailed Description

Definition at line 2 of file jcsscompressedfiles.model.php.


Member Function Documentation

DAOJcsscompressedfiles::create_table_object (  )  [protected]

Create the table object describing this dataobejcts table.

Reimplemented from DataObjectBase.

Definition at line 14 of file jcsscompressedfiles.model.php.

00014                                                  {
00015                 return new DBTable(
00016                         'jcsscompressedfiles',
00017                         array(
00018                                 new DBFieldEnum('type', array_keys(JCSSManager::get_types()),  null, DBField::NOT_NULL),
00019                                 new DBFieldText('filename', 255, null, DBField::NOT_NULL),
00020                                 new DBFieldText('hash', 255, null, DBField::NOT_NULL),
00021                                 new DBFieldInt('num_sources', 1, DBFieldInt::UNSIGNED | DBField::NOT_NULL),
00022                                 new DBFieldSerialized('sources', DBFieldText::BLOB_LENGTH_SMALL, null, DBField::NOT_NULL),
00023                                 new DBFieldInt('version', 1,DBFieldInt::UNSIGNED | DBField::NOT_NULL)
00024                         ),
00025                         array('type', 'filename')
00026                 );              
00027         }
DAOJcsscompressedfiles::get_versioned_filename (  ) 

Returns versioned filename.

Returns:
string

Definition at line 34 of file jcsscompressedfiles.model.php.

00034                                                  {
00035                 $arr = explode('.', $this->filename);
00036                 $ext = array_pop($arr);
00037                 $arr[] = $this->version;
00038                 $arr[] = $ext;
00039                 return implode('.', $arr);                      
00040         }
DAOJcsscompressedfiles::substitute ( arr_files  ) 

Substitute any of the files given in $arr_files.

Parameters:
array  $arr_files
Returns:
array Array of files

Definition at line 48 of file jcsscompressedfiles.model.php.

00048                                                {
00049                 if (count($arr_files) < count($this->sources)) {
00050                         return $arr_files;
00051                 }
00052                 
00053                 $ret = array();
00054                 $matches = 0;
00055                 foreach($arr_files as $file) {
00056                         if (in_array($file, $this->sources)) {
00057                                 if ($matches == 0) {
00058                                         $ret[] = $this->get_versioned_filename();
00059                                 }
00060                                 $matches++;
00061                         }
00062                         else {
00063                                 $ret[] = $file;
00064                         }
00065                 }
00066                 
00067                 if ($matches != count($this->sources)) {
00068                         $ret = $arr_files;
00069                 }
00070                 
00071                 return $ret;
00072         }

Member Data Documentation

DAOJcsscompressedfiles::$filename

Definition at line 4 of file jcsscompressedfiles.model.php.

DAOJcsscompressedfiles::$hash

Definition at line 5 of file jcsscompressedfiles.model.php.

DAOJcsscompressedfiles::$num_sources

Definition at line 6 of file jcsscompressedfiles.model.php.

DAOJcsscompressedfiles::$sources

Definition at line 7 of file jcsscompressedfiles.model.php.

DAOJcsscompressedfiles::$type

Definition at line 3 of file jcsscompressedfiles.model.php.

DAOJcsscompressedfiles::$version

Definition at line 8 of file jcsscompressedfiles.model.php.


The documentation for this class was generated from the following file: