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


PHP UserService::getUserbyField方法代码示例

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


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

示例1: prepareForEdit

 public function prepareForEdit($model)
 {
     // check the existence of the client to add this contact to
     $cid = $model->clientid ? $model->clientid : (int) $this->_getParam('clientid');
     $client = $this->clientService->getClient($cid);
     if ($client == null) {
         $this->flash("Client not found, please update!");
         $client = new Client();
     }
     $this->view->title = "Editing Contact";
     $this->view->client = $client;
     $this->view->clients = $this->clientService->getClients();
     $this->view->assocUser = null;
     if ($model->id) {
         $this->view->assocUser = $this->userService->getUserbyField('contactid', $model->id);
     }
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:17,代码来源:ContactController.php

示例2: prepareForEdit

 /**
  * Prepare a contact for being edited. 
  */
 public function prepareForEdit($model)
 {
     if ($model == null) {
         $this->error("Specified contact not found");
         return;
     }
     // check the existence of the client to add this contact to
     $cid = $model->clientid ? $model->clientid : (int) $this->_getParam('clientid');
     $client = $this->clientService->getClient($cid);
     if ($client == null) {
         $this->error("Specified contact not found");
         return;
     }
     $this->view->title = "Editing Contact";
     $this->view->client = $client;
     $this->view->clients = $this->clientService->getClients();
     $this->view->assocUser = $this->userService->getUserbyField('contactid', $model->id);
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:21,代码来源:ContactController.php

示例3: processIncomingEmails

 /**
  * Processes incoming emails so that issues can be created/updated
  *
  * @param unknown_type $emails
  */
 public function processIncomingEmails($emails)
 {
     foreach ($emails as $mail) {
         // First we need to find which customer the email belongs to
         $from = ifset($mail->headers, 'from', false);
         if (!$from) {
             za()->log("Failed finding from email header in " . print_r($mail, true));
             continue;
         }
         // clean it up a bit
         if (!preg_match("/[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}/i", $from, $matches)) {
             za()->log("Error finding valid email address", Zend_Log::ERR);
             continue;
         }
         $email = $matches[0];
         // Get the contact now. If it doesn't exist that's okay, it
         // might be a system user instead.
         $contact = $this->clientService->getContactByField('email', $email);
         // If not found by primary, try secondary
         if (!$contact) {
             $contact = $this->clientService->getContactByField('altemail', $email);
         }
         // We'll also see whether this issue was sent in by a user
         // of the system.
         $user = $this->userService->getUserByField('email', $email);
         if (!$contact && !$user) {
             za()->log("No valid user found with 'from' address {$email}", Zend_Log::WARN);
             $this->trackerService->track('invalid-issue-email', $email, null, null, serialize($mail));
             continue;
         }
         // Next up, see if the contact has an associated user, because
         // we'll add them in as the 'creator' of the issue
         if ($contact != null) {
             $contactUser = $this->userService->getUserbyField('contactid', $contact->id);
             if ($contactUser != null) {
                 $user = $contactUser;
             }
         }
         if ($user != null) {
             za()->setUser($user);
         }
         $params = array();
         // Saving a new issue uses the title of the email
         $subject = ifset($mail->headers, 'subject', false);
         if (!$subject) {
             // we'll accept an empty subject, just create a default title
             $subject = "Support request from {$from}";
         }
         $textBody = $this->emailService->getTextBody($mail);
         $issue = null;
         // Try and get an existing ticket
         za()->log("Checking email subject {$subject}");
         if (preg_match("/#(\\d+)/", $subject, $matches)) {
             // existing
             $id = $matches[1];
             $issue = $this->getIssue($id);
             if ($issue) {
                 za()->log("Adding note to request {$id}");
                 // Make sure the issue found currently belongs to the contact
                 // client!
                 // if there's no contact, make sure there's a user instead
                 if ($contact) {
                     if ($issue->clientid != $contact->clientid) {
                         $issue = null;
                     }
                 } else {
                     if (!$user) {
                         $issue = null;
                     }
                 }
             } else {
                 $this->log->warn("Request not found for id {$id}");
             }
         }
         $infoText = "";
         if ($user) {
             $infoText = "Email coming from user #" . $user->id . " -  " . $user->username . " ";
         }
         if ($contact) {
             $infoText = "Email coming from contact #" . $contact->id . " - " . $contact->firstname . " ";
         }
         $this->trackerService->track('incoming-issue-email', $email, null, null, "Processing email from " . $email . ": " . $infoText);
         $notifyOfId = false;
         // If we've already got an issue, it means we're wanting to
         // just update its comments
         if ($issue) {
             // Just add an additional comment to the
             // current issue.
             $poster = $contact ? $contact->firstname : $user->getUsername();
             $note = $this->notificationService->addNoteTo($issue, $textBody, $subject, $poster);
             $this->notificationService->sendWatchNotifications($note, array('controller' => 'issue', 'action' => 'edit', 'params' => array('id' => $issue->id)));
             za()->log("Note added to request {$issue->id}", Zend_Log::INFO);
         } else {
             // new
             $issue = new Issue();
//.........这里部分代码省略.........
开发者ID:nyeholt,项目名称:relapse,代码行数:101,代码来源:IssueService.php


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