@@ 28-60 (lines=33) @@ | ||
25 | * Action to handle recommendation votes on comments (Up) |
|
26 | * @return BaseObject |
|
27 | */ |
|
28 | function procCommentVoteUp() |
|
29 | { |
|
30 | if(!Context::get('is_logged')) |
|
31 | { |
|
32 | return new BaseObject(-1, 'msg_invalid_request'); |
|
33 | } |
|
34 | ||
35 | $comment_srl = Context::get('target_srl'); |
|
36 | if(!$comment_srl) |
|
37 | { |
|
38 | return new BaseObject(-1, 'msg_invalid_request'); |
|
39 | } |
|
40 | ||
41 | $oCommentModel = getModel('comment'); |
|
42 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
|
43 | $module_srl = $oComment->get('module_srl'); |
|
44 | if(!$module_srl) |
|
45 | { |
|
46 | return new BaseObject(-1, 'msg_invalid_request'); |
|
47 | } |
|
48 | ||
49 | $oModuleModel = getModel('module'); |
|
50 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
|
51 | if($comment_config->use_vote_up == 'N') |
|
52 | { |
|
53 | return new BaseObject(-1, 'msg_invalid_request'); |
|
54 | } |
|
55 | ||
56 | $point = 1; |
|
57 | $output = $this->updateVotedCount($comment_srl, $point); |
|
58 | $this->add('voted_count', $output->get('voted_count')); |
|
59 | return $output; |
|
60 | } |
|
61 | ||
62 | /** |
|
63 | * Action to handle recommendation votes on comments (Down) |
|
@@ 66-98 (lines=33) @@ | ||
63 | * Action to handle recommendation votes on comments (Down) |
|
64 | * @return BaseObject |
|
65 | */ |
|
66 | function procCommentVoteDown() |
|
67 | { |
|
68 | if(!Context::get('is_logged')) |
|
69 | { |
|
70 | return new BaseObject(-1, 'msg_invalid_request'); |
|
71 | } |
|
72 | ||
73 | $comment_srl = Context::get('target_srl'); |
|
74 | if(!$comment_srl) |
|
75 | { |
|
76 | return new BaseObject(-1, 'msg_invalid_request'); |
|
77 | } |
|
78 | ||
79 | $oCommentModel = getModel('comment'); |
|
80 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
|
81 | $module_srl = $oComment->get('module_srl'); |
|
82 | if(!$module_srl) |
|
83 | { |
|
84 | return new BaseObject(-1, 'msg_invalid_request'); |
|
85 | } |
|
86 | ||
87 | $oModuleModel = getModel('module'); |
|
88 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
|
89 | if($comment_config->use_vote_down == 'N') |
|
90 | { |
|
91 | return new BaseObject(-1, 'msg_invalid_request'); |
|
92 | } |
|
93 | ||
94 | $point = -1; |
|
95 | $output = $this->updateVotedCount($comment_srl, $point); |
|
96 | $this->add('blamed_count', $output->get('blamed_count')); |
|
97 | return $output; |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Action to be called when a comment posting is reported |
@@ 25-45 (lines=21) @@ | ||
22 | * Action to handle vote-up of the post (Up) |
|
23 | * @return BaseObject |
|
24 | */ |
|
25 | function procDocumentVoteUp() |
|
26 | { |
|
27 | if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
28 | ||
29 | $document_srl = Context::get('target_srl'); |
|
30 | if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
31 | ||
32 | $oDocumentModel = getModel('document'); |
|
33 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
|
34 | $module_srl = $oDocument->get('module_srl'); |
|
35 | if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
36 | ||
37 | $oModuleModel = getModel('module'); |
|
38 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
39 | if($document_config->use_vote_up=='N') return new BaseObject(-1, 'msg_invalid_request'); |
|
40 | ||
41 | $point = 1; |
|
42 | $output = $this->updateVotedCount($document_srl, $point); |
|
43 | $this->add('voted_count', $output->get('voted_count')); |
|
44 | return $output; |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * insert alias |
|
@@ 70-90 (lines=21) @@ | ||
67 | * Action to handle vote-up of the post (Down) |
|
68 | * @return BaseObject |
|
69 | */ |
|
70 | function procDocumentVoteDown() |
|
71 | { |
|
72 | if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
73 | ||
74 | $document_srl = Context::get('target_srl'); |
|
75 | if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
76 | ||
77 | $oDocumentModel = getModel('document'); |
|
78 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
|
79 | $module_srl = $oDocument->get('module_srl'); |
|
80 | if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
81 | ||
82 | $oModuleModel = getModel('module'); |
|
83 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
84 | if($document_config->use_vote_down=='N') return new BaseObject(-1, 'msg_invalid_request'); |
|
85 | ||
86 | $point = -1; |
|
87 | $output = $this->updateVotedCount($document_srl, $point); |
|
88 | $this->add('blamed_count', $output->get('blamed_count')); |
|
89 | return $output; |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * Action called when the post is reported by other member |