add phpDoc comment in comment module

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10783 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-06-20 06:17:28 +00:00
parent f3db7bc440
commit d8eeb2154d
7 changed files with 390 additions and 219 deletions

View file

@ -1,21 +1,24 @@
<?php <?php
/** /**
* @class commentAdminController * commentAdminController class
* @author NHN (developers@xpressengine.com) * admin controller class of the comment module
* @brief admin controller class of the comment module *
**/ * @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentAdminController extends comment { class commentAdminController extends comment {
/** /**
* @brief Initialization * Initialization
**/ * @return void
*/
function init() { function init() {
} }
/** /**
* @brief Modify comment(s) status to publish/unpublish if calling module is using Comment Approval System * Modify comment(s) status to publish/unpublish if calling module is using Comment Approval System
* @return Object * @return void
*/ */
function procCommentAdminChangePublishedStatusChecked() function procCommentAdminChangePublishedStatusChecked()
{ // Error display if none is selected { // Error display if none is selected
@ -38,6 +41,10 @@
} }
} }
/**
* Change comment status
* @return void|object
*/
function procCommentAdminChangeStatus() function procCommentAdminChangeStatus()
{ {
$will_publish = Context::get('will_publish'); $will_publish = Context::get('will_publish');
@ -149,9 +156,10 @@
} }
/** /**
* @brief Delete the selected comment from the administrator page * Delete the selected comment from the administrator page
**/ * @return void
*/
function procCommentAdminDeleteChecked() { function procCommentAdminDeleteChecked() {
$isTrash = Context::get('is_trash'); $isTrash = Context::get('is_trash');
@ -228,6 +236,10 @@
} }
} }
/**
* comment move to trash
* @return void|object
*/
function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB) function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB)
{ {
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php'); require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
@ -256,9 +268,10 @@
} }
} }
/** /**
* @brief cancel the blacklist of abused comments reported by other users * Cancel the blacklist of abused comments reported by other users
**/ * @return void|object
*/
function procCommentAdminCancelDeclare() { function procCommentAdminCancelDeclare() {
$comment_srl = trim(Context::get('comment_srl')); $comment_srl = trim(Context::get('comment_srl'));
@ -269,6 +282,10 @@
} }
} }
/**
* Comment add to _SESSION
* @return void
*/
function procCommentAdminAddCart() function procCommentAdminAddCart()
{ {
$comment_srl = (int)Context::get('comment_srl'); $comment_srl = (int)Context::get('comment_srl');
@ -289,9 +306,10 @@
} }
} }
/** /**
* @brief delete all comments of the specific module * Delete all comments of the specific module
**/ * @return object
*/
function deleteModuleComments($module_srl) { function deleteModuleComments($module_srl) {
$args->module_srl = $module_srl; $args->module_srl = $module_srl;
$output = executeQuery('comment.deleteModuleComments', $args); $output = executeQuery('comment.deleteModuleComments', $args);
@ -310,9 +328,10 @@
} }
/** /**
* @brief restore comment from trash module, called by trash module * Restore comment from trash module, called by trash module
* this method is passived * this method is passived
**/ * @return object
*/
function restoreTrash($originObject) function restoreTrash($originObject)
{ {
if(is_array($originObject)) $originObject = (object)$originObject; if(is_array($originObject)) $originObject = (object)$originObject;
@ -336,10 +355,11 @@
return $output; return $output;
} }
/** /**
* @brief empty comment in trash, called by trash module * Empty comment in trash, called by trash module
* this method is passived * this method is passived
**/ * @return object
*/
function emptyTrash($originObject) function emptyTrash($originObject)
{ {
$originObject = unserialize($originObject); $originObject = unserialize($originObject);

View file

@ -1,21 +1,24 @@
<?php <?php
/** /**
* @class commentAdminView * commentAdminView class
* @author NHN (developers@xpressengine.com) * admin view class of the comment module
* @brief admin view class of the comment module *
**/ * @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentAdminView extends comment { class commentAdminView extends comment {
/**
/** * Initialization
* @brief Initialization * @return void
**/ */
function init() { function init() {
} }
/** /**
* @brief Display the list(for administrators) * Display the list(for administrators)
**/ * @return void
*/
function dispCommentAdminList() { function dispCommentAdminList() {
// option to get a list // option to get a list
$args->page = Context::get('page'); // /< Page $args->page = Context::get('page'); // /< Page
@ -61,9 +64,10 @@
$this->setTemplateFile('comment_list'); $this->setTemplateFile('comment_list');
} }
/** /**
* @brief show the blacklist of comments in the admin page * Show the blacklist of comments in the admin page
**/ * @return void
*/
function dispCommentAdminDeclared() { function dispCommentAdminDeclared() {
// option to get a blacklist // option to get a blacklist
$args->page = Context::get('page'); // /< Page $args->page = Context::get('page'); // /< Page

View file

@ -1,17 +1,19 @@
<?php <?php
/**
* @class comment
* @author NHN (developers@xpressengine.com)
* @brief comment module's high class
**/
require_once(_XE_PATH_.'modules/comment/comment.item.php'); require_once(_XE_PATH_.'modules/comment/comment.item.php');
/**
* comment
* comment module's high class
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class comment extends ModuleObject { class comment extends ModuleObject {
/**
/** * Implemented if additional tasks are required when installing
* @brief implemented if additional tasks are required when installing * @return Object
**/ */
function moduleInstall() { function moduleInstall() {
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
@ -36,9 +38,10 @@
return new Object(); return new Object();
} }
/** /**
* @brief method to check if installation is succeeded * Method to check if installation is succeeded
**/ * @return bool
*/
function checkUpdate() { function checkUpdate() {
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
@ -70,9 +73,10 @@
return false; return false;
} }
/** /**
* @brief Execute update * Execute update
**/ * @return Object
*/
function moduleUpdate() { function moduleUpdate() {
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
@ -128,9 +132,10 @@
return new Object(0, 'success_updated'); return new Object(0, 'success_updated');
} }
/** /**
* @brief Regenerate cache file * Regenerate cache file
**/ * @return void
*/
function recompileCache() { function recompileCache() {
} }
} }

View file

@ -1,21 +1,24 @@
<?php <?php
/** /**
* @class commentController * commentController class
* @author NHN (developers@xpressengine.com) * controller class of the comment module
* @brief controller class of the comment module *
**/ * @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentController extends comment { class commentController extends comment {
/**
/** * Initialization
* @brief Initialization * @return void
**/ */
function init() { function init() {
} }
/** /**
* @brief action to handle recommendation votes on comments (Up) * Action to handle recommendation votes on comments (Up)
**/ * @return Object
*/
function procCommentVoteUp() { function procCommentVoteUp() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
@ -35,9 +38,10 @@
return $this->updateVotedCount($comment_srl, $point); return $this->updateVotedCount($comment_srl, $point);
} }
/** /**
* @brief action to handle recommendation votes on comments (Down) * Action to handle recommendation votes on comments (Down)
**/ * @return Object
*/
function procCommentVoteDown() { function procCommentVoteDown() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
@ -57,9 +61,10 @@
return $this->updateVotedCount($comment_srl, $point); return $this->updateVotedCount($comment_srl, $point);
} }
/** /**
* @brief action to be called when a comment posting is reported * Action to be called when a comment posting is reported
**/ * @return void|Object
*/
function procCommentDeclare() { function procCommentDeclare() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
@ -69,9 +74,10 @@
return $this->declaredComment($comment_srl); return $this->declaredComment($comment_srl);
} }
/** /**
* @brief trigger to delete its comments together with document deleted * Trigger to delete its comments together with document deleted
**/ * @return Object
*/
function triggerDeleteDocumentComments(&$obj) { function triggerDeleteDocumentComments(&$obj) {
$document_srl = $obj->document_srl; $document_srl = $obj->document_srl;
if(!$document_srl) return new Object(); if(!$document_srl) return new Object();
@ -79,9 +85,10 @@
return $this->deleteComments($document_srl, true); return $this->deleteComments($document_srl, true);
} }
/** /**
* @brief trigger to delete corresponding comments when deleting a module * Trigger to delete corresponding comments when deleting a module
**/ * @return object
*/
function triggerDeleteModuleComments(&$obj) { function triggerDeleteModuleComments(&$obj) {
$module_srl = $obj->module_srl; $module_srl = $obj->module_srl;
if(!$module_srl) return new Object(); if(!$module_srl) return new Object();
@ -90,18 +97,20 @@
return $oCommentController->deleteModuleComments($module_srl); return $oCommentController->deleteModuleComments($module_srl);
} }
/** /**
* @brief Authorization of the comments * Authorization of the comments
* available only in the current connection of the session value * available only in the current connection of the session value
**/ * @return void
*/
function addGrant($comment_srl) { function addGrant($comment_srl) {
$_SESSION['own_comment'][$comment_srl] = true; $_SESSION['own_comment'][$comment_srl] = true;
} }
/** /**
*@brief Check if module is using comment validation system * Check if module is using comment validation system
* @param number $document_srl * @param int $document_srl
* @return boolean * @param int $module_srl
* @return bool
*/ */
function isModuleUsingPublishValidation($document_srl=null, $module_srl=null) function isModuleUsingPublishValidation($document_srl=null, $module_srl=null)
{ {
@ -116,9 +125,12 @@
return $use_validation; return $use_validation;
} }
/** /**
* @brief Enter comments * Enter comments
**/ * @param object $obj
* @param bool $manual_inserted
* @return object
*/
function insertComment($obj, $manual_inserted = false) { function insertComment($obj, $manual_inserted = false) {
// check if comment's module is using comment validation and set the publish status to 0 (false) // check if comment's module is using comment validation and set the publish status to 0 (false)
@ -314,9 +326,10 @@
} }
/** /**
* @brief Send email to module's admins after a new comment was interted successfully * Send email to module's admins after a new comment was interted successfully
* if Comments Approval System is used * if Comments Approval System is used
* @param type $obj * @param object $obj
* @return void
*/ */
function sendEmailToAdminAfterInsertComment($obj) function sendEmailToAdminAfterInsertComment($obj)
{ {
@ -434,9 +447,12 @@
} }
/** /**
* @brief fix the comment * Fix the comment
**/ * @param object $obj
* @param bool $is_admin
* @return object
*/
function updateComment($obj, $is_admin = false) { function updateComment($obj, $is_admin = false) {
$obj->__isupdate = true; $obj->__isupdate = true;
// call a trigger (before) // call a trigger (before)
@ -517,9 +533,13 @@
return $output; return $output;
} }
/** /**
* @brief Delete comment * Delete comment
**/ * @param int $comment_srl
* @param bool $is_admin
* @param bool $isMoveToTrash
* @return object
*/
function deleteComment($comment_srl, $is_admin = false, $isMoveToTrash = false) { function deleteComment($comment_srl, $is_admin = false, $isMoveToTrash = false) {
// create the comment model object // create the comment model object
$oCommentModel = &getModel('comment'); $oCommentModel = &getModel('comment');
@ -588,8 +608,9 @@
} }
/** /**
* @brief remove all comment relation log * Remove all comment relation log
**/ * @return Object
*/
function deleteCommentLog() function deleteCommentLog()
{ {
$this->_deleteDeclaredComments($args); $this->_deleteDeclaredComments($args);
@ -597,9 +618,11 @@
return new Object(0, 'success'); return new Object(0, 'success');
} }
/** /**
* @brief remove all comments of the article * Remove all comments of the article
**/ * @param int $document_srl
* @return object
*/
function deleteComments($document_srl) { function deleteComments($document_srl) {
// create the document model object // create the document model object
$oDocumentModel = &getModel('document'); $oDocumentModel = &getModel('document');
@ -649,10 +672,10 @@
} }
/** /**
* @brief delete declared comment, log * delete declared comment, log
* @param $commentSrls : srls string (ex: 1, 2,56, 88) * @param array|string $commentSrls : srls string (ex: 1, 2,56, 88)
* @return void * @return void
**/ */
function _deleteDeclaredComments($commentSrls) function _deleteDeclaredComments($commentSrls)
{ {
executeQuery('comment.deleteDeclaredComments', $commentSrls); executeQuery('comment.deleteDeclaredComments', $commentSrls);
@ -660,18 +683,21 @@
} }
/** /**
* @brief delete voted comment log * delete voted comment log
* @param $commentSrls : srls string (ex: 1, 2,56, 88) * @param array|string $commentSrls : srls string (ex: 1, 2,56, 88)
* @return void * @return void
**/ */
function _deleteVotedComments($commentSrls) function _deleteVotedComments($commentSrls)
{ {
executeQuery('comment.deleteCommentVotedLog', $commentSrls); executeQuery('comment.deleteCommentVotedLog', $commentSrls);
} }
/** /**
* @brief Increase vote-up counts of the comment * Increase vote-up counts of the comment
**/ * @param int $comment_srl
* @param int $point
* @return Object
*/
function updateVotedCount($comment_srl, $point = 1) { function updateVotedCount($comment_srl, $point = 1) {
if($point > 0) { if($point > 0) {
$failed_voted = 'failed_voted'; $failed_voted = 'failed_voted';
@ -734,9 +760,11 @@
return new Object(0, $success_message); return new Object(0, $success_message);
} }
/** /**
* @brief report a blamed comment * Report a blamed comment
**/ * @param $comment_srl
* @return void
*/
function declaredComment($comment_srl) { function declaredComment($comment_srl) {
// Fail if session information already has a reported document // Fail if session information already has a reported document
if($_SESSION['declared_comment'][$comment_srl]) return new Object(-1, 'failed_declared'); if($_SESSION['declared_comment'][$comment_srl]) return new Object(-1, 'failed_declared');
@ -788,9 +816,14 @@
$this->setMessage('success_declared'); $this->setMessage('success_declared');
} }
/** /**
* @brief method to add a pop-up menu when clicking for displaying child comments * Method to add a pop-up menu when clicking for displaying child comments
**/ * @param string $url
* @param string $str
* @param strgin $icon
* @param strgin $target
* @return void
*/
function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') { function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') {
$comment_popup_menu_list = Context::get('comment_popup_menu_list'); $comment_popup_menu_list = Context::get('comment_popup_menu_list');
if(!is_array($comment_popup_menu_list)) $comment_popup_menu_list = array(); if(!is_array($comment_popup_menu_list)) $comment_popup_menu_list = array();
@ -804,9 +837,10 @@
Context::set('comment_popup_menu_list', $comment_popup_menu_list); Context::set('comment_popup_menu_list', $comment_popup_menu_list);
} }
/** /**
* @brief save the comment extension form for each module * Save the comment extension form for each module
**/ * @return void
*/
function procCommentInsertModuleConfig() { function procCommentInsertModuleConfig() {
$module_srl = Context::get('target_module_srl'); $module_srl = Context::get('target_module_srl');
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
@ -839,6 +873,12 @@
} }
} }
/**
* Comment module config setting
* @param int $srl
* @param object $comment_config
* @return Object
*/
function setCommentModuleConfig($srl, $comment_config){ function setCommentModuleConfig($srl, $comment_config){
$oModuleController = &getController('module'); $oModuleController = &getController('module');
$oModuleController->insertModulePartConfig('comment',$srl,$comment_config); $oModuleController->insertModulePartConfig('comment',$srl,$comment_config);
@ -846,8 +886,9 @@
} }
/** /**
* @brief get comment all list * Get comment all list
**/ * @return void
*/
function procCommentGetList() function procCommentGetList()
{ {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');

View file

@ -1,15 +1,30 @@
<?php <?php
/** /**
* @class commentItem * commentItem class
* @author NHN (developers@xpressengine.com) * comment Object
* @brief comment Object *
**/ * @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentItem extends Object { class commentItem extends Object {
/**
* comment number
* @var int
*/
var $comment_srl = 0; var $comment_srl = 0;
/**
* Get the column list int the table
* @var array
*/
var $columnList = array(); var $columnList = array();
/**
* Constructor
* @param int $comment_srl
* @param array $columnList
* @return void
*/
function commentItem($comment_srl = 0, $columnList = array()) { function commentItem($comment_srl = 0, $columnList = array()) {
$this->comment_srl = $comment_srl; $this->comment_srl = $comment_srl;
$this->columnList = $columnList; $this->columnList = $columnList;
@ -21,6 +36,10 @@
$this->_loadFromDB(); $this->_loadFromDB();
} }
/**
* Load comment data from DB and set to commentItem object
* @return void
*/
function _loadFromDB() { function _loadFromDB() {
if(!$this->comment_srl) return; if(!$this->comment_srl) return;
@ -30,6 +49,10 @@
$this->setAttribute($output->data); $this->setAttribute($output->data);
} }
/**
* Comment attribute set to Object object
* @return void
*/
function setAttribute($attribute) { function setAttribute($attribute) {
if(!$attribute->comment_srl) { if(!$attribute->comment_srl) {
$this->comment_srl = null; $this->comment_srl = null;
@ -101,6 +124,10 @@
return $this->get('notify_message')=='Y' ? true : false; return $this->get('notify_message')=='Y' ? true : false;
} }
/**
* Notify to comment owner
* @return void
*/
function notify($type, $content) { function notify($type, $content) {
// return if not useNotify // return if not useNotify
if(!$this->useNotify()) return; if(!$this->useNotify()) return;
@ -158,6 +185,10 @@
return htmlspecialchars($this->get('nick_name')); return htmlspecialchars($this->get('nick_name'));
} }
/**
* Return content with htmlspecialchars
* @return string
*/
function getContentText($strlen = 0) { function getContentText($strlen = 0) {
if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
@ -168,6 +199,10 @@
return htmlspecialchars($content); return htmlspecialchars($content);
} }
/**
* Return content after filter
* @return string
*/
function getContent($add_popup_menu = true, $add_content_info = true, $add_xe_content_class = true) { function getContent($add_popup_menu = true, $add_content_info = true, $add_xe_content_class = true) {
if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
@ -203,6 +238,10 @@
return $content; return $content;
} }
/**
* Return summary content
* @return string
*/
function getSummary($str_size = 50, $tail = '...') { function getSummary($str_size = 50, $tail = '...') {
$content = $this->getContent(false, false); $content = $this->getContent(false, false);
// for newline, insert a blank. // for newline, insert a blank.
@ -279,9 +318,10 @@
return $file_list; return $file_list;
} }
/** /**
* @brief return the editor html * Return the editor html
**/ * @return string
*/
function getEditor() { function getEditor() {
$module_srl = $this->get('module_srl'); $module_srl = $this->get('module_srl');
if(!$module_srl) $module_srl = Context::get('module_srl'); if(!$module_srl) $module_srl = Context::get('module_srl');
@ -289,9 +329,10 @@
return $oEditorModel->getModuleEditor('comment', $module_srl, $this->comment_srl, 'comment_srl', 'content'); return $oEditorModel->getModuleEditor('comment', $module_srl, $this->comment_srl, 'comment_srl', 'content');
} }
/** /**
* @brief return author's profile image * Return author's profile image
**/ * @return object
*/
function getProfileImage() { function getProfileImage() {
if(!$this->isExists() || !$this->get('member_srl')) return; if(!$this->isExists() || !$this->get('member_srl')) return;
$oMemberModel = &getModel('member'); $oMemberModel = &getModel('member');
@ -301,9 +342,10 @@
return $profile_info->src; return $profile_info->src;
} }
/** /**
* @brief return author's signiture * Return author's signiture
**/ * @return string
*/
function getSignature() { function getSignature() {
// pass if the posting not exists. // pass if the posting not exists.
if(!$this->isExists() || !$this->get('member_srl')) return; if(!$this->isExists() || !$this->get('member_srl')) return;

View file

@ -1,23 +1,25 @@
<?php <?php
/** /**
* @class commentModel * commentModel class
* @author NHN (developers@xpressengine.com) * model class of the comment module
* @brief model class of the comment module *
**/ * @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentModel extends comment { class commentModel extends comment {
/**
/** * Initialization
* @brief Initialization * @return void
**/ */
function init() { function init() {
} }
/** /**
* @brief display the pop-up menu of the post * display the pop-up menu of the post
* * Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added
* Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added * @return void
**/ */
function getCommentMenu() { function getCommentMenu() {
// get the post's id number and the current login information // get the post's id number and the current login information
$comment_srl = Context::get('target_srl'); $comment_srl = Context::get('target_srl');
@ -84,27 +86,34 @@
} }
/** /**
* @brief check if you have a permission to comment_srl * Check if you have a permission to comment_srl
* * use only session information
* use only session information * @param int $comment_srl
**/ * @return bool
*/
function isGranted($comment_srl) { function isGranted($comment_srl) {
return $_SESSION['own_comment'][$comment_srl]; return $_SESSION['own_comment'][$comment_srl];
} }
/** /**
* @brief Returns the number of child comments * Returns the number of child comments
**/ * @param int $comment_srl
* @return int
*/
function getChildCommentCount($comment_srl) { function getChildCommentCount($comment_srl) {
$args->comment_srl = $comment_srl; $args->comment_srl = $comment_srl;
$output = executeQuery('comment.getChildCommentCount', $args); $output = executeQuery('comment.getChildCommentCount', $args);
return (int)$output->data->count; return (int)$output->data->count;
} }
/** /**
* @brief get the comment * Get the comment
**/ * @param int $comment_srl
* @param bool $is_admin
* @param array $columnList
* @return commentItem
*/
function getComment($comment_srl=0, $is_admin = false, $columnList = array()) { function getComment($comment_srl=0, $is_admin = false, $columnList = array()) {
$oComment = new commentItem($comment_srl, $columnList); $oComment = new commentItem($comment_srl, $columnList);
if($is_admin) $oComment->setGrant(); if($is_admin) $oComment->setGrant();
@ -112,9 +121,12 @@
return $oComment; return $oComment;
} }
/** /**
* @brief get the multiple comments(not paginating) * Get the comment list(not paginating)
**/ * @param string|array $comment_srl_list
* @param array $columnList
* @return array
*/
function getComments($comment_srl_list, $columnList = array()) { function getComments($comment_srl_list, $columnList = array()) {
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list); if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
// fetch from a database // fetch from a database
@ -138,9 +150,11 @@
return $result; return $result;
} }
/** /**
* @brief get the total number of comments in corresponding with document_srl. * Get the total number of comments in corresponding with document_srl.
**/ * @param int $document_srl
* @return int
*/
function getCommentCount($document_srl) { function getCommentCount($document_srl) {
$args->document_srl = $document_srl; $args->document_srl = $document_srl;
@ -165,9 +179,12 @@
return (int)$total_count; return (int)$total_count;
} }
/** /**
* @brief get the total number of comments in corresponding with document_srl. * Get the total number of comments in corresponding with document_srl.
**/ * @param string $date
* @param array $moduleSrlList
* @return int
*/
function getCommentCountByDate($date = '', $moduleSrlList = array()) { function getCommentCountByDate($date = '', $moduleSrlList = array()) {
if($date) $args->regDate = date('Ymd', strtotime($date)); if($date) $args->regDate = date('Ymd', strtotime($date));
if(count($moduleSrlList)>0) $args->module_srl = $moduleSrlList; if(count($moduleSrlList)>0) $args->module_srl = $moduleSrlList;
@ -178,9 +195,12 @@
return $output->data->count; return $output->data->count;
} }
/** /**
* @brief get the total number of comments in corresponding with module_srl. * Get the total number of comments in corresponding with module_srl.
**/ * @param int $module_srl
* @param bool $published
* @return int
*/
function getCommentAllCount($module_srl,$published=null) { function getCommentAllCount($module_srl,$published=null) {
$args->module_srl = $module_srl; $args->module_srl = $module_srl;
@ -211,6 +231,10 @@
return (int)$total_count; return (int)$total_count;
} }
/**
* Get the module info without duplication
* @return array
*/
function getDistinctModules() function getDistinctModules()
{ {
$output = executeQuery('comment.getDistinctModules'); $output = executeQuery('comment.getDistinctModules');
@ -228,10 +252,13 @@
return $result; return $result;
} }
/** /**
* @brief get the comment in corresponding with mid. * Get the comment in corresponding with mid.
* TODO add commentItems to cache too * @todo add commentItems to cache too
**/ * @param object $obj
* @param array $columnList
* @return array
*/
function getNewestCommentList($obj, $columnList = array()) { function getNewestCommentList($obj, $columnList = array()) {
if($obj->mid) { if($obj->mid) {
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
@ -283,9 +310,14 @@
return $result; return $result;
} }
/** /**
* @brief get a comment list of the doc in corresponding woth document_srl. * Get a comment list of the doc in corresponding woth document_srl.
**/ * @param int $document_srl
* @param int $page
* @param bool $is_admin
* @param int $count
* @return object
*/
function getCommentList($document_srl, $page = 0, $is_admin = false, $count = 0) { function getCommentList($document_srl, $page = 0, $is_admin = false, $count = 0) {
if(!isset($document_srl)) return; if(!isset($document_srl)) return;
// cache controll // cache controll
@ -348,10 +380,13 @@
return $output; return $output;
} }
/** /**
* @brief update a list of comments in corresponding with document_srl * Update a list of comments in corresponding with document_srl
* take care of previously used data than GA version * Take care of previously used data than GA version
**/ * @param int $module_srl
* @param int $document_srl
* @return void
*/
function fixCommentList($module_srl, $document_srl) { function fixCommentList($module_srl, $document_srl) {
// create a lock file to prevent repeated work when performing a batch job // create a lock file to prevent repeated work when performing a batch job
$lock_file = "./files/cache/tmp/lock.".$document_srl; $lock_file = "./files/cache/tmp/lock.".$document_srl;
@ -407,9 +442,14 @@
FileHandler::removeFile($lock_file); FileHandler::removeFile($lock_file);
} }
/** /**
* @brief relocate comments in the hierarchical structure * Relocate comments in the hierarchical structure
**/ * @param array $comment_list
* @param array $list
* @param int $depth
* @param object $parent
* @return void
*/
function _arrangeComment(&$comment_list, $list, $depth, $parent = null) { function _arrangeComment(&$comment_list, $list, $depth, $parent = null) {
if(!count($list)) return; if(!count($list)) return;
foreach($list as $key => $val) { foreach($list as $key => $val) {
@ -430,9 +470,12 @@
} }
} }
/** /**
* @brief get all the comments in time decending order(for administrators) * Get all the comments in time decending order(for administrators)
**/ * @param object $obj
* @param array $columnList
* @return object
*/
function getTotalCommentList($obj, $columnList = array()) { function getTotalCommentList($obj, $columnList = array()) {
$query_id = 'comment.getTotalCommentList'; $query_id = 'comment.getTotalCommentList';
// Variables // Variables
@ -526,9 +569,11 @@
return $output; return $output;
} }
/** /**
* @brief get all the comment count in time decending order(for administrators) * Get all the comment count in time decending order(for administrators)
**/ * @param object $obj
* @return int
*/
function getTotalCommentCount($obj) { function getTotalCommentCount($obj) {
$query_id = 'comment.getTotalCommentCountByGroupStatus'; $query_id = 'comment.getTotalCommentCountByGroupStatus';
// Variables // Variables
@ -588,9 +633,11 @@
return $output->data; return $output->data;
} }
/** /**
* @brief return a configuration of comments for each module * Return a configuration of comments for each module
**/ * @param int $module_srl
* @return object
*/
function getCommentConfig($module_srl) { function getCommentConfig($module_srl) {
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
@ -598,6 +645,10 @@
return $comment_config; return $comment_config;
} }
/**
* Return a list of voting member
* @return void
*/
function getCommentVotedMemberList() function getCommentVotedMemberList()
{ {
$comment_srl = Context::get('comment_srl'); $comment_srl = Context::get('comment_srl');
@ -636,6 +687,10 @@
$this->add('voted_member_list',$output->data); $this->add('voted_member_list',$output->data);
} }
/**
* Return a secret status by secret field
* @return array
*/
function getSecretNameList() function getSecretNameList()
{ {
global $lang; global $lang;

View file

@ -1,21 +1,25 @@
<?php <?php
/** /**
* @class commentView * commentView class
* @author NHN (developers@xpressengine.com) * comment module's view class
* @brief comment module's view class *
**/ * @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentView extends comment { class commentView extends comment {
/**
/** * Initialization
* @brief Initialization * @return void
**/ */
function init() { function init() {
} }
/** /**
* @brief add a form fot comment setting on the additional setting of module * Add a form fot comment setting on the additional setting of module
**/ * @param string $obj
* @return string
*/
function triggerDispCommentAdditionSetup(&$obj) { function triggerDispCommentAdditionSetup(&$obj) {
$current_module_srl = Context::get('module_srl'); $current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls'); $current_module_srls = Context::get('module_srls');