コード例 #1
0
ファイル: UserSearch.php プロジェクト: seans888/SMF-Project
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = User::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'status' => $this->status,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        $query->andFilterWhere(['like', 'username', $this->username])
            ->andFilterWhere(['like', 'user_type', $this->user_type])
            ->andFilterWhere(['like', 'auth_key', $this->auth_key])
            ->andFilterWhere(['like', 'password_hash', $this->password_hash])
            ->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])
            ->andFilterWhere(['like', 'email', $this->email]);

        return $dataProvider;
    }
コード例 #2
0
 /**
  * @param $attribute
  * @param $params
  * @return bool
  */
 public function myValidatePassword($attribute, $params)
 {
     $model = User::find()->where(['username' => $this->username])->andWhere(['status' => 1])->one();
     if (!empty($model) && $model->setPassword($this->{$attribute}) == $model->password) {
         return true;
     }
     $this->addError($attribute, 'The username or password is error!');
 }
コード例 #3
0
ファイル: UserTest.php プロジェクト: djc1103617718/WangYi
 /**
  * @param $attribute
  * @param $params
  * @return bool
  */
 public function validateOriginalPassword($attribute, $params)
 {
     $model = User::find()->where(['username' => Yii::$app->session['username']])->one();
     if (!empty($model) && $this->{$attribute} == $model->password) {
         return true;
     }
     $this->addError($attribute, 'The original password is error!');
 }
コード例 #4
0
ファイル: User.php プロジェクト: MarketPlaceDaniel/WangYi
 /**
  * @return array|null|\yii\db\ActiveRecord
  * @throws NotFoundHttpException
  */
 public static function findModelByUsername()
 {
     if ($username = Yii::$app->session['__username']) {
         if (($model = User::find()->where(['username' => $username])->one()) !== null) {
             return $model;
         }
     }
     throw new NotFoundHttpException('The requested page does not exist.');
 }
コード例 #5
0
ファイル: PostController.php プロジェクト: Atsumoriso/Yii
 /**
  * Creates a new Post model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Post();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'category' => Category::find()->all(), 'authors' => User::find()->all()]);
     }
 }
コード例 #6
0
ファイル: UserSearch.php プロジェクト: jaibabu9/987654321
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['like', '_id', $this->_id])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'user_role', $this->user_role])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'created_at', $this->created_at])->andFilterWhere(['like', 'updated_at', $this->updated_at]);
     return $dataProvider;
 }
コード例 #7
0
 /**
  * @return \yii\web\Response
  */
 public function actionCreate()
 {
     $model = new Comment();
     $model->ip = Yii::$app->request->userIP;
     $model->username = Yii::$app->session['__username'];
     $model->user_id = User::find()->where(['username' => $model->username])->one()->id;
     $model->created_at = time();
     $model->updated_at = time();
     //$params = FilterForm::filterHtml();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['show/view', 'id' => $model->news_id]);
     }
     echo '发布失败,请重新发表评论!';
 }
コード例 #8
0
 /**
  * @param $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::find()->orderBy('created_at DESC');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     if ($this->created_at !== null) {
         $date = strtotime($this->created_at);
         $query->andFilterWhere(['between', 'created_at', $date, $date + 3600 * 24]);
     }
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['registration_ip' => $this->registration_ip]);
     return $dataProvider;
 }
コード例 #9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'role' => $this->role, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'fname', $this->fname])->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'contact_no', $this->contact_no])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'company_description', $this->company_description])->andFilterWhere(['like', 'shipping_address', $this->shipping_address])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
コード例 #10
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'role' => $this->role, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'data_nasc' => $this->data_nasc]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'sexo', $this->sexo])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'endereco', $this->endereco])->andFilterWhere(['like', 'complemento', $this->complemento])->andFilterWhere(['like', 'instituicao', $this->instituicao])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'grupoacesso', $this->grupoacesso])->andFilterWhere(['like', 'cpf', $this->cpf]);
     return $dataProvider;
 }
コード例 #11
0
ファイル: User.php プロジェクト: jia253/centosYii2
 /**
  * Finds user by username
  *
  * @param  string      $username
  * @return static|null
  */
 public static function findByUsername($username)
 {
     $user = User::find()->where(['username' => $username])->asArray()->one();
     if ($user) {
         return new static($user);
     }
     return null;
     /*foreach (self::$users as $user) {
                 if (strcasecmp($user['username'], $username) === 0) {
                     return new static($user);
                 }
             }
     
             return null;*/
 }
