Permalink
Browse files

Merge remote-tracking branch 'dstockto/cs_event_getcomments'

  • Loading branch information...
2 parents 8f84a9f + 968e4d8 commit 6c5f19771ee26f518b79a0ef2733bc2a7d3a41c6 @lornajane lornajane committed Jan 9, 2013
Showing with 76 additions and 18 deletions.
  1. +76 −18 src/system/application/libraries/wsactions/event/Getcomments.php
@@ -1,37 +1,95 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
+/**
+ * Joindin webservice for getting comments
+ *
+ * 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 Getcomments extends BaseWsRequest {
-
- var $CI = null;
- var $xml= null;
+if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
+/**
+ * Joindin webservice for getting comments
+ *
+ * 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 Getcomments extends BaseWsRequest
+{
+ public $CI = null;
+ public $xml = null;
- public function Getcomments($xml) {
- $this->CI=&get_instance();
- $this->xml=$xml;
+
+ /**
+ * Instantiates the webservice to get comments
+ *
+ * @param string $xml XML sent to service
+ */
+ public function Getcomments($xml)
+ {
+ $this->CI = &get_instance();
+ $this->xml = $xml;
}
- public function checkSecurity($xml) {
+
+ /**
+ * Ensures that the caller sent the event id, otherwise the
+ * API is public
+ *
+ * @param string $xml XML sent to webservice
+ *
+ * @return boolean
+ *
+ * @todo Investigate if checking on event id would give back a bogus
+ * error message for when there is no event id.
+ */
+ 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 the comments for an event
+ *
+ * @return array
+ */
+ public function run()
+ {
$this->CI->load->library('wsvalidate');
- $rules=array(
- 'event_id' =>'required|isevent',
+ $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_comments_model');
- $ret=$this->CI->event_comments_model->getEventComments($eid);
+ $ret = $this->CI->event_comments_model->getEventComments($eid);
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 6c5f197

Please sign in to comment.