Permalink
Browse files

Merge remote-tracking branch 'dstockto/cs_comment_getdetail'

  • Loading branch information...
2 parents d436f18 + 0fa6e5e commit c949e7f119f4e0e18e2cb029d619ce1e9cc4b44c @lornajane lornajane committed Jan 19, 2013
Showing with 77 additions and 29 deletions.
  1. +77 −29 src/system/application/libraries/wsactions/comment/Getdetail.php
View
106 src/system/application/libraries/wsactions/comment/Getdetail.php
@@ -1,42 +1,90 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-
+<?php
+/**
+ * Webservice for getting comment details
+ *
+ * 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
+ */
+if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
/**
-* TODO: make this work with any given type - blog, event, talk
-*/
-class Getdetail extends BaseWsRequest {
-
- var $CI = null;
- var $xml= null;
-
- public function Getdetail($xml) {
- $this->CI=&get_instance(); //print_r($this->CI);
- $this->xml=$xml;
+ * Webservice for getting comment details
+ *
+ * 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
+ *
+ * @todo make this work with any given type - blog, event, talk
+ */
+class Getdetail extends BaseWsRequest
+{
+ public $CI = null;
+ public $xml = null;
+
+ /**
+ * Instantiates the web service
+ *
+ * @param string $xml XML sent to service
+ */
+ public function __construct($xml)
+ {
+ $this->CI = &get_instance(); //print_r($this->CI);
+ $this->xml = $xml;
}
- public function checkSecurity($xml) {
+
+ /**
+ * Public method. Returns true.
+ *
+ * @param string $xml XML sent to service
+ *
+ * @return boolean
+ */
+ public function checkSecurity($xml)
+ {
// public method!
return true;
}
- //-----------------------
- public function run() {
- $id = $this->xml->action->cid;
- $type = $this->xml->action->rtype;
-
- //$ret=$this->CI->event_model->getEventDetail($id);
- //return array('msg'=>'valid');
-
+
+ /**
+ * Runs the webservice to get details for a comment
+ *
+ * @return array
+ */
+ public function run()
+ {
+ $id = $this->xml->action->cid;
+ $type = $this->xml->action->rtype;
+
//getTalkComments
- $ret=array();
- if ($this->xml->action->rtype=='talk') {
+ $ret = array();
+ if ($this->xml->action->rtype == 'talk') {
$this->CI->load->model('talk_comments_model');
- $ret=$this->CI->talk_comments_model->getCommentDetail($id);
- } elseif ($this->xml->action->rtype=='event') {
+ $ret = $this->CI->talk_comments_model->getCommentDetail($id);
+ } elseif ($this->xml->action->rtype == 'event') {
$this->CI->load->model('event_comments_model');
- $ret=$this->CI->event_comments_model->getCommentDetail($id);
+ $ret = $this->CI->event_comments_model->getCommentDetail($id);
}
- if (count($ret)>0) {
- $ret=array('output'=>'json','data'=>array('items'=>$ret));
+ if (count($ret) > 0) {
+ $ret = array(
+ 'output' => 'json',
+ 'data' => array('items' => $ret)
+ );
} else {
- $ret=array('output'=>'json','data'=>array('items'=>array('msg'=>'Comment not found!')));
+ $ret = array(
+ 'output' => 'json',
+ 'data' => array(
+ 'items' => array(
+ 'msg' => 'Comment not found!')
+ )
+ );
}
return $ret;
}

0 comments on commit c949e7f

Please sign in to comment.