コード例 #12
0
ファイル: UserSearch.php プロジェクト: arfo90/fp-app
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'mobile_number' => $this->mobile_number, 'mobileNumber' => $this->mobileNumber]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'addressImage', $this->addressImage]);
     return $dataProvider;
 }
コード例 #13
0
 /**
  * Authencticate or create and authenticate user
  *
  * @param \frontend\components\SteamAuth $client
  */
 public function steamAuth($client)
 {
     $user = User::find()->where(['steamid' => $client->steamId])->one();
     if (Yii::$app->user->isGuest) {
         if ($user) {
             Yii::$app->user->login($user);
             return $this->redirect(['site/index']);
         }
         $user = User::createSteamUser($client);
         if (!$user) {
             throw new Exception("Не получилось создать пользователя :(", 500);
         }
         return $this->redirect(['site/index']);
     }
     return $this->redirect(['site/index']);
 }
コード例 #14
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     if (Yii::$app->user->identity->rol_id == '2') {
         $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'rol_id' => $this->rol_id, 'supervisor' => $this->supervisor, 'id_organizacion' => $this->id_organizacion, 'id_empresa' => $this->id_empresa, 'id_distrito' => $this->id_distrito])->orderBy(['username' => SORT_ASC]);
     } else {
         $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'rol_id' => '1', 'supervisor' => $this->supervisor, 'id_organizacion' => $this->id_organizacion, 'id_empresa' => $this->id_empresa, 'id_distrito' => $this->id_distrito])->orderBy(['username' => SORT_ASC]);
     }
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'apellido', $this->apellido])->andFilterWhere(['like', 'cedula', $this->cedula]);
     return $dataProvider;
 }
コード例 #15
0
ファイル: Message.php プロジェクト: buuug7/game4039
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         // ...custom code here..
         //unread初始值为所有接收人,添加未阅读的用户id
         if ($insert) {
             $user = User::find()->select('id')->asArray()->all();
             $user = ArrayHelper::getColumn($user, 'id');
             $this->unread = implode(',', $user);
             //将deleted初始值设置为0,防止该字段为null
             $this->deleted = 0;
         }
         //...custom code end
         return true;
     } else {
         return false;
     }
 }
コード例 #16
0
 public function actionLogin()
 {
     if (!Yii::$app->request->isPost) {
         exit('Valid Request');
     }
     $data = Yii::$app->request->post();
     $user = User::find()->where(['username' => $data['username']])->one();
     $login_url = Url::toRoute(['login/index'], true);
     if (empty($user)) {
         return $this->redirect($login_url);
     }
     $password = md5(md5($data['password']) . $user->salt);
     if ($password != $user->password) {
         return $this->redirect($login_url);
     }
     $session = Yii::$app->session;
     if (!$session->isActive) {
         $session->open();
     }
     $session['user'] = ['id' => $user->id, 'username' => $user->username];
     return $this->goHome();
 }
