예제 #1
0
 protected function renderFirstBlock()
 {
     $logged_in = !Yii::app()->user->isGuest && !isset($_GET['normal']);
     $text = EInfotext::model()->get(2);
     $text->textarea = true;
     $date = EInfotext::model()->get(3);
     $titel = EInfotext::model()->get(4);
     $active = EInfotext::model()->get(5);
     if ($logged_in) {
         if (isset($_POST['stop'])) {
             $active->info = $_POST['infoactive'];
             $_POST['infotext'] = $_POST['Page']['text'];
             $date->info = $_POST['infodate'];
             $titel->info = $_POST['infotitel'];
             $text->info = $_POST['infotext'];
             $active->save();
             $date->save();
             $titel->save();
             $text->save();
         }
     }
     return $this->renderPartial('index_first', array('logged_in' => $logged_in, 'text' => $text, 'date' => $date, 'titel' => $titel, 'active' => $active), true);
 }
예제 #2
0
 public function get($id)
 {
     $info = EInfoText::model()->findByPk($id);
     if (!$info) {
         $info = EInfotext::model();
         $info->attributes = array('id' => $id);
         $info->save(false);
     }
     return $info;
 }