%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/var/www/html/ppaobm/vendor/dektrium/yii2-user/models/ |
Upload File : |
<?php
/*
* This file is part of the Dektrium project.
*
* (c) Dektrium project <http://github.com/dektrium/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace dektrium\user\models;
use dektrium\user\Finder;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
/**
* UserSearch represents the model behind the search form about User.
*/
class UserSearch extends Model
{
/** @var integer */
public $id;
/** @var string */
public $username;
/** @var string */
public $email;
/** @var int */
public $created_at;
/** @var int */
public $last_login_at;
/** @var string */
public $registration_ip;
/** @var Finder */
protected $finder;
/**
* @param Finder $finder
* @param array $config
*/
public function __construct(Finder $finder, $config = [])
{
$this->finder = $finder;
parent::__construct($config);
}
/** @inheritdoc */
public function rules()
{
return [
'fieldsSafe' => [['id', 'username', 'email', 'registration_ip', 'created_at', 'last_login_at'], 'safe'],
'createdDefault' => ['created_at', 'default', 'value' => null],
'lastloginDefault' => ['last_login_at', 'default', 'value' => null],
];
}
/** @inheritdoc */
public function attributeLabels()
{
return [
'id' => Yii::t('user', '#'),
'username' => Yii::t('user', 'Username'),
'email' => Yii::t('user', 'Email'),
'created_at' => Yii::t('user', 'Registration time'),
'last_login_at' => Yii::t('user', 'Last login'),
'registration_ip' => Yii::t('user', 'Registration ip'),
];
}
/**
* @param $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = $this->finder->getUserQuery();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]],
]);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$modelClass = $query->modelClass;
$table_name = $modelClass::tableName();
if ($this->created_at !== null) {
$date = strtotime($this->created_at);
$query->andFilterWhere(['between', $table_name . '.created_at', $date, $date + 3600 * 24]);
}
$query->andFilterWhere(['like', $table_name . '.username', $this->username])
->andFilterWhere(['like', $table_name . '.email', $this->email])
->andFilterWhere([$table_name . '.id' => $this->id])
->andFilterWhere([$table_name . 'registration_ip' => $this->registration_ip]);
return $dataProvider;
}
}