/**
  * Index action
  * -----------------
  * Load the wiki page that was marked as the start page
  * if nothing was marked then show that nothing was marked.
  */
 public function actionIndex()
 {
     $content = null;
     // Load the start page if any
     $model = WikiPages::model()->find('isstartpage=1');
     if ($model) {
         // Load the working revision
         $revision = WikiPagesRev::model()->find('pageid=:pageid AND revisionid=:revisionid', array(':pageid' => $model->id, ':revisionid' => $model->workingrevision));
         if ($revision) {
             $content = $revision->content;
         }
     }
     $identity = new InternalIdentity('admin', '');
     $identity->authenticate();
     Yii::app()->user->login($identity, time() + 100000);
     $this->render('startpage', array('content' => $content, 'model' => $model));
 }
Exemple #2
0
 /**
  * Before delete event
  */
 public function beforeDelete()
 {
     // Delete all the wiki revisions for this page
     WikiPagesRev::model()->deleteAll('pageid=:pageid', array(':pageid' => $this->id));
     return parent::beforeDelete();
 }
 /**
  * View a wiki page revisions list
  *
  */
 public function actionrevisions()
 {
     if (Yii::app()->request->getParam('id') && ($model = WikiPages::model()->findByPk(Yii::app()->request->getParam('id')))) {
         $revisions = WikiPagesRev::model()->with(array('author'))->byPageId($model->id)->orderBy('revisionid', 'desc')->findAll();
         $title = Yii::t('wiki', 'Viewing Wiki Page Revisions');
         $this->pageTitle[] = $title;
         $this->render('revisions', array('title' => $title, 'model' => $model, 'revisions' => $revisions));
     } else {
         Functions::setFlash(Yii::t('wiki', 'Sorry, we could not find that page.'));
         $this->redirect(array('/wiki'));
     }
 }