first commit
This commit is contained in:
44
autoload/cms/class.Layout.php
Normal file
44
autoload/cms/class.Layout.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?
|
||||
namespace cms;
|
||||
class Layout implements \ArrayAccess
|
||||
{
|
||||
public function __construct( int $layout_id )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$result = $mdb -> get( 'pp_layouts', '*', [ 'id' => $layout_id ] );
|
||||
if ( \S::is_array_fix( $result ) ) foreach ( $result as $key => $val )
|
||||
$this -> $key = $val;
|
||||
}
|
||||
|
||||
public function __get( $variable )
|
||||
{
|
||||
if ( array_key_exists( $variable, $this -> data ) )
|
||||
return $this -> $variable;
|
||||
}
|
||||
|
||||
public function __set( $variable, $value )
|
||||
{
|
||||
$this -> $variable = $value;
|
||||
}
|
||||
|
||||
public function offsetExists( $offset )
|
||||
{
|
||||
return isset( $this -> $offset );
|
||||
}
|
||||
|
||||
public function offsetGet( $offset )
|
||||
{
|
||||
return $this -> $offset;
|
||||
}
|
||||
|
||||
public function offsetSet( $offset, $value )
|
||||
{
|
||||
$this -> $offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset( $offset )
|
||||
{
|
||||
unset( $this -> $offset );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user