本文整理汇总了PHP中Notifier::raiseEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifier::raiseEvent方法的具体用法?PHP Notifier::raiseEvent怎么用?PHP Notifier::raiseEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifier
的用法示例。
在下文中一共展示了Notifier::raiseEvent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdd
public function actionAdd($isFancy = 0)
{
$model = new Vacancy();
if (isset($_POST[$this->modelName]) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$model->attributes = $_POST[$this->modelName];
if ($model->validate()) {
$model->user_ip = Yii::app()->controller->currentUserIp;
$model->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
if ($model->save(false)) {
$model->name = CHtml::encode($model->name);
$model->body = CHtml::encode($model->body);
$notifier = new Notifier();
$notifier->raiseEvent('onNewReview', $model);
if (Yii::app()->user->checkAccess('vacancy_admin')) {
Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
} else {
Yii::app()->user->setFlash('success', tt('success_send'));
}
$this->redirect(array('index'));
}
$model->unsetAttributes(array('name', 'body', 'verifyCode'));
} else {
Yii::app()->user->setFlash('error', tt('failed_send'));
}
$model->unsetAttributes(array('verifyCode'));
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('add', array('model' => $model), false, true);
} else {
$this->render('add', array('model' => $model));
}
}
示例2: actionAdd
public function actionAdd($isFancy = 0)
{
$model = new Reviews();
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
if ($model->validate()) {
if ($model->save(false)) {
$model->name = CHtml::encode($model->name);
$model->body = CHtml::encode($model->body);
$notifier = new Notifier();
$notifier->raiseEvent('onNewReview', $model);
if (Yii::app()->user->getState('isAdmin')) {
Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
} else {
Yii::app()->user->setFlash('success', tt('success_send'));
}
$this->redirect(array('index'));
}
$model->unsetAttributes(array('name', 'body', 'verifyCode'));
} else {
Yii::app()->user->setFlash('error', tt('failed_send'));
}
$model->unsetAttributes(array('verifyCode'));
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('add', array('model' => $model), false, true);
} else {
$this->render('add', array('model' => $model));
}
}
示例3: processPayment
public function processPayment(Payments $payment)
{
$payment->status = Payments::STATUS_WAITOFFLINE;
$payment->update(array('status'));
try {
$notifier = new Notifier();
$notifier->raiseEvent('onOfflinePayment', $payment);
} catch (CHttpException $e) {
}
return array('status' => Paysystem::RESULT_OK, 'message' => tt('Thank you! Notification of your payment sent to the administrator.', 'payment'));
}
示例4: actionComplain
public function actionComplain($isFancy = 0)
{
$id = Yii::app()->request->getParam('id', 0);
if (!$id) {
throw404();
}
$model = new $this->modelName();
$modelApartment = Apartment::model()->findByPk($id);
if (!$modelApartment) {
throw404();
}
if (isset($_POST[$this->modelName]) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$model->attributes = $_POST[$this->modelName];
$model->apartment_id = $id;
$model->session_id = Yii::app()->session->sessionId;
$model->user_id = 0;
$model->user_ip = Yii::app()->controller->currentUserIp;
$model->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
if (!Yii::app()->user->isGuest) {
$model->email = Yii::app()->user->email;
$model->name = Yii::app()->user->username;
$model->user_id = Yii::app()->user->id;
}
if ($model->validate()) {
if ($this->checkAlreadyComplain($model->apartment_id, $model->user_id, $model->session_id)) {
if ($model->save(false)) {
$notifier = new Notifier();
$notifier->raiseEvent('onNewComplain', $model);
Yii::app()->user->setFlash('success', tt('Thanks_for_complain', 'apartmentsComplain'));
$model = new $this->modelName();
// clear fields
}
} else {
Yii::app()->user->setFlash('notice', tt('your_already_post_complain', 'apartmentsComplain'));
}
}
}
if ($isFancy) {
Yii::app()->clientscript->scriptMap['jquery.js'] = false;
Yii::app()->clientscript->scriptMap['jquery.min.js'] = false;
Yii::app()->clientscript->scriptMap['jquery-ui.min.js'] = false;
$this->renderPartial('complain_form', array('model' => $model, 'apId' => $id, 'isFancy' => true, 'modelApartment' => $modelApartment), false, true);
} else {
$this->render('complain_form', array('model' => $model, 'apId' => $id, 'modelApartment' => $modelApartment, 'wtf' => 'huilo'));
}
}
示例5: actionMainform
public function actionMainform($isFancy = 0)
{
$model = new SimpleformModel();
$model->scenario = 'forrent';
if (isset($_POST['SimpleformModel']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$request = Yii::app()->request;
$isForBuy = $request->getPost('isForBuy', 0);
$model->attributes = $_POST['SimpleformModel'];
if ($isForBuy) {
$model->scenario = 'forbuy';
}
if ($model->validate()) {
if (!$isForBuy) {
$model->time_inVal = $this->getI18nTimeIn($model->time_in);
$model->time_outVal = $this->getI18nTimeOut($model->time_out);
}
$types = Apartment::getI18nTypesArray();
$model->type = $types[$model->type];
$notifier = new Notifier();
if (!$isForBuy) {
$notifier->raiseEvent('onNewSimpleBookingForRent', $model);
} else {
$notifier->raiseEvent('onNewSimpleBookingForBuy', $model);
}
Yii::app()->user->setFlash('success', tt('Operation successfully complete. Your order will be reviewed by administrator.'));
}
}
$user = null;
if (!Yii::app()->user->isGuest) {
$user = User::model()->findByPk(Yii::app()->user->getId());
}
$type = Apartment::getTypesWantArray();
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('simpleform', array('model' => $model, 'type' => $type, 'user' => $user, 'isFancy' => true), false, true);
} else {
$this->render('simpleform', array('model' => $model, 'type' => $type, 'user' => $user, 'isFancy' => false));
}
}
示例6: run
public function run()
{
Yii::import('application.modules.contactform.models.ContactForm');
$model = new ContactForm();
$model->scenario = 'insert';
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if (!Yii::app()->user->isGuest) {
$model->email = Yii::app()->user->email;
$model->username = Yii::app()->user->username;
}
if ($model->validate()) {
$notifier = new Notifier();
$notifier->raiseEvent('onNewContactform', $model);
Yii::app()->user->setFlash('success', tt('Thanks_for_message', 'contactform'));
$model = new ContactForm();
// clear fields
} else {
$model->unsetAttributes(array('verifyCode'));
Yii::app()->user->setFlash('error', tt('Error_send', 'contactform'));
}
}
$this->render('widgetContactform', array('model' => $model));
}
示例7: actionRegister
public function actionRegister()
{
if (!param('useUserRegistration', 0)) {
throw404();
}
$this->showSearchForm = false;
$this->layout = '//layouts/inner';
if (Yii::app()->user->isGuest) {
if (param('user_registrationMode') == 'without_confirm') {
$model = new User('register_without_confirm');
} else {
$model = new User('register');
}
if (isset($_POST['User']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$model->attributes = $_POST['User'];
if ($model->validate()) {
$model->activatekey = User::generateActivateKey();
$user = User::createUser($model->attributes);
if ($user) {
$model->id = $user['id'];
$model->password = $user['password'];
$model->email = $user['email'];
$model->username = $user['username'];
$model->activatekey = $user['activatekey'];
$model->activateLink = $user['activateLink'];
$notifier = new Notifier();
$notifier->raiseEvent('onNewUser', $model, array('user' => $user['userModel']));
if (param('user_registrationMode') == 'without_confirm') {
$login = new LoginForm();
$login->setAttributes(array('username' => $user['username'], 'password' => $user['password']));
if ($login->validate() && $login->login()) {
User::updateUserSession();
User::updateLatestInfo(Yii::app()->user->id, Yii::app()->controller->currentUserIp);
$this->redirect(array('/usercpanel/main/index'));
} else {
/*echo 'getErrors=<pre>';
print_r($login->getErrors());
echo '</pre>';
exit;*/
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered.'));
}
} else {
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered. The letter for account activation has been sent on {useremail}', array('{useremail}' => $user['email'])));
}
} else {
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'Error. Repeat attempt later'));
}
} else {
$model->unsetAttributes(array('verifyCode'));
}
}
$this->render('register', array('model' => $model));
} else {
$this->redirect('index');
}
}
示例8: actionData
public function actionData()
{
$this->setActiveMenu('my_data');
$model = $this->loadModel(Yii::app()->user->id);
$agencyUserIdOld = '';
if ($model->type == User::TYPE_AGENT) {
$agencyUserIdOld = $model->agency_user_id;
}
if (preg_match("/null\\.io/i", $model->email)) {
Yii::app()->user->setFlash('error', tt('Please change your email and password!', 'socialauth'));
}
if (isset($_POST[$this->modelName])) {
$model->scenario = 'usercpanel';
$model->attributes = $_POST[$this->modelName];
if ($agencyUserIdOld != $model->agency_user_id) {
if ($model->agency_user_id) {
$agency = User::model()->findByPk($model->agency_user_id);
if ($agency) {
$notifier = new Notifier();
$notifier->raiseEvent('onNewAgent', $model, array('forceEmail' => $agency->email));
} else {
$model->addError('agency_user_id', 'There is no Agency with such ID');
}
}
$model->agent_status = User::AGENT_STATUS_AWAIT_VERIFY;
}
if ($model->save()) {
if ($model->scenario == 'usercpanel') {
Yii::app()->user->setFlash('success', tt('Your details successfully changed.'));
}
$this->redirect(array('index'));
}
}
$this->render('data', array('model' => $model));
}
示例9: actionSendEmail
public function actionSendEmail($id, $isFancy = 0)
{
$apartment = Apartment::model()->findByPk($id);
if (!$apartment) {
throw404();
}
if (!param('use_module_request_property')) {
throw404();
}
$model = new SendMailForm();
if (isset($_POST['SendMailForm'])) {
$model->attributes = $_POST['SendMailForm'];
if (!Yii::app()->user->isGuest) {
$model->senderEmail = Yii::app()->user->email;
$model->senderName = Yii::app()->user->username;
}
$model->ownerId = $apartment->user->id;
$model->ownerEmail = $apartment->user->email;
$model->ownerName = $apartment->user->username;
$model->apartmentUrl = $apartment->getUrl();
if ($model->validate()) {
$notifier = new Notifier();
$notifier->raiseEvent('onRequestProperty', $model, array('forceEmail' => $model->ownerEmail));
Yii::app()->user->setFlash('success', tt('Thanks_for_request', 'apartments'));
$model = new SendMailForm();
// clear fields
} else {
$model->unsetAttributes(array('verifyCode'));
Yii::app()->user->setFlash('error', tt('Error_send_request', 'apartments'));
}
}
if ($isFancy) {
//Yii::app()->clientscript->scriptMap['*.js'] = false;
Yii::app()->clientscript->scriptMap['jquery.js'] = false;
Yii::app()->clientscript->scriptMap['jquery.min.js'] = false;
Yii::app()->clientscript->scriptMap['jquery-ui.min.js'] = false;
$this->renderPartial('send_email', array('apartment' => $apartment, 'isFancy' => true, 'model' => $model), false, true);
} else {
$this->render('send_email', array('apartment' => $apartment, 'isFancy' => false, 'model' => $model));
}
}
示例10: actionRecover
public function actionRecover($id)
{
if (demo()) {
HAjax::jsonError(tc('Sorry, this action is not allowed on the demo server.'));
}
$model = $this->loadModel($id);
$tempRecoverPassword = $model->randomString();
$recoverPasswordKey = User::generateActivateKey();
$model->temprecoverpassword = $tempRecoverPassword;
$model->recoverPasswordKey = $recoverPasswordKey;
$model->update(array('temprecoverpassword', 'recoverPasswordKey'));
$model->recoverPasswordLink = Yii::app()->createAbsoluteUrl('/site/recover?key=' . $recoverPasswordKey);
// send email
$notifier = new Notifier();
$notifier->raiseEvent('onRecoveryPassword', $model, array('user' => $model));
HAjax::jsonOk(Yii::t('module_notifier', 'A new password has been created and sent to {email}.', array('{email}' => $model->email)));
}
示例11: afterSave
public function afterSave()
{
if ($this->id_userTo) {
$user = User::model()->findByPk($this->id_userTo);
if ($user) {
$sql = 'SELECT id FROM ' . Yii::app()->session->sessionTableName . ' WHERE user_id = ' . $user->id . ' AND expire > ' . time();
$res = Yii::app()->db->createCommand($sql)->queryScalar();
# полагаем, что пользователь оффлайн - отправляем уведомление на почту
if (!$res) {
$user->messageEmailSend = $this->message;
$notifier = new Notifier();
$notifier->raiseEvent('onNewPrivateMessage', $user, array('user' => $user));
/*if (!$resSend) {
$errorsSend[] = $userModel->email;
}*/
}
}
}
return parent::beforeSave();
}
示例12: actionCreate
public function actionCreate()
{
if (!Yii::app()->user->isGuest) {
if (Yii::app()->user->checkAccess('backend_access')) {
$this->redirect(Yii::app()->createUrl('/apartments/backend/main/create'));
} else {
$this->redirect(Yii::app()->createUrl('/userads/main/create'));
}
}
if (param('user_registrationMode') == 'without_confirm') {
$user = new User('register_without_confirm');
} else {
$user = new User('register');
}
$login = new LoginForm();
$model = new Apartment();
$model->active = Apartment::STATUS_DRAFT;
$model->period_activity = param('apartment_periodActivityDefault', 'always');
$model->references = $model->getFullInformation($model->id, $model->type);
$isAdmin = false;
$activeTab = 'tab_register';
$isUpdate = Yii::app()->request->getPost('is_update');
if (!$isUpdate && isset($_POST['LoginForm']) && ($_POST['LoginForm']['username'] || $_POST['LoginForm']['password'])) {
if (Yii::app()->user->getState('attempts-login') >= LoginForm::ATTEMPTSLOGIN) {
$login->scenario = 'withCaptcha';
}
$activeTab = 'tab_login';
$login->attributes = $_POST['LoginForm'];
if ($login->validate() && $login->login()) {
Yii::app()->user->setState('attempts-login', 0);
User::updateUserSession();
$isAdmin = Yii::app()->user->checkAccess('backend_access');
$user = User::model()->findByPk(Yii::app()->user->id);
} else {
Yii::app()->user->setState('attempts-login', Yii::app()->user->getState('attempts-login', 0) + 1);
if (Yii::app()->user->getState('attempts-login') >= LoginForm::ATTEMPTSLOGIN) {
$login->scenario = 'withCaptcha';
}
}
}
if (isset($_POST['Apartment'])) {
$model->attributes = $_POST['Apartment'];
if (!$isUpdate) {
$adValid = $model->validate();
$userValid = false;
if ($activeTab == 'tab_register' && param('useUserRegistration')) {
$user->attributes = $_POST['User'];
$userValid = $user->validate();
if ($adValid && $userValid) {
$user->activatekey = User::generateActivateKey();
$userData = User::createUser($user->attributes);
if ($userData) {
$user = $userData['userModel'];
$user->password = $userData['password'];
$user->activatekey = $userData['activatekey'];
$user->activateLink = $userData['activateLink'];
$notifier = new Notifier();
$notifier->raiseEvent('onNewUser', $user, array('forceEmail' => $user->email));
}
}
}
if ($user->id && ($activeTab == 'tab_login' && $adValid || $activeTab == 'tab_register' && param('useUserRegistration') && $adValid && $userValid)) {
if (param('useUseradsModeration', 1)) {
$model->active = Apartment::STATUS_MODERATION;
} else {
$model->active = Apartment::STATUS_ACTIVE;
}
$model->owner_active = Apartment::STATUS_ACTIVE;
$model->owner_id = $user->id;
if ($model->save(false)) {
if (!$isAdmin && param('useUseradsModeration', 1)) {
Yii::app()->user->setFlash('success', tc('The listing is succesfullty added and is awaiting moderation'));
} else {
Yii::app()->user->setFlash('success', tc('The listing is succesfullty added'));
}
if ($activeTab == 'tab_register') {
if (param('user_registrationMode') == 'without_confirm') {
$login = new LoginForm();
$login->setAttributes(array('username' => $user['username'], 'password' => $user['password']));
if ($login->validate() && $login->login()) {
User::updateUserSession();
User::updateLatestInfo(Yii::app()->user->id, Yii::app()->controller->currentUserIp);
$this->redirect(array('/usercpanel/main/index'));
} else {
/*echo 'getErrors=<pre>';
print_r($login->getErrors());
echo '</pre>';
exit;*/
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered.'));
}
} else {
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered. The letter for account activation has been sent on {useremail}', array('{useremail}' => $user['email'])));
}
} else {
if ($isAdmin) {
NewsProduct::getProductNews();
$this->redirect(array('/apartments/backend/main/update', 'id' => $model->id));
Yii::app()->end();
} else {
$this->redirect(array('/userads/main/update', 'id' => $model->id));
//.........这里部分代码省略.........
示例13: afterSave
public function afterSave()
{
if ($this->status == Comment::STATUS_APPROVED) {
$this->_calcRating();
// if($this->model_name == 'Apartment'){
// $ad = Apartment::model()->with('user')->findByPk($this->model_id);
// if($ad && isset($ad->user)){
// $user = $ad->user;
// $notifier = new Notifier();
// $notifier->raiseEvent('onNewComment', $this, array('user' => $user));
// }
// }
}
if ($this->isNewRecord) {
if (!Yii::app()->user->isGuest) {
$model = HUser::getModel();
$this->user_name = $model->username;
$this->user_email = $model->email;
}
$notifier = new Notifier();
$notifier->raiseEvent('onNewComment', $this);
}
return parent::afterSave();
}
示例14: actionRegister
public function actionRegister()
{
$this->layout = '//layouts/inner';
if (Yii::app()->user->isGuest && param('useUserads')) {
$model = new User('register');
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
if ($model->validate()) {
$model->activatekey = User::generateActivateKey();
$user = User::createUser($model->attributes);
if ($user) {
$model->id = $user['id'];
$model->password = $user['password'];
$model->email = $user['email'];
$model->username = $user['username'];
$model->activatekey = $user['activatekey'];
$model->activateLink = $user['activateLink'];
$notifier = new Notifier();
$notifier->raiseEvent('onNewUser', $model, array('user' => $user['userModel']));
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'You were successfully registered. The letter for account activation has been sent on {useremail}', array('{useremail}' => $user['email'])));
} else {
showMessage(Yii::t('common', 'Registration'), Yii::t('common', 'Error. Repeat attempt later'));
}
} else {
$model->unsetAttributes(array('verifyCode'));
}
}
$this->render('register', array('model' => $model));
} else {
$this->redirect('index');
}
}