55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* @package lnApp
|
|
* @subpackage Auth
|
|
* @category Models
|
|
* @author Deon George
|
|
* @copyright (c) 2010 Deon George
|
|
* @license http://dev.leenooks.net/license.html
|
|
*/
|
|
class Model_Auth_RoleDefault extends Model_Auth_Role {
|
|
protected $_table_names_plural = false;
|
|
|
|
protected $_object_formated = array();
|
|
protected $_formated = FALSE;
|
|
protected $_formats = array();
|
|
|
|
/**
|
|
* Format fields for display purposes
|
|
*
|
|
* @param string column name
|
|
* @return mixed
|
|
*/
|
|
protected function _format() {
|
|
$format = Validate::factory($this->_object);
|
|
|
|
foreach ($this->_formats as $column => $formats)
|
|
$format->filters($column,$formats);
|
|
|
|
if ($format->check())
|
|
foreach ($format as $column => $value)
|
|
$this->_object_formated[$column] = $value;
|
|
|
|
$this->_formated = TRUE;
|
|
}
|
|
|
|
/**
|
|
* Return a formated columns, as per the model definition
|
|
*/
|
|
public function display($column) {
|
|
// Trigger a load of the record.
|
|
$value = $this->__get($column);
|
|
|
|
// If some of our fields need to be formated for display purposes.
|
|
if ($this->_loaded AND ! $this->_formated AND $this->_formats)
|
|
$this->_format();
|
|
|
|
if (isset($this->_object_formated[$column]))
|
|
return $this->_object_formated[$column];
|
|
else
|
|
return $value;
|
|
}
|
|
}
|
|
?>
|