Example #1
0
 public function actionUpdateAjax()
 {
     if (demo()) {
         echo 'ok';
         Yii::app()->end();
     }
     $id = Yii::app()->request->getPost('id');
     $val = Yii::app()->request->getPost('val', '');
     if (!$id) {
         Yii::app()->user->setFlash('error', tt('Enter the required value'));
         echo 'error_save';
         Yii::app()->end();
     }
     $model = SocialauthModel::model()->findByPk($id);
     if (!$val && !in_array($model->name, SocialauthModel::model()->allowEmpty)) {
         Yii::app()->user->setFlash('error', tt('Enter the required value'));
         echo 'error_save';
         Yii::app()->end();
     }
     $model->value = $val;
     if ($model->save()) {
         echo 'ok';
     } else {
         Yii::app()->user->setFlash('error', tt('Enter the required value'));
         echo 'error_save';
     }
 }
Example #2
0
 public function init()
 {
     parent::init();
     if (SocialauthModel::getSocialParamValue('useGoogleOauth')) {
         $this->services['google_oauth'] = array('class' => 'CustomGoogleService', 'client_id' => SocialauthModel::getSocialParamValue('googleOauthClientId'), 'client_secret' => SocialauthModel::getSocialParamValue('googleOauthClientSecret'));
     }
     if (SocialauthModel::getSocialParamValue('useTwitter')) {
         $this->services['twitter'] = array('class' => 'CustomTwitterService', 'key' => SocialauthModel::getSocialParamValue('twitterKey'), 'secret' => SocialauthModel::getSocialParamValue('twitterSecret'));
     }
     if (SocialauthModel::getSocialParamValue('useFacebook')) {
         $this->services['facebook'] = array('class' => 'CustomFBService', 'client_id' => SocialauthModel::getSocialParamValue('facebookClientId'), 'client_secret' => SocialauthModel::getSocialParamValue('facebookClientSecret'));
     }
     if (SocialauthModel::getSocialParamValue('useVkontakte')) {
         $this->services['vkontakte'] = array('class' => 'CustomVKService', 'client_id' => SocialauthModel::getSocialParamValue('vkontakteClientId'), 'client_secret' => SocialauthModel::getSocialParamValue('vkontakteClientSecret'));
     }
     if (SocialauthModel::getSocialParamValue('useMailruOAuth')) {
         $this->services['mailru'] = array('class' => 'CustomMailruService', 'client_id' => SocialauthModel::getSocialParamValue('mailruClientId'), 'client_secret' => SocialauthModel::getSocialParamValue('mailruClientSecret'));
     }
 }
Example #3
0
$this->menu = array(array());
$this->adminTitle = tt('Manage social settings');
$info = '';
if (!SocialauthModel::getSocialParamValue('useGoogleOauth')) {
    $info .= Yii::t('module_socialauth', 'Go to link for register Google application - {link}', array('{link}' => CHtml::link('https://code.google.com/apis/console/', 'https://code.google.com/apis/console/', array('target' => '_blank')))) . '<br />';
}
if (!SocialauthModel::getSocialParamValue('useTwitter')) {
    $info .= Yii::t('module_socialauth', 'Go to link for register Twitter application - {link}', array('{link}' => CHtml::link('https://dev.twitter.com/apps/new', 'https://dev.twitter.com/apps/new', array('target' => '_blank')))) . '<br />';
}
if (!SocialauthModel::getSocialParamValue('useFacebook')) {
    $info .= Yii::t('module_socialauth', 'Go to link for register Facebook application - {link}', array('{link}' => CHtml::link('https://developers.facebook.com/apps/', 'https://developers.facebook.com/apps/', array('target' => '_blank')))) . '<br />';
}
if (!SocialauthModel::getSocialParamValue('useVkontakte')) {
    $info .= Yii::t('module_socialauth', 'Go to link for register VK.com application - {link}', array('{link}' => CHtml::link('http://vk.com/editapp?act=create&site=1', 'http://vk.com/editapp?act=create&site=1', array('target' => '_blank')))) . '<br />';
}
if (!SocialauthModel::getSocialParamValue('useMailruOAuth')) {
    $info .= Yii::t('module_socialauth', 'Go to link for register Mail.ru application - {link}', array('{link}' => CHtml::link('http://api.mail.ru/sites/my/add', 'http://api.mail.ru/sites/my/add', array('target' => '_blank')))) . '<br />';
}
if ($info) {
    Yii::app()->user->setFlash('info', $info);
}
$this->widget('CustomGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'function(){$("a[rel=\'tooltip\']").tooltip(); $("div.tooltip-arrow").remove(); $("div.tooltip-inner").remove();}', 'id' => 'socialauth-table', 'columns' => array(array('header' => tt('Section'), 'value' => 'tt($data->section)', 'filter' => CHtml::dropDownList('section_filter', $currentSection, $this->getSections())), array('header' => tt('Setting'), 'value' => '$data->title', 'type' => 'raw', 'htmlOptions' => array('class' => 'width250')), array('name' => 'value', 'type' => 'raw', 'value' => 'SocialauthModel::getAdminValue($data)', 'htmlOptions' => array('class' => 'width150'), 'filter' => false, 'sortable' => false), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update}', 'buttons' => array('update' => array('visible' => 'SocialauthModel::getVisible($data->type)', 'click' => 'js: function() { updateConfig($(this).attr("href")); return false; }'))))));
?>

<?php 
$this->beginWidget('bootstrap.widgets.TbModal', array('id' => 'myModal'));
?>

<div id="form_param"></div>

<div class="modal-footer">