コード例 #17
0
ファイル: PaymentController.php プロジェクト: skamnev/members
 /**
  * Displays homepage.
  *
  * @return mixed
  */
 public function actionIndex_old()
 {
     $model = new BraintreeForm();
     $user = Yii::$app->getUser()->getIdentity();
     if (!empty($user->firstname)) {
         $model->customer_firstName = $user->firstname;
     }
     if (!empty($user->lastname)) {
         $model->customer_lastName = $user->lastname;
     }
     if (!empty($user->email)) {
         $model->customer_email = $user->email;
     }
     if (empty($user->braintree_customer_id)) {
         //create braintree customer if customer id record does not exists
         $model->setScenario('customer');
         if ($model->load(Yii::$app->request->post()) && $model->validate()) {
             $customer = $model->send();
             if ($customer['status']) {
                 $user->braintree_customer_id = $customer['result']->customer->id;
                 if ($user->save()) {
                     //@TODO add logic to delete user on Braintree side if can not save customer id
                 }
             }
         }
     } else {
         // else if customer id record exists
         $model->setScenario('creditCard');
         if ($model->load(Yii::$app->request->post()) && $model->validate()) {
             $model->customerId = $user->braintree_customer_id;
             if ($creditCard = $model->send()) {
                 $model->paymentMethodToken = $creditCard['result']->creditCard->token;
                 $model->planId = Yii::$app->get('braintree')->planId;
                 $model->setScenario('subscription');
                 if ($subscription = $model->send()) {
                     $user = Yii::$app->getUser()->getIdentity();
                     if (!empty($model->customer_firstName) && $model->customer_firstName != $user->firstname) {
                         $user->firstname = $model->customer_firstName;
                     }
                     if (!empty($model->customer_lastName) && $model->customer_lastName != $user->lastname) {
                         $user->lastname = $model->customer_lastName;
                     }
                     $checkEmail = User::find()->where(['email' => $model->customer_email])->andWhere(['not', ['id' => $user->id]])->exists();
                     if (!empty($model->customer_email) && $model->customer_email != $user->email && !$checkEmail) {
                         $user->email = $model->customer_email;
                     }
                     $user->status = User::STATUS_PAID;
                     if ($user->save()) {
                         return Yii::$app->response->redirect(array('mapping'));
                     } else {
                         Yii::$app->getSession()->setFlash('warning', Yii::t('errors', 'Can not update user status. Please contact system administrator'));
                     }
                 }
             }
         }
     }
     $model->setScenario('subscription');
     return $this->render('index', ['model' => $model]);
 }
コード例 #18
0
ファイル: User.php プロジェクト: xswolf/baihey
 public function getAllList()
 {
     return User::find()->all();
 }
コード例 #19
0
ファイル: Actividad.php プロジェクト: noeliovando/yii2advance
 public function setEmpresa()
 {
     $this->id_empresa = ArrayHelper::getValue(User::find()->andWhere(['id' => $this->id_usuario])->asArray()->one(), 'id_empresa');
 }
コード例 #20
0
ファイル: SiteController.php プロジェクト: jaibabu9/987654321
 public function actionChecklogin()
 {
     $params = $_POST;
     $customer = json_decode(file_get_contents("php://input"), true);
     // print_r($customer); die;
     $username = User::find()->where(['username' => $customer['username']])->one();
     if (!$username) {
         $this->setHeader(200);
         echo json_encode(array('status' => 1, 'data' => 'Username does not exist'), JSON_PRETTY_PRINT);
     }
     $pass = User::find()->where(['username' => $customer['username'], 'password' => md5($customer['password'])])->one();
     if (!$pass) {
         $this->setHeader(200);
         echo json_encode(array('status' => 1, 'data' => 'password does not match'), JSON_PRETTY_PRINT);
     } else {
         Yii::$app->user->login(User::findByUsername($customer['username']), 3600 * 24 * 30);
         $this->setHeader(200);
         echo json_encode(array('user_role' => $username['user_role']), JSON_PRETTY_PRINT);
     }
     //return $this->redirect(['contact']);
 }
コード例 #21
0
ファイル: _form.php プロジェクト: jaibabu9/987654321
    <?php 
echo $form->field($model, 'user_id')->hiddenInput()->label(false);
?>
    <div class="row">
        <div class="col-md-6">
        <?php 
echo $form->field($model, 'title');
?>
        </div>

    <!--?= $form->field($model, 'file') ?-->
        <div class="col-md-6">
            <!--?= $form->field($model, 'share_to') ?-->

            <?php 
