PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
admin
/
controllers
<?php class ShareButtonController extends CController { public $layout = 'admin_column'; public function filters() { return array( 'accessControl', ); } public function accessRules() { $module = $this->getModule(); return array( array('allow', 'actions' => array( 'ajaxupdate','index','create','view','delete','update','synctofile', ), 'roles' => array($module->languageManagerRole), ), array('deny', // deny all users 'users' => array('*'), ), ); } public function actionIndex() { $model = new SocialShareButton('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['SocialShareButton'])) { $model->attributes = $_GET['SocialShareButton']; } $this->render('index', array( 'model' => $model, )); } public function actionView() { $id = $_REQUEST['id']; $model = SocialShareButton::model()->findByPk($id); $this->render('view', array('model' => $model)); } public function actionUpdate() { $model = new SocialShareButtonForm('update'); if (isset($_POST['SocialShareButtonForm'])) { $model->attributes = $_POST['SocialShareButtonForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = SocialShareButton::model()->findByPk($id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $attributes = array(); foreach ($model->getAttributes() as $name => $value) { $model->$name = $t->$name; } $this->render('update', array('model' => $model)); } public function actionDelete() { if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = SocialShareButton::model()->findByPk($id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } } public function actionAjaxUpdate() { $act = $_GET['act']; if ($act == 'doSync') { $this->sync(); echo 'ok'; return; } $autoIdAll = $_POST['autoId']; if (count($autoIdAll) > 0) { foreach ($autoIdAll as $autoId) { $model = SocialShareButton::model()->findByPk($autoId); if ($act == 'doDelete') { //$model->is_deleted = '1'; } if ($model->save()) { echo 'ok'; } else { throw new Exception('Sorry', 500); } } } } public function actionCreate() { $model = new SocialShareButtonForm('create'); if (isset($_POST['SocialShareButtonForm'])) { $model->attributes = $_POST['SocialShareButtonForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } $this->render('create', array('model' => $model)); } public function actionSynctoFile() { $this->sync(); } public function sync() { $terms = SocialShareButton::model()->findAll(); $content = $this->renderPartial('phpterm', array('terms' => $terms), true); $script_directory = '/social_buttons'; $file_name = 'share_buttons.php'; $app_root = substr(Yii::app()->baseUrl, 1, strlen(Yii::app()->baseUrl) - 1); $basePath = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$app_root.DIRECTORY_SEPARATOR; $filePath = $basePath.$script_directory.DIRECTORY_SEPARATOR.$file_name; $out = fopen($filePath, 'wb'); fwrite($out, $content); } }
[+]
..
[-] TemplateController.php
[edit]
[-] PlanController.php
[edit]
[-] DomainController.php
[edit]
[-] WebsiteController.php
[edit]
[-] ConfigController.php
[edit]
[-] TransactionController.php
[edit]
[-] MailtemplateController.php
[edit]
[-] DefaultController.php
[edit]
[-] CategoryController.php
[edit]
[-] DashboardController.php
[edit]
[-] UserController.php
[edit]
[-] LanguageController.php
[edit]
[-] ModuleController.php
[edit]
[-] ModulecategoryController.php
[edit]
[-] PlanDescriptionController.php
[edit]
[-] TermController.php
[edit]
[-] SubscriptionController.php
[edit]
[-] InterfaceController.php
[edit]
[-] ColorController.php
[edit]
[-] ShareButtonController.php
[edit]
[-] SkinpresetController.php
[edit]
[-] ContentController.php
[edit]
[-] LogController.php
[edit]
[-] ProfileController.php
[edit]