array(), ); protected $_has_one = array( 'record_id'=>array(), ); protected $_has_many = array( 'group'=>array('through'=>'group_method','foreign_key'=>'method_id') ); protected $_sorting = array( 'name'=>'ASC', ); protected $_nullifempty = array( 'menu_display', ); protected $status; public function controller_sub() { return substr_count($this->name,'_') ? substr($this->name,($x=strpos($this->name,'_')),strpos($this->name,':')-$x) : ''; } public function controller() { return Kohana::classname(sprintf('Controller%s_%s',($this->directory() ? '_' : '').$this->directory(),$this->module->name).$this->controller_sub()); } public function directory() { return substr($this->name,0,substr_count($this->name,'_') ? strpos($this->name,'_') : strpos($this->name,':')); } public function method() { return substr($this->name,strpos($this->name,':')+1); } /** * Calculate the description for this method on any menu link */ public function menu_display() { return $this->menu_display ? $this->menu_display : sprintf('%s: %s',$this->module->name,$this->name); } public function status($status=NULL) { if ($status) $this->status = $status; return $this->status; } public function url() { if (! preg_match('/:/',$this->name)) return NULL; list($type,$action) = preg_split('/:/',$this->name,2); return URL::link($this->directory(),$this->module->name.$this->controller_sub().'/'.$action); } } ?>