$usr = User::find()->all();
$usrs = ArrayHelper::map($usr, function ($model) {
    return $model->_id->{'$id'};
}, 'username');
echo $form->field($model, 'share_to')->label('Share To')->widget(Select2::classname(), ['data' => $usrs, 'options' => ['placeholder' => 'Select User', 'id' => 'file_id'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-md-8">

                    <!--?= $form->field($model, 'file')->fileInput() ?-->
                    <?php 
echo $form->field($model, 'file')->widget(FileInput::classname(), ['options' => ['accept' => 'file/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showUpload' => false]]);
?>
        </div>
コード例 #22
0
ファイル: User.php プロジェクト: jaybril/www.mimgpotea.com
 public function updateUserByPsw($moblie, $newPsw)
 {
     $result = User::find()->where(array('mobile' => $moblie))->one();
     $result->password = $newPsw;
     $result->update();
     if (!$result) {
         return false;
     }
     return $result;
 }
コード例 #23
0
ファイル: UserController.php プロジェクト: jaibabu9/987654321
 public function actionSearchdoc()
 {
     $model = new SearchdocForm();
     $user_ids = array();
     $prof = new Profile();
     if (Yii::$app->request->post()) {
         $location = $_POST['SearchdocForm']['location'];
         $drSpecialist = $_POST['SearchdocForm']['drSpecialist'];
         $model->location = $location;
         $model->drSpecialist = $drSpecialist;
         if ($location != "" && $drSpecialist != "") {
             $matched_id = ArrayHelper::map(Profile::find()->where(['drSpecialist' => new \MongoId($drSpecialist), 'city' => (string) $location])->all(), function ($prof) {
                 return $prof->userId->{'$id'};
             }, 'city');
             foreach ($matched_id as $key => $value) {
                 array_push($user_ids, $key);
             }
         } elseif ($location != "") {
             $matched_id = ArrayHelper::map(Profile::find()->where(['city' => (string) $location])->all(), function ($prof) {
                 return $prof->userId->{'$id'};
             }, 'city');
             foreach ($matched_id as $key => $value) {
                 array_push($user_ids, $key);
             }
         } elseif ($drSpecialist != "") {
             $matched_id = ArrayHelper::map(Profile::find()->where(['drSpecialist' => new \MongoId($drSpecialist)])->all(), function ($prof) {
                 return $prof->userId->{'$id'};
             }, 'city');
             foreach ($matched_id as $key => $value) {
                 array_push($user_ids, $key);
             }
         } else {
         }
         $doctors = User::find()->where(['_id' => $user_ids, "user_role" => '1'])->with('profile')->all();
     } else {
         $currentUserId = Yii::$app->user->identity->_id;
         $session = Yii::$app->session;
         $location = Yii::$app->session['profile'][0]['city'];
         $model->location = $location;
         $matched_id = ArrayHelper::map(Profile::find()->where(['city' => (string) $location])->all(), function ($prof) {
             return $prof->userId->{'$id'};
         }, 'city');
         foreach ($matched_id as $key => $value) {
             array_push($user_ids, $key);
         }
         $doctors = User::find()->where(['_id' => $user_ids, "user_role" => '1'])->with('profile')->all();
     }
     return $this->render('searchdoc', ['model' => $model, 'doctors' => $doctors]);
 }
コード例 #24
0
ファイル: _form.php プロジェクト: buuug7/game4039
echo $form->field($model, 'phone')->textInput(['maxlength' => true]);
?>

	<?php 
echo $form->field($model, 'address')->textarea(['rows' => 3]);
?>

	<?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>

	<?php 
echo $form->field($model, 'notes')->textarea(['rows' => 3]);
?>

	<?php 
echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::map(\frontend\models\User::find()->all(), 'id', 'username'), ['prompt' => '']);
?>

	<div class="form-group">
		<?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
	</div>

	<?php 
ActiveForm::end();
?>

</div>
コード例 #25
0
ファイル: _form.php プロジェクト: rsoaresgouveia/SiGePolo
  </div>
  <div class="col-md-4"> 
    <?php 
echo $form->field($model, 'situacao')->dropdownList(['acordo' => 'Acordo', 'sem_acordo' => 'Sem Acordo', 'reconciliacao' => 'Reconciliação', 'redesignada' => 'Redesignada', 'processo_nao_realizados' => 'Processo Não Realizado'], ['prompt' => 'Selecione']);
?>
    </div>
      <div class="col-md-3">
  <?php 
echo $form->field($model, 'dataFim')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATETIME, 'ajaxConversion' => false, 'value' => time(), 'options' => ['pluginOptions' => ['autoclose' => true]]]);
?>
  </div>
  </div>
    <div class="row">
      <div class="col-md-6"> 
        <?php 
echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::map(\frontend\models\User::find()->where(['id' => Yii::$app->user->identity->id])->orderBy(['nome' => SORT_ASC])->all(), 'id', 'nome'));
?>
      </div>
    </div>
    <div class="row">
        <div class="col-md-6"> 
         <?php 
echo $form->field($model, 'descricao')->textArea(['maxlength' => true, 'rows' => 4, 'cols' => 30]);
?>
         </div>
     </div>
    



    
コード例 #26
0
ファイル: main.php プロジェクト: seans888/SMF-Project
                ['label' => 'Event', 'url' => ['/event/index']],
				//['label' => 'Logs', 'url' => ['/logs/index']],
				//['label' => 'Migration', 'url' => ['/migration/index']],
				['label' => 'Testimonials', 'url' => ['/testimonials/index']],
				//['label' => 'Users', 'url' => ['/user/index']],
				[ 
                    'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
                    'url' => ['/site/logout'],
                    'linkOptions' => ['data-method' => 'post']],
					
               
					
					
                ];
				}else if ($roles == 'alumni'){
				$userid = ArrayHelper::getValue(User::find()->where(['username' => Yii::$app->user->identity->username])->one(), 'id');
				$alumniid = ArrayHelper::getValue(Alumni::find()->where(['user_id' => $userid])->one(), 'id');
				
				$menuItems =[
				['label' => 'Home', 'url' => ['/site/index']],
				['label' => 'Alumni', 'url' => ['/alumni/view', 'id' => $alumniid]],
				['label' => 'Event', 'url' => ['/event/index']],
				['label' => 'Testimonials', 'url' => ['/testimonials/index']],
				
				[ 
                    'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
                    'url' => ['/site/logout'],
                    'linkOptions' => ['data-method' => 'post']],
					
               
					
コード例 #27
0
ファイル: UserController.php プロジェクト: Atsumoriso/Yii
 /**
  * Lists all User models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => User::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
コード例 #28
0
ファイル: MappingComponent.php プロジェクト: skamnev/members
 public function checkProfileFields()
 {
     if (!Yii::$app->user->isGuest) {
         $userModel = User::find()->where(['id' => Yii::$app->user->id]);
         foreach ($this->profileFields as $field) {
             $userModel->andWhere(['!=', $field, '']);
         }
         return $userModel->asArray()->one();
     }
 }
コード例 #29
0
 public function actionInvitations()
 {
     $datas = Invite::find()->where(['status' => 1, 'user_id' => new \MongoId(Yii::$app->user->identity->_id)])->asArray()->all();
     $j = 0;
     foreach ($datas as $key => $value) {
         $doc = User::find()->where(["_id" => $datas[$j]['user_id']])->one();
         $patient = User::find()->where(["_id" => $datas[$j]['patient_id']])->one();
         $datas[$j]['docname'] = $doc->username;
         $datas[$j]['patientname'] = $patient->username;
         $j = $j + 1;
     }
     $doctors = User::find()->where(['user_role' => '1'])->asArray()->all();
     $doctorsData = array();
     $k = 0;
     foreach ($doctors as $key => $value) {
         $doctorsData[$k]['label'] = $value['username'];
         $doctorsData[$k]['value'] = $value['username'];
         $doctorsData[$k]['id'] = (string) $value['_id'];
         $k = $k + 1;
     }
     return $this->render('invitations', ['datas' => $datas, 'doctors' => $doctorsData]);
 }
コード例 #30
0
 public function getAnalista()
 {
     $datos = User::find()->andwhere(['rol_id' => '3'])->andwhere('user.supervisor LIKE "%' . Yii::$app->user->identity->username . '%"')->all();
     return ArrayHelper::map($datos, 'id', 'username');
 }