Updates to Module administration

This commit is contained in:
Deon George
2013-05-29 21:43:59 +10:00
parent 14fd3ba24e
commit 86afba378c
16 changed files with 287 additions and 215 deletions

View File

@@ -9,5 +9,19 @@
* @license http://dev.osbill.net/license.html
*/
class Model_Auth_RoleDefault extends Model_Auth_Role {
/**
* Show a bootstrap label button for a field with a boolean value
*/
public function label_bool($column,$render=FALSE) {
if (! isset($this->_table_columns[$column]))
return NULL;
if (! $render)
return $this->display($column);
return View::factory(Config::theme().'/label/bool')
->set('label',$this->$column ? 'label-success' : '')
->set('column',$this->display($column));
}
}
?>

View File

@@ -21,11 +21,13 @@ class Model_Module extends ORM_OSB {
'module_method'=>array('far_key'=>'id'),
);
protected $_sorting = array(
'status'=>'DESC',
'name'=>'ASC',
);
protected $_display_filters = array(
'external'=>array(
array('StaticList_YesNo::get',array(':value')),
),
'name'=>array(
array('strtoupper',array(':value')),
),
@@ -34,6 +36,10 @@ class Model_Module extends ORM_OSB {
),
);
public function external($render=FALSE) {
return $this->label_bool('external',$render);
}
/**
* Return an instance of this Module's Model
*

View File

@@ -29,6 +29,16 @@ class Model_Module_Method extends ORM_OSB {
'name'=>'ASC',
);
protected $status;
public function controller() {
return Kohana::classname(sprintf('Controller%s_%s',($this->directory() ? '_' : '').$this->directory(),$this->module->name));
}
public function directory() {
return substr($this->name,0,strpos($this->name,'_'));
}
/**
* Calculate the description for this method on any menu link
*/
@@ -40,6 +50,17 @@ class Model_Module_Method extends ORM_OSB {
return sprintf('%s: %s',$this->module->name,$this->name);
}
public function method() {
return substr($this->name,strpos($this->name,'_')+1);
}
public function status($status=NULL) {
if ($status)
$this->status = $status;
return $this->status;
}
public function url() {
if (! preg_match('/_/',$this->name))
return NULL;