Advertisement
Guest User

racallot_model

a guest
Jul 13th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. <?php
  2.  
  3. class Racallot_model extends Model {
  4.  
  5.  
  6. function match_cat($rl, $rs, $vl, $vs)
  7. {
  8.  
  9. $this->load->library('rac_category');
  10. $rac_cat = $this->rac_category->vac_get_cat('rac_status', $rl, $rs);
  11. $vac_cat = $this->rac_category->vac_get_cat('vac_status', $vl, $vs);
  12.  
  13. if($vac_cat == 'cat1')
  14. {
  15.  
  16. $test = 'SA'; //seat can be alloted
  17. return $test;
  18. }
  19.  
  20. if($vac_cat == 'cat2')
  21. {
  22. if($rac_cat == 'cat1')
  23. {
  24. $test = 'SNA V2 R1'; //seat NOT alloted
  25. }
  26. if($rac_cat == 'cat2')
  27. {
  28. $test = 'CD'; //check only destination
  29. }
  30. if($rac_cat == 'cat3')
  31. {
  32. $test = 'CSD V2 R3'; //check souce and destination
  33. }
  34. if($rac_cat == 'cat4')
  35. {
  36. $test = 'SNA V2 R4'; //seat NOT alloted
  37. }
  38. return $test;
  39. }
  40. if($vac_cat == 'cat3')
  41. {
  42. if($rac_cat == 'cat1')
  43. {
  44. $test = 'SNA V3 R1'; //seat NOT alloted
  45. }
  46. if($rac_cat == 'cat2')
  47. {
  48. $test = 'CD'; //check only destination
  49. }
  50. if($rac_cat == 'cat3')
  51. {
  52. $test = 'CSD V3 R3'; //check souce and destination
  53. }
  54. if($rac_cat == 'cat4')
  55. {
  56. $test = 'SNA V3 R4'; //seat NOT alloted
  57. }
  58. return $test;
  59. }
  60. if($vac_cat == 'cat4')
  61. {
  62. if($rac_cat == 'cat1')
  63. {
  64. $test = 'SNA V4 R1'; //seat NOT alloted
  65. }
  66. if($rac_cat == 'cat2')
  67. {
  68. $test = 'SNA V4 R2'; //seat NOT alloted
  69. }
  70. if($rac_cat == 'cat3')
  71. {
  72. $test = 'CSD V4 R3'; //check souce and destination
  73. }
  74. if($rac_cat == 'cat4')
  75. {
  76. $test = 'CS V4 R4'; //check only source
  77. }
  78. return $test;
  79. }
  80.  
  81.  
  82. }
  83.  
  84.  
  85.  
  86.  
  87. //////////////////another function of this model is...///////////
  88. function readDb($table, $rl1)
  89. {
  90.  
  91. $q = $this->db->get($table, 1, $rl1);
  92. //$q = $this->db->query('SELECT * FROM $table LIMIT "$rl1" , 1');
  93. $row = $q->row_array();
  94.  
  95.  
  96. $berth_no = $row['berth_no'];
  97. $from_station = $row['from_station'];
  98. $to_station = $row['to_station'];
  99. $status = $row['status'];
  100. $array = array('berth_no' => '$berth_no', 'from_station' => '$from_station', 'to_station' => '$to_station', 'status' => '$status');
  101.  
  102. return $berth_no;
  103.  
  104. }
  105.  
  106.  
  107.  
  108. function getDb($table, $rl1)
  109. {
  110.  
  111. $q = $this->db->get($table, 1, $rl1);
  112. //$q = $this->db->query('SELECT * FROM $table LIMIT "$rl1" , 1');
  113. $row = $q->row_array();
  114.  
  115.  
  116. $berth_no = $row['berth_no'];
  117. $from_station = $row['from_station'];
  118. $to_station = $row['to_station'];
  119. $status = $row['status'];
  120. $array = array('berth_no' => $berth_no, 'from_station' => $from_station, 'to_station' => $to_station, 'status' => $status);
  121.  
  122. return $array;
  123.  
  124. }
  125.  
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement