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


PHP Messages::model方法代码示例

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


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

示例1: deactivate

 public function deactivate($contractor_id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "user_type='contractor' AND userid=" . $contractor_id;
     Affiliates::model()->deleteAll($criteria);
     Referral::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "owner_user_type='contractor' AND owner_id=" . $contractor_id;
     Answers::model()->deleteAll($criteria);
     Questions::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "user_type='contractor' AND deleted_by=" . $contractor_id;
     Messagedeleted::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "from_user_type='contractor' AND from_id=" . $contractor_id;
     Messages::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "to_user_type='contractor' AND to_id=" . $contractor_id;
     Messages::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "viewed_user_type='contractor' AND viewed_by=" . $contractor_id;
     QuestionViews::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "referred_by_type='contractor' AND referred_by=" . $contractor_id;
     Referral::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "invited_id=" . $contractor_id;
     ContractorTeam::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "contractor_id=" . $contractor_id;
     ContractorBond::model()->deleteAll($criteria);
     ContractorLicense::model()->deleteAll($criteria);
     ContractorPoints::model()->deleteAll($criteria);
     ContractorSocials::model()->deleteAll($criteria);
     ContractorTeam::model()->deleteAll($criteria);
     ContractorViews::model()->deleteAll($criteria);
     Contractorphotos::model()->deleteAll($criteria);
     Feedback::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "ContractorId=" . $contractor_id;
     self::model()->deleteAll($criteria);
     return true;
 }
开发者ID:seph-krueger,项目名称:handyman,代码行数:43,代码来源:Contractors.php

示例2: actionRead

 public function actionRead()
 {
     $id = Yii::app()->request->getParam('id');
     $apId = (int) Yii::app()->request->getParam('apId');
     if (!$id) {
         throw404();
     }
     $user = User::model()->findByPk($id);
     Yii::app()->user->setState('menu_active', 'messages.read');
     $model = new $this->modelName();
     // выставляем флаг о прочитанности
     $unRealMessages = Messages::model()->unReadUser()->criteriaUser($id, Yii::app()->user->id)->findAll(array('select' => 'id'));
     $idArr = array();
     foreach ($unRealMessages as $item) {
         $idArr[] = (int) $item->id;
     }
     if (count($idArr) > 0) {
         Messages::model()->updateByPk($idArr, array('is_read' => Messages::STATUS_READ_USER, 'date_read' => new CDbExpression('NOW()')));
     }
     $allMessages = $pages = null;
     $return = Messages::getAllMessagesUser($id);
     if ($return) {
         $allMessages = $return['allMessages'];
         $pages = $return['pages'];
     }
     # если нет сообщений от выбранного пользователя
     /*if (!$allMessages)
     		throw404();*/
     $this->render('read', array('allMessages' => $allMessages, 'pages' => $pages, 'senderInfo' => $user, 'model' => $model, 'uid' => $id, 'apId' => $apId));
 }
开发者ID:barricade86,项目名称:raui,代码行数:30,代码来源:MainController.php

示例3: actionRegister

 public function actionRegister()
 {
     if (!Yii::app()->user->isGuest) {
         $this->redirect(array('site/index'));
     }
     $model = new Users();
     if (isset($_POST['Users'])) {
         $model->CreatedDate = date('Y-m-d H:i:s');
         $model->UserId = $this->getRandomNumber();
         $model->ActivationCode = $this->generateRandomString(15);
         $model->attributes = $_POST['Users'];
         if ($model->save()) {
             $message = Messages::model()->mailHeader();
             $message .= '<p>Dear ' . $model->UserName . '</p>';
             $message .= 'Thank you for registering with Getweiss.com';
             $message .= '<p>Please click the link below to activate your account</p>';
             $message .= '<p><a style="color:#FFF; text-decoration:none" href="' . Yii::app()->getBaseUrl(true) . '/site/activate/?ac=' . $model->ActivationCode . '">' . Yii::app()->getBaseUrl(true) . '/site/activate/?ac=' . $model->ActivationCode . '</a></p>';
             $message .= 'Regards<br/>Getweiss.com.';
             $message .= Messages::model()->mailFooter();
             // Messages::model()->sendMail('Get Weiss', 'Activation', Yii::app()->params['adminEmail'], $model->EmailAddress, $message);
             $adminmessage = Messages::model()->mailHeader();
             $adminmessage .= 'New User Registered in Getweiss.com';
             $adminmessage .= '<p><u>Name</u>: ' . $model->UserName . '</p>';
             $adminmessage .= '<p><u>Email</u>: ' . $model->EmailAddress . '</p>';
             $adminmessage .= Messages::model()->mailFooter();
             //Messages::model()->sendMail($model->UserName, 'New User Registration', $model->EmailAddress, Yii::app()->params['adminEmail'], $adminmessage);
             $this->redirect(array('index', 'msg' => 'success'));
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:brahmajiayatas,项目名称:getweiss,代码行数:31,代码来源:SiteController.php

示例4: loadModel

 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Messages::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, Yii::t('App', 'The requested page does not exist.'));
         }
     }
     return $this->_model;
 }
开发者ID:reubsc,项目名称:sds,代码行数:12,代码来源:MessagesController.php

示例5: getAllSentMessages

 public static function getAllSentMessages($toUserId)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'to_user_id=:toUserId AND sent_active=:sentActive';
     $criteria->params = array(':toUserId' => $toUserId, ':sentActive' => '1');
     $messages = Messages::model()->findAll($criteria);
     if (!empty($messages)) {
         return $messages;
     } else {
         return false;
     }
 }
开发者ID:romeo14,项目名称:pow,代码行数:12,代码来源:MessagesApi.php

示例6: actionGetcount

 public function actionGetcount()
 {
     // un-read notification count
     $type = 'friend';
     $notification_count = array();
     $notification = Notification::model()->findAll("user_id=:uid AND is_read = 0 AND type != '{$type}'", array(':uid' => Yii::app()->user->userId));
     $message = Messages::model()->findAll('user_id=:uid AND is_read=0', array(':uid' => Yii::app()->user->userId));
     $friend = UserFriend::model()->findAll('friend_id=:uid AND is_read=0', array(':uid' => Yii::app()->user->userId));
     $notification_count['noti'] = count($notification);
     $notification_count['mess'] = count($message);
     $notification_count['friend'] = count($friend);
     print_r(json_encode($notification_count));
 }
开发者ID:nomannoor,项目名称:social-property,代码行数:13,代码来源:NotificationController.php

示例7: actionContractor

 public function actionContractor()
 {
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->role == 'contractor') {
             $this->pageTitle = 'Handyman.com - Contractor Dashboard';
             $this->cities = Cities::model()->findAll(array('order' => 'RAND()', 'limit' => 10));
             $contractor_id = Yii::app()->user->getId();
             $model = Contractors::model()->findByPk($contractor_id);
             $param['page'] = "dashboard";
             $param['model'] = $model;
             $criteria = new CDbCriteria();
             $criteria->condition = "to_id={$contractor_id} and to_user_type='contractor'";
             $param['message_count'] = Messages::model()->count($criteria);
             $this->render('contractor', $param);
         } else {
             $this->redirect(Yii::app()->homeUrl);
         }
     } else {
         $this->redirect(Yii::app()->homeUrl);
     }
 }
开发者ID:seph-krueger,项目名称:handyman,代码行数:21,代码来源:TestController.php

