Changeset 73
- Timestamp:
- 08/22/08 10:23:22 (2 years ago)
- Files:
-
- branches/1.0/lib/model/PluginsfGuardUser.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/model/PluginsfGuardUser.php
r23 r73 43 43 { 44 44 $age = null; 45 45 46 if ($this->getBirthdate()) 46 47 { 47 $age = date("Y") - (int) $this->getBirthdate('Y'); 48 $month_diff = date("m") - (int) $this->getBirthdate('m'); 49 $day_diff = date("d") - (int) $this->getBirthdate('d'); 50 $age -= $day_diff < 0 || $month_diff < 0 ? 1 : 0; 51 } 48 $age = date("Y") - (int) $this->getBirthdate('Y'); 49 $month = (int) $this->getBirthdate('m'); 50 $day = (int) $this->getBirthdate('d'); 51 52 if (date("m") < $month || (date("m") == $month && date("d") < $day)) 53 { 54 --$age; 55 } 56 } 57 52 58 return $age; 53 59 } 54 60 55 61 /** 56 62 * Check if user allow to be contacted. If he published a job offer in its own … … 63 69 { 64 70 $allow = parent::getAllowContact(); 65 71 66 72 if ($check_jobs && $this->countJobs(new Criteria) > 0) 67 73 { 68 74 $allow = true; 69 75 } 70 76 71 77 return $allow; 72 78 }
