Ejemplo n.º 1
0
 public function init()
 {
     parent::init();
     $this->_texts = Data::cache(TextModel::CACHE_KEY, 3600, function () {
         return TextModel::find()->asArray()->all();
     });
 }
Ejemplo n.º 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.';
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 7
0
 public function init()
 {
     parent::init();
     $this->_texts = TextModel::find()->asArray()->all();
     /*})*/
 }
Ejemplo n.º 8
0
 public function actionIndex()
 {
     $items = Carousel::itemlist(1306, 460);
     $testmonials = Text::find()->all();
     return $this->render('index', array('items' => $items, 'testmonials' => $testmonials));
 }