示例8: actionContractor

 public function actionContractor()
 {
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->role == 'contractor') {
             $this->pageTitle = 'Handyman.com - Contractor Dashboard';
             $this->cities = Cities::model()->findAll(array('order' => 'RAND()', 'limit' => 10));
             $contractor_id = Yii::app()->user->getId();
             $model = Contractors::model()->findByPk($contractor_id);
             $param['page'] = "dashboard";
             $param['model'] = $model;
             $criteria = new CDbCriteria();
             $criteria->condition = "to_id={$contractor_id} and to_user_type='contractor'";
             $param['message_count'] = Messages::model()->count($criteria);
             $criteria2 = new CdbCriteria();
             $criteria2->condition = "contractor_id = {$contractor_id}";
             $param['views_count'] = ContractorViews::model()->count($criteria2);
             $oneWeekAgo = date("Y-m-d H:i:s", strtotime("-1 months"));
             $criteria3 = new CdbCriteria();
             $criteria3->addBetweenCondition('date_added', $oneWeekAgo, date("Y-m-d H:i:s"));
             $param['latest_project_count'] = Projects::model()->count($criteria3);
             $param['from'] = $oneWeekAgo;
             $param['to'] = date("Y-m-d H:i:s");
             $param['points'] = 0;
             $points = ContractorPoints::model()->findByAttributes(array('contractor_id' => $contractor_id));
             if (count($points) > 0) {
                 $param['points'] = $points->points;
             }
             $team_invites = ContractorTeam::model()->findbyAttributes(array('invited_id' => $contractor_id, 'confirmed' => 0));
             $param['team_invites'] = $team_invites;
             $this->render('contractor', $param);
         } else {
             $this->redirect(Yii::app()->homeUrl);
         }
     } else {
         $this->redirect(Yii::app()->homeUrl);
     }
 }
开发者ID:seph-krueger,项目名称:handyman,代码行数:37,代码来源:DashboardController.php

示例9: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $folder = Yii::getPathOfAlias('webroot') . '/../images/users/';
     UserText::model()->deleteAllByAttributes(array("UserId" => $id));
     UserOptions::model()->deleteAllByAttributes(array("UserId" => $id));
     MembershipUsers::model()->deleteAllByAttributes(array("UserId" => $id));
     Messages::model()->deleteAllByAttributes(array("SenderId" => $id));
     Messages::model()->deleteAllByAttributes(array("ReceiverId" => $id));
     if (UserImages::model()->findAllByAttributes(array("UserId" => $id))) {
         $imgList = UserImages::model()->findAllByAttributes(array("UserId" => $id));
         foreach ($imgList as $list) {
             unlink($folder . $list->ImagePath);
         }
     }
     UserImages::model()->deleteAllByAttributes(array("UserId" => $id));
     $this->loadModel($id)->delete();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
开发者ID:brahmajiayatas,项目名称:getweiss,代码行数:26,代码来源:UsersController.php

示例10: getAllMessagesUser

 public static function getAllMessagesUser($idFrom = '')
 {
     $allMessages = $pages = null;
     if ($idFrom) {
         $criteria = new CDbCriteria();
         $criteria->addCondition('(id_userFrom = :idFrom AND id_userTo = :idUserOwner) OR (id_userFrom = :idUserOwner AND id_userTo = :idFrom) AND status =:status AND is_deleted = :is_deleted');
         $criteria->addCondition('status = "' . self::MESSAGE_ACTIVE . '"');
         $criteria->params[':idFrom'] = $idFrom;
         $criteria->params[':idUserOwner'] = Yii::app()->user->id;
         $criteria->params[':status'] = self::MESSAGE_ACTIVE;
         $criteria->params[':is_deleted'] = self::MESSAGE_NOT_DELETED;
         $criteria->order = 'id DESC';
         $pages = new CPagination(count(Messages::model()->findAll($criteria)));
         $pages->pageSize = param('userPaginationPageSize', 20);
         $pages->applyLimit($criteria);
         $allMessages = Messages::model()->findAll($criteria);
     }
     return array('pages' => $pages, 'allMessages' => $allMessages);
 }
开发者ID:barricade86,项目名称:raui,代码行数:19,代码来源:Messages.php

示例11: array

<?php

$newMessages = Messages::model()->findAll('to_user_id = :to and message_read = 0', array(':to' => Yii::app()->user->id));
if ($newMessages) {
    echo '<div class="success">';
    echo Yii::t('UserModule.user', 'You have new Messages !');
    echo '<ul>';
    foreach ($newMessages as $message) {
        printf("<li>%s</li>", CHtml::link($message->title, array('messages/view', 'id' => $message->id)));
    }
    echo '</ul>';
    echo '</div>';
}
开发者ID:reubsc,项目名称:sds,代码行数:13,代码来源:newMessages.php

