public function afterUninstall() { //Удаляем таблицу модуля Yii::app()->db->createCommand()->dropTable(Page::model()->tableName()); Yii::app()->db->createCommand()->dropTable(PageTranslate::model()->tableName()); return parent::afterUninstall(); }
/** * Delete page translations after deleting language * @param $event */ public function deleteTranslations($event) { // Delete page translations Yii::import('application.modules.pages.models.PageTranslate'); $pages = PageTranslate::model()->findAll(array('condition' => 'language_id=:lang_id', 'params' => array(':lang_id' => $event->sender->getPrimaryKey()))); if ($pages) { foreach ($pages as $p) { $p->delete(); } } // Delete categories translations Yii::import('application.modules.pages.models.PageCategoryTranslate'); $categories = PageCategoryTranslate::model()->findAll(array('condition' => 'language_id=:lang_id', 'params' => array(':lang_id' => $event->sender->getPrimaryKey()))); if ($categories) { foreach ($categories as $c) { $c->delete(); } } }
</li> <li class="active"> <?php echo PageTranslate::getLabel('list'); ?> </li> </ol> <?php echo $this->Session->getAlert(); ?> <div class="alert alert-primary"> <button type="button" class="close" data-dismiss="alert">×</button> <?php echo PageTranslate::getLabel(SEARCH); ?> </div> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> <?php echo UserTranslate::getLabel('list'); ?> </h3> </div> <div class="panel-body"> <table class="table table-hover table-bordered" id="pageData"> <thead> <tr> <th style="width:8%;" class="te"><?php
echo MenuTranslate::getLabel(HOME); ?> </a> </li> <li> <a href="<?php echo Router::generateURL('cockpit/page'); ?> "><?php echo PageTranslate::getLabel("title"); ?> </a> </li> <li class="active"> <?php echo PageTranslate::getLabel(ADD); ?> </li> </ol> <?php echo $this->Session->getAlert(); ?> <form action="<?php echo Router::generateURL('cockpit/page/add'); ?> " method="post" class="form-horizontal"> <?php echo $this->FormField->hidden('creation'); ?>
</li> <li class="active"> <?php echo PageTranslate::getLabel(CONSULT); ?> </li> </ol> <form action="" method="post" class="form-horizontal"> <?php echo $this->FormField->hidden('id'); ?> <div class="panel panel-success"> <div class="panel-heading"> <h3 class="panel-title"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <?php echo PageTranslate::getLabel(CONSULT); ?> </h3> </div> <div class="panel-body"> <?php if ($this->Session->user('category') == 3) { ?> <?php if ($this->request->data->logicaldelete == 1) { echo $this->FormField->text('logicaldelete', true, 'form-control'); } ?> <?php echo $this->FormField->text('creation', true, 'form-control'); ?>
function online($id = null) { if ($id === null || !is_numeric($id)) { $this->redirect('cockpit/page'); return false; } $this->loadModel(PAGE); $this->request->data = $this->Page->findFirst(array('fields' => DBUtils::$table[PAGE], 'conditions' => array('Page.id' => $id))); $this->request->data->online = $this->request->data->online == 1 ? 0 : 1; $id = $this->Page->save($this->request->data); if (!is_numeric($id)) { $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, ErrorsTranslate::getLabel(DB) . '/id:' . $id); $this->Session->setAlert(ErrorsTranslate::getLabel(DB) . $id, DANGER); return false; } if ($this->request->data->online == 1) { $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, PageTranslate::getLabel('onlineUpdated') . '/id:' . $id); $this->Session->setAlert(PageTranslate::getLabel('onlineUpdated'), SUCCESS); } else { $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, PageTranslate::getLabel('offlineUpdated') . '/id:' . $id); $this->Session->setAlert(PageTranslate::getLabel('offlineUpdated'), SUCCESS); } $this->redirect('cockpit/page'); }
echo MenuTranslate::getLabel(HOME); ?> </a> </li> <li> <a href="<?php echo Router::generateURL('cockpit/page'); ?> "><?php echo PageTranslate::getLabel('title'); ?> </a> </li> <li class="active"> <?php echo PageTranslate::getLabel(UPDATE); ?> </li> </ol> <?php echo $this->Session->getAlert(); ?> <form action="<?php echo Router::generateURL('cockpit/page/edit/' . $id); ?> " method="post" class="form-horizontal"> <?php echo $this->FormField->hidden('id'); ?>
"><?php echo PageTranslate::getLabel('title'); ?> </a> </li> <li class="active"> <?php echo PageTranslate::getLabel(DELETE); ?> </li> </ol> <div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <?php echo PageTranslate::getLabel('infodel'); ?> </div> <form action="<?php echo Router::generateURL('cockpit/page/delete/' . $id); ?> " method="post" class="form-horizontal"> <?php echo $this->FormField->hidden('id'); ?> <?php echo $this->FormField->hidden('updated'); ?> <?php echo $this->FormField->hidden('updater');