More comments, bug fixed too.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
return $this->visibility->isVisible($visibility);
}
- /** Stores the list of fields which have already been fetched for this Profile
+ /** Stores the list of fields which have already fetched for this Profile
*/
public function setFetchedFields($fields)
{
$this->fetched_fields = $fields;
}
+ /** Have we already fetched this field ?
+ */
private function fetched($field)
{
- if (($fields | self::FETCH_ALL) != self::FETCH_ALL) {
- Platal::page()->kill("Invalid fetched fields: $fields");
+ if (!array_key_exists($field, ProfileField::$fields)) {
+ Platal::page()->kill("Invalid field: $field");
}
return ($this->fetched_fields & $field);
*/
private function consolidateFields()
{
+ // Link phones to addresses
if ($this->phones != null) {
if ($this->addresses != null) {
$this->addresses->addPhones($this->phones);
}
}
+ // Link addresses to jobs
if ($this->addresses != null && $this->jobs != null) {
$this->jobs->addAddresses($this->addresses);
}
+
+ // Link jobterms to jobs
if ($this->jobs != null && $this->jobterms != null) {
$this->jobs->addJobTerms($this->jobterms);
}
$sub = $uf->addJobTermsFilter(count($this->val));
$conditions = array();
foreach ($this->val as $i => $jtid) {
- $conditions[] = $sub[$i] . ' = ' . XDB::escape($jtid);
+ $conditions[] = $sub[$i] . '.jtid_1 = ' . XDB::escape($jtid);
}
$jsub = $uf->addJobFilter();
$conditions[] = $uf->getVisibilityCondition($jsub . '.pub');
* Adds a filter on job terms of profile.
* @param $nb the number of job terms to use
* @return an array of the fields to filter (one for each term).
- * Code using this function should used returned field as is (contains table and field name).
*/
public function addJobTermsFilter($nb = 1)
{
$this->with_pjt = $nb;
$jobtermstable = array();
for ($i = 1; $i <= $nb; ++$i) {
- $jobtermstable[] = 'pjtr_'.$i.'.jtid_1';
+ $jobtermstable[] = 'pjtr_'.$i;
}
return $jobtermstable;
}
'advanced_search.php' => $this->make_hook('redir_advanced', AUTH_PUBLIC),
'search/autocomplete' => $this->make_hook('autocomplete', AUTH_COOKIE, 'directory_ax', NO_AUTH),
'search/list' => $this->make_hook('list', AUTH_COOKIE, 'directory_ax', NO_AUTH),
- 'jobs' => $this->make_hook('referent', AUTH_COOKIE),
- 'emploi' => $this->make_hook('referent', AUTH_COOKIE),
- 'referent/search' => $this->make_hook('referent', AUTH_COOKIE),
+ 'jobs' => $this->make_hook('referent', AUTH_COOKIE),
+ 'emploi' => $this->make_hook('referent', AUTH_COOKIE),
+ 'referent/search' => $this->make_hook('referent', AUTH_COOKIE),
'search/referent/countries' => $this->make_hook('referent_countries', AUTH_COOKIE),
);
}
$page->setTitle('Emploi et Carrières');
- // nb de mentors
+ // Count mentors
$res = XDB::query("SELECT count(distinct pid) FROM profile_mentor_term");
$page->assign('mentors_number', $res->fetchOneCell());
$page->addJsLink('jquery.autocomplete.js');
- // On vient d'un formulaire
+ // Search for mentors matching filters
require_once 'ufbuilder.inc.php';
$ufb = new UFB_MentorSearch();
if (!$ufb->isEmpty()) {