app->controller($this->key); } function current(){ $this->current = $this->iterator()->current(); $this->current['action'] = $this->current['action']?$this->current['action']:'index'; $this->key = $this->current['controller'].':'.$this->current['action']; return $this; } function row($fag,$key){ $row = array( 'menu_type' => $this->content_typename(), 'app_id'=>$this->target_app->app_id, 'menu_order'=>$this->current['order'], ); $this->current['action'] = $this->current['action']?$this->current['action']:'index'; $row['menu_path'] = "app={$this->target_app->app_id}&ctl={$this->current['controller']}&act={$this->current['action']}"; $row['menu_title'] = $this->current['group'].':'.$this->current['value']; $row['addon'] = $this->key; $row['display'] = $this->current['display']?$this->current['display']:"true"; $row['permission'] = $this->current['permission']; return $row; } function install(){ kernel::log('Installing '.$this->content_typename().' '.$this->key()); $menus_row = $this->row($fag,$key); return app::get('desktop')->model('menus')->insert($menus_row); } function clear_by_app($app_id){ if(!$app_id){ return false; } app::get('desktop')->model('menus')->delete(array( 'app_id'=>$app_id,'menu_type' => $this->content_typename())); } }