ProfessionsTablePeer.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. class ProfessionsTablePeer extends BaseProfessionsTablePeer
  3. {
  4. /* returns fields required for the registration of given status */
  5. static public function getAddingFields($id)
  6. {
  7. if (in_array($id, self::studentreaderField()))
  8. return array('student_card','reader_card','error'=>'You must give either student or reader card.');
  9. elseif (in_array($id, self::readerField()))
  10. return array('reader_card','error'=>'You must give reader card.');
  11. elseif (in_array($id, self::readerpassportField()))
  12. return array('reader_card','passport','error'=>'You must give either passport or reader card.');
  13. elseif (in_array($id, self::passportField()))
  14. return array('passport','error'=>'You must give passport.');
  15. else return array('error'=>'no such status');
  16. }
  17. //bachelor(0), master(1) => either student or reader card
  18. static public function studentreaderField()
  19. {
  20. return array('0','1');
  21. }
  22. //candidate(2), preparatory school(6) => reader card
  23. static public function readerField()
  24. {
  25. return array('2','6');
  26. }
  27. //teacher(3), employee(4) => either reader card or passport
  28. static public function readerpassportField()
  29. {
  30. return array('3','4');
  31. }
  32. //graduate(5), sponsor(7) => passport
  33. static public function passportField()
  34. {
  35. return array('5','7');
  36. }
  37. }