XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
CommentViewAction.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16require_once XOOPS_MODULE_PATH . '/legacy/class/AbstractListAction.class.php';
17require_once XOOPS_MODULE_PATH . '/legacy/admin/forms/CommentFilterForm.class.php';
18
19class Legacy_CommentViewAction extends Legacy_Action
20{
21 public $mObject = null;
22
23 public function getDefaultView(&$controller, &$xoopsUser)
24 {
25 $handler =& xoops_getmodulehandler('comment');
26 $this->mObject =& $handler->get(xoops_getrequest('com_id'));
27
28 if (null == $this->mObject) {
29 return LEGACY_FRAME_VIEW_ERROR;
30 }
31
32 return LEGACY_FRAME_VIEW_SUCCESS;
33 }
34
35 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
36 {
37 //
38 // Lazy load
39 //
40 $this->mObject->loadModule();
41 $this->mObject->loadUser();
42 $this->mObject->loadStatus();
43
44 $render->setTemplateName('comment_view.html');
45 $render->setAttribute('object', $this->mObject);
46
47 //
48 // Load children of specified comment and assign those.
49 //
50 $handler =& xoops_getmodulehandler('comment');
51 $criteria =new Criteria('com_pid', $this->mObject->get('com_id'));
52 $children =& $handler->getObjects($criteria);
53
54 if ((is_countable($children) ? count($children) : 0) > 0) {
55 foreach (array_keys($children) as $key) {
56 $children[$key]->loadModule();
57 $children[$key]->loadUser();
58 }
59 }
60 $render->setAttribute('children', $children);
61 }
62
63 public function executeViewError(&$controller, &$xoopsUser, &$render)
64 {
65 $controller->executeForward('./index.php');
66 }
67}