X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fjobterms.php;h=ae5c758e454072e881ac310cee89dfe1fc2cda03;hb=0c9edc89377266444fa06b77104dc5781eae1698;hp=460b74e6a5b0cf17b782d39738bc51224384be92;hpb=12ddbc2037b16496dfb9d91c4f7091850146fcde;p=platal.git diff --git a/classes/jobterms.php b/classes/jobterms.php index 460b74e..ae5c758 100644 --- a/classes/jobterms.php +++ b/classes/jobterms.php @@ -1,6 +1,6 @@ changeTpl('include/jobterms.branch.tpl', NO_SKIN); - $subTerms = self::getSubTerms(Env::v('jtid'), $filter); + $subTerms = self::getSubTerms(Env::v('jtid'), $filter, Env::v('text_filter')); $page->assign('subTerms', $subTerms); switch ($filter) { case self::ONLY_JOBS: @@ -78,6 +107,8 @@ class JobTerms { $page->assign('filter', 'mentor'); break; } + $page->assign('jtid', Env::v('jtid')); + $page->assign('text_filter', Env::v('text_filter')); $page->assign('attrfunc', Env::v('attrfunc')); $page->assign('treeid', Env::v('treeid')); } @@ -94,7 +125,11 @@ class JobTerms { if (nod != -1) { jtid = nod.attr("id").replace(/^.*_([0-9]+)$/, "$1"); } - return { "jtid" : jtid, "treeid" : "'.addslashes($treeid).'", "attrfunc" : "'.addslashes($attrfunc).'" } + return { + "jtid" : jtid, + "treeid" : "'.addslashes($treeid).'", + "attrfunc" : "'.addslashes($attrfunc).'" + } } }} });'; } @@ -102,7 +137,7 @@ class JobTerms { /** * Extract search token from term * @param $term a utf-8 string that can contain any char - * @param an array of elementary tokens + * @return an array of elementary tokens */ static public function tokenize($term) { @@ -127,14 +162,15 @@ class JobTerms { * Create the INNER JOIN query to restrict search to some job terms * @param $tokens an array of the job terms to look for (LIKE comp) * @param $table_alias the alias or name of the table with a jtid field to restrict + * @param $table_field the name of the field to restrict in table_alias, usually jtid * @return a partial SQL query */ - static public function token_join_query(array $tokens, $table_alias) { + static public function token_join_query(array $tokens, $table_alias, $table_field = 'jtid') { $joins = ''; $i = 0; foreach ($tokens as $t) { ++$i; - $joins .= ' INNER JOIN profile_job_term_search AS s'.$i.' ON(s'.$i.'.jtid = '.$table_alias.'.jtid AND s'.$i.'.search LIKE '.XDB::escape($t).')'; + $joins .= ' INNER JOIN profile_job_term_search AS s'.$i.' ON(s'.$i.'.jtid = '.$table_alias.'.'.$table_field.' AND s'.$i.'.search LIKE '.XDB::escape($t).')'; } return $joins; }