コード例 #1
0
 private function Search()
 {
     $suggestions = array();
     if (strlen($this->request->getPost('zip')) > 0 || strlen($this->request->getPost('firstname')) > 0 || strlen($this->request->getPost('lastname')) > 0) {
         $params = array();
         if (strlen($this->request->getPost('zip')) > 0 && is_numeric($this->request->getPost('zip'))) {
             $zip = substr($this->request->getPost('zip'), 0, 1) == 0 ? substr($this->request->getPost('zip'), 1) : $this->request->getPost('zip');
             $params['zip']['value'] = $zip . '%';
             $params['zip']['operator'] = 'LIKE';
         }
         if (strlen($this->request->getPost('firstname'))) {
             $params['first_name']['value'] = '%' . $this->request->getPost('firstname') . '%';
             $params['first_name']['operator'] = 'LIKE';
         }
         if (strlen($this->request->getPost('lastname'))) {
             $params['last_name']['value'] = '%' . $this->request->getPost('lastname') . '%';
             $params['last_name']['operator'] = 'LIKE';
         }
         $Userobject = new Feusers();
         $suggestionQuery = $Userobject->searchUsers($params);
         foreach ($suggestionQuery as $suggestion) {
             $onspot = '';
             $onspotTitle = '';
             if ($suggestion->onspot) {
                 $onspotDates = $suggestion->getOnspotdates();
                 $onspot = '<span class="onspot inactive"></span>';
                 $onspotTitle = ' title="Heute nicht vor Ort"';
                 foreach ($onspotDates as $onspotdate) {
                     if (date('d.m.') == date('d.m.', $onspotdate->tstamp)) {
                         $onspot = '<span class="onspot active"></span>';
                         $onspotTitle = ' title="Heute für Sie am Stand"';
                     }
                 }
             }
             $info1 = $suggestion->jobtitle ? $suggestion->jobtitle . '<br>' : '';
             $info2 = $suggestion->specialization ? $suggestion->specialization . '<br>' : '';
             $info3 = $suggestion->division ? $suggestion->division . '<br>' : '';
             $suggestions['suggestions'][] = array('value' => $suggestion->first_name . ' ' . $suggestion->last_name, 'html' => '<div class="suggestion-item"' . $onspotTitle . '>' . $onspot . '<table><tr><td><img src="' . $this->userImgExists($suggestion->image) . '" style="max-height:100px"></td><td style="word-break: break-all;width:11.4vw"><p><span style="font-weight:bold">' . $suggestion->title . ' ' . $suggestion->first_name . ' ' . $suggestion->last_name . '</span><br>' . $info1 . '' . $info2 . $info3 . '<span class="contactButton small">SMS senden</span></p></td></tr></table></div>', 'data' => $suggestion->uid);
         }
     }
     return $suggestions;
 }