/** * Signs user up. * * @return Member |null the saved model or null if saving fails */ public function signup() { if ($this->validate()) { $user = new Member(); $user->username = $this->username; $user->email = $this->email; $user->setPassword($this->password); $user->generateAuthKey(); $user->status = Member::STATUS_ACTIVE; if ($user->save()) { Yii::$app->session->setFlash('success', 'Well done! successfully to registered data! '); $notification = new Notification(); $notification->title = 'member'; $notification->message = 'new member, username:'******'model' => 'Member', 'id' => $user->id]); if ($notification->save()) { $this->sendEmail($this->email); Yii::$app->session->setFlash('success', 'please check your email! '); } else { print_r($notification->getErrors()); exit(0); } return $user; } else { return $user->getErrors(); } } return null; }
/** * 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(); $user->status = 0; if ($user->save()) { $notification = new Notification(); $notification->title = 'user'; $notification->message = 'new user, username:'******'model' => 'User', 'id' => $user->id]); if ($notification->save()) { $this->sendEmail($this->email); } else { print_r($notification->getErrors()); exit(0); } return $user; } else { return $user->getErrors(); } } return null; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Notification::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'userId' => $this->userId, 'updateDate' => $this->updateDate, 'createDate' => $this->createDate]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'params', $this->params]); return $dataProvider; }
echo Yii::$app->name; ?> </a> <!-- Header Navbar: style can be found in header.less --> <nav class="navbar navbar-static-top" role="navigation"> <!-- Sidebar toggle button--> <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <div class="navbar-right"> <ul class="nav navbar-nav"> <?php echo \sintret\gii\models\Notification::notification(); ?> <!-- User Account: style can be found in dropdown.less --> <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="glyphicon glyphicon-user"></i> <span><?php echo Yii::$app->user->identity->username; ?> <i class="caret"></i></span> </a> <ul class="dropdown-menu"> <!-- User image --> <li class="user-header bg-light-blue"> <img src="<?php echo yii::$app->user->identity->thumbnailTrue;
public function actionSample() { //$objPHPExcel = new \PHPExcel(); $template = Yii::$app->util->templateExcel(); $model = new Notification(); $date = date('YmdHis'); $name = $date . Notification; //$attributes = $model->attributeLabels(); $models = Notification::find()->all(); $excelChar = Yii::$app->util->excelChar(); $not = Yii::$app->util->excelNot(); foreach ($model->attributeLabels() as $k => $v) { if (!in_array($k, $not)) { $attributes[$k] = $v; } } $objReader = \PHPExcel_IOFactory::createReader('Excel5'); $objPHPExcel = $objReader->load(Yii::getAlias($template)); return $this->render('sample', ['models' => $models, 'attributes' => $attributes, 'excelChar' => $excelChar, 'not' => $not, 'name' => $name, 'objPHPExcel' => $objPHPExcel]); }