HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
UserController.php
Go to the documentation of this file.
1 <?php
2 
4 {
8  private $_model;
9 
13  public function filters()
14  {
15  return CMap::mergeArray(parent::filters(), array(
16  'accessControl', // perform access control for CRUD operations
17  ));
18  }
25  public function accessRules()
26  {
27  return array(
28  array('allow', // allow all users to perform 'index' and 'view' actions
29  'actions' => array('index','view'),
30  'users' => array('*'),
31  ),
32  array('deny', // deny all users
33  'users' => array('*'),
34  ),
35  );
36  }
37 
41  public function actionView()
42  {
43  $model = $this->loadModel();
44  $this->render('view', array(
45  'model' => $model,
46  ));
47  }
48 
52  public function actionIndex()
53  {
54  //$this->redirect(array('//user/admin/admin'));
55  $dataProvider = new CActiveDataProvider('User', array(
56  'criteria' => array(
57  'condition' => 'status>'.User::STATUS_BANNED,
58  ),
59 
60  'pagination' => array(
61  'pageSize' => Yii::app()->controller->module->user_page_size,
62  ),
63  ));
64 
65  $this->render('index', array(
66  'dataProvider' => $dataProvider,
67  ));
68  }
69 
74  public function loadModel()
75  {
76  if ($this->_model === null) {
77  if (isset($_GET['id'])) {
78  $this->_model = User::model()->findbyPk($_GET['id']);
79  }
80  if ($this->_model === null) {
81  throw new CHttpException(404, 'The requested page does not exist.');
82  }
83  }
84 
85  return $this->_model;
86  }
87 
94  public function loadUser($id = null)
95  {
96  if ($this->_model === null) {
97  if ($id !== null || isset($_GET['id'])) {
98  $this->_model = User::model()->findbyPk($id !== null ? $id : $_GET['id']);
99  }
100  if ($this->_model === null) {
101  throw new CHttpException(404, 'The requested page does not exist.');
102  }
103  }
104 
105  return $this->_model;
106  }
107 }