Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created May 21, 2010 11:59
Show Gist options
  • Save workmad3/408746 to your computer and use it in GitHub Desktop.
Save workmad3/408746 to your computer and use it in GitHub Desktop.
<?php
include_once MODEL_PATH.'forums/Forum.php';
include_once MODEL_PATH.'forums/Topic.php';
require_once MODEL_PATH.'socialNetwork/group/XACLGroup.php';
/**
* InitTopic
*
* This controller
*
* @copyright inovia 2009
*
* @action forums.topics.ShowTopic
* @out HTML
*/
class forums_group_topics_ShowTopic extends PLE_Controller_Group_WithBreadCrumb
{
public function validate(){
Out::start('Smarty');
In::check('groupName', 'string',' groupName'.t('must be of type').' string');
In::check('topicId', 'int',' topicId'.t('must be of type').' int');
In::checkOption('offset', 'int','offset'.t('must be of type').' int');
In::checkOption('limit', 'int','limit'.t('must be of type').' int');
return true;
}
public function actions()
{
Session::setReturnPath(In::getAllGET());
$groupName = In::get("groupName");
$topicId = In::get("topicId");
$topic = new Topic(array("id"=>$topicId));
Out::$data->page->title = $topic->getTitle();
Out::$data->XACL = new XACLGroup($topic->getOwner());
Out::$data->topic = $topic;
Out::$data->profile->name = $groupName;
require_once MODEL_PATH.'socialNetwork/group/Group.php';
Out::$data->owner = new Group(array('name'=>$groupName));
Out::$data->group->name = $groupName;
Out::$data->baseURL = "?action=forums.group.topics.ShowTopic&topicId=".$topicId."&groupName=".In::get("groupName");
$offset = 0;
$limit = 10;
$this->b->add(new PLE_Helpers_Breadcrumb_Element($groupName,
"index.php?action=socialNetwork.group.GetProfile&groupName=$groupName"));
$this->b->add(new PLE_Helpers_Breadcrumb_Element(t('forum'),
'?action=forums.group.topics.DisplayTopics&groupName='.$groupName));
$this->b->add(new PLE_Helpers_Breadcrumb_Element($topic->getTitle(),
""));
if(In::get("offset")){
$offset = In::get("offset");
}
if(In::get("limit")){
$limit = In::get("limit");
}
$messageData = Message::getMessages($topicId, $limit, $offset);
Out::$data->messages = $messageData->list;
Out::$data->pagerInfo["messages"] = $messageData->pager;
Out::$data->pagerInfo["messages"]->generateUrl();
Out::$renderer->setTemplate('forums/group/topics/showTopic.tpl');
}
public function defaultActions()
{
Out::$renderer->setTemplate('forums/group/topics/showTopic.tpl');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment