move code up one directory
[atutor.git] / mods / _standard / social / lib / classes / Member.class.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2009                                                                              */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14
15 /**
16  * Members class for Social Networking
17  * TODO: Extend it for the entire ATutor.
18  */
19 class Member {
20         var $id;                //member id
21         var $profile;   //profile details
22
23         function Member($id){
24                 $this->id = intval($id);
25         }
26
27
28         /**
29          * Add a new job position
30          * @param       string          Name of the company, in full.
31          * @param       string          Title of this position
32          * @param       int                     Started date for this position, in the format of yyyymm
33          * @param       int                     Position ended on this date, in the format of yyyymm, or 'NOW'. 
34          *                                              'NOW' means it is still on going.
35          * @param       string          Description of what the position was about
36          */
37         function addPosition($company, $title, $from, $to, $description){
38                 global $addslashes, $db;
39                 $member_id      = $this->id;
40                 $company        = $addslashes($company);
41                 $title          = $addslashes($title);
42                 $from           = $addslashes($from);
43                 $to                     = $addslashes($to);
44                 $description = $addslashes($description);
45
46                 $sql = 'INSERT INTO '.TABLE_PREFIX."social_member_position (member_id, company, title, `from`, `to`, description) VALUES ($member_id, '$company', '$title', '$from', '$to', '$description')";
47                 mysql_query($sql, $db);
48         }
49
50         
51         /**
52          * Add a new education
53          * TODO: University names can be generated from another table.
54          * 
55          * @param       string          Name of the University, in full. Might need to pull from another table.
56          * @param       int                     This education begins on this date, yyyymm
57          * @param       int                     This education ends on this date, yyyymm, or can be 'NOW'
58          * @param       string          The full name of the country this University is in, ie. Canada
59          * @param       string          The full name of the province this University is in, ie. Ontario
60          * @param       string          The name of the degree, ie. B.Sc.
61          * @param       string          The field of study, ie. Computer Science
62          * @param       string          The description of this education.
63          */
64         function addEducation($university, $from, $to, $country, 
65                                                   $province, $degree, $field, $description){ 
66                 global $addslashes, $db;
67                 $member_id                      = $this->id;
68                 $university                     = $addslashes($university);
69                 $from                           = $addslashes($from);
70                 $to                                     = $addslashes($to);
71                 $country                        = $addslashes($country);
72                 $province                       = $addslashes($province);
73                 $degree                         = $addslashes($degree);
74                 $field                          = $addslashes($field);
75                 $description            = $addslashes($description);
76                 
77                 $sql = 'INSERT INTO '.TABLE_PREFIX."social_member_education (member_id, university, `from`, `to`, country, province, degree, field, description) VALUES ($member_id, '$university', '$from', '$to', '$country', '$province', '$degree', '$field', '$description')";
78                 mysql_query($sql, $db);
79         }
80
81
82         /**
83          * Add a new website associated with this member, can be blog, work, portfolio, etc.
84          * @param       string          Unique URL of the website
85          * @param       string          A name for the website.
86          */
87         function addWebsite($url, $site_name){ 
88                 global $addslashes, $db;
89                 $member_id      = $this->id;
90                 $url            = $addslashes($url);
91                 $site_name      = $addslashes($site_name);
92
93                 $sql = 'INSERT INTO '. TABLE_PREFIX ."social_member_websites (member_id, url, site_name) VALUES ($member_id, '$url', '$site_name')";
94                 mysql_query($sql, $db);
95         }
96
97
98         /** 
99          * Add new interest for this member, in CSV format
100          * @param       string          interest
101          */
102         function addInterests($interests){
103                 $this->updateAdditionalInformation($interests);
104         }
105
106
107         /** 
108          * Add new interest for this member, in CSV format
109          * @param       string          interest
110          */
111         function addAssociations($associations){
112                 $this->updateAdditionalInformation('', $associations);
113         }
114
115
116         /** 
117          * Add new interest for this member, in CSV format
118          * @param       string          interest
119          */
120         function addAwards($awards){
121                 $this->updateAdditionalInformation('', '', $awards);
122         }
123         /**
124          * Add a new representation
125          * Special field for LCA to add a represetnative or agent.
126          * 
127          * @param       string          The represetnative full name
128          * @param       string          The title of the representative
129          * @param       string          The represetnative's phone number
130          * @param       string          The representativ's email address
131          * @param       string          The representative's mailing address
132          */
133         function addRepresentation($rep_name, $rep_title, $rep_phone, $rep_email, $rep_address){ 
134                 global $addslashes, $db;
135                 $member_id                      = $this->id;
136                 $rep_name                       = $addslashes($rep_name);
137                 $rep_title                      = $addslashes($rep_title);
138                 $rep_phone                      = $addslashes($rep_phone);
139                 $rep_email                      = $addslashes($rep_email);
140                 $rep_address                    = $addslashes($rep_address);
141                 
142                 $sql = 'INSERT INTO '.TABLE_PREFIX."social_member_representation (member_id, rep_name, rep_title, rep_phone, rep_email, rep_address) VALUES ($member_id, '$rep_name', '$rep_title', '$rep_phone', '$rep_email', '$rep_address')";
143                 mysql_query($sql, $db);
144                 header('Location:edit_profile.php');
145                 exit;
146         }
147
148         /**
149          * Add a new contact person
150          * Special field for LCA to add a contact such as a parent or gaurdian.
151          * 
152          * @param       string          The contact full name
153          * @param       string          The contact's phone number
154          * @param       string          The contact's email address
155          * @param       string          The contact's mailing address
156          */
157
158         function addContact($con_name, $con_phone, $con_email, $con_address){ 
159                 global $addslashes, $db;
160                 $member_id                      = $this->id;
161                 $con_name                       = $addslashes($con_name);
162                 $con_phone                      = $addslashes($con_phone);
163                 $con_email                      = $addslashes($con_email);
164                 $con_address                    = $addslashes($con_address);
165                 
166                 $sql = 'INSERT INTO '.TABLE_PREFIX."social_member_contact (member_id, con_name, con_phone, con_email, con_address) VALUES ($member_id, '$con_name', '$con_phone', '$con_email', '$con_address')";
167                 mysql_query($sql, $db);
168                 header('Location:edit_profile.php');
169                 exit;
170         }
171         /**
172          * Add personal characteristics
173          * Special field for LCA to add a contact such as a parent or gaurdian.
174          * 
175          * @param       string          person's weight
176          * @param       string          person's height
177          * @param       string          person's hair colour
178          * @param       string          person's eye colour
179          * @param       string          person's ethnicity
180          * @param       string          person's languages spoken
181          * @param       string          person's disbailities
182          */
183
184         function addPersonal($per_weight, $per_height, $per_hair, $per_eyes, $per_ethnicity, $per_languages, $per_disabilities){ 
185                 global $addslashes, $db;
186                 $member_id                      = $this->id;
187                 $per_weight                     = $addslashes($per_weight);
188                 $per_height                     = $addslashes($per_height);
189                 $per_hair                       = $addslashes($per_hair);
190                 $per_eyes                       = $addslashes($per_eyes);
191                 $per_ethnicity                  = $addslashes($per_ethnicity);
192                 $per_languages                  = $addslashes($per_languages);
193                 $per_disabilities               = $addslashes($per_disabilities);
194
195                 $sql = 'INSERT INTO '.TABLE_PREFIX."social_member_personal (member_id, per_weight, per_height, per_hair, per_eyes, per_ethnicity, per_languages, per_disabilities) VALUES ($member_id, '$per_weight', '$per_height', '$per_hair', '$per_eyes','$per_ethnicity','$per_languages','$per_disabilities')";
196                 mysql_query($sql, $db);
197                 header('Location:edit_profile.php');
198                 exit;
199         }
200
201
202
203         /** 
204          * Add additional information, including interest, awards, associations.
205          * @param       string          CSV format of interests, ie. camping, biking, etc
206          * @param       string          CSV format of associations, clubs, groups, ie. IEEE
207          * @param       string          CSV format of awards, honors
208          * @param       string          expterise, occupation
209          * @param       string          any extra information
210          */
211         function addAdditionalInformation($interests, $associations, $awards, $expertise, $others){ 
212                 global $addslashes, $db;
213                 $member_id              = $this->id;
214                 $interests              = $addslashes($interests);
215                 $associations   = $addslashes($associations);
216                 $awards                 = $addslashes($awards);
217                 $expertise              = $addslashes($expertise);
218                 $others                 = $addslashes($others);
219                 $sql = 'INSERT INTO ' . TABLE_PREFIX . "social_member_additional_information (member_id, interests,  associations, awards, expertise, others) VALUES ($member_id, '$interests', '$associations', '$awards', '$expertise', '$others')";
220                 mysql_query($sql, $db);
221         }
222
223
224         /** 
225          * Add visitor
226          * @param       int             visitor id
227          */
228         function addVisitor($visitor_id){
229                 global $db;
230                 $visitor_id = intval($visitor_id);
231                 $sql = 'INSERT INTO '.TABLE_PREFIX."social_member_track (`member_id`, `visitor_id`, `timestamp`) VALUES (".$this->getID().", $visitor_id, NOW())";
232                 mysql_query($sql, $db);
233         }
234
235
236         /**
237          * Update a new job position
238          * @param       int                     The id of this entry
239          * @param       string          Name of the company, in full.
240          * @param       string          Tht title of this position
241          * @param       int                     Started date for this position, in the format of yyyymm
242          * @param       int                     Position ended on this date, in the format of yyyymm, or 'NOW'. 
243          *                                              'NOW' means it is still on going.
244          * @param       string          Description of the position
245          */
246         function updatePosition($id, $company, $title, $from, $to, $description){ 
247                 global $addslashes, $db;
248                 $id                      = intval($id);
249                 $company         = $addslashes($company);
250                 $title           = $addslashes($title);
251                 $form            = $addslashes($form);
252                 $to                      = $addslashes($to);
253                 $description = $addslashes($description);
254
255                 $sql = 'UPDATE '.TABLE_PREFIX."social_member_position SET company='$company', title='$title', `from`='$from', `to`='$to', description='$description' WHERE id=$id";
256                 mysql_query($sql, $db);
257         }
258
259
260         /**
261          * Update a new education
262          * TODO: University names can be generated from another table.
263          * 
264          * @param       int                     ID of this entry
265          * @param       string          Name of the University, in full. Might need to pull from another table.
266          * @param       int                     This education begins on this date, yyyymm
267          * @param       int                     This education ends on this date, yyyymm, or can be 'NOW'
268          * @param       string          The full name of the country this University is in, ie. Canada
269          * @param       string          The full name of the province this University is in, ie. Ontario
270          * @param       string          The name of the degree, ie. B.Sc.
271          * @param       string          The field of study, ie. Computer Science
272          * @param       string          The description of this education.
273          */
274         function updateEducation($id, $university, $from, $to, $country, $province, $degree, $field, $description){ 
275                 global $addslashes, $db;
276                 $id                                     = intval($id);
277                 $university                     = $addslashes($university);
278                 $from                           = $addslashes($from);
279                 $to                                     = $addslashes($to);
280                 $country                        = $addslashes($country);
281                 $province                       = $addslashes($province);
282                 $degree                         = $addslashes($degree);
283                 $field                          = $addslashes($field);
284                 $description            = $addslashes($description);
285
286                 $sql = 'UPDATE '.TABLE_PREFIX."social_member_education SET university='$university', `from`='$from', `to`='$to', country='$country', province='$province', degree='$degree', field='$field', description='$description' WHERE id=$id";
287                 mysql_query($sql, $db);         
288         }
289
290
291         /**
292          * Updates a new website associated with this member, can be blog, work, portfolio, etc.
293          * @param       int                     ID of this entry
294          * @param       string          Unique URL of the website
295          * @param       string          A name for the website.
296          */
297         function updateWebsite($id, $url, $site_name){ 
298                 global $addslashes, $db;
299                 $id                     = intval($id);
300                 $url            = $addslashes($url);
301                 $site_name      = $addslashes($site_name);
302
303                 $sql = 'UPDATE '.TABLE_PREFIX."social_member_websites SET url='$url', site_name='$site_name' WHERE id=$id";
304                 mysql_query($sql, $db);
305         }
306
307
308         /** 
309          * Update additional information, including interest, awards, associations.
310          * @param       string          CSV format of interests, ie. camping, biking, etc
311          * @param       string          CSV format of associations, clubs, groups, ie. IEEE
312          * @param       string          CSV format of awards, honors
313          * @param       string          expterise, occupation
314          * @param       string          any extra information
315          */
316         function updateAdditionalInformation($interests='', $associations='', $awards='', $expertise='', $others=''){ 
317                 global $addslashes, $db;
318                 $interests = $addslashes($interests);
319                 $associations = $addslashes($associations);
320                 $awards = $addslashes($awards);
321                 $expertise = $addslashes($expertise);
322                 $others = $addslashes($others);
323
324                 $sql = '';
325                 //tricky, not all fields get updated at once.  Update only the ones that has entries.
326                 if ($interests!=''){
327                         $sql .= "interests='$interests', ";
328                 }
329                 if ($associations!=''){
330                         $sql .= " associations='$associations', ";
331                 }
332                 if ($awards!=''){
333                         $sql .= "awards='$awards', ";
334                 }
335                 if ($expertise!=''){
336                         $sql .= "expertise='$expertise', ";
337                 }
338                 if ($others!=''){
339                         $sql .= "others='$others', ";           
340                 }
341                 if ($sql!=''){
342                         $sql = substr($sql, 0, -2);
343                 }
344
345                 $sql2 = 'INSERT INTO '.TABLE_PREFIX."social_member_additional_information SET ".$sql.", member_id=".$_SESSION['member_id'] . " ON DUPLICATE KEY UPDATE ".$sql;
346                 mysql_query($sql2, $db);
347         }
348         /**
349          * Edit representation
350          * Special field for LCA to add a represetnative or agent.
351          * 
352          * @param       string          The represetnative full name
353          * @param       string          The title of the representative
354          * @param       string          The represetnative's phone number
355          * @param       string          The representativ's email address
356          * @param       string          The representative's mailing address
357          */
358         function updateRepresentation($id, $rep_name, $rep_title, $rep_phone, $rep_email, $rep_address){ 
359                 global $addslashes, $db;
360                 $member_id                      = $this->id;
361                 $rep_name                       = $addslashes($rep_name);
362                 $rep_title                      = $addslashes($rep_title);
363                 $rep_phone                      = $addslashes($rep_phone);
364                 $rep_email                      = $addslashes($rep_email);
365                 $rep_address                    = $addslashes($rep_address);
366                 
367                 $sql = "UPDATE ".TABLE_PREFIX."social_member_representation SET rep_name='$rep_name', rep_title='$rep_title', rep_phone='$rep_phone', rep_email='$rep_email', rep_address='$rep_address' WHERE id='$id'";
368                 mysql_query($sql, $db);
369         }
370
371         /**
372          * Edit contact person
373          * Special field for LCA to add a contact such as a parent or gaurdian.
374          * 
375          * @param       string          The contact full name
376          * @param       string          The contact's phone number
377          * @param       string          The contact's email address
378          * @param       string          The contact's mailing address
379          */
380
381         function updateContact($con_name, $con_phone, $con_email, $con_address){ 
382                 global $addslashes, $db;
383                 $member_id                      = $this->id;
384                 $con_name                       = $addslashes($con_name);
385                 $con_phone                      = $addslashes($con_phone);
386                 $con_email                      = $addslashes($con_email);
387                 $con_address                    = $addslashes($con_address);
388                 
389                 $sql = "UPDATE ".TABLE_PREFIX."social_member_contact SET con_name='$con_name', con_phone='$con_phone', con_email='$con_email', con_address='con_address' WHERE id='$id'";
390                 mysql_query($sql, $db);
391         }
392
393         /**
394          * Update personal characteristics
395          * Special field for LCA to add a contact such as a parent or gaurdian.
396          * 
397          * @param       string          person's weight
398          * @param       string          person's height
399          * @param       string          person's hair colour
400          * @param       string          person's eye colour
401          * @param       string          person's ethnicity
402          * @param       string          person's languages spoken
403          * @param       string          person's disbailities
404          */
405
406         function updatePersonal($per_weight, $per_height, $per_hair, $per_eyes, $per_ethnicity, $per_languages, $per_disabilities){ 
407                 global $addslashes, $db;
408                 $member_id                      = $this->id;
409                 $per_weight                     = $addslashes($per_weight);
410                 $per_height                     = $addslashes($per_height);
411                 $per_hair                       = $addslashes($per_hair);
412                 $per_eyes                       = $addslashes($per_eyes);
413                 $per_ethnicity                  = $addslashes($per_ethnicity);
414                 $per_languages                  = $addslashes($per_languages);
415                 $per_disabilities               = $addslashes($per_disabilities);
416
417                 $sql = "UPDATE ".TABLE_PREFIX."social_member_personal SET per_weight = '$per_weight', per_height = '$per_height', per_hair = '$per_hair', per_eyes = '$per_eyes', per_ethnicity = '$per_ethnicity', per_languages = '$per_languages', per_disabilities = '$per_disabilities' WHERE member_id = '$member_id'";
418                 mysql_query($sql, $db);
419                 header('Location:edit_profile.php');
420                 exit;
421         }
422
423
424         /**
425          * Get member info
426          * This method tends to be have a negative impact on system run time.  
427          */
428         function getDetails(){
429                 global $db;
430                 $sql =  'SELECT core.*, T.interests, T.associations, T.awards, T.expertise, T.others FROM '.
431                                 '(SELECT * FROM '.TABLE_PREFIX.'members WHERE member_id='.$this->id.') AS core '.
432                                 'LEFT JOIN '.
433                                 TABLE_PREFIX.'social_member_additional_information T ON core.member_id=T.member_id';
434                 $result = mysql_query($sql, $db);
435                 if ($result){
436                         $row = mysql_fetch_assoc($result);
437                         $this->profile = $row;
438                 }
439                 return $this->profile;
440         }
441
442
443         /**
444          * Get member address
445          */
446         function getAddress(){
447                 global $db;
448                 $sql = 'SELECT address, postal, city, province, country FROM '.TABLE_PREFIX.'members WHERE member_id='.$this->id;
449                 $result = mysql_query($sql, $db);
450                 if ($result){
451                         $row = mysql_fetch_assoc($result);
452                 }
453                 return $row;
454         }
455         
456
457         /**
458          * Get position info
459          * @return      the array of job/position
460          */
461         function getPosition(){
462                 global $db;
463                 $position = array();
464
465                 $sql = 'SELECT * FROM '.TABLE_PREFIX.'social_member_position WHERE member_id='.$this->id;
466                 $result = mysql_query($sql, $db);
467                 if ($result){
468                         while($row = mysql_fetch_assoc($result)){
469                                 $position[] = $row;
470                         }
471                 }
472                 return $position;
473         }
474
475
476         /**
477          * Get education info
478          * can be 1+ 
479          * @return      the array of education details
480          */
481         function getEducation(){
482                 global $db;
483                 $education = array();
484
485                 $sql = 'SELECT * FROM '.TABLE_PREFIX.'social_member_education WHERE member_id='.$this->id;
486                 $result = mysql_query($sql, $db);
487                 if ($result){
488                         while($row = mysql_fetch_assoc($result)){
489                                 $education[] = $row;
490                         }
491                 }
492                 return $education;
493         }
494
495
496         /** 
497          * Get websites. can be 1+
498          * @return      the array of website details.
499          */
500         function getWebsites(){
501                 global $db;
502                 $websites = array();
503
504                 $sql = 'SELECT * FROM '.TABLE_PREFIX.'social_member_websites WHERE member_id='.$this->id;
505                 $result = mysql_query($sql, $db);
506                 if ($result){
507                         while($row = mysql_fetch_assoc($result)){
508                                 //escape XSS
509                                 $row['url'] = htmlentities_utf8($row['url']);
510                                 
511                                 //index row entry
512                                 $websites[] = $row;
513                         }
514                 }
515                 return $websites;
516         }
517
518
519         /**
520          * Get member's representative info 
521          * @return      the array of representative's details
522          */
523         function getRepresentation(){
524                 global $db;
525                 $representation = array();
526
527                 $sql = 'SELECT * FROM '.TABLE_PREFIX.'social_member_representation WHERE member_id='.$this->id;
528                 $result = mysql_query($sql, $db);
529                 if ($result){
530                         while($row = mysql_fetch_assoc($result)){
531                                 $representation[] = $row;
532                         }
533                 }
534                 return $representation;
535         }
536         /**
537          * Get member's alternate contact info 
538          * @return      the array of contact's details
539          */
540         function getContact(){
541                 global $db;
542                 $contact = array();
543
544                 $sql = 'SELECT * FROM '.TABLE_PREFIX.'social_member_contact WHERE member_id='.$this->id;
545                 $result = mysql_query($sql, $db);
546                 if ($result){
547                         while($row = mysql_fetch_assoc($result)){
548                                 $contact[] = $row;
549                         }
550                 }
551                 return $contact;
552         }
553
554         /**
555          * Get member's personal info 
556          * @return      the array of personal characteristics
557          */
558         function getPersonal(){
559                 global $db;
560                 $personal = array();
561
562                 $sql = 'SELECT * FROM '.TABLE_PREFIX.'social_member_personal WHERE member_id='.$this->id;
563
564
565                 $result = mysql_query($sql, $db);
566                 if ($result){
567                         $personal = mysql_fetch_assoc($result);
568                 }
569                 return $personal;
570
571         }
572
573         /**
574          * Get visitor counts within a month, the resultant array contains a daily, weekly, monthly, and a total count.
575          * @return      the count of all visitors on this page, within a month. 
576          */
577         function getVisitors(){
578                 global $db;
579                 $count = array('month'=>0, 'week'=>0, 'day'=>0, 'total'=>0);
580                 //Time offsets
581                 $month  = time() - 60*60*24*30; //month, within 30days.
582                 $week   = time() - 60*60*24*7;          //week, within 7 days.
583                 $day    = time() - 60*60*24;            //day, within 24 hours.
584
585                 $sql = 'SELECT visitor_id, UNIX_TIMESTAMP(timestamp) AS `current_time` FROM '.TABLE_PREFIX.'social_member_track WHERE member_id='.$this->id;
586                 $result = mysql_query($sql, $db);
587                 if ($result){
588                         while ($row = mysql_fetch_assoc($result)){
589                                 if($row['current_time'] >= $month && $row['current_time'] <= $week){
590                                         $count['month']++;
591                                 } elseif ($row['current_time'] > $week && $row['current_time'] <= $day){
592                                         $count['week']++;
593                                 } elseif ($row['current_time'] > $day){
594                                         $count['day']++;
595                                 } else {
596                                         continue;
597                                 }
598                                 $count['total']++;
599                         }
600                 }
601
602                 //clean up table randomly, 1%
603                 if (rand(1,100) == 1){
604                         $sql = 'DELETE FROM '.TABLE_PREFIX."social_member_track WHERE UNIX_TIMESTAMP(`timestamp`) < $month";
605                         mysql_query($sql, $db);
606                 }
607                 
608                 return $count;
609         }
610
611         
612         /**
613          * Delete position
614          * @param       int             position id
615          */
616         function deletePosition($id){
617                 global $db;
618
619                 $sql = 'DELETE FROM '.TABLE_PREFIX.'social_member_position WHERE id='.$id;
620                 $result = mysql_query($sql, $db);
621          }
622
623         
624         /**
625          * Delete education
626          * @param       int             education id
627          */
628         function deleteEducation($id){
629                 global $db;
630
631                 $sql = 'DELETE FROM '.TABLE_PREFIX.'social_member_education WHERE id='.$id;
632                 $result = mysql_query($sql, $db);
633         }
634
635         
636         /**
637          * Delete websites
638          * @param       int             websites id
639          */
640         function deleteWebsite($id){
641                 global $db;
642
643                 $sql = 'DELETE FROM '.TABLE_PREFIX.'social_member_websites WHERE id='.$id;
644                 $result = mysql_query($sql, $db);
645         }
646         
647
648         /**
649          * Delete interest
650          */
651         function deleteInterests(){
652                 global $db;
653
654                 $sql = 'UPDATE '.TABLE_PREFIX."social_member_additional_information SET interests='' WHERE member_id=".$this->getID();
655                 $result = mysql_query($sql, $db);
656         }
657
658
659         /**
660          * Delete associations
661          */
662         function deleteAssociations(){
663                 global $db;
664
665                 $sql = 'UPDATE '.TABLE_PREFIX."social_member_additional_information SET associations='' WHERE member_id=".$this->getID();
666                 $result = mysql_query($sql, $db);
667         }
668
669         
670         /**
671          * Delete awards
672          */
673         function deleteAwards(){
674                 global $db;
675
676                 $sql = 'UPDATE '.TABLE_PREFIX."social_member_additional_information SET awards='' WHERE member_id=".$this->getID();
677                 $result = mysql_query($sql, $db);
678         }
679
680         /**
681          * Delete representation
682          */
683         function deleteRepresentation($member_id){
684                 global $db;
685
686                 $sql = 'DELETE FROM '.TABLE_PREFIX.'social_member_representation WHERE member_id='.$this->getID();
687                 $result = mysql_query($sql, $db);
688
689         }
690         /**
691          * Delete contact
692          */
693         function deleteContact(){
694                 global $db;
695                 $sql = 'DELETE FROM '.TABLE_PREFIX.'social_member_contact WHERE member_id='.$this->getID();
696                 $result = mysql_query($sql, $db);
697         }
698
699         /**
700          * Delete personal information
701          */
702         function deletePersonal(){
703                 global $db;
704                 $sql = 'DELETE FROM '.TABLE_PREFIX.'social_member_personal WHERE member_id='.$this->getID();
705                 $result = mysql_query($sql, $db);
706         }
707
708
709         /**
710          * Get the ID of this member
711          */
712         function getID(){
713                 return $this->id;
714         }
715 }
716 ?>