const ADDRESS_POSTAL = 0x000008;
const EDUCATION_MAIN = 0x000010;
- const EDUCATION_ALL = 0x000020;
- const EDUCATION_FINISHED = 0x000040;
- const EDUCATION_CURRENT = 0x000080;
+ const EDUCATION_EXTRA = 0x000020;
+ const EDUCATION_ALL = 0x000040;
+ const EDUCATION_FINISHED = 0x000080;
+ const EDUCATION_CURRENT = 0x000100;
- const JOBS_MAIN = 0x000100;
- const JOBS_ALL = 0x000200;
- const JOBS_FINISHED = 0x000400;
- const JOBS_CURRENT = 0x000800;
+ const JOBS_MAIN = 0x001000;
+ const JOBS_ALL = 0x002000;
+ const JOBS_FINISHED = 0x004000;
+ const JOBS_CURRENT = 0x008000;
private $pid;
private $hrpid;
$this->visibility = self::$v_values[$visibility];
}
- public function getAddresses($flags)
+
+ /* Addresses
+ */
+ public function getAddresses($flags, $limit = null)
{
$where = XDB::format('pa.pid = {?}', $this->id());
if ($flags & self::ADDRESS_MAIN) {
if (count($type) > 0) {
$where .= ' AND pa.type IN ' . XDB::formatArray($type);
}
+ $limit = is_null($limit) ? '' : XDB::format('LIMIT {?}', (int)$limit);
return XDB::iterator('SELECT pa.text, pa.postalCode, pa.type, pa.latitude, pa.longitude,
gl.name AS locality, gas.name AS subAdministrativeArea,
ga.name AS administrativeArea, gc.countryFR AS country,
LEFT JOIN geoloc_administrativeareas AS ga ON (ga.id = pa.administrativeAreaId)
LEFT JOIN geoloc_administrativeareas AS gas ON (gas.id = pa.subAdministrativeAreaId)
LEFT JOIN geoloc_countries AS gc ON (gc.iso_3166_1_a2 = pa.countryId)
- WHERE ' . $where);
+ WHERE ' . $where . '
+ ORDER BY pa.id
+ ' . $limit);
}
public function getMainAddress()
}
}
+
+ /* Educations
+ */
+ public function getEducations($flags, $limit = null)
+ {
+ $where = XDB::format('pe.uid = {?}', $this->id());
+ if ($flags & self::EDUCATION_MAIN) {
+ $where .= ' AND FIND_IN_SET(\'primary\', pe.flags)';
+ } else if ($flags & self::EDUCATION_EXTRA) {
+ $where .= ' AND NOT FIND_IN_SET(\'primary\', pe.flags)';
+ } else if ($flags & self::EDUCATION_FINISHED) {
+ $where .= ' AND pe.grad_year <= YEAR(CURDATE())';
+ } else if ($flags & self::EDUCATION_CURRENT) {
+ $where .= ' AND pe.grad_year > YEAR(CURDATE())';
+ }
+ $limit = is_null($limit) ? '' : XDB::format('LIMIT {?}', (int)$limit);
+ return XDB::iterator('SELECT pe.entry_year, pe.grad_year, pe.program,
+ pee.name AS school, pee.abbreviation AS school_short, pee.url AS school_url, gc.countryFR AS country,
+ pede.degree, pede.abbreviation AS degree_short, pede.level AS degree_level, pefe.field,
+ FIND_IN_SET(\'primary\', pe.flags) AS prim
+ FROM profile_education AS pe
+ INNER JOIN profile_education_enum AS pee ON (pe.eduid = pee.id)
+ LEFT JOIN geoloc_countries AS gc ON (gc.iso_3166_1_a2 = pee.country)
+ INNER JOIN profile_education_degree_enum AS pede ON (pe.degreeid = pede.id)
+ LEFT JOIN profile_education_field_enum AS pefe ON (pe.fieldid = pefe.id)
+ WHERE ' . $where . '
+ ORDER BY NOT FIND_IN_SET(\'primary\', pe.flags), pe.entry_year, pe.id
+ ' . $limit);
+ }
+
+ public function getExtraEducations($limit = null)
+ {
+ return $this->getEducations(self::EDUCATION_EXTRA, $limit);
+ }
+
+
public function owner()
{
return User::getSilent($this);
function _education_fmt($params, &$smarty)
{
- extract($params);
- return education_fmt($name, $url, $degree, $grad_year, $field, $program, $sexe, $long);
+ $params = new PlDict($params);
+ $edu = $params->v('edu');
+ if (!$params->has('sex')) {
+ $profile = $params->v('profile');
+ $sex = $profile->isFemale();
+ } else {
+ $sex = $params->b('sex');
+ }
+ return education_fmt($edu['school_short'], $edu['school_url'], $edu['degree_short'], $edu['grad_year'],
+ $edu['field'], $edu['program'], $sex, $params->b('long'));
}
Platal::page()->register_function('education_fmt', '_education_fmt');
{if $profile->nationality3}
<img src='images/flags/{$profile->nationality3}.gif' alt='{$profile->nationality3}' height='11' title='{$profile->nationality3}' />
{/if}
- {$profile->promo()}
-
- {if $c.eduname0}, {education_fmt name=$c.eduname0 url=$c.eduurl0 degree=$c.edudegree0
- grad_year=$c.edugrad_year0 field=$c.edufield0 program=$c.eduprogram0 sexe=$c.sexe}{*
- *}{/if}{if $c.eduname1}, {education_fmt name=$c.eduname1 url=$c.eduurl1 degree=$c.edudegree1
- grad_year=$c.edugrad_year1 field=$c.edufield1 program=$c.eduprogram1 sexe=$c.sexe}{*
- *}{/if}{if $c.eduname2}, {education_fmt name=$c.eduname2 url=$c.eduurl2 degree=$c.edudegree2
- grad_year=$c.edugrad_year2 field=$c.edufield2 program=$c.eduprogram2 sexe=$c.sexe}{*
- *}{/if}{if $c.eduname3}, {education_fmt name=$c.eduname3 url=$c.eduurl3 degree=$c.edudegree3
- grad_year=$c.edugrad_year3 field=$c.edufield3 program=$c.eduprogram3 sexe=$c.sexe}{*
- *}{/if}{if $c.dcd}, décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
+ {$profile->promo()}{*
+ *}{iterate from=$profile->getExtraEducations(4) item=edu}, {education_fmt edu=$edu profile=$profile}{/iterate}{*
+ *}{if $dead}, {"décédé"|sex:"décédée":$user} le {$orfile->deathdate|date_format}{/if}
</div>
</div>
<div class="long">
{if !$dead}
{assign var=address value=$profile->getMainAddress()}
- {if $c.web || $c.mobile || $address.country || $c.entreprise || (!$c.dcd && !$c.actif )}
+ {if $c.web || $c.mobile || $address.country || $c.entreprise || (!$dead && !$registered)}
<table cellspacing="0" cellpadding="0">
{if $c.web}
<tr>