Exemple #1
0
 public function __construct(User $_user, Profile $_profile, array $_public_names, array $_old_public_names)
 {
     parent::__construct($_user, $_profile, true, 'usage');
     $this->public_names = $_public_names;
     $this->old_public_names = $_old_public_names;
     if (!is_null($this->profileOwner)) {
         require_once 'name.func.inc.php';
         $this->new_alias = build_email_alias($this->public_names);
         $this->old_alias = XDB::fetchOneCell('SELECT  email
                                                 FROM  email_source_account
                                                WHERE  uid = {?} AND type = \'alias\' AND FIND_IN_SET(\'usage\', flags)', $this->profileOwner->id());
         if ($this->old_alias == $this->new_alias) {
             $this->old_alias = $this->new_alias = null;
         } else {
             $used = XDB::fetchOneCell('SELECT  COUNT(uid)
                                          FROM  email_source_account
                                         WHERE  email = {?} AND type != \'alias_aux\'', $this->new_alias);
             if (!$used) {
                 // Check against homonyms
                 $used = XDB::fetchOneCell('SELECT  COUNT(email)
                                              FROM  email_source_other
                                             WHERE  email = {?}', $this->new_alias);
             }
             if ($used) {
                 $this->new_alias = null;
             }
         }
     }
 }
Exemple #2
0
 public function __construct(User $_user, Profile $_profile, $_id, $_name, $_acronym, $_url, $_email, $_tel, $_fax, $_address, $_stamp = 0)
 {
     parent::__construct($_user, $_profile, false, 'entreprise', $_stamp);
     $this->id = $_id;
     $this->name = $_name;
     $this->acronym = $_acronym;
     $this->url = $_url;
     $this->email = $_email;
     $this->tel = $_tel;
     $this->fax = $_fax;
     $this->address = $_address;
     $_name = preg_replace('/[^0-9a-z]/i', ' ', strtolower(replace_accent($_name)));
     $name = explode(" ", $_name);
     $name_array = array_map("trim", $name);
     $length = count($name_array);
     $where = "";
     for ($i = 0; $i < $length; $i++) {
         if (strlen($name_array[$i]) > 2) {
             if ($where !== "") {
                 $where .= " OR ";
             }
             $where .= "name LIKE '%" . $name_array[$i] . "%'";
         }
     }
     if ($where != '') {
         $res = XDB::iterator('SELECT  name
                                 FROM  profile_job_enum
                                WHERE  ' . $where);
         $this->suggestions = "| ";
         while ($sug = $res->next()) {
             $this->suggestions .= $sug['name'] . " | ";
         }
     }
 }
Exemple #3
0
 public function __construct(User $_user, Profile $_profile, $_newGradYear)
 {
     parent::__construct($_user, $_profile, true, 'orange');
     $this->newGradYear = $_newGradYear;
     $res = XDB::query("SELECT  entry_year, grad_year\n                             FROM  profile_education\n                            WHERE  pid = {?} AND FIND_IN_SET('primary', flags)", $this->profile->id());
     $years = $res->fetchOneRow();
     $this->entryYear = $years[0];
     $this->oldGradYear = $years[1];
 }
Exemple #4
0
 public function __construct(User $_user, array $_address, $_pid, $_jobid, $_groupid, $_type, $_id, $_stamp = 0)
 {
     $_profile = Profile::get($_pid);
     parent::__construct($_user, $_profile, false, 'address', $_stamp);
     $this->key_pid = $_pid;
     $this->key_jobid = $_jobid;
     $this->key_groupid = $_groupid;
     $this->key_type = $_type;
     $this->key_id = $_id;
     $this->given_text = $_address['text'];
     $this->address = $_address;
 }
Exemple #5
0
 public function __construct(User $_user, Profile $_profile, $_idmedal, $_subidmedal, $_level, $has_levels, $_stamp = 0)
 {
     parent::__construct($_user, $_profile, false, 'medal', $_stamp);
     $this->mid = $_idmedal;
     $this->gid = $_subidmedal;
     $this->level = $_level;
     $this->has_levels = $has_levels;
     if (is_null($this->gid)) {
         $this->gid = 0;
     }
     if (!$this->has_levels) {
         $this->level = '';
     }
 }
Exemple #6
0
 public function __construct(User $_user, Profile $_profile, PlUpload $upload, $_stamp = 0)
 {
     parent::__construct($_user, $_profile, true, 'photo', $_stamp);
     $this->read($upload);
 }