X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fjobterms.php;h=4cab3aae2b0b6d7070e040cff38102190f6aab60;hb=c9910f7559bb0cfd787b4fb73f864000f28e38cc;hp=460b74e6a5b0cf17b782d39738bc51224384be92;hpb=12ddbc2037b16496dfb9d91c4f7091850146fcde;p=platal.git diff --git a/classes/jobterms.php b/classes/jobterms.php index 460b74e..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: @@ -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')); } @@ -86,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).'" + } } }} });'; } @@ -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; }