Permalink
Browse files

Merge remote-tracking branch 'dstockto/cs_event_gettalks'

  • Loading branch information...
lornajane committed Jan 7, 2013
2 parents c2878c0 + 444c94c commit fd7de30d5b12b8ceac78d351027e4a835e37f9b2
Showing with 83 additions and 24 deletions.
  1. +83 −24 src/system/application/libraries/wsactions/event/Gettalks.php
@@ -1,41 +1,91 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
+/**
+ * Joindin webservice for getting talk
+ *
+ * PHP version 5
+ *
+ * @category Joind.in
+ * @package Configuration
+ * @copyright 2009 - 2012 Joind.in
+ * @license http://github.com/joindin/joind.in/blob/master/doc/LICENSE JoindIn
+ */
-class Gettalks extends BaseWsRequest {
-
- var $CI = null;
- var $xml= null;
+if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
+/**
+ * Joindin webservice for getting talk
+ *
+ * PHP version 5
+ *
+ * @category Joind.in
+ * @package Configuration
+ * @copyright 2009 - 2012 Joind.in
+ * @license http://github.com/joindin/joind.in/blob/master/doc/LICENSE JoindIn
+ */
+class Gettalks extends BaseWsRequest
+{
+ public $CI = null;
+ public $xml = null;
- public function Gettalks($xml) {
- $this->CI=&get_instance(); //print_r($this->CI);
- $this->xml=$xml;
+ /**
+ * Instantiates the webservice to retrieve talks
+ *
+ * @param string $xml XML sent to webservice
+ */
+ public function Gettalks($xml)
+ {
+ $this->CI = &get_instance(); //print_r($this->CI);
+ $this->xml = $xml;
}
- public function checkSecurity($xml) {
+
+ /**
+ * Ensures that the event ID is set but otherwise allows all calls
+ *
+ * @param string $xml XML sent to service
+ *
+ * @return boolean
+ *
+ * @todo Check on error message when event_id is not provided
+ */
+ public function checkSecurity($xml)
+ {
//public function!
// Be sure they've given us an event ID
- if (!isset($xml->action->event_id)) { return false; }
+ if (!isset($xml->action->event_id)) {
+ return false;
+ }
return true;
-
}
- //-----------------------
- public function run() {
+
+ /**
+ * Does the work to get talks from the database
+ *
+ * @return array
+ */
+ public function run()
+ {
$this->CI->load->library('wsvalidate');
- $rules=array(
- 'event_id' =>'required|isevent',
- //'reqkey' =>'required|reqkey'
+ $rules = array(
+ 'event_id' =>'required|isevent',
);
- $eid=$this->xml->action->event_id;
- $valid=$this->CI->wsvalidate->validate($rules, $this->xml->action);
+
+ $eid = $this->xml->action->event_id;
+ $valid = $this->CI->wsvalidate->validate($rules, $this->xml->action);
+
if (!$valid) {
$this->CI->load->model('event_model');
$this->CI->load->model('talk_track_model');
- $ret=$this->CI->event_model->getEventTalks($eid, false);
+ $ret = $this->CI->event_model->getEventTalks($eid, false);
// add the track and format the speaker information for each talk
foreach ($ret as $talk) {
- $talk->tracks = $this->CI->talk_track_model->getSessionTrackInfo($talk->ID);
- $speaker = '';
+ $talk->tracks = $this->CI->talk_track_model
+ ->getSessionTrackInfo($talk->ID);
+ $speaker = '';
if (count($talk->speaker)) {
foreach ($talk->speaker as $speaker_obj) {
$speaker .= $speaker_obj->speaker_name . ', ';
@@ -44,10 +94,19 @@ public function run() {
}
$talk->speaker = $speaker;
}
- return array('output'=>'json','data'=>array('items'=>$ret));
+ return array(
+ 'output'=>'json',
+ 'data'=>array(
+ 'items'=>$ret)
+ );
} else {
- return array('output'=>'json','data'=>array('items'=>array('msg'=>'Invalid Event ID!')));
+ return array(
+ 'output'=>'json',
+ 'data'=>array(
+ 'items'=>array(
+ 'msg'=>'Invalid Event ID!')
+ )
+ );
}
}
-
}

0 comments on commit fd7de30

Please sign in to comment.