コード例 #1
0
 public function actionGetMentor($ent_id)
 {
     $ent = Entrepreneur::findOne($ent_id);
     $results = $ent->mentors;
     foreach ($results as $key => $value) {
         echo "user_id:" . $value->user_id . "\n";
         echo "username:"******"\n";
     }
 }
コード例 #2
0
ファイル: SignupForm.php プロジェクト: azruljamil/smev3
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup()
 {
     if ($this->validate()) {
         $user = new User();
         $user->username = $this->username;
         $user->email = $this->email;
         $user->setPassword($this->password);
         $user->generateAuthKey();
         if ($user->save()) {
             $profile = new Profile();
             $profile->loadDefaultValues();
             $profile->first_name = $this->first_name;
             $profile->last_name = $this->last_name;
             $profile->dob = $this->dob;
             $profile->address = $this->address;
             $profile->address2 = $this->address2;
             $profile->district = $this->district;
             $profile->state = $this->state;
             $profile->mobile = $this->mobile;
             $profile->ic = $this->ic;
             $profile->postcode = $this->postcode;
             $profile->name = $this->name;
             $profile->link('user', $user);
             if ($this->role == 'ENT') {
                 $ent = new Entrepreneur();
                 $ent->plkn = $this->plkn;
                 $ent->link('user', $user);
             } elseif ($this->role == 'MNT') {
                 $mnt = new Mentor();
                 $mnt->link('user', $user);
             }
             Yii::$app->mailer->compose()->setFrom('*****@*****.**')->setTo($user->email)->setSubject('SALEXES Registration')->setTextBody('Congratulations you have been succesfully registered with us !!!')->setHtmlBody('<b>Please contact admin@9teraju.com to make payment for account activation.</b>')->send();
             return $user;
         }
     }
     return null;
 }
コード例 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Entrepreneur::find();
     $query->joinWith(['user', 'profile']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['username'] = ['asc' => ['user.username' => SORT_ASC], 'desc' => ['user.username' => SORT_DESC]];
     $dataProvider->sort->attributes['email'] = ['asc' => ['user.email' => SORT_ASC], 'desc' => ['user.email' => SORT_DESC]];
     $dataProvider->sort->attributes['name'] = ['asc' => ['profile.name' => SORT_ASC], 'desc' => ['profile.name' => SORT_DESC]];
     $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', 'profile.name', $this->name])->andFilterWhere(['like', 'profile.user_id', $this->user_id])->andFilterWhere(['like', 'user.email', $this->email]);
     $query->andFilterWhere(['like', 'plkn', $this->plkn]);
     return $dataProvider;
 }
コード例 #4
0
ファイル: Invoice.php プロジェクト: azruljamil/smev3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntrepreneurUsers()
 {
     return $this->hasMany(Entrepreneur::className(), ['user_id' => 'entrepreneur_user_id'])->viaTable('{{%entp_invoice}}', ['invoice_id' => 'id']);
 }
コード例 #5
0
 /**
  * Finds the Entrepreneur model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Entrepreneur the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Entrepreneur::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #6
0
ファイル: Supplier.php プロジェクト: azruljamil/smev3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntrepreneurs()
 {
     return $this->hasMany(Entrepreneur::className(), ['user_id' => 'entrepreneur_id'])->viaTable('{{%entp_supplier}}', ['supplier_id' => 'id']);
 }
コード例 #7
0
ファイル: EntpInvoice.php プロジェクト: azruljamil/smev3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntrepreneurUser()
 {
     return $this->hasOne(Entrepreneur::className(), ['user_id' => 'entrepreneur_user_id']);
 }
コード例 #8
0
ファイル: Mentor.php プロジェクト: azruljamil/smev3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntrepreneurs()
 {
     return $this->hasMany(Entrepreneur::className(), ['user_id' => 'entrepreneur_user_id'])->viaTable('{{%mentor_entrepreneur}}', ['mentor_id' => 'id']);
 }
コード例 #9
0
ファイル: Expenses.php プロジェクト: azruljamil/smev3
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntrepreneurs()
 {
     return $this->hasMany(Entrepreneur::className(), ['id' => 'entrepreneur_id'])->viaTable('{{%entp_expenses}}', ['expenses_id' => 'id']);
 }