예제 #1
0
 public function init()
 {
     parent::init();
     $this->_texts = Data::cache(TextModel::CACHE_KEY, 3600, function () {
         return TextModel::find()->asArray()->all();
     });
 }
예제 #2
0
 public function actionDelete($id)
 {
     if ($model = Text::findOne($id)) {
         $model->delete();
     } else {
         $this->error = Yii::t('easyii', 'Not found');
     }
     return $this->formatResponse(Yii::t('easyii/text', 'Text deleted'));
 }
 public function insertTexts()
 {
     if (Text::find()->count()) {
         return '`<b>' . Text::tableName() . '</b>` table is not empty, skipping...';
     }
     $this->db->createCommand('TRUNCATE TABLE `' . Text::tableName() . '`')->query();
     (new Text(['text' => 'Welcome on EasyiiCMS demo website', 'slug' => 'index-welcome-title']))->save();
     return 'Text data inserted.';
 }
예제 #4
0
 public function dbInstall()
 {
     $db = Yii::$app->db;
     $tableOptions = null;
     if ($db->driverName === 'mysql') {
         $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=MyISAM';
     }
     $db->createCommand()->createTable(Text::tableName(), ['text_id' => 'pk', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $tableOptions)->execute();
     $db->createCommand()->createIndex('slug', Text::tableName(), 'slug', true)->execute();
 }
예제 #5
0
파일: Text.php 프로젝트: radiegtya/easyii
 public function init()
 {
     parent::init();
     $texts = Data::cache(TextModel::CACHE_KEY, 3600, function () {
         return TextModel::find()->asArray()->all();
     });
     foreach ($texts as $text) {
         $this->_texts[$text['text_id']] = $this->parseText($text);
     }
 }
예제 #6
0
 public function down()
 {
     $this->dropTable(models\Admin::tableName());
     $this->dropTable(models\LoginForm::tableName());
     $this->dropTable(models\Module::tableName());
     $this->dropTable(models\Photo::tableName());
     $this->dropTable(models\Setting::tableName());
     $this->dropTable(Carousel::tableName());
     $this->dropTable(catalog\models\Category::tableName());
     $this->dropTable(catalog\models\Item::tableName());
     $this->dropTable(article\models\Category::tableName());
     $this->dropTable(article\models\Item::tableName());
     $this->dropTable(Feedback::tableName());
     $this->dropTable(File::tableName());
     $this->dropTable(gallery\models\Category::tableName());
     $this->dropTable(Guestbook::tableName());
     $this->dropTable(News::tableName());
     $this->dropTable(Page::tableName());
     $this->dropTable(Subscriber::tableName());
     $this->dropTable(History::tableName());
     $this->dropTable(Text::tableName());
 }
예제 #7
0
파일: Text.php 프로젝트: vitalik74/easyii
 public function init()
 {
     parent::init();
     $this->_texts = TextModel::find()->asArray()->all();
     /*})*/
 }
예제 #8
0
 public function actionIndex()
 {
     $items = Carousel::itemlist(1306, 460);
     $testmonials = Text::find()->all();
     return $this->render('index', array('items' => $items, 'testmonials' => $testmonials));
 }