/** * Lists all models. */ public function actionIndex() { $pageSize = CommonService::getPageSize(); $criteria = new CDbCriteria(); $name = ''; if (isset($_GET['name'])) { $name = $_GET['name']; $userArr = TestUserService::getUserList($name, 'id'); $criteria->addInCondition('created_by', array_keys($userArr)); $criteria->addSearchCondition('ip', $name, true, 'OR'); } $dataProvider = new CActiveDataProvider('UserLog', array('criteria' => $criteria, 'sort' => array('defaultOrder' => array('id' => true)), 'pagination' => array('pageSize' => $pageSize))); $this->render('index', array('dataProvider' => $dataProvider, 'name' => $name)); }
public function actionUserList() { $q = ''; $type = 'realname'; if (!empty($_GET['q'])) { $q = strtolower($_GET['q']); } if (!empty($_GET['type'])) { $type = $_GET['type']; } $prefixId = 0; if (!empty($_GET['p'])) { $prefixId = $_GET['p']; } $items = TestUserService::getUserList($q, $type); $items = TestUserService::handleActiveClose($prefixId, $q, $items); foreach ($items as $key => $value) { echo "{$key}|{$value}\n"; } }