/** * Toggle topic status */ public function actiontoggletopic() { if (!Yii::app()->user->checkAccess('op_forum_topics')) { throw new CHttpException(403, Yii::t('forum', 'Sorry, You are not allowed to perform that operation.')); } if (isset($_GET['id']) && ($model = ForumTopics::model()->findByPk($_GET['id']))) { $model->visible = $model->visible == 1 ? 0 : 1; $model->update(); Yii::app()->user->setFlash('success', Yii::t('forum', 'Topics Status Changed.')); $this->redirect(Yii::app()->request->getUrlReferrer()); } else { $this->redirect(Yii::app()->request->getUrlReferrer()); } }
/** * Get the rows for the sitemap */ protected function getRows() { $_rows = array(); // Grab blog cats $blogCats = BlogCats::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($blogCats)) { foreach ($blogCats as $blogCat) { $_rows[] = $this->makeData($this->getFullUrl('/blog/category/' . $blogCat->alias), time(), 'monthly', 0.1); } } // Grab blog rows $blogRows = Blog::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($blogRows)) { foreach ($blogRows as $blogRow) { $_rows[] = $this->makeData($this->getFullUrl('/blog/view/' . $blogRow->alias), $blogRow->postdate, 'weekly', 1); } } // Grab tutorials cats $tutorialsCats = TutorialsCats::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($tutorialsCats)) { foreach ($tutorialsCats as $tutorialsCat) { $_rows[] = $this->makeData($this->getFullUrl('/tutorials/category/' . $tutorialsCat->alias), time(), 'monthly', 0.1); } } // Grab tutorials rows $tutorialsRows = Tutorials::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($tutorialsRows)) { foreach ($tutorialsRows as $tutorialsRow) { $_rows[] = $this->makeData($this->getFullUrl('/tutorials/view/' . $tutorialsRow->alias), $tutorialsRow->postdate, 'weekly', 1); } } // Grab extensions cats $extensionsCats = ExtensionsCats::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($extensionsCats)) { foreach ($extensionsCats as $extensionsCat) { $_rows[] = $this->makeData($this->getFullUrl('/extensions/category/' . $extensionsCat->alias), time(), 'monthly', 0.1); } } // Grab extensions rows $extensionsRows = Extensions::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($extensionsRows)) { foreach ($extensionsRows as $extensionsRow) { $_rows[] = $this->makeData($this->getFullUrl('/extensions/view/' . $extensionsRow->alias), $extensionsRow->postdate, 'weekly', 1); } } // Grab users rows $usersRows = Members::model()->findAll(); if (count($usersRows)) { foreach ($usersRows as $usersRow) { $_rows[] = $this->makeData($this->getFullUrl('/user/' . $usersRow->id . '-' . $usersRow->seoname), $usersRow->joined, 'monthly', 1); } } // Grab forum topics rows $forumTopics = ForumTopics::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($forumTopics)) { foreach ($forumTopics as $forumTopic) { $_rows[] = $this->makeData($this->getFullUrl('/forum/topic/' . $forumTopic->id . '-' . $forumTopic->alias), $forumTopic->dateposted, 'daily', 1); } } // Grab custom pages $customPages = CustomPages::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($customPages)) { foreach ($customPages as $customPage) { $_rows[] = $this->makeData($this->getFullUrl('/' . $forumTopic->alias), $customPage->dateposted, 'weekly', 1); } } // Grab documentation pages $documentations = Documentation::model()->findAll('language=:langauge', array(':langauge' => Yii::app()->language)); if (count($documentations)) { foreach ($documentations as $documentation) { $_rows[] = $this->makeData($this->getFullUrl('/documentation/guide/' . $documentation->type . '/topic/' . $documentation->mkey), $documentation->last_updated, 'weekly', 1); } } // Return array return $_rows; }