/**
  * @see SearchAppController::advanced_search()
  */
 public function advanced_search()
 {
     if ($this->request->isPost()) {
         $this->_setSearchFields();
         if (!$this->OgAcl->canViewInactiveCompanies()) {
             $this->_searchParameters['clientStatus'] = 837750;
         }
         //for searching inactive companies
         if (!$this->OgAcl->canViewCompanyPitchConsultants() && !$this->OgAcl->canViewCompanyProspects() && !$this->OgAcl->canViewCompanyInfluencers()) {
             $this->_searchParameters['audienceType'] = 837767;
         }
         if (isset($this->_searchParameters['brandId'])) {
             $this->_searchParameters['brandInfo'] = array($this->_searchParameters['brandLabel']);
             if (isset($this->_searchParameters['subbrand']) && $this->_searchParameters['brandId']) {
                 $this->_searchParameters['brandInfo'] = $this->_searchParameters['brandId'] . $this->_searchParameters['subbrand'];
             }
         }
         unset($this->_searchParameters['companyBrand']);
         unset($this->_searchParameters['companybrandLabel']);
         unset($this->_searchParameters['brandId']);
         unset($this->_searchParameters['brandLabel']);
         unset($this->_searchParameters['subbrand']);
         unset($this->_searchParameters['subbrandLabel']);
         //specified region, country, l, uid with the post data to search user cause these are not available in post data
     }
     parent::advanced_search();
 }
 protected function _processSearchResults($data)
 {
     $target_map = array("USER" => "/users/view/", "ROLE" => "/roles/view/", "GROUP" => "/groups/view/", "CONTACT" => "/group/contacts/index/");
     $rt = array();
     foreach ($data as $row) {
         $row['target'] = $target_map[$row['type']] . urlencode($row['identifier']);
         array_push($rt, $row);
     }
     return parent::_processSearchResults($rt);
 }
 /**
  * @see SearchAppController::advanced_search()
  */
 public function advanced_search()
 {
     if ($this->request->isPost()) {
         $this->_setSearchFields();
         $this->_searchParameters['canViewDraftOffices'] = 0;
         if ($this->OgAcl->canViewDraftOffices()) {
             $this->_searchParameters['canViewDraftOffices'] = 1;
         }
     }
     parent::advanced_search();
 }
 /**
  * @see SearchAppController::advanced_search()
  */
 public function advanced_search()
 {
     if ($this->request->isPost()) {
         $this->_setSearchFields();
         // No longer needed since the view is passing an empty string if it wasn't selected
         // if (Hash::check($this->request->data, "Form.receivePublishedThoughtLeadership") && $this->request->data['Form']['receivePublishedThoughtLeadership'] ===  ''){
         // unset($this->_searchParameters['receivePublishedThoughtLeadership']);
         // }
         //specified region, country, l, uid with the post data to search user cause these are not available in post data
     }
     parent::advanced_search();
 }
Ejemplo n.º 5
0
 /**
  * Looks for config options overrides in Configure class
  * - Search.mode : type of MySQL search, natural or boolean
  * - Search.allowedChars : characters allowed in the search query
  */
 function beforeFilter()
 {
     // Search mode
     if ($mode = Configure::read('Search.mode')) {
         if (in_array($mode, array('natural', 'boolean'))) {
             $this->mode = $mode;
         }
     }
     // Query expansion
     if ($this->mode == 'natural' && Configure::read('Search.withQueryExpansion') !== null) {
         $this->withQueryExpansion = Configure::read('Search.withQueryExpansion');
     }
     // Allowed chars
     if ($allowedChars = Configure::read('Search.allowedChars')) {
         if (is_array($allowedChars)) {
             $this->allowedChars = $allowedChars;
         }
     }
     parent::beforeFilter();
 }
 /**
  * @see SearchAppController::advanced_search()
  */
 public function advanced_search()
 {
     if ($this->request->isPost()) {
         $this->_setSearchFields();
         $this->_searchParameters['primaryofficeid'] = isset($this->_searchParameters['office']) ? $this->_searchParameters['office'] : '';
         $this->_searchParameters['omusertype']['usertypeid'] = isset($this->_searchParameters['usertypelabel']) ? $this->_searchParameters['usertypelabel'] : '';
         $this->_searchParameters['omusersubtype']['usersubtypeid'] = isset($this->_searchParameters['usersubtypelabel']) ? $this->_searchParameters['usersubtypelabel'] : '';
         $this->_searchParameters['industry'] = isset($this->_searchParameters['industrylabel']) ? $this->_searchParameters['industrylabel'] : '';
         $this->_searchParameters['region'] = isset($this->_searchParameters['regionLabel']) ? $this->_searchParameters['regionLabel'] : '';
         $this->_searchParameters['country'] = isset($this->_searchParameters['countryLabel']) ? $this->_searchParameters['countryLabel'] : '';
         $this->_searchParameters['l'] = isset($this->_searchParameters['cityLabel']) ? $this->_searchParameters['cityLabel'] : '';
         $this->_searchParameters['uid'] = isset($this->_searchParameters['email']) ? $this->_searchParameters['email'] : '';
         $this->_searchParameters['jobskills']['skillid'] = isset($this->_searchParameters['skill']) ? $this->_searchParameters['skill'] : '';
         $this->_searchParameters['jobskills']['subskillid'] = isset($this->_searchParameters['subskill']) ? $this->_searchParameters['subskill'] : '';
         $this->_searchParameters['languages']['language'] = isset($this->_searchParameters['languagelabel']) ? $this->_searchParameters['languagelabel'] : '';
         $this->_searchParameters['languages']['proficiency'] = isset($this->_searchParameters['languagelevellabel']) ? $this->_searchParameters['languagelevellabel'] : '';
         $this->_searchParameters['clientbrand']['client'] = isset($this->_searchParameters['clientLabel']) ? $this->_searchParameters['clientLabel'] : '';
         $this->_searchParameters['department']['subdeptid'] = isset($this->_searchParameters['subdepartment']) ? $this->_searchParameters['subdepartment'] : '';
         // Leadership lists
         $this->_searchParameters['groupLeadership']['grouptypeid'] = isset($this->_searchParameters['groupLeadership']['grouptype']) ? $this->_searchParameters['groupLeadership']['grouptype'] : '';
         $this->_searchParameters['groupLeadership']['disciplineid'] = isset($this->_searchParameters['groupLeadership']['discipline']) ? $this->_searchParameters['groupLeadership']['discipline'] : '';
         $this->_searchParameters['groupLeadership']['countryid'] = isset($this->_searchParameters['groupLeadership']['country']) ? $this->_searchParameters['groupLeadership']['country'] : '';
         $this->_searchParameters['groupLeadership']['regionid'] = isset($this->_searchParameters['groupLeadership']['region']) ? $this->_searchParameters['groupLeadership']['region'] : '';
         /**
          * omgdiscipline/disciplineid cannot be sent to OCD as an empty field.
          * If nothing is selected in a form, it should be removed from search params.
          */
         if (isset($this->_searchParameters['disciplineid'])) {
             $this->_searchParameters['omgdiscipline']['disciplineid'] = $this->_searchParameters['disciplineid'];
         } else {
             unset($this->_searchParameters['omgdiscipline']);
         }
         unset($this->_searchParameters['groupLeadership']['leadershiplist']);
         unset($this->_searchParameters['disciplinelabel']);
         unset($this->_searchParameters['disciplineid']);
         unset($this->_searchParameters['discipline']);
         unset($this->_searchParameters['address']);
         unset($this->_searchParameters['office']);
         unset($this->_searchParameters['countryLabel']);
         unset($this->_searchParameters['city']);
         unset($this->_searchParameters['regionLabel']);
         unset($this->_searchParameters['cityLabel']);
         unset($this->_searchParameters['officeLabel']);
         unset($this->_searchParameters['skill']);
         unset($this->_searchParameters['office']);
         unset($this->_searchParameters['groupLeadership']['region']);
         unset($this->_searchParameters['groupLeadership']['country']);
         unset($this->_searchParameters['groupLeadership']['discipline']);
         unset($this->_searchParameters['groupLeadership']['grouptype']);
         if ($this->OgAcl->canSearchForSuspendedUsers()) {
             $this->_searchParameters['includesuspendedusers'] = 1;
         }
         if ($this->OgAcl->canViewHrNote()) {
             $this->_searchParameters['omghrnote'] = '';
             $this->searchCategory[$this->_searchType]['fields']['omghrnote'] = 'HR Notes';
         }
         // adding HR notes as searchable field
     }
     parent::advanced_search();
 }