array( 'type' => 'int', 'col' => 'id_fichier', 'form' => 'idFichier', ), 'Nom' => array( 'type' => 'text', 'col' => 'nom_fichier', 'label' => true, ), 'Type' => array( 'type' => 'text', 'col' => 'type_fichier', ), 'Poids' => array( 'type' => 'int', 'col' => 'poids_fichier', ), 'Chemin' => array( 'type' => 'eval', 'value' => '$this->path.$this->Id', ), 'Fax' => array( 'type' => 'ext-object', 'class' => 'PGS_Fax', ), ); function getProperties() { return self::$properties; } function create($file) { if (is_array($file) && is_uploaded_file($file['tmp_name']) && $file['size'] > 0 && $file['error'] == 0) { $fichier = Object_Factory::Build(__CLASS__); $fichier->Nom = File_Util::webName($file['name']); $fichier->Type = 'PDF'; $fichier->Poids = filesize($file['tmp_name']); $fichier->Save(); move_uploaded_file($file['tmp_name'], $fichier->Chemin); return $fichier; } else if (file_exists($file) && is_file($file)){ $fichier = Object_Factory::Build(__CLASS__); $fichier->Nom = File_Util::webName(basename($file)); $fichier->Type = 'PDF'; $fichier->Poids = filesize($file); $fichier->Save(); copy($file, $fichier->Chemin); return $fichier; } else { return false; } } function Delete() { @unlink($this->Chemin); parent::Delete(); } } ?>