00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Model.php';
00026
00027
00028
00029
00042
00043 class FF_Model_Advisor extends FF_Model {
00044
00045
00050 var $name;
00051
00056 var $phone;
00057
00062 var $email;
00063
00068 var $department;
00069
00074 var $degree1;
00075
00080 var $degree1Field;
00081
00086 var $degree2;
00087
00092 var $degree2Field;
00093
00098 var $degree3;
00099
00104 var $degree3Field;
00105
00110 var $lastUpdate;
00111
00116 var $availability = 1;
00117
00122 var $ADTAvailability = 0;
00123
00128 var $interest1;
00129
00134 var $interest2;
00135
00140 var $interest3;
00141
00146 var $bio;
00147
00152 var $keywords = array();
00153
00154
00155
00156
00165 function save($in_isUpdate)
00166 {
00167 if ($in_isUpdate) {
00168 return $this->o_dataAccess->update($this->exportToArray());
00169 }
00170 else {
00171 $this->setId(FF_Auth::getCredential('userId'));
00172 return $this->o_dataAccess->add($this->exportToArray());
00173 }
00174 }
00175
00176
00177
00178
00185 function reset()
00186 {
00187 $this->id = null;
00188 $this->name = null;
00189 $this->phone = null;
00190 $this->email = null;
00191 $this->department = null;
00192 $this->degree1 = null;
00193 $this->degree1Field = null;
00194 $this->degree2 = null;
00195 $this->degree2Field = null;
00196 $this->degree3 = null;
00197 $this->degree3Field = null;
00198 $this->lastUpdate = null;
00199 $this->availability = 1;
00200 $this->ADTAvailability = 0;
00201 $this->interest1 = null;
00202 $this->interest2 = null;
00203 $this->interest3 = null;
00204 $this->bio = null;
00205 $this->keywords = array();
00206 }
00207
00208
00209
00210
00219 function importFromArray($in_data)
00220 {
00221 $this->setId($in_data['id']);
00222 $this->setName($in_data['name']);
00223 $this->setPhone(@$in_data['phone']);
00224 $this->setEmail(@$in_data['email']);
00225 $this->setDepartment(@$in_data['department']);
00226 $this->setDegree1($in_data['degree1']);
00227 $this->setDegree1Field($in_data['degree1_field']);
00228 $this->setDegree2($in_data['degree2']);
00229 $this->setDegree2Field($in_data['degree2_field']);
00230 $this->setDegree3($in_data['degree3']);
00231 $this->setDegree3Field($in_data['degree3_field']);
00232 $this->setLastUpdate(@$in_data['last_update']);
00233 $this->setInterest1($in_data['interest1']);
00234 $this->setInterest2($in_data['interest2']);
00235 $this->setInterest3($in_data['interest3']);
00236 $this->setAvailability(@$in_data['availability']);
00237 $this->setADTAvailability(@$in_data['adt_availability']);
00238 $this->setBio(@$in_data['bio']);
00239 }
00240
00241
00242
00243
00252 function exportToArray()
00253 {
00254 $a_data = array();
00255 $a_data['id'] = $this->getId();
00256 $a_data['degree1'] = $this->getDegree1();
00257 $a_data['degree1_field'] = $this->getDegree1Field();
00258 $a_data['degree2'] = $this->getDegree2();
00259 $a_data['degree2_field'] = $this->getDegree2Field();
00260 $a_data['degree3'] = $this->getDegree3();
00261 $a_data['degree3_field'] = $this->getDegree3Field();
00262 $a_data['availability'] = $this->getAvailability();
00263 $a_data['adt_availability'] = $this->getADTAvailability();
00264 $a_data['interest1'] = $this->getInterest1();
00265 $a_data['interest2'] = $this->getInterest2();
00266 $a_data['interest3'] = $this->getInterest3();
00267 $a_data['bio'] = $this->getBio();
00268 $a_data['keywords'] = $this->getKeywords();
00269 return $a_data;
00270 }
00271
00272
00273
00274
00283 function doesAdvisorExist($in_userId)
00284 {
00285 return $this->o_dataAccess->doesAdvisorExist($in_userId);
00286 }
00287
00288
00289
00290
00291 function getName()
00292 {
00293 return $this->name;
00294 }
00295
00296
00297
00298
00299 function setName($in_value)
00300 {
00301 $this->name = $in_value;
00302 }
00303
00304
00305
00306
00307 function getPhone()
00308 {
00309 if (empty($this->phone)) {
00310 return;
00311 }
00312 elseif (strlen($this->phone) >= 10) {
00313 return preg_replace('/(\d{3})(\d{3})(\d{4})/', '\\1-\\2-\\3', $this->phone);
00314 }
00315 else {
00316 return preg_replace('/(\d{3})(\d{4})/', '\\1-\\2', $this->phone);
00317 }
00318 }
00319
00320
00321
00322
00323 function setPhone($in_value)
00324 {
00325 $this->phone = $in_value;
00326 }
00327
00328
00329
00330
00331 function getEmail()
00332 {
00333 return $this->email;
00334 }
00335
00336
00337
00338
00339 function setEmail($in_value)
00340 {
00341 $this->email = $in_value;
00342 }
00343
00344
00345
00346
00347 function getDepartment()
00348 {
00349 return $this->department;
00350 }
00351
00352
00353
00354
00355 function setDepartment($in_value)
00356 {
00357 $this->department = $in_value;
00358 }
00359
00360
00361
00362
00363 function getDegree1()
00364 {
00365 return $this->degree1;
00366 }
00367
00368
00369
00370
00371 function setDegree1($in_value)
00372 {
00373 $this->degree1 = $in_value;
00374 }
00375
00376
00377
00378
00379 function getDegree1Field()
00380 {
00381 return $this->degree1Field;
00382 }
00383
00384
00385
00386
00387 function setDegree1Field($in_value)
00388 {
00389 $this->degree1Field = $in_value;
00390 }
00391
00392
00393
00394
00395 function getDegree2()
00396 {
00397 return $this->degree2;
00398 }
00399
00400
00401
00402
00403 function setDegree2($in_value)
00404 {
00405 $this->degree2 = $in_value;
00406 }
00407
00408
00409
00410
00411 function getDegree2Field()
00412 {
00413 return $this->degree2Field;
00414 }
00415
00416
00417
00418
00419 function setDegree2Field($in_value)
00420 {
00421 $this->degree2Field = $in_value;
00422 }
00423
00424
00425
00426
00427 function getDegree3()
00428 {
00429 return $this->degree3;
00430 }
00431
00432
00433
00434
00435 function setDegree3($in_value)
00436 {
00437 $this->degree3 = $in_value;
00438 }
00439
00440
00441
00442
00443 function getDegree3Field()
00444 {
00445 return $this->degree3Field;
00446 }
00447
00448
00449
00450
00451 function setDegree3Field($in_value)
00452 {
00453 $this->degree3Field = $in_value;
00454 }
00455
00456
00457
00458
00459 function setLastUpdate($in_value)
00460 {
00461 $this->lastUpdate = $in_value;
00462 }
00463
00464
00465
00466
00467 function getLastUpdate()
00468 {
00469 return date('F jS, Y', $this->lastUpdate);
00470 }
00471
00472
00473
00474
00475 function getAvailability()
00476 {
00477 return $this->availability;
00478 }
00479
00480
00481
00482
00483 function setAvailability($in_value)
00484 {
00485 $this->availability = $in_value;
00486 }
00487
00488
00489
00490
00491 function getADTAvailability()
00492 {
00493 return $this->ADTAvailability;
00494 }
00495
00496
00497
00498
00499 function setADTAvailability($in_value)
00500 {
00501 $this->ADTAvailability = $in_value;
00502 }
00503
00504
00505
00506
00507 function getAllInterests()
00508 {
00509 $a_interests = array_filter(array($this->getInterest1(), $this->getInterest2(), $this->getInterest3()));
00510 foreach ($a_interests as $s_key => $s_interest) {
00511 $a_interests[$s_key] = preg_replace('/.*?\|/', '', $s_interest);
00512 }
00513
00514 return implode(', ', $a_interests);
00515 }
00516
00517
00518
00519
00520 function getInterest1()
00521 {
00522 return $this->interest1;
00523 }
00524
00525
00526
00527
00528 function setInterest1($in_value)
00529 {
00530 $this->interest1 = $in_value;
00531 }
00532
00533
00534
00535
00536 function getInterest2()
00537 {
00538 return $this->interest2;
00539 }
00540
00541
00542
00543
00544 function setInterest2($in_value)
00545 {
00546 $this->interest2 = $in_value;
00547 }
00548
00549
00550
00551
00552 function getInterest3()
00553 {
00554 return $this->interest3;
00555 }
00556
00557
00558
00559
00560 function setInterest3($in_value)
00561 {
00562 $this->interest3 = $in_value;
00563 }
00564
00565
00566
00567
00568 function getBio()
00569 {
00570 return $this->bio;
00571 }
00572
00573
00574
00575
00576 function setBio($in_value)
00577 {
00578 $this->bio = $in_value;
00579 }
00580
00581
00582
00583
00584 function getKeywords()
00585 {
00586 if (empty($this->keywords)) {
00587 $this->keywords = $this->o_dataAccess->getKeywords($this->getId());
00588 }
00589
00590 return $this->keywords;
00591 }
00592
00593
00594
00595
00596 function setKeywords($in_value)
00597 {
00598 $this->keywords = $in_value;
00599 }
00600
00601
00602
00603
00604 function setCountry($in_value)
00605 {
00606 $this->country = $in_value;
00607 }
00608
00609
00610
00611
00618 function _initDataAccess()
00619 {
00620 $this->o_dataAccess =& FF_DataAccess::factory('Advisor');
00621 }
00622
00623
00624 }
00625 ?>