return array(
'search' => $this->make_hook('quick', AUTH_PUBLIC),
'search/adv' => $this->make_hook('advanced', AUTH_COOKIE),
+ 'search/ajax/region' => $this->make_hook('region', AUTH_COOKIE, '', NO_AUTH),
+ 'search/ajax/grade' => $this->make_hook('grade', AUTH_COOKIE, '', NO_AUTH),
'advanced_search.php' => $this->make_hook('redir_advanced', AUTH_PUBLIC),
);
}
XDB::iterator('SELECT id,text FROM applis_def ORDER BY text'));
$page->assign('choix_secteurs',
XDB::iterator('SELECT id,label FROM emploi_secteur ORDER BY label'));
+ $this->get_diplomas();
+ }
+
+ function get_diplomas($school = null)
+ {
+ if (is_null($school) && Env::has('school')) {
+ $school = Env::i('school');
+ }
- if (Env::has('school')) {
- $sql = 'SELECT type FROM applis_def WHERE id='.Env::i('school');
+ if (!is_null($school)) {
+ $sql = 'SELECT type FROM applis_def WHERE id=' . $school;
} else {
$sql = 'DESCRIBE applis_def type';
}
$res = XDB::query($sql);
$row = $res->fetchOneRow();
- if (Env::has('school')) {
+ if (!is_null($school)) {
$types = $row[0];
} else {
$types = explode('(',$row[1]);
$types = str_replace("'","",substr($types[1],0,-1));
}
+ global $page;
$page->assign('choix_diplomas', explode(',',$types));
}
}
+ $page->addJsLink('ajax.js');
$page->register_modifier('display_lines', 'display_lines');
}
+
+ function handler_region(&$page, $country = null)
+ {
+ require_once("geoloc.inc.php");
+ $page->ChangeTpl('search/adv.region.form.tpl', NO_SKIN);
+ $page->assign('region', "");
+ $page->assign('country', $country);
+ }
+
+ function handler_grade(&$page, $school = null)
+ {
+ $page->ChangeTpl('search/adv.grade.form.tpl', NO_SKIN);
+ $page->assign('grade', '');
+ $this->get_diplomas($school);
+ }
}
?>
<tr>
<td>Pays</td>
<td>
- <select name="country" onchange="javascript:document.forms.recherche.submit();">
+ <select name="country" onchange="return Ajax.update_html('region', '{$platal->ns}search/ajax/region/' + this.value);">
{if $smarty.request.country}
{assign var="country" value=$smarty.request.country}
{else}
<tr>
<td>Région ou département</td>
<td>
- <select name="region">
+ <select name="region" id="region">
{if $smarty.request.region}
{assign var="region" value=$smarty.request.region}
{else}
{assign var="region" value=""}
{/if}
- {if $smarty.request.country neq ""}
- {geoloc_region country=$smarty.request.country region=$region}
- {else}
- <option value=""></option>
- {/if}
+ {include file="search/adv.region.form.tpl" country=$smarty.request.country}
</select>
</td>
</tr>
<tr>
<td>Formation</td>
<td>
- <select name="school" onchange="javascript:document.forms.recherche.submit();">
+ <select name="school" onchange="return Ajax.update_html('grade', '{$platal->ns}search/ajax/grade/' + this.value);">
<option value="0"></option>
{iterate item=cs from=$choix_schools}
<option value="{$cs.id}" {if $smarty.request.school eq $cs.id}selected="selected"{/if}>
<tr>
<td></td>
<td>
- <select name="diploma">
- <option value="0"></option>
- {section name=diploma loop=$choix_diplomas}
- <option value="{$choix_diplomas[diploma]}" {if $smarty.request.diploma eq
- $choix_diplomas[diploma]}selected="selected"{/if}>
- {$choix_diplomas[diploma]}
- </option>
- {/section}
+ <select name="diploma" id="grade">
+ {include file="search/adv.grade.form.tpl" grade=$smarty.request.diploma}
</select>
</td>
</tr>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2006 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<option value="0"></option>
+{section name=diploma loop=$choix_diplomas}
+<option value="{$choix_diplomas[diploma]}" {if $grade eq $choix_diplomas[diploma]}selected="selected"{/if}>
+ {$choix_diplomas[diploma]}
+</option>
+{/section}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2006 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{if $country neq ""}
+ {geoloc_region country=$country region=$region}
+{else}
+ <option value=""></option>
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}