当前位置: 首页>>代码示例>>PHP>>正文


PHP YumUser类代码示例

本文整理汇总了PHP中YumUser的典型用法代码示例。如果您正苦于以下问题:PHP YumUser类的具体用法?PHP YumUser怎么用?PHP YumUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了YumUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionprojectdetails

 public function actionprojectdetails()
 {
     if (!empty(Yii::app()->user->_data)) {
         $projectModel = new YumUserProject();
         // get project id
         $id = Yii::app()->request->getParam('project_id');
         // here define the userdocumentsprojects as relation
         $projectObj = $projectModel->with('projectresources')->findByPk($id);
         $projectArr = [];
         $projectArr['project'] = $projectObj;
         //get project tasks
         $projModel = new YumUserProject();
         $projectTasks = $projModel->findAll('parent_id=:parent_id', array('parent_id' => $id));
         if (!empty($projectTasks)) {
             $projectArr['task'] = $projectTasks;
         } else {
             $projectArr['task'] = [];
         }
         $allUsersModel = new YumUser();
         $allUsersObjs = $allUsersModel->findAll();
         $this->render('projectdetails', array('projectdetails' => $projectArr, 'allUsers' => $allUsersObjs));
     } else {
         $this->redirect(array('//user/auth/login'));
     }
 }
开发者ID:usmansaleem10,项目名称:youthpowered,代码行数:25,代码来源:YumUserProjectController.php

示例2: actionCreate

 public function actionCreate()
 {
     // if some data has been entered before or the user is already logged in,
     // take the already existing data and prefill the input form
     if ($model = Shop::getCustomer()) {
         $address = $model->address;
     } else {
         $model = new Customer();
     }
     if (isset($_POST['Customer'])) {
         $model->attributes = $_POST['Customer'];
         if (isset($_POST['Address'])) {
             $address = new Address();
             $address->attributes = $_POST['Address'];
             if ($address->save()) {
                 $model->address_id = $address->id;
             }
         }
         if (!Yii::app()->user->isGuest) {
             $model->user_id = Yii::app()->user->id;
         }
         $model->validate();
         if (Shop::module()->useWithYum && isset($_POST['register']) && ($_POST['register'] = true)) {
             if (isset($_POST['Customer']['password']) && isset($_POST['Customer']['passwordRepeat'])) {
                 if ($_POST['Customer']['password'] != $_POST['Customer']['passwordRepeat']) {
                     $model->addError('password', Shop::t('Passwords do not match'));
                 } else {
                     if ($_POST['Customer']['password'] == '') {
                         $model->addError('password', Shop::t('Password is empty'));
                     } else {
                         $user = new YumUser();
                         $profile = new YumProfile();
                         $profile->attributes = $_POST['Customer'];
                         $profile->attributes = $_POST['Address'];
                         if ($user->register(strtr($model->email, array('@' => '_', '.' => '_')), $_POST['Customer']['password'], $profile)) {
                             $user->status = YumUser::STATUS_ACTIVE;
                             $user->save(false, array('status'));
                             $model->user_id = $user->id;
                             Shop::setFlash(Shop::t('Successfully registered user'));
                         } else {
                             $model->addErrors($user->getErrors());
                             $model->addErrors($profile->getErrors());
                             Shop::setFlash(Shop::t('Error while registering user'));
                         }
                     }
                 }
             }
         }
         if (!$model->hasErrors()) {
             if ($model->save()) {
                 Yii::app()->user->setState('customer_id', $model->customer_id);
                 $this->redirect(array('//shop/order/create', 'customer' => $model->customer_id));
             }
         }
     }
     $this->render('create', array('customer' => $model, 'address' => isset($address) ? $address : new Address()));
 }
开发者ID:axetion007,项目名称:yii-shop,代码行数:57,代码来源:CustomerController.php

示例3: listDocuments

 public function listDocuments()
 {
     $model = new YumUserdocuments();
     $allDocuments = $model->findAll();
     Yii::import('user.models.*');
     $userModel = new YumUser();
     $allUsers = $userModel->findAll();
     if (!empty($allDocuments)) {
         $this->render('index', array('model' => $model, 'documents' => $allDocuments, 'allUsers' => $allUsers));
         return;
     } else {
         $this->render('index', array('model' => $model, 'documents' => $allDocuments, 'allUsers' => $allUsers));
     }
 }
开发者ID:usmansaleem10,项目名称:youthpowered,代码行数:14,代码来源:YumUserdocumentsController.php

示例4: actionEditAvatar

 public function actionEditAvatar()
 {
     $model = YumUser::model()->findByPk(Yii::app()->user->id);
     if (isset($_POST['YumUser'])) {
         $model->attributes = $_POST['YumUser'];
         $model->setScenario('avatarUpload');
         if (Yum::module('avatar')->avatarMaxWidth != 0) {
             $model->setScenario('avatarSizeCheck');
         }
         $model->avatar = CUploadedFile::getInstanceByName('YumUser[avatar]');
         if ($model->validate()) {
             if ($model->avatar instanceof CUploadedFile) {
                 // Prepend the id of the user to avoid filename conflicts
                 $filename = Yum::module('avatar')->avatarPath . '/' . $model->id . '_' . $_FILES['YumUser']['name']['avatar'];
                 $model->avatar->saveAs($filename);
                 $model->avatar = $filename;
                 if ($model->save()) {
                     Yum::setFlash(Yum::t('The image was uploaded successfully'));
                     Yum::log(Yum::t('User {username} uploaded avatar image {filename}', array('{username}' => $model->username, '{filename}' => $model->avatar)));
                     $this->redirect(array('//profile/profile/view'));
                 }
             }
         }
     }
     $this->render('edit_avatar', array('model' => $model));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:26,代码来源:YumAvatarController.php

示例5: actionRegistration

 public function actionRegistration()
 {
     Yii::import('application.modules.profile.models.*');
     $profile = new YumProfile();
     if (isset($_POST['Profile'])) {
         $profile->attributes = $_POST['YumProfile'];
         if ($profile->save()) {
             $user = new YumUser();
         }
         $password = YumUser::generatePassword();
         // we generate a dummy username here, since yum requires one
         $user->register(md5($profile->email), $password, $profile);
         $this->sendRegistrationEmail($user, $password);
         Yum::setFlash('Thank you for your registration. Please check your email.');
         $this->redirect(Yum::module()->loginUrl);
     }
     $this->render('/registration/registration', array('profile' => $profile));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:18,代码来源:RegistrationController.php

示例6: renderContent

 protected function renderContent()
 {
     parent::renderContent();
     if (Yii::app()->user->isGuest) {
         return false;
     }
     $user = YumUser::model()->findByPk(Yii::app()->user->id);
     $this->render('profile_comments', array('comments' => Yii::app()->user->data()->profile->recentComments()));
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:9,代码来源:ProfileCommentsWidget.php

示例7: checkexists

 public function checkexists($attribute, $params)
 {
     $user = null;
     // we only want to authenticate when there are no input errors so far
     if (!$this->hasErrors()) {
         if (strpos($this->login_or_email, "@")) {
             $profile = YumProfile::model()->findByAttributes(array('email' => $this->login_or_email));
             $this->user = $profile && $profile->user && $profile->user instanceof YumUser ? $profile->user : null;
         } else {
             $this->user = YumUser::model()->findByAttributes(array('username' => $this->login_or_email));
         }
     }
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:13,代码来源:YumPasswordRecoveryForm.php

示例8: loadModel

 public function loadModel($id = null)
 {
     if (!$id) {
         $id = Yii::app()->user->id;
     }
     if (is_numeric($id)) {
         return $this->_model = YumUser::model()->findByPk($id);
     } else {
         if (is_string($id)) {
             return $this->_model = YumUser::model()->find("username = '{$id}'");
         }
     }
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:13,代码来源:YumProfileController.php

示例9: isPublic

	public function isPublic($user = null) {
		if($user == null)
			$user = Yii::app()->user->id;

		if(!$this->visible)
			return false;

		if($privacy = YumUser::model()->findByPk($user)->privacy) {
			if($privacy->public_profile_fields & pow(2, $this->id))
				return true;
		}

		return false;
	}
开发者ID:neam,项目名称:yii-user-management,代码行数:14,代码来源:YumProfileField.php

示例10: rules

 public function rules()
 {
     $rules = parent::rules();
     if (!(Yum::hasModule('registration') && Yum::module('registration')->registration_by_email)) {
         $rules[] = array('username', 'required');
     }
     $rules[] = array('newsletter, terms,type_id', 'safe');
     // password requirement is already checked in YumUser model, its sufficient
     // to check for verifyPassword here
     $rules[] = array('verifyPassword', 'required');
     $rules[] = array('password', 'compare', 'compareAttribute' => 'verifyPassword', 'message' => Yum::t("Retype password is incorrect."));
     if (Yum::module('registration')->enableCaptcha && !Yum::module()->debug) {
         $rules[] = array('verifyCode', 'captcha', 'allowEmpty' => CCaptcha::checkRequirements());
     }
     return $rules;
 }
开发者ID:usmansaleem10,项目名称:youthpowered,代码行数:16,代码来源:YumRegistrationForm.php

示例11: actionCreate

 public function actionCreate()
 {
     $this->layout = Yum::module()->adminLayout;
     $model = new YumRole();
     $this->performAjaxValidation($model, 'yum-role-form');
     if (isset($_POST['YumRole'])) {
         $model->attributes = $_POST['YumRole'];
         if ($model->save()) {
             if (Yum::module()->enableLogging == true) {
                 $user = YumUser::model()->findbyPK(Yii::app()->user->id);
                 Yum::log(Yum::t('The role {role} has been created by {username}', array('{role}' => $model->title, '{username}' => Yii::app()->user->data()->username)));
             }
             $this->redirect(array('admin'));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:17,代码来源:YumRoleController.php

示例12: getPublicFields

 public function getPublicFields()
 {
     if (!Yum::module('profile')->enablePrivacySetting) {
         return false;
     }
     $fields = array();
     if ($privacy = @YumUser::model()->cache(500)->with('privacy')->findByPk($this->user_id)->privacy->public_profile_fields) {
         $i = 1;
         foreach (YumProfileField::model()->cache(500)->findAll() as $field) {
             if ($i & $privacy && $field->visible != 0) {
                 $fields[] = $field;
             }
             $i *= 2;
         }
     }
     return $fields;
 }
开发者ID:bhaveshsoni,项目名称:yii-user-management,代码行数:17,代码来源:YumProfile.php

示例13: actionCompose

 public function actionCompose($to_user_id = null, $answer_to = 0)
 {
     $model = new YumMessage();
     $this->performAjaxValidation('YumMessage', 'yum-message-form');
     if (isset($_POST['YumMessage'])) {
         $model->attributes = $_POST['YumMessage'];
         $model->from_user_id = Yii::app()->user->id;
         $model->validate();
         if (!$model->hasErrors()) {
             $model->save();
             Yum::setFlash(Yum::t('Message "{message}" has been sent to {to}', array('{message}' => $model->title, '{to}' => YumUser::model()->findByPk($model->to_user_id)->username)));
             $this->redirect(Yum::module('message')->inboxRoute);
         }
     }
     $fct = 'render';
     if (Yii::app()->request->isAjaxRequest) {
         $fct = 'renderPartial';
     }
     $this->{$fct}('compose', array('model' => $model, 'to_user_id' => $to_user_id, 'answer_to' => $answer_to));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:20,代码来源:YumMessageController.php

示例14: authenticate

 public function authenticate($without_password = false)
 {
     $user = YumUser::model()->find('username = :username', array(':username' => $this->username));
     // try to authenticate via email
     if (Yum::hasModule('profile') && Yum::module()->loginType & UserModule::LOGIN_BY_EMAIL && !$user) {
         if ($profile = YumProfile::model()->find('email = :email', array(':email' => $this->username))) {
             if ($profile->user) {
                 $user = $profile->user;
             }
         }
     }
     if (!$user) {
         return self::ERROR_STATUS_USER_DOES_NOT_EXIST;
     }
     if ($user->status == YumUser::STATUS_INACTIVE) {
         $this->errorCode = self::ERROR_STATUS_INACTIVE;
     } else {
         if ($user->status == YumUser::STATUS_BANNED) {
             $this->errorCode = self::ERROR_STATUS_BANNED;
         } else {
             if ($user->status == YumUser::STATUS_REMOVED) {
                 $this->errorCode = self::ERROR_STATUS_REMOVED;
             } else {
                 if ($without_password) {
                     $this->credentialsConfirmed($user);
                 } else {
                     if (!CPasswordHelper::verifyPassword($this->password, $user->password)) {
                         $this->errorCode = self::ERROR_PASSWORD_INVALID;
                     } else {
                         $this->credentialsConfirmed($user);
                     }
                 }
             }
         }
     }
     return !$this->errorCode;
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:37,代码来源:YumUserIdentity.php

示例15: write

 public static function write($to, $from, $subject, $body, $mail = true)
 {
     $message = new YumMessage();
     if (!$mail) {
         $message->omit_mail = true;
     }
     if (is_object($from)) {
         $message->from_user_id = (int) $from->id;
     } else {
         if (is_numeric($from)) {
             $message->from_user_id = $from;
         } else {
             if (is_string($from) && ($user = YumUser::model()->find("username = '{$from}'"))) {
                 $message->from_user_id = $user->id;
             } else {
                 return false;
             }
         }
     }
     if (is_object($to)) {
         $message->to_user_id = (int) $to->id;
     } else {
         if (is_numeric($to)) {
             $message->to_user_id = $to;
         } else {
             if (is_string($to) && ($user = YumUser::model()->find("username = '{$to}'"))) {
                 $message->to_user_id = $user->id;
             } else {
                 return false;
             }
         }
     }
     $message->title = $subject;
     $message->message = $body;
     return $message->save();
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:36,代码来源:YumMessage.php


注:本文中的YumUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。