1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
function getResultSearch($langCode,$motscles, $domaine , $local,$contrat,$Remuneration){
$tmotscles = explode(" ",$motscles);
if($domaine != 0)
{
$where_domaine = " AND o.domaineId = '{$domaine}' ";
}
if($contrat != 0)
{
$where_contrat = " AND o.contratId = '{$contrat}' ";
}
if($local != 0)
{
$where_local = " AND o.localId = '{$local}' ";
}
if($Remuneration != 0)
{
$where_remuneration = " AND (o.offreRemunerationMin <= '{$Remuneration}' ";
}
$sc = "
SELECT {$this->alias}.offreId,
{$this->alias}.offreTitre,
{$this->alias}.offreText,
{$this->alias}.langCode,
{$this->alias}.offreMotsCles,
o.contratId,
o.localId,
o.domaineId,
o.offreActive,
o.offreRemunerationMin,
o.offreRemunerationMax,
dt.domaineTitre,
ct.contratTitre,
lt.localTitre,
o.offreDateModif
FROM {$this->table} {$this->alias}
INNER JOIN recrutement_offre o ON {$this->alias}.offreId = o.offreId
INNER JOIN recrutement_domaine_text dt
ON o.domaineId = dt.domaineId
AND dt.langCode = '{$langCode}'
INNER JOIN recrutement_contrat_text ct
ON o.contratId = ct.contratId
AND ct.langCode = '{$langCode}'
INNER JOIN recrutement_local_text lt
ON o.localId = lt.localId
AND lt.langCode = '{$langCode}'
LEFT JOIN thermidor_language l ON {$this->alias}.langCode = l.langCode
WHERE {$this->alias}.langCode = '{$langCode}'
AND o.`offreActive` = 1
{$where_domaine}
{$where_contrat}
{$where_local}
{$where_remuneration}
";
if(is_array($tmotscles))
{
foreach ($tmotscles as $mc){
$sc .= " AND {$this->alias}.offreMotsCles LIKE '%{$mc}%'";
}
}
$sc .= " GROUP BY {$this->alias}.`offreId` ";
if($rc = Database::execute_sql($sc))
{
return $this->parseResults($rc);
}
} |
Partager