|
楼主 |
发表于 2012-12-14 15:29:17
|
显示全部楼层
本帖最后由 Lory 于 2012-12-14 15:33 编辑
多谢1楼兄弟,尝试了一下,可以的
这个数据结构是和数据库里相匹配的,方便程序中操作
用 require_once 包含
PHP复制代码
<?Php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ACTA_terminal
{
private $property = array();
public function __construct ()
{
$this->property['TerminalID'] = '';
$this->property['TerminalGroupID'] = '';
$this->property['TerminalGroup'] = '';
$this->property['TerminalSN'] = '';
$this->property['TerminalType'] = '';
$this->property['TerminalName'] = '';
$this->property['TerminalIP'] = '';
$this->property['TerminalModel'] = '';
$this->property['FirmwareVersion'] = '';
$this->property['FAMVersion'] = '';
$this->property['Description'] = '';
$this->property['RegisteredUser'] = '';
$this->property['MaxUser'] = '';
$this->property['AutomatchUser'] = '';
$this->property['MaxAutomatchUser'] = '';
$this->property['CurrentStatus'] = '';
$this->property['RegStatus'] = '';
$this->property['dmode'] = '';
$this->property['last_update'] = '';
$this->property['last_log'] = '';
}
public function __set ($property, $value)
{
if (isset($this->property[$property]))
{
$this->property[$property] = $value;
}
}
public function __get ($property)
{
if (isset($this->property[$property]))
{
return $this->property[$property];
}
return FALSE;
}
/*
从客户端传递的对象初始化本对象
*/
public function loadFromObject ($terminal)
{
$this->property['TerminalID'] = $terminal->terminalID;
$this->property['TerminalType'] = $terminal->terminalType;
$this->property['TerminalName'] = $terminal->terminalName;
$this->property['TerminalSN'] = $terminal->terminalSN;
$this->property['TerminalIP'] = $terminal->terminalIP;
$this->property['TerminalModel'] = $terminal->terminalStatus->modelNumber;
$this->property['FirmwareVersion'] = $terminal->terminalStatus->firmwareVersion;
$this->property['Description'] = $terminal->terminalStatus->description;
$this->property['RegisteredUser'] = $terminal->terminalStatus->registeredUsers;
$this->property['MaxUser'] = $terminal->terminalStatus->maximumUsers;
$this->property['AutomatchUser'] = $terminal->terminalStatus->automatchUsers;
$this->property['MaxAutomatchUser'] = $terminal->terminalStatus->maximumAutomatchUsers;
}
}
复制代码 |
|