Added Node Session

This commit is contained in:
Deon George
2012-12-12 15:00:03 +11:00
parent b415296c62
commit cf7f5256ae
7 changed files with 149 additions and 19 deletions

View File

@@ -52,5 +52,41 @@ class Controller_Node extends Controller_TemplateDefault_View {
$this->response->headers('Content-Type','application/json');
$this->response->body($google->json());
}
/**
* Return details of a specific node SESSION in the ACTIVITY LOG
* @param $id NODE,SESSION_ID,SESSION_START_DATE
*/
public function action_session() {
$id = $this->request->param('id');
if (substr_count($id,',') != 2) {
SystemMessage::add(array(
'title'=>_('Invalid ID'),
'body'=>sprintf(_('The session ID %s is invalid'),$id),
'type'=>'error',
));
return;
}
list($nid,$sid,$start) = explode(',',$id,3);
$no = ORM::factory('NODE',$nid);
if (! $no->loaded()) {
SystemMessage::add(array(
'title'=>_('Invalid Node'),
'body'=>sprintf(_('The Node ID %s is invalid'),$nid),
'type'=>'error',
));
return;
}
Block::add(array(
'title'=>sprintf(_('Session %s Detail for Node %s'),$sid,$no->display('NODE_NAME')),
'body'=>View::factory(sprintf('%s/clientsession',strtolower($this->request->controller())))->set('o',$no->actlog_session($sid,$start)),
));
}
}
?>