/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'review' page.
  */
 public function actionCreate($programId = null, $semesterId = null)
 {
     $this->areaSmall = 'New Post';
     Yii::log($this->module->basePath);
     $college = College::getUserCollege();
     $this->forumBreadcrumb = array('Programs' => array('forum/index'));
     if ($programId) {
         $program = Program::model()->findByPk($programId);
         $this->programId = $programId;
         $this->forumBreadcrumb = array_merge($this->forumBreadcrumb, array($program->program_name => array('forum/programView', 'programId' => $programId)));
     }
     if ($semesterId) {
         $semester = Semester::model()->findByPk($semesterId);
         $this->semesterId = $semesterId;
         $this->forumBreadcrumb = array_merge($this->forumBreadcrumb, array($semester->semester_name => array('forum/viewTopics', 'programId' => $programId, 'semesterId' => $semesterId)));
     }
     $this->forumBreadcrumb = array_merge($this->forumBreadcrumb, array('New Post'));
     $model = new ThreadForm($college->college_id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['PostItem'])) {
         $model->postItem->attributes = $_POST['PostItem'];
         $model->thread->attributes = $_POST['Thread'];
         $fileUpload = CUploadedFile::getInstance($model->thread, 'attachment');
         Yii::log(CVarDumper::dumpAsString($fileUpload));
         if ($fileUpload !== null) {
             $model->thread->attachment = $fileUpload;
         }
         if ($model->validate()) {
             if ($model->save()) {
                 if ($fileUpload !== null) {
                     $model->thread->attachment->saveAs($this->module->basePath . '/files/' . $model->thread->attachment . "_" . $model->thread->getPrimaryKey());
                 }
                 //$model->thread->attachment->saveAs(Yii::app()->basePath . '/../files/' . $model->thread->attachment);
                 $this->redirect(array('review', 'id' => $model->postItem->post_item_id));
                 exit;
             } else {
                 Yii::app()->user->setFlash('error', 'Unable to post your thread.');
             }
         }
     }
     $this->render('create', array('model' => $model, 'collegeId' => $college->college_id));
 }
/* @var $this ProfileController */
?>

<div class="row-fluid">

    <div class="span-12">

        <div class="snippet-header">
            <h1><?php 
echo Yii::t('view', 'event.upcoming');
?>
</h1>
        </div>

        <?php 
$this->widget('bootstrap.widgets.TbExtendedGridView', array('dataProvider' => Event::getLatestEventsSnippet(Yii::app()->params['defaultLatestEventsToGet'], College::getUserCollege()->college_id), 'selectableCells' => true, 'selectableRows' => 1, 'columns' => array(array('name' => 'title', 'header' => 'Title'), array('name' => 'city', 'header' => 'Location'), array('header' => 'Date', 'type' => 'raw', 'value' => '$data["start_date"] . CHtml::tag("br") . $data["end_date"]'), array('header' => 'Time', 'type' => 'raw', 'value' => '$data["start_time"] . CHtml::tag("br") . $data["end_time"]'), array('value' => 'Yii::app()->getController()->createAbsoluteUrl("/event/event/view", array("id" => $data["id"]))', 'headerHtmlOptions' => array('style' => 'display: none;'), 'htmlOptions' => array('class' => 'link', 'style' => 'display: none;'))), 'template' => "{items}", 'emptyText' => "There are currently no Events", 'type' => 'bordered', 'rowCssClassExpression' => '"link-row"', 'htmlOptions' => array('class' => 'snippetEventGrid')));
$btn = $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('view', 'event.more'), 'type' => 'primary', 'url' => array('/event/event/index'), 'size' => 'large', 'icon' => 'flag'), true);
echo CHtml::tag('div', array('class' => 'snippet-more-area'), $btn);
?>

    </div>

</div>

<script>

   $(document).ready(function (){

       $('.snippetEventGrid tbody tr.link-row').click(function(){
         var link = $(this).children("td.link").html();
           window.location.assign(link);
 public function actionSearchTopics($string, $progId = null, $semesterId = null)
 {
     $college = College::getUserCollege();
     $this->areaLarge = $college->college_name;
     $this->areaSmall = Yii::t('forum', 'forum.area.search');
     if (!empty($progId)) {
         $this->areaSmall .= " (In " . Program::model()->findByPk($progId)->program_name;
         if (!empty($semesterId)) {
             $this->areaSmall .= " / " . Semester::model()->findByPk($semesterId)->semester_name;
         }
         $this->areaSmall .= " )";
     }
     $this->canPost = false;
     Yii::log($string);
     $threads = Thread::model()->searchTopics($string, $college->college_id, $progId, $semesterId);
     Yii::log(CVarDumper::dumpAsString($threads));
     $topicRows = array();
     foreach ($threads as $i => $thread) {
         $row = array('id' => $thread['thread_id'], 'topic' => $thread['title'], 'program_name' => $thread['program_name'], 'program' => $thread['program_id'], 'semester' => CHtml::link($thread['semester_name'], array('viewTopics', 'programId' => $thread['program_id'], 'semesterId' => $thread['semester_id'])), 'progCode' => $thread['program_code'], 'postDate' => $thread['date_created'], 'numReplies' => $thread['reply_count']);
         $topicRows[] = $row;
     }
     $gridColumns = array(array('name' => 'topic', 'header' => 'Topic', 'type' => 'raw', 'value' => 'CHtml::link($data["topic"], array("post/readTopic", "id" => $data["id"]));'), array('name' => 'program_name', 'header' => 'Program', 'type' => 'raw', 'value' => 'CHtml::link($data["program_name"], array("programView", "programId" => $data["program"]));'), array('name' => 'semester', 'header' => 'Semester', 'type' => 'raw'), array('name' => 'postDate', 'header' => 'Post Date', 'filter' => false, 'value' => 'Yii::app()->timeagoFormat->timeago(new DateTime($data["postDate"]))'), array('name' => 'numReplies', 'header' => 'Replies', 'filter' => false));
     $filtersForm = new FiltersForm();
     if (isset($_GET['FiltersForm'])) {
         $filtersForm->filters = $_GET['FiltersForm'];
     }
     $filteredData = $filtersForm->filter($topicRows);
     $forumGridData = new CommunityArrayDataProvider(array_values($filteredData), array('sort' => array('attributes' => array('topic', 'program', 'postDate', 'numReplies')), 'pagination' => array('pageSize' => Yii::app()->params['forum_pageSize'])));
     $forumGridData->setPagination(false);
     $this->emptyText = "No topics could be found";
     $this->render('topics', array('gridColumns' => $gridColumns, 'forumGridData' => $forumGridData, 'filtersForm' => $filtersForm));
 }
<div class="row-fluid">

    <div class="span-12">

        <div class="snippet-header">
            <h1><?php 
echo Yii::t('view', 'topic.today');
?>
</h1>
        </div>

        <?php 
$this->widget('bootstrap.widgets.TbGridView', array('dataProvider' => Thread::getTodaysThreadsSnippet(College::getUserCollege()->college_id), 'columns' => array(array('header' => 'Title', 'name' => 'title', 'type' => 'raw', 'value' => 'CHtml::link($data["title"], array("/community/post/readTopic", "id" => $data["id"]));'), array('header' => 'Forum', 'name' => 'program_name', 'type' => 'raw', 'value' => 'CHtml::link($data["program_name"], array("/community/forum/programView", "programId" => $data["program_id"]));'), array('header' => 'Semester', 'name' => 'semester_name', 'type' => 'raw', 'value' => 'CHtml::link($data["semester_name"], array("/community/forum/viewTopics", "programId" => $data["program_id"], "semesterId" => $data["semester_id"]));'), array('header' => 'Program Code', 'name' => 'program_code'), array('header' => 'Date Posted', 'name' => 'date_created', 'value' => 'Yii::app()->timeagoFormat->timeago(new DateTime($data["date_created"]))')), 'template' => "{items}", 'emptyText' => "There are currently no Topics today", 'type' => 'bordered', 'htmlOptions' => array('class' => 'snippetTopicGrid')));
$btn = $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('view', 'topic.more'), 'type' => 'primary', 'size' => 'large', 'url' => array('/community/forum/todaysTopics'), 'icon' => 'comment'), true);
echo CHtml::tag('div', array('class' => 'snippet-more-area'), $btn);
?>

    </div>

</div>