PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
admin
/
controllers
<?php class UserController extends PController { public $layout = 'admin_column'; public function filters() { return array( 'accessControl', ); } public function accessaRules() { $module = $this->getModule(); return array( array('allow', 'actions' => array( 'ajaxupdate','index','create','manage','delete','update','resetpassword', ), 'roles' => array($module->userManagerRole), ), array('deny', // deny all users 'users' => array('*'), ), ); } public function actionIndex() { $this->breadcrumbs = array( Yii::t('admin', 'Users'), ); $model = new User('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['User'])) { $model->attributes = $_GET['User']; } // Render $this->render('index', array( 'model' => $model, )); } public function actionView() { $id = $_REQUEST['id']; $model = User::model()->findByPk((int) $id); $socials = Social::model()->findAll('yiiuser=:user', array(':user' => $id)); $this->render('view', array('model' => $model, 'socials' => $socials)); } public function actionUpdate() { $model = new UserForm('update'); if (isset($_POST['UserForm'])) { $model->attributes = $_POST['UserForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $user = User::model()->findByPk((int) $id); if ($user == null) { $url = $this->createUrl('index'); $this->redirect($url); } $this->breadcrumbs = array( Yii::t('admin', 'Users') => array('user/index'), $user->username, ); $attributes = array(); foreach ($model->getAttributes() as $name => $value) { $model->$name = $user->$name; } $this->render('update', array('model' => $model)); } public function actionActive() { $pk = $_REQUEST['pk']; if ($pk == Yii::app()->user->id) { echo 0; return; } $user = User::model()->findByPk((int) $pk); if (isset($user)) { $user->is_active = 1 - $user->is_active; $user->save(); echo '1'; return; } echo '0'; } public function actionSetAdmin() { $pk = $_REQUEST['pk']; if ($pk == Yii::app()->user->id) { echo 0; return; } $user = User::model()->findByPk((int) $pk); if (isset($user)) { $user->is_admin = 1 - $user->is_admin; $user->save(); echo '1'; return; } echo '0'; } public function actionAjaxUpdate() { $act = $_GET['act']; $autoIdAll = array(); if (isset($_POST['autoId'])) { $autoIdAll = $_POST['autoId']; } if (count($autoIdAll) > 0) { foreach ($autoIdAll as $autoId) { $model = User::model()->findByPk($autoId); if ($act == 'doActive') { $model->is_active = 1; $model->save(); } elseif ($act == 'doInactive') { $model->is_active = 0; $model->save(); } else { throw new Exception('Sorry', 500); } } } } public function actionResetpassword() { $model = new ResetPassForm(); if (isset($_POST['ResetPassForm'])) { $model->attributes = $_POST['ResetPassForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $user = User::model()->findByPk((int) $id); if (is_null($user) || !isset($user)) { $url = $this->createUrl('index'); $this->redirect($url); } $model->id = $id; $this->render('reset', array('model' => $model)); } public function actionCreate() { $this->breadcrumbs = array( Yii::t('admin', 'Users') => array('user/index'), Yii::t('admin', 'Create'), ); $model = new UserForm('create'); if (isset($_POST['UserForm'])) { $model->attributes = $_POST['UserForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } $this->render('create', array('model' => $model)); } }
[+]
..
[-] 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]