예제 #1
0
 public function init()
 {
     $this->_model = Page::findOne($this->id);
     if (!is_null($this->_model)) {
         $this->title = $this->_model->title;
         $this->adminActions[] = array('action' => Url::to(array('/pages/page/onlineview', 'id' => $this->_model->id)), 'content' => "<i class='icon icon-eye-open icon-1x tipster' title='anzeigen'> </i>");
         $this->adminActions[] = array('action' => Url::to(array('/pages/page/update', 'id' => $this->_model->id)), 'content' => "<i class='icon icon-pencil icon-1x tipster' title='bearbeiten'> </i>");
     }
     parent::init();
 }
예제 #2
0
파일: Page.php 프로젝트: frenzelgmbh/scms
 /**
  * Forms an associative, multidimensional array holding only the first
  * level of nodes. Used when lazy loading is enabled and only the first
  * nodes should be shown.
  * 
  * @param int dataview_id The id of the dataview to show this tree for
  * @param User $user The user model to filter this tree for (Defaults to false, meaning no user filter)
  *
  * @return array The parent child data as associative, multidimensional array
  */
 public static function rootTreeAsArray($id)
 {
     $checkRootNode = Page::findOne($id);
     if (is_null($checkRootNode->parent_pages_id) or $checkRootNode->parent_pages_id == 0) {
         $rootNode = $checkRootNode->id;
     } else {
         $rootNode = $checkRootNode->parent_pages_id;
     }
     $roots = array();
     $roots = Page::find()->where(array('id' => $rootNode))->All();
     $out = array();
     foreach ($roots as $root) {
         $currow = array('id' => $root->id, 'child' => $root->noChildren, 'text' => $root->name);
         $out[] = $currow;
     }
     return $trees = array('id' => 0, 'item' => $out);
 }
예제 #3
0
 /**
  * Shows the diff of the current cms page compared to the version before
  * @param  integer $id of the old page
  * @return view the diff view
  */
 public function actionDiffview($id)
 {
     $model = $this->findParentModel($id);
     $compareModel = Page::findOne($id);
     if (!is_array($model->body)) {
         $lines2 = explode("\n", $model->body);
     }
     if (!is_array($compareModel->body)) {
         $lines1 = explode("\n", $compareModel->body);
     }
     foreach ($lines1 as $i => $line) {
         $lines1[$i] = rtrim($line, "\r\n");
     }
     foreach ($lines2 as $i => $line) {
         $lines2[$i] = rtrim($line, "\r\n");
     }
     $renderer = new DiffRendererHtmlInline();
     $difftext = new \Diff($lines1, $lines2);
     return $this->render('view_diff', array('difftext' => $difftext->render($renderer), 'model' => $model));
 }