示例12: array

 |
				<?php 
        echo CHtml::ajaxLink('Delete', array('message/trashSentMessage', 'id' => $model->Objid), array('success' => "function(data){\n\t\t\t\t\$('#message" . $model->Objid . "').html(data);\t\n\t\t\t\twindow.location.reload(true);\t\n\t\t\t\t}", 'beforeSend' => 'function() { 
				if(confirm("Are you sure want to delete this message?")){
				$("#loader' . $model->Objid . '").addClass("loading");
				return true;         
				}else{
				return false;
				}
				}', 'complete' => 'function() {
				$("#loader").removeClass("loading");
				}'));
        ?>
            </div>
            <p><?php 
        echo Messages::model()->limitWords($model->Subject, 5);
        ?>
</p>
            <div class="message_date"><span><?php 
        echo date('D, d M', strtotime($model->Date));
        ?>
</span></div>
            <div id="loader<?php 
        echo $model->Objid;
        ?>
" style="padding:19px 6px;"></div>
            <div class="clear"></div>
          </li>
          <?php 
    }
} else {
开发者ID:brahmajiayatas,项目名称:getweiss,代码行数:31,代码来源:sent.php

示例13: actionMessage

 public function actionMessage($id)
 {
     $message = Messages::model()->with('sender', 'receiver')->findByPk($id);
     $this->breadcrumbs = array(_('Користувачі') => $this->createUrl('users'), 'Перегляд повідомлення');
     $this->render('message', array('message' => $message));
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:6,代码来源:UsersController.php

示例14: getMessageCreators

 public static function getMessageCreators($id)
 {
     $messageCreatorIds = [];
     $requestUsersArray = [];
     $messagesArray = array();
     $requestsModel = Requests::model()->findByPk($id);
     if ($requestsModel) {
         foreach ($requestsModel->mstRequestUsers as $user) {
             $requestUsersArray[] = (int) $user->user_id;
         }
     }
     if (!empty($requestUsersArray)) {
         $criteria = new CDbCriteria();
         $criteria->addCondition('request.id = ' . $requestsModel->id);
         $criteria->addCondition('t.status = 1');
         $criteria->order = 't.created_on DESC';
         $criteria->with = array('request');
         $modelArray = Messages::model()->findAll($criteria);
         foreach ($modelArray as $model) {
             $messagesArray = array('creator' => $model->created_by);
         }
     }
     return $messagesArray;
 }
开发者ID:VanyaAvchyan,项目名称:Pol,代码行数:24,代码来源:ActionClass.php

示例15: actionMessagesWith

 /**
  * conversation with user
  */
 public function actionMessagesWith()
 {
     //Check if user is subnormal
     if (!Yii::app()->user->isGuest && Yii::app()->user->knights_name != $_GET['sir']) {
         //Check page
         $page = 1;
         //Is the first page
         if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) {
             $page = $_GET['page'];
         }
         $register_start = $page * Yii::app()->params['messages']['max_by_page'] - Yii::app()->params['messages']['max_by_page'];
         //$message_list = Messages::model()->findAll( "(from_user = :users_id1 AND to_user =:knight_users_id1) OR (from_user = :knight_users_id2 AND to_user =:users_id2) ORDER BY " );
         $paramsCondition = array(':users_id1' => Yii::app()->user->users_id, ':users_id2' => Yii::app()->user->users_id, ':knight_users_id1' => $this->knight->users_id, ':knight_users_id2' => $this->knight->users_id, ':status_delete' => Messages::STATUS_DELETED);
         $total_rows = Messages::model()->count('(from_user = :users_id1 AND to_user =:knight_users_id1) OR (from_user = :knight_users_id2 AND to_user =:users_id2) AND status != :status_delete', $paramsCondition);
         //Set params
         $params = array('messages' => Messages::getMessageWith(Yii::app()->user->users_id, $this->knight->users_id, $register_start, Yii::app()->params['messages']['max_by_page']), 'totalPages' => ceil($total_rows / Yii::app()->params['messages']['max_by_page']), 'page' => $page);
         $this->render('messagesWith', $params);
     } else {
         //No permitimos tener conversaciones con uno mismo.
         $this->redirect('/site/error');
     }
 }
开发者ID:RubenDjOn,项目名称:medieval-jousting-tournaments,代码行数:25,代码来源:CharacterController.php


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