<?php
class Andy_ShowDeleted_ControllerPublic_ShowDeleted extends XenForo_ControllerPublic_Abstract
{
protected function _preDispatch($action)
{
if (!XenForo_Visitor::getInstance()->isSuperAdmin())
{
throw $this->getNoPermissionResponseException();
}
}
public function actionIndex()
{
//########################################
// get data
// this is fetching $posts from XenForo_Model_Post
// the function getDeletedPosts() is initially not there
// we extended XenForo_Model_Post with Andy_ShowDeleted_Model_Post
// all Andy_ShowDeleted_Model_Post functions are now accessible from XenForo_Model_Post
// get deleted post_id and message data
$posts = $this->getModelFromCache('XenForo_Model_Post')->getDeletedPosts();
// the function getThreads is located in library/Xenforo/Model/Thread.php
// getThreads gets two arrays:
// array($conditions) and array($fetchOptions)
// get deleted threads
$threads = $this->getModelFromCache('XenForo_Model_Thread')->getThreads(
array('discussion_state' => 'deleted'),
array('order' => 'thread_id','limit' => 50)
);
//########################################
// display data
// $viewParams must be an array
$viewParams = array('posts' => $posts,'threads' => $threads,
);
// send to template for display
return $this->responseView('Andy_ShowDeleted_ViewPublic_ShowDeleted', 'andy_showdeleted', $viewParams);
}
}
?>