/** * Restore revision log * */ public function restoreRevisionLog($revisionId) { $this->activity['projectid'] = $this->page->projectid; $this->activity['type'] = Activity::TYPE_WIKI; $this->activity['title'] = "Restored Revision <strong>{revid}</strong> for the page <strong>{pagetitle}</strong> "; // Append project params $this->activity['params'] = array_merge($this->activity['params'], array('{revid}' => WikiPages::model()->getModelRevisionLink($revisionId, $this->page->id, $this->page->alias), '{pagetitle}' => $this->page->getLink())); // Activity: New Project Activity::log($this->activity); }
/** * 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)); }
echo CHtml::beginForm('', 'post', array('id' => 'revisionDiffForm')); ?> <?php foreach ($revisions as $revision) { ?> <div class='revision-row'> <span><?php echo CHtml::radioButton('revisionFrom', false, array('value' => $revision->id)); ?> </span> <span><?php echo CHtml::radioButton('revisionTo', false, array('value' => $revision->id)); ?> </span> <span><?php echo WikiPages::model()->getModelRevisionLink($revision->revisionid, $model->id, $model->alias, array('title' => Yii::t('wiki', 'Logged on {date} By {user}', array('{date}' => Yii::app()->dateFormatter->formatDateTime($revision->created, 'short', 'short'), '{user}' => $revision->author->username)))); ?> </span> <span> <span><?php echo CHtml::link(CHtml::image(Yii::app()->params['imagesUrl'] . '/icons/x.png', 'delete'), array('/wiki/deleterevision', 'id' => $revision->id), array('class' => 'deleteConfirm', 'title' => Yii::t('wiki', 'Delete Revision'))); ?> </span> <span><?php echo CHtml::link(CHtml::image(Yii::app()->params['imagesUrl'] . '/icons/a_left.png', 'restore'), array('/wiki/restorerevision', 'id' => $revision->id), array('title' => Yii::t('wiki', 'Restore Revision'))); ?> </span> </span> </div> <?php if ($revision->comment) {
/** * 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')); } }