diff --git a/protected/components/Controller.php b/protected/components/Controller.php
index 0fc80b3..685bbda 100644
--- a/protected/components/Controller.php
+++ b/protected/components/Controller.php
@@ -220,5 +220,77 @@ public function logFromEmailActivity($type)
}
return $result;
}
+
+ protected function getInputAsJson()
+ {
+ return CJSON::decode(file_get_contents('php://input'));
+ }
+
+ /**
+ * Send raw HTTP response
+ * @param int $status HTTP status code
+ * @param string $body The body of the HTTP response
+ * @param string $contentType Header content-type
+ * @return HTTP response
+ */
+ protected function sendResponse($status = 200, $body = '', $contentType = 'application/json')
+ {
+ // Set the status
+ $statusHeader = 'HTTP/1.1 ' . $status . ' ' . $this->getStatusCodeMessage($status);
+ header($statusHeader);
+ // Set the content type
+ header('Content-type: ' . $contentType);
+
+ echo $body;
+ Yii::app()->end();
+ }
+
+ protected function getStatusCodeMessage($status)
+ {
+ $codes = array(
+ 100 => 'Continue',
+ 101 => 'Switching Protocols',
+ 200 => 'OK',
+ 201 => 'Created',
+ 202 => 'Accepted',
+ 203 => 'Non-Authoritative Information',
+ 204 => 'No Content',
+ 205 => 'Reset Content',
+ 206 => 'Partial Content',
+ 300 => 'Multiple Choices',
+ 301 => 'Moved Permanently',
+ 302 => 'Found',
+ 303 => 'See Other',
+ 304 => 'Not Modified',
+ 305 => 'Use Proxy',
+ 306 => '(Unused)',
+ 307 => 'Temporary Redirect',
+ 400 => 'Bad Request',
+ 401 => 'Unauthorized',
+ 402 => 'Payment Required',
+ 403 => 'Forbidden',
+ 404 => 'Not Found',
+ 405 => 'Method Not Allowed',
+ 406 => 'Not Acceptable',
+ 407 => 'Proxy Authentication Required',
+ 408 => 'Request Timeout',
+ 409 => 'Conflict',
+ 410 => 'Gone',
+ 411 => 'Length Required',
+ 412 => 'Precondition Failed',
+ 413 => 'Request Entity Too Large',
+ 414 => 'Request-URI Too Long',
+ 415 => 'Unsupported Media Type',
+ 416 => 'Requested Range Not Satisfiable',
+ 417 => 'Expectation Failed',
+ 500 => 'Internal Server Error',
+ 501 => 'Not Implemented',
+ 502 => 'Bad Gateway',
+ 503 => 'Service Unavailable',
+ 504 => 'Gateway Timeout',
+ 505 => 'HTTP Version Not Supported',
+ );
+ return (isset($codes[$status])) ? $codes[$status] : '';
+ }
}
\ No newline at end of file
diff --git a/protected/config/main.php b/protected/config/main.php
index 968933d..29c0c2f 100644
--- a/protected/config/main.php
+++ b/protected/config/main.php
@@ -15,13 +15,9 @@
'application.extensions.sweekit.Sweeml',
'application.extensions.MobileDetect.Mobile_Detect',
'application.extensions.calc.eqEOS',
- 'ext.eoauth.*',
- 'ext.eoauth.lib.*',
- 'ext.lightopenid.*',
- 'ext.eauth.*',
- 'ext.eauth.services.*',
'application.vendors',
'ext.yii-mail.YiiMailMessage',
+ 'ext.imperavi-redactor-widget.ImperaviRedactorWidget',
),
'modules' => array(
'gii' => array(
@@ -35,9 +31,6 @@
'admin' => array(
'defaultController' =>'user',
),
- 'exel' => array(
- 'defaultController' =>'index',
- ),
'mailingList'=>array(
'defaultController'=>'email',
),
@@ -68,12 +61,12 @@
),
//'session' => array(
//'timeout' => 86400,
- //),
+ //),
'request' => array(
'class' => 'HttpRequest',
'enableCsrfValidation' => true,
'enableCookieValidation' => true,
- 'noCsrfValidationRoutes' => array('admin/item', 'register/SaveComment'), ///, 'logg/History'
+ 'noCsrfValidationRoutes' => array('admin/item', 'register/SaveComment','site/modal','site/Getmenu'), ///, 'logg/History'
),
'languageManager' => array(
'class' => 'DbLanguageManager',
@@ -158,9 +151,6 @@
'class' => 'ext.image.ImageComponent',
'driver' => 'Gd',
),
- 'loid' => array(
- 'class' => 'ext.lightopenid.loid',
- ),
'mail' => array(
'class' => 'ext.yii-mail.YiiMail',
'transportType' => 'php',
@@ -168,94 +158,6 @@
'logging' => false,
'dryRun' => false
),
- 'eauth' => array(
- 'class' => 'ext.eauth.EAuth',
- 'popup' => true, // Use the popup window instead of redirecting.
- 'cache' => false, // Cache component name or false to disable cache. Defaults to 'cache'.
- 'cacheExpire' => 0, // Cache lifetime. Defaults to 0 - means unlimited.
- 'services' => array(// You can change the providers and their classes.
-// 'google' => array(
-// 'class' => 'GoogleOpenIDService',
-// ),
-// 'yandex' => array(
-// 'class' => 'YandexOpenIDService',
-// ),
-// 'twitter' => array(
- // register your app here: https://dev.twitter.com/apps/new
-// 'class' => 'TwitterOAuthService',
-// 'key' => '...',
-// 'secret' => '...',
-// ),
- 'google_oauth' => array(
- // register your app here: https://code.google.com/apis/console/
- 'class' => 'CustomGoogleService',
- 'client_id' => '121482514649-7orl2mum6mco54pe33rvl743j9bp2353.apps.googleusercontent.com',
- 'client_secret' => 's19p91oTKTLJvvMKGVEi_kebs',
- 'title' => 'Google (OAuth)',
- ),
-// 'yandex_oauth' => array(
- // register your app here: https://oauth.yandex.ru/client/my
-// 'class' => 'YandexOAuthService',
-// 'client_id' => '...',
-// 'client_secret' => '...',
-// 'title' => 'Yandex (OAuth)',
-// ),
- 'facebook' => array(
- // register your app here: https://developers.facebook.com/apps/
- 'class' => 'CustomFacebookService',
- 'client_id' => '689556884392541',
- 'client_secret' => '5af00ac919412ac2dcaa416e29adeec3',
- ),
-// 'linkedin' => array(
- // register your app here: https://www.linkedin.com/secure/developer
-// 'class' => 'LinkedinOAuthService',
-// 'key' => '...',
-// 'secret' => '...',
-// ),
-// 'github' => array(
- // register your app here: https://github.com/settings/applications
-// 'class' => 'GitHubOAuthService',
-// 'client_id' => '...',
-// 'client_secret' => '...',
-// ),
-// 'live' => array(
- // register your app here: https://manage.dev.live.com/Applications/Index
-// 'class' => 'LiveOAuthService',
-// 'client_id' => '...',
-// 'client_secret' => '...',
-// ),
- 'vkontakte' => array(
- // register your app here: https://vk.com/editapp?act=create&site=1
- 'class' => 'CustomVKontakteService',
- 'client_id' => '3792586',
- 'client_secret' => 'VY2T0rp0SMkHtyRmrTSJ',
- ),
-// 'mailru' => array(
- // register your app here: http://api.mail.ru/sites/my/add
-// 'class' => 'MailruOAuthService',
-// 'client_id' => '...',
-// 'client_secret' => '...',
-// ),
-// 'moikrug' => array(
- // register your app here: https://oauth.yandex.ru/client/my
-// 'class' => 'MoikrugOAuthService',
-// 'client_id' => '...',
-// 'client_secret' => '...',
-// ),
-// 'odnoklassniki' => array(
- // register your app here: http://dev.odnoklassniki.ru/wiki/pages/viewpage.action?pageId=13992188
- // ... or here: http://www.odnoklassniki.ru/dk?st.cmd=appsInfoMyDevList&st._aid=Apps_Info_MyDev
-// 'class' => 'OdnoklassnikiOAuthService',
-// 'client_id' => '...',
-// 'client_public' => '...',
-// 'client_secret' => '...',
-// 'title' => 'Odnokl.',
-// ),
- ),
- ),
- 'excel'=>array(
- 'class'=>'application.extensions.PHPExcel',
- ),
),
'params' => array(
'adminEmail' => 'dobrynina@astrafit.com',
diff --git a/protected/controllers/SiteController.php b/protected/controllers/SiteController.php
index ff92cad..a517dd1 100644
--- a/protected/controllers/SiteController.php
+++ b/protected/controllers/SiteController.php
@@ -13,7 +13,7 @@ public function accessRules() {
return array(
array('allow',
'roles' => array('client','superadmin','admin'),
- 'actions' => array('myData'),
+ 'actions' => array('myData','modal'),
),
array('deny',
'roles' => array('guest'),
@@ -218,9 +218,26 @@ public function actionError() {
$this->render('error', $error);
}
}
- public static function Logging() {
-// $this->actionLogin();
+
+ public function actionModal() {
+ $data = $this->getInputAsJson();
+ $model = new Joinus();
+ if(empty($data['name']) || empty($data['email']))
+ {
+ $this->sendResponse(401, 'There was an error while sending data');
+ } else {
+ $model->attributes = $data;
+ if($model->validate()) {
+ $model->save();
+ $this->sendResponse(200, 'Email was sended successfull');
+ }
+ }
+ }
+
+ public function actionGetmenu() {
+ echo json_encode(Pages::getPages());
}
+
public function actionLogin() {
$this->layout = '//layouts/main-temp';
$model = new User('login');
diff --git a/protected/models/JoinUs.php b/protected/models/JoinUs.php
new file mode 100644
index 0000000..e45af97
--- /dev/null
+++ b/protected/models/JoinUs.php
@@ -0,0 +1,90 @@
+ Yii::t('page', 'Ваше имя'),
+ 'company' => Yii::t('page', 'Название компании'),
+ 'url' => Yii::t('page', 'Ссылка на сайт магазина'),
+ 'phone' => Yii::t('page', 'Телефон для обратной связи'),
+ 'email'=> Yii::t('page', 'Емейл'),
+ 'text'=>Yii::t('page', 'Коментарии'),
+ );
+ }
+
+ public function scopes() {
+ return array(
+ 'notBlocked' => array(
+ 'condition' => 'is_blocked=0',
+ ),
+ );
+ }
+
+ public function getPages() {
+ return self::model()->findAll();
+ }
+
+ public function rules() {
+ return array(
+ array('name', 'required', 'on' => 'insert,update'),
+ array('company', 'required', 'on' => 'insert,update'),
+ array('email', 'required', 'on' => 'insert,update'),
+ array('url', 'required', 'on' => 'insert,update'),
+ array('name,company,url,phone,email,text', 'safe', 'on' => 'search,insert,update'),
+ );
+ //$charset = Yii::app()->charset;
+ }
+
+ public function getId() {
+ return $this->_id;
+ }
+
+ public function getName() {
+ return $this->name;
+ }
+
+ public function getCompany() {
+ return $this->company;
+ }
+
+ public function getUrl() {
+ return $this->url;
+ }
+
+ public function getPhone() {
+ return $this->phone;
+ }
+
+ public function getEmail() {
+ return $this->email;
+ }
+
+ public function getText() {
+ return $this->text;
+ }
+
+}
diff --git a/protected/models/Page.php b/protected/models/Page.php
new file mode 100644
index 0000000..24c8f1a
--- /dev/null
+++ b/protected/models/Page.php
@@ -0,0 +1,91 @@
+ Yii::t('page', 'Имя'),
+ 'info' => Yii::t('page', 'Информация'),
+ 'body' => Yii::t('page', 'Контент'),
+ 'weight' => Yii::t('page', 'Позиция'),
+ 'pages_id'=> Yii::t('page', 'Где отображать'),
+ 'create_time'=>Yii::t('page', 'Дата создания'),
+ );
+ }
+
+ public function scopes() {
+ return array(
+ 'notBlocked' => array(
+ 'condition' => 'is_blocked=0',
+ ),
+ );
+ }
+
+ public function getPages() {
+ return self::model()->findAll();
+ }
+
+ public function rules() {
+ return array(
+ array('title', 'required', 'on' => 'insert,update'),
+ array('info', 'required', 'on' => 'insert,update'),
+ //array('pages_id', 'required', 'on' => 'insert,update'),
+ array('weight', 'required', 'on' => 'insert,update'),
+ array('body', 'required', 'on' => 'insert,update'),
+ array('name,info,body,weight', 'safe', 'on' => 'search,insert,update'),
+ );
+ //$charset = Yii::app()->charset;
+ }
+
+ public function getId() {
+ return $this->_id;
+ }
+
+ public function getName() {
+ return $this->name;
+ }
+
+ public function getIsBlocked() {
+ return $this->is_blocked;
+ }
+
+ public function getInfo() {
+ return $this->info;
+ }
+
+ public function getWeight() {
+ return $this->weight;
+ }
+
+ public function getBody() {
+ return $this->body;
+ }
+
+ public function getPagesId() {
+ return $this->pages_id;
+ }
+
+}
diff --git a/protected/models/Pages.php b/protected/models/Pages.php
new file mode 100644
index 0000000..52fad4c
--- /dev/null
+++ b/protected/models/Pages.php
@@ -0,0 +1,72 @@
+ Yii::t('pages', 'Имя'),
+ 'info' => Yii::t('pages', 'Информация'),
+ 'weight' => Yii::t('pages', 'Позиция'),
+ );
+ }
+
+ public function scopes() {
+ return array(
+ 'notBlocked' => array(
+ 'condition' => 'is_blocked=0',
+ ),
+ );
+ }
+
+ public static function getPages() {
+ $connection=Yii::app()->db;
+ $sql = 'SELECT * FROM pages';
+ return $connection->createCommand($sql)->queryAll();
+ }
+
+ public function rules() {
+ return array(
+ array('name', 'required', 'on' => 'insert,update'),
+ array('info', 'required', 'on' => 'insert,update'),
+ array('name,info,weight', 'safe', 'on' => 'search,insert,update'),
+ );
+ //$charset = Yii::app()->charset;
+ }
+
+ public function getName() {
+ return $this->name;
+ }
+
+ public function getIsBlocked() {
+ return $this->is_blocked;
+ }
+
+ public function getInfo() {
+ return $this->info;
+ }
+
+ public function getWeight() {
+ return $this->weight;
+ }
+
+
+}
diff --git a/protected/modules/admin/controllers/PagesController.php b/protected/modules/admin/controllers/PagesController.php
new file mode 100644
index 0000000..5264192
--- /dev/null
+++ b/protected/modules/admin/controllers/PagesController.php
@@ -0,0 +1,117 @@
+ array(
+ 'class' => 'application.modules.admin.components.actions.BlockAction',
+ 'modelClass' => 'Pages',
+ 'message_block' => Yii::t('infoMessages', 'Страница разблокирован!'),
+ 'errorMessage_block' => Yii::t('infoMessages', 'Произошла ошибка при разблокировании страницы!'),
+ 'message_unBlock' => Yii::t('infoMessages', 'Страница заблокирован!'),
+ 'errorMessage_unBlock' => Yii::t('infoMessages', 'Произошла ошибка при блокировании страницы!'),
+ ),
+ 'markAsDeleted' => array(
+ 'class' => 'application.modules.admin.components.actions.MarkAsDeletedAction',
+ 'modelClass' => 'Pages',
+ 'message_mark' => Yii::t('infoMessages', 'Страница удалена!'),
+ 'errorMessage_mark' => Yii::t('infoMessages', 'Произошла ошибка при удалении страницы!'),
+ )
+ );
+ }
+
+ public function actionIndex() {
+ $search = new Pages('search');
+ $search->unsetAttributes();
+
+ if (!is_null(Yii::app()->request->getQuery('Pages')))
+ $search->attributes = Yii::app()->request->getQuery('Pages');
+
+ $criteria = new CDbCriteria;
+ $criteria->compare('t.name', $search->name, true);
+ $criteria->compare('t.is_blocked', array('0' => 0, '1' => 1));
+
+ $dataProvider = new ActiveDataProvider('Pages', array(
+ 'criteria' => $criteria,
+ 'sort' => array(
+ 'defaultOrder' => array('weight' => true),
+ 'sortVar' => 'sort',
+ ),
+ 'pagination' => array(
+ 'pageVar' => 'page',
+ 'sizeVar' => 'size',
+ 'pageSize' => Yii::app()->params['defaultPageSize'],
+ 'sizeOptions' => Yii::app()->params['sizeOptions'],
+ ),
+ ));
+ $this->render('index',
+ array('dataProvider'=>$dataProvider,'search'=>$search)
+ );
+ }
+
+ public function actionCreate() {
+ $model = new Pages;
+
+ if (!is_null(Yii::app()->request->getPost('ajax')) && Yii::app()->request->getPost('ajax') === 'create-user-form')
+ $this->performAjaxValidation($model);
+
+ if (!is_null(Yii::app()->request->getPost('Pages'))) {
+ $model->attributes = Yii::app()->request->getPost('Pages');
+ $model->is_blocked = 0;
+ if(!$model->weight)
+ $model->weight = 1;
+ //var_dump($model);die;
+ if ($model->save()) {
+ //save client role for user
+ $this->setFlashSuccess(Yii::t('infoMessages', 'Новая страница добавлена!'));
+ $this->redirect(array('index'));
+ }
+ }
+
+ $this->render('create', array(
+ 'model' => $model
+ ));
+ }
+
+ public function actionUpdate() {
+ $model = $this->loadModel();
+
+ if (!is_null(Yii::app()->request->getPost('ajax')) && Yii::app()->request->getPost('ajax') === 'update-user-form') {
+ $this->performAjaxValidation($model);
+ }
+
+ if ($model === null)
+ throw new CHttpException(404);
+
+ if (!is_null(Yii::app()->request->getPost('Pages'))) {
+ $model->attributes = Yii::app()->request->getPost('Pages');
+
+ if ($model->save()) {
+ $this->setFlashSuccess(Yii::t('infoMessages', 'Данные обновлены!'));
+ $this->redirect(array('index'));
+ }
+ }
+
+ $this->render('update', array(
+ 'model' => $model,
+ 'uid' => $model->id
+ ));
+ }
+}
diff --git a/protected/modules/admin/views/layouts/main.php b/protected/modules/admin/views/layouts/main.php
index 3d81f51..f52d2ba 100644
--- a/protected/modules/admin/views/layouts/main.php
+++ b/protected/modules/admin/views/layouts/main.php
@@ -58,8 +58,15 @@
-
-
+
+
+
+
+
+
'nav')); ?>
diff --git a/protected/modules/admin/views/page/_grid.php b/protected/modules/admin/views/page/_grid.php
new file mode 100644
index 0000000..2e63ad1
--- /dev/null
+++ b/protected/modules/admin/views/page/_grid.php
@@ -0,0 +1,207 @@
+widget('bootstrap.widgets.TbExtendedGridView', array(
+ 'id'=>'user-grid',
+ 'type' => 'striped bordered',
+ 'dataProvider'=>$dataProvider,
+ 'filter'=>$search,
+ 'template' => "{pager}{items}{pager}",
+ 'bulkActionPosition'=>'top',
+ 'bulkActions' => array(
+ 'actionButtons' => array(
+ array(
+ 'buttonType' => 'button',
+ 'type' => 'primary',
+ 'size' => 'medium',
+ 'id' => 'unblock',
+ 'label' => Yii::t('pages','Разблокировать'),
+ 'click' => 'js:function(checked){
+ var values=[];
+ var valuesIDS=$("#user-grid tr td.blocked-class").find("input:checkbox:checked")
+ valuesIDS.each(function(){
+ values.push($(this).val());
+ });
+
+ if(values.length == 1) {
+ $.ajax({
+ url:"'.Yii::app()->controller->createUrl('block').'",
+ data: {
+ ids:values
+ },
+ success:function(data){
+ $("#user-grid").yiiGridView("update");
+ }
+ });
+ }
+
+ }'
+ ),
+ array(
+ 'buttonType' => 'button',
+ 'type' => 'warning',
+ 'size' => 'medium',
+ 'id' => 'block',
+ 'label' => Yii::t('user','Заблокировать'),
+ 'click' => 'js:function(checked){
+ var values=[];
+ var valuesIDS=$("#user-grid tr td.not-blocked-class").find("input:checkbox:checked")
+ valuesIDS.each(function(){
+ values.push($(this).val());
+ });
+
+ if(values.length == 0) {
+ $.ajax({
+ url:"'.Yii::app()->controller->createUrl('block').'",
+ data: {
+ ids:values
+ },
+ success:function(data){
+ $("#user-grid").yiiGridView("update");
+ }
+ });
+ }
+ }'
+ ),
+ array(
+ 'buttonType' => 'button',
+ 'type' => 'danger',
+ 'size' => 'medium',
+ 'id' => 'remove-u-b',
+ 'label' => Yii::t('user','Удалить'),
+ 'click' => 'js:function(checked){
+ var values=[];
+ var valuesIDS=$("#user-grid").find("input:checkbox:checked")
+ valuesIDS.each(function(){
+ values.push($(this).val());
+ });
+
+ if(values.length > 0) {
+ $.ajax({
+ url:"'.Yii::app()->controller->createUrl('markAsDeleted').'",
+ data: {
+ ids:values
+ },
+ success:function(data){
+ $("#user-grid").yiiGridView("update");
+ }
+ });
+ }
+ }'
+ ),
+ ),
+ //if grid doesn't have a checkbox column type, it will attach
+ //one and this configuration will be part of it
+ 'checkBoxColumnConfig' => array(
+ 'name' => 'id'
+ ),
+ ),
+ //'rowCssClassExpression'=>'$data[\'userID\']!=0 ? "row-selected":"row-not-selected"',
+ 'columns'=>array(
+ array(
+ 'class'=>'CCheckBoxColumn',
+ 'selectableRows'=>'2',
+ 'cssClassExpression' => '($data->is_blocked > 0) ? "blocked-class" : "not-blocked-class"',
+ ),
+ array(
+ 'name'=>'title',
+ 'value'=>'$data->title',
+ 'htmlOptions'=>array(
+ 'width'=>'100px',
+ ),
+ ),
+ array(
+ 'name'=>'create_time',
+ 'value'=>function($data)
+ {
+ return Yii::app()->dateFormatter->formatDateTime($data->create_time,'short','short');
+ },
+ 'htmlOptions'=>array(
+ 'width'=>'100px',
+ ),
+ 'filter'=>false,
+ ),
+ array(
+ 'class'=>'ButtonColumn',
+ 'template'=>' {update} {block} {unblock} {delete}',
+ 'htmlOptions'=>array(
+ 'width'=>'50px',
+ ),
+ 'buttons'=>array(
+ 'block'=>array(
+ 'label'=>Yii::t('user', 'Заблокировать'),
+ 'imageUrl'=>Yii::app()->baseUrl.'/static/admin/gridview/b_eye_visible.png',
+ 'url'=>function($data)
+ {
+ return Yii::app()->controller->createUrl('block',array('id'=>$data->id));
+ },
+ 'visible'=>'$data->is_blocked == 0',
+ 'click'=>"
+ function() {
+ if(!confirm('". Yii::t('user', 'Вы уверены что хотите заблокировать контент?') ."')) return false;
+ $.fn.yiiGridView.update('user-grid', {
+ type:'GET',
+ url:$(this).attr('href'),
+ success:function(data) {
+ showMessage(data);
+ $.fn.yiiGridView.update('user-grid');
+ },
+ });
+ return false;
+ }",
+ ),
+ 'unblock'=>array(
+ 'label'=>Yii::t('user', 'Разблокировать'),
+ 'imageUrl'=>Yii::app()->baseUrl.'/static/admin/gridview/b_lock.png',
+ 'url'=>function($data)
+ {
+ return Yii::app()->controller->createUrl('block',array('id'=>$data->id));
+ },
+ 'visible'=>'$data->is_blocked == 1',
+ 'click'=>"
+ function() {
+ if(!confirm('". Yii::t('user', 'Вы уверены что хотите разблокировать контент?') ."')) return false;
+ $.fn.yiiGridView.update('user-grid', {
+ type:'GET',
+ url:$(this).attr('href'),
+ success:function(data) {
+ showMessage(data);
+ $.fn.yiiGridView.update('user-grid');
+ },
+ });
+ return false;
+ }",
+ ),
+ 'delete'=>array(
+ 'url'=>function($data)
+ {
+ return Yii::app()->controller->createUrl('markAsDeleted',array('id'=>$data->id));
+ },
+ 'visible'=>'($data->is_blocked <> 1 && $data->id <> Yii::app()->user->id)',//(Yii::app()->user->checkAccess(\'block_admin\')) &&
+ 'click'=>"
+ function() {
+ if(!confirm('". Yii::t('user', 'Вы уверены что хотите удалить этот контент?') ."')) return false;
+ $.fn.yiiGridView.update('user-grid', {
+ type:'GET',
+ url:$(this).attr('href'),
+ success:function(data) {
+ showMessage(data);
+ $.fn.yiiGridView.update('user-grid');
+ },
+ });
+ return false;
+ }",
+ ),
+ ),
+ ),//ButtonColumn
+ ),
+));
+?>
+
+baseUrl;
+
+$app->clientScript
+ //->registerCoreScript('jquery')
+ ->registerScript(__FILE__,"
+ ", CClientScript::POS_READY
+ );
+?>
diff --git a/protected/modules/admin/views/page/create.php b/protected/modules/admin/views/page/create.php
new file mode 100644
index 0000000..c6a967b
--- /dev/null
+++ b/protected/modules/admin/views/page/create.php
@@ -0,0 +1,99 @@
+pageTitle=Yii::t('Page', 'Создание страницы');
+
+$this->breadcrumbs=array(
+ Yii::t('Page', 'Управление страницами')=>array('index'),
+ $this->pageTitle,
+);
+?>
+
+pageTitle); ?>
+
+
+beginWidget('CActiveForm', array(
+ 'id'=>'create-user-form',
+ 'enableAjaxValidation'=>true,
+ 'clientOptions'=>array(
+ 'validateOnSubmit'=>true,
+ ),
+ 'htmlOptions'=>array(
+ 'class'=>'form-horizontal',
+ 'width'=>'250px',
+ ),
+ )); ?>
+
+
+
+endWidget(); ?>
+
diff --git a/protected/modules/admin/views/page/index.php b/protected/modules/admin/views/page/index.php
new file mode 100644
index 0000000..b69643c
--- /dev/null
+++ b/protected/modules/admin/views/page/index.php
@@ -0,0 +1,22 @@
+pageTitle=Yii::t('pages', 'Управление страницами');
+
+$this->breadcrumbs=array(
+ $this->pageTitle,
+);
+?>
+
+
pageTitle); ?>
+
+controller->createUrl('create'),
+ array('class'=>'btn btn-primary btn-wrap')
+ );
+
+ $this->renderPartial('_grid',array(
+ 'dataProvider'=>$dataProvider,
+ 'search'=>$search
+ ));
+?>
\ No newline at end of file
diff --git a/protected/modules/admin/views/page/update.php b/protected/modules/admin/views/page/update.php
new file mode 100644
index 0000000..bdd737c
--- /dev/null
+++ b/protected/modules/admin/views/page/update.php
@@ -0,0 +1,119 @@
+pageTitle=Yii::t('adminUser', 'Редактирование страницы');
+
+$this->breadcrumbs=array(
+ Yii::t('adminUser', 'Управление страницами')=>array('index'),
+ $this->pageTitle,
+);
+?>
+
+
pageTitle); ?>
+
+
+
+baseUrl;
+
+$app->clientScript
+ ->registerCoreScript('jquery')
+ ->registerScriptFile($baseUrl.'/static/admin/debug/print_r.js')
+ ->registerScript(__FILE__,"
+
+ function updateModal(data) {
+ var data = jQuery.parseJSON(data);
+ if(data.status=='success'){
+ $('#ch_pass').modal('hide');
+ showMessage(data.html);
+ //$('div#ch_pass_cont').empty();
+ } else {
+ $('div#ch_pass_cont').html(data.html);
+ }
+ }
+
+ ", CClientScript::POS_READY
+);
+?>
diff --git a/protected/modules/admin/views/pages/_grid.php b/protected/modules/admin/views/pages/_grid.php
new file mode 100644
index 0000000..aee4b77
--- /dev/null
+++ b/protected/modules/admin/views/pages/_grid.php
@@ -0,0 +1,207 @@
+widget('bootstrap.widgets.TbExtendedGridView', array(
+ 'id'=>'user-grid',
+ 'type' => 'striped bordered',
+ 'dataProvider'=>$dataProvider,
+ 'filter'=>$search,
+ 'template' => "{pager}{items}{pager}",
+ 'bulkActionPosition'=>'top',
+ 'bulkActions' => array(
+ 'actionButtons' => array(
+ array(
+ 'buttonType' => 'button',
+ 'type' => 'primary',
+ 'size' => 'medium',
+ 'id' => 'unblock',
+ 'label' => Yii::t('pages','Разблокировать'),
+ 'click' => 'js:function(checked){
+ var values=[];
+ var valuesIDS=$("#user-grid tr td.blocked-class").find("input:checkbox:checked")
+ valuesIDS.each(function(){
+ values.push($(this).val());
+ });
+
+ if(values.length == 1) {
+ $.ajax({
+ url:"'.Yii::app()->controller->createUrl('block').'",
+ data: {
+ ids:values
+ },
+ success:function(data){
+ $("#user-grid").yiiGridView("update");
+ }
+ });
+ }
+
+ }'
+ ),
+ array(
+ 'buttonType' => 'button',
+ 'type' => 'warning',
+ 'size' => 'medium',
+ 'id' => 'block',
+ 'label' => Yii::t('user','Заблокировать'),
+ 'click' => 'js:function(checked){
+ var values=[];
+ var valuesIDS=$("#user-grid tr td.not-blocked-class").find("input:checkbox:checked")
+ valuesIDS.each(function(){
+ values.push($(this).val());
+ });
+
+ if(values.length == 0) {
+ $.ajax({
+ url:"'.Yii::app()->controller->createUrl('block').'",
+ data: {
+ ids:values
+ },
+ success:function(data){
+ $("#user-grid").yiiGridView("update");
+ }
+ });
+ }
+ }'
+ ),
+ array(
+ 'buttonType' => 'button',
+ 'type' => 'danger',
+ 'size' => 'medium',
+ 'id' => 'remove-u-b',
+ 'label' => Yii::t('user','Удалить'),
+ 'click' => 'js:function(checked){
+ var values=[];
+ var valuesIDS=$("#user-grid").find("input:checkbox:checked")
+ valuesIDS.each(function(){
+ values.push($(this).val());
+ });
+
+ if(values.length > 0) {
+ $.ajax({
+ url:"'.Yii::app()->controller->createUrl('markAsDeleted').'",
+ data: {
+ ids:values
+ },
+ success:function(data){
+ $("#user-grid").yiiGridView("update");
+ }
+ });
+ }
+ }'
+ ),
+ ),
+ //if grid doesn't have a checkbox column type, it will attach
+ //one and this configuration will be part of it
+ 'checkBoxColumnConfig' => array(
+ 'name' => 'id'
+ ),
+ ),
+ //'rowCssClassExpression'=>'$data[\'userID\']!=0 ? "row-selected":"row-not-selected"',
+ 'columns'=>array(
+ array(
+ 'class'=>'CCheckBoxColumn',
+ 'selectableRows'=>'2',
+ 'cssClassExpression' => '($data->visible > 0) ? "blocked-class" : "not-blocked-class"',
+ ),
+ array(
+ 'name'=>'name',
+ 'value'=>'$data->name',
+ 'htmlOptions'=>array(
+ 'width'=>'100px',
+ ),
+ ),
+ array(
+ 'name'=>'create_time',
+ 'value'=>function($data)
+ {
+ return Yii::app()->dateFormatter->formatDateTime($data->create_time,'short','short');
+ },
+ 'htmlOptions'=>array(
+ 'width'=>'100px',
+ ),
+ 'filter'=>false,
+ ),
+ array(
+ 'class'=>'ButtonColumn',
+ 'template'=>' {update} {block} {unblock} {delete}',
+ 'htmlOptions'=>array(
+ 'width'=>'50px',
+ ),
+ 'buttons'=>array(
+ 'block'=>array(
+ 'label'=>Yii::t('user', 'Заблокировать'),
+ 'imageUrl'=>Yii::app()->baseUrl.'/static/admin/gridview/b_eye_visible.png',
+ 'url'=>function($data)
+ {
+ return Yii::app()->controller->createUrl('block',array('id'=>$data->id));
+ },
+ 'visible'=>'$data->is_blocked == 0',
+ 'click'=>"
+ function() {
+ if(!confirm('". Yii::t('user', 'Вы уверены что хотите заблокировать страницу?') ."')) return false;
+ $.fn.yiiGridView.update('user-grid', {
+ type:'GET',
+ url:$(this).attr('href'),
+ success:function(data) {
+ showMessage(data);
+ $.fn.yiiGridView.update('user-grid');
+ },
+ });
+ return false;
+ }",
+ ),
+ 'unblock'=>array(
+ 'label'=>Yii::t('user', 'Разблокировать'),
+ 'imageUrl'=>Yii::app()->baseUrl.'/static/admin/gridview/b_lock.png',
+ 'url'=>function($data)
+ {
+ return Yii::app()->controller->createUrl('block',array('id'=>$data->id));
+ },
+ 'visible'=>'$data->is_blocked == 1',
+ 'click'=>"
+ function() {
+ if(!confirm('". Yii::t('user', 'Вы уверены что хотите разблокировать страницу?') ."')) return false;
+ $.fn.yiiGridView.update('user-grid', {
+ type:'GET',
+ url:$(this).attr('href'),
+ success:function(data) {
+ showMessage(data);
+ $.fn.yiiGridView.update('user-grid');
+ },
+ });
+ return false;
+ }",
+ ),
+ 'delete'=>array(
+ 'url'=>function($data)
+ {
+ return Yii::app()->controller->createUrl('markAsDeleted',array('id'=>$data->id));
+ },
+ 'visible'=>'($data->is_blocked <> 1 && $data->id <> Yii::app()->user->id)',//(Yii::app()->user->checkAccess(\'block_admin\')) &&
+ 'click'=>"
+ function() {
+ if(!confirm('". Yii::t('user', 'Вы уверены что хотите удалить этого пользователя?') ."')) return false;
+ $.fn.yiiGridView.update('user-grid', {
+ type:'GET',
+ url:$(this).attr('href'),
+ success:function(data) {
+ showMessage(data);
+ $.fn.yiiGridView.update('user-grid');
+ },
+ });
+ return false;
+ }",
+ ),
+ ),
+ ),//ButtonColumn
+ ),
+));
+?>
+
+baseUrl;
+
+$app->clientScript
+ //->registerCoreScript('jquery')
+ ->registerScript(__FILE__,"
+ ", CClientScript::POS_READY
+ );
+?>
diff --git a/protected/modules/admin/views/pages/create.php b/protected/modules/admin/views/pages/create.php
new file mode 100644
index 0000000..c6adf31
--- /dev/null
+++ b/protected/modules/admin/views/pages/create.php
@@ -0,0 +1,52 @@
+pageTitle=Yii::t('Pages', 'Создание страницы');
+
+$this->breadcrumbs=array(
+ Yii::t('Pages', 'Управление страницами')=>array('index'),
+ $this->pageTitle,
+);
+?>
+
+
pageTitle); ?>
+
+
diff --git a/protected/modules/admin/views/pages/index.php b/protected/modules/admin/views/pages/index.php
new file mode 100644
index 0000000..316e45d
--- /dev/null
+++ b/protected/modules/admin/views/pages/index.php
@@ -0,0 +1,22 @@
+pageTitle=Yii::t('pages', 'Управление страницами');
+
+$this->breadcrumbs=array(
+ $this->pageTitle,
+);
+?>
+
+
pageTitle); ?>
+
+controller->createUrl('create'),
+ array('class'=>'btn btn-primary btn-wrap')
+ );
+
+ $this->renderPartial('_grid',array(
+ 'dataProvider'=>$dataProvider,
+ 'search'=>$search
+ ));
+?>
\ No newline at end of file
diff --git a/protected/modules/admin/views/pages/update.php b/protected/modules/admin/views/pages/update.php
new file mode 100644
index 0000000..403e633
--- /dev/null
+++ b/protected/modules/admin/views/pages/update.php
@@ -0,0 +1,81 @@
+pageTitle=Yii::t('adminUser', 'Редактирование страницы');
+
+$this->breadcrumbs=array(
+ Yii::t('adminUser', 'Управление страницами')=>array('index'),
+ $this->pageTitle,
+);
+?>
+
+
pageTitle); ?>
+
+
+
+baseUrl;
+
+$app->clientScript
+ ->registerCoreScript('jquery')
+ ->registerScriptFile($baseUrl.'/static/admin/debug/print_r.js')
+ ->registerScript(__FILE__,"
+
+ function updateModal(data) {
+ var data = jQuery.parseJSON(data);
+ if(data.status=='success'){
+ $('#ch_pass').modal('hide');
+ showMessage(data.html);
+ //$('div#ch_pass_cont').empty();
+ } else {
+ $('div#ch_pass_cont').html(data.html);
+ }
+ }
+
+ ", CClientScript::POS_READY
+);
+?>
diff --git a/protected/modules/admin/views/partner/index.php b/protected/modules/admin/views/partner/index.php
index 3a5e03f..06fb78d 100644
--- a/protected/modules/admin/views/partner/index.php
+++ b/protected/modules/admin/views/partner/index.php
@@ -9,8 +9,8 @@
pageTitle); ?>
controller->createUrl('create'),
+echo CHtml::link(Yii::t('adminUser', 'Создать партнера'),
+ Yii::app()->controller->createUrl('create'),
array('class'=>'btn btn-primary btn-wrap')
);
diff --git a/protected/modules/admin/views/user/index.php b/protected/modules/admin/views/user/index.php
index bf7c256..a36efb4 100644
--- a/protected/modules/admin/views/user/index.php
+++ b/protected/modules/admin/views/user/index.php
@@ -14,7 +14,7 @@
array('class'=>'btn btn-primary btn-wrap')
);
- $this->renderPartial('_grid',array(
+$this->renderPartial('_grid',array(
'dataProvider'=>$dataProvider,
'search'=>$search,
));
diff --git a/protected/views/layouts/main.php b/protected/views/layouts/main.php
index a90952e..72c9020 100644
--- a/protected/views/layouts/main.php
+++ b/protected/views/layouts/main.php
@@ -6,7 +6,6 @@
-
baseUrl;
@@ -16,23 +15,18 @@
-
-
-
-
-
-
-
-
+
+
- renderPartial('//layouts/reformal');?>
+
+ renderPartial('/site/modal');?>
renderPartial('//layouts/gAnalytics');?>