Esempio n. 1
0
 private function prepareRequestedCriteria()
 {
     if ($idKeyword = SJB_Request::getVar('idKeyword', false)) {
         if (strpos($idKeyword, ',') !== false) {
             $idKeywordTrimmed = array();
             foreach (explode(',', $idKeyword) as $idK) {
                 $idKeywordTrimmed[] = SJB_HelperFunctions::trimValue($idK);
             }
             foreach ($idKeywordTrimmed as $val) {
                 if (intval($val)) {
                     $_REQUEST['sid']['in'][] = (int) $val;
                 } else {
                     unset($_REQUEST['sid']['in']);
                     $_REQUEST['keywords']['like'][] = $val;
                 }
             }
         } else {
             if (intval($idKeyword)) {
                 $_REQUEST['sid']['equal'] = (int) $idKeyword;
             } else {
                 $_REQUEST['keywords']['like'] = SJB_HelperFunctions::trimValue($idKeyword);
             }
         }
     }
     if ($companyUserName = SJB_Request::getVar('company_name', false)) {
         if (!empty($companyUserName['like'])) {
             $listingSids = SJB_UserManager::getUserSIDsLikeCompanyName($companyUserName['like']);
             if (empty($listingSids)) {
                 unset($_REQUEST['company_name']);
             }
             $usernameLikeSids = SJB_UserManager::getUserSIDsLikeUsername(SJB_DB::quote($companyUserName['like']));
             $firstLastNameLikeSids = SJB_UserManager::getUserSIDsLikeFirstNameOrLastName(SJB_DB::quote($companyUserName['like']));
             $_REQUEST['user_sid']['in'] = array_merge(!empty($usernameLikeSids) ? $usernameLikeSids : array(''), !empty($firstLastNameLikeSids) ? $firstLastNameLikeSids : array(''));
         }
     }
 }