initial commit

This commit is contained in:
Chris Sewell
2012-11-28 03:55:08 -05:00
parent 7adb399b2e
commit cf140a2e97
3247 changed files with 492437 additions and 0 deletions

54
lib/model/DevicesFiles.php Executable file
View File

@ -0,0 +1,54 @@
<?php
/**
* Subclass for representing a row from the 'devices_files' table.
*
*
*
* @package lib.model
*/
class DevicesFiles extends BaseDevicesFiles
{
const save_path = 'uploads/spreadsheet';
private $fileLoaded = false;
private $data = null;
public function setData($data){
$this->data = $data;
}
public function getData(){
return $this->data;
}
public function fileLoaded(){
return $this->fileLoaded;
}
public function saveToDisk(){
$filename = $this->getFilename();
$filepath = self::save_path."/".$filename;
if(empty($filename)) return;
$data = $this->data;
$fp = fopen($filepath,'w');
if($fp){
if(fwrite($fp,$data)){
chmod($filepath, 0777);
}
}
}
public function loadFromDisk($filename){
$filepath = self::save_path . '/'.$filename;
$fp = fopen($filepath,'r');
if($fp){
$data = "";
$data = fread($fp,filesize($filepath));
$unserialize = unserialize($data);
$this->data = $unserialize;
$this->fileLoaded = true;
}else
$this->fileLoaded = false;
}
}