<?php
/***************************************************************************
- * Copyright (C) 2003-2011 Polytechnique.org *
+ * Copyright (C) 2003-2013 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
$this->visibility = $visibility;
}
+ public function __destruct()
+ {
+ // Need to delete objects allocated by the profile
+ // http://www.php.net/manual/en/function.unset.php#98692
+ unset($this->owner);
+ }
+
public function id()
{
return $this->pid;
return $this->corps;
}
+ /**
+ * Retrieve the name of the corps which has been done.
+ *
+ * Note: this function first tries getCorps(), and if this field is blank
+ * tries to find an education which degree is "Corps".
+ *
+ * Returns an empty string if nothing has been found.
+ */
+ public function getCorpsName()
+ {
+ $corps = $this->getCorps();
+ if ($corps && $corps->current) {
+ $corpsList = DirEnum::getOptions(DirEnum::CURRENTCORPS);
+ return $corpsList[$corps->current];
+ }
+
+ foreach ($this->getExtraEducations() as $edu) {
+ if (!strcasecmp($edu->degree, 'Corps')) {
+ if ($edu->school_short) {
+ return $edu->school_short;
+ } elseif ($edu->school) {
+ return $edu->school;
+ }
+ }
+ }
+ return '';
+ }
+
/** Networking
*/
private $networks = null;
*/
public static function getAccountEquivalentName($name)
{
- switch ($name)
- {
- case self::DN_DIRECTORY:
- case self::DN_SORT:
+ switch ($name) {
+ case self::DN_DIRECTORY:
return 'directory_name';
- case self::DN_FULL:
- case self::DN_PUBLIC:
+ case self::DN_SORT:
+ return 'sort_name';
+ case self::DN_FULL:
+ case self::DN_PUBLIC:
+ case self::DN_PRIVATE:
+ case self::DN_SHORT:
return 'full_name';
- case self::DN_PRIVATE:
- case self::DN_SHORT:
- case self::DN_YOURSELF:
- default:
+ case self::DN_YOURSELF:
+ return 'display_name';
+ default:
return 'display_name';
}
}