Ejemplo n.º 1
0
 public function afterUninstall()
 {
     Yii::app()->settings->clear('contacts');
     $db = Yii::app()->db;
     $db->createCommand()->dropTable(ContactsMaps::model()->tableName());
     $db->createCommand()->dropTable(ContactsMarkers::model()->tableName());
     $db->createCommand()->dropTable(ContactsRouter::model()->tableName());
     $db->createCommand()->dropTable(ContactsRouterTranslate::model()->tableName());
     return parent::afterUninstall();
 }
Ejemplo n.º 2
0
 /**
  * Действие редактирование и добавление
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     $mapsCount = ContactsMaps::model()->count();
     if ($mapsCount < 1) {
         throw new CHttpException(403);
     }
     $model = $new === true ? new ContactsRouter() : ContactsRouter::model()->findByPk($_GET['id']);
     $this->pageName = $model->isNewRecord ? Yii::t('app', 'CREATE', 1) : Yii::t('app', 'UPDATE', 1);
     $this->breadcrumbs = array(Yii::t('ContactsModule.default', 'MODULE_NAME') => array('/admin/contacts'), Yii::t('ContactsModule.default', 'ROUTER') => array('/admin/contacts/router'), $this->pageName);
     if (isset($_POST['ContactsRouter'])) {
         $model->attributes = $_POST['ContactsRouter'];
         if ($model->validate()) {
             $model->save();
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }