X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fjobterms.php;h=4cab3aae2b0b6d7070e040cff38102190f6aab60;hb=51c2c63a898801a7a6839f7b08313c12ddd1c47f;hp=c7918657b1cffc0282c381f7c983dcefc5d103bf;hpb=f2d397df81eb949f846d5a06127f7d72e8b9105d;p=platal.git diff --git a/classes/jobterms.php b/classes/jobterms.php index c791865..4cab3aa 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: @@ -80,6 +108,7 @@ class JobTerms { 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')); } @@ -88,15 +117,19 @@ class JobTerms { return '$("'.addslashes($domElement).'").jstree({ "core" : {"strings":{"loading":"Chargement ..."}}, "plugins" : ["themes","json_data"], - "themes" : { "url" : platal_baseurl + "css/jstree.css" }, + "themes" : { "url" : $.plURL("css/jstree.css") }, "json_data" : { "ajax" : { - "url" : platal_baseurl + "'.addslashes($platalpage).'", + "url" : $.plURL("'.addslashes($platalpage).'"), "data" : function(nod) { var jtid = 0; 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).'" + } } }} });'; } @@ -104,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) { @@ -129,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; }