Status updates, SSL updates

This commit is contained in:
Deon George
2013-11-08 22:02:32 +11:00
parent 28ea1ac613
commit 2d9d7f383c
31 changed files with 688 additions and 299 deletions

View File

@@ -65,6 +65,18 @@ abstract class ORM extends Kohana_ORM {
return $this->where('status','=',TRUE);
}
/**
* Determine if the account is authoised by the user
*/
public function authorised(Model $o=NULL,Model_Account $ao=NULL,$aid='account_id') {
if (is_null($o))
$o = $this;
if (is_null($ao))
$ao = Auth::instance()->get_user();
return in_array($o->{$aid},$ao->RTM->customers($ao->RTM));
}
/**
* Overrides Kohana cache so that it can be globally disabled.
*/
@@ -137,21 +149,6 @@ abstract class ORM extends Kohana_ORM {
$this->_display_filters = Arr::merge($this->_display_filters,$filters);
}
/**
* 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));
}
/**
* Function help to find records that are active
*/
@@ -218,10 +215,6 @@ abstract class ORM extends Kohana_ORM {
return $x;
}
public function status($render=FALSE) {
return $this->label_bool('status',$render);
}
public function where_active() {
return $this->_where_active();
}