<?php
require_once '/home/website/internal/class.lp_userfile.php';
class Lp_Resource extends Lp {
public $resourceId;
public $fileArray;
public $files = array();
function __construct($resourceId = null){
if($resourceId){
$this->resourceId = $resourceId;
$this->pull_Resource_Object();
$this->wrap_Resource_Object();
}
}
function pull_Resource_Object(){
$query = "SELECT * from lp_resource
WHERE
resourceId = '$this->resourceId'
LIMIT 1";
$result = mysql_query($query);
if(!$result){ Lp_internal::internal_error($query, 'Lp_Resource::pull_Resource_Object()'); return false; }
$obj = mysql_fetch_object($result);
$this->resourceObj = $obj;
}
function wrap_Resource_Object(){
$this->fileArray = $this->resourceObj->fileArray;
$this->create_Obj_File_Array();
return true;
}
function create_Obj_File_Array(){
if(!$this->fileArray)){ return false; } // No files in Resource
$files1 = unserialize($this->fileArray);
if(is_array($files1)){
$this->files = $files1; //Verified that unserialized value is an array.
}
}
/* THIS IS WHERE THE PROBLEM IS!!!!!! WHen i iterate through $this->files is where the problem is (called from outside the object)
*/
function create_File_List(){
$html = '<div id="fileArrayHeader" style="width:100%;height:25px;background-color:'.$this->headerBgColor.';border-bottom:'.$this->headerBorderColor.';">
File List...
</div>
';
$html .= '<div id="fileArrayDiv" style="width:100%;">
';
if(is_array($this->files) && count($this->files) > 0){
foreach($this->files as $fileId){
$File = new Lp_Userfile($fileId);
$html .= '<div style="width:75px;height:75px;float:left;background-color:white;font-family:Tahoma, Verdana;font-size:9pt;text-align:center;">
';
$html .= '<a href="'.$File->link.'" target="_BLANK">
<img src="http://www.lifepower.net/images/tempFileLogo.gif" border=0><BR>'.
$File->displayName .
'</a>';
$html .= '</div>
';
}
$html .= '</div>
';
}else{
$html .= '<span style="font-family:Tahoma;font-size:9pt;">
No Files...
</span>
';
$html .= $this->files[0]; // This is where I get the value "A" from "Array"
}
print $html;
}
}
?>