Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Racallot_model extends Model {
- function match_cat($rl, $rs, $vl, $vs)
- {
- $this->load->library('rac_category');
- $rac_cat = $this->rac_category->vac_get_cat('rac_status', $rl, $rs);
- $vac_cat = $this->rac_category->vac_get_cat('vac_status', $vl, $vs);
- if($vac_cat == 'cat1')
- {
- $test = 'SA'; //seat can be alloted
- return $test;
- }
- if($vac_cat == 'cat2')
- {
- if($rac_cat == 'cat1')
- {
- $test = 'SNA V2 R1'; //seat NOT alloted
- }
- if($rac_cat == 'cat2')
- {
- $test = 'CD'; //check only destination
- }
- if($rac_cat == 'cat3')
- {
- $test = 'CSD V2 R3'; //check souce and destination
- }
- if($rac_cat == 'cat4')
- {
- $test = 'SNA V2 R4'; //seat NOT alloted
- }
- return $test;
- }
- if($vac_cat == 'cat3')
- {
- if($rac_cat == 'cat1')
- {
- $test = 'SNA V3 R1'; //seat NOT alloted
- }
- if($rac_cat == 'cat2')
- {
- $test = 'CD'; //check only destination
- }
- if($rac_cat == 'cat3')
- {
- $test = 'CSD V3 R3'; //check souce and destination
- }
- if($rac_cat == 'cat4')
- {
- $test = 'SNA V3 R4'; //seat NOT alloted
- }
- return $test;
- }
- if($vac_cat == 'cat4')
- {
- if($rac_cat == 'cat1')
- {
- $test = 'SNA V4 R1'; //seat NOT alloted
- }
- if($rac_cat == 'cat2')
- {
- $test = 'SNA V4 R2'; //seat NOT alloted
- }
- if($rac_cat == 'cat3')
- {
- $test = 'CSD V4 R3'; //check souce and destination
- }
- if($rac_cat == 'cat4')
- {
- $test = 'CS V4 R4'; //check only source
- }
- return $test;
- }
- }
- //////////////////another function of this model is...///////////
- function readDb($table, $rl1)
- {
- $q = $this->db->get($table, 1, $rl1);
- //$q = $this->db->query('SELECT * FROM $table LIMIT "$rl1" , 1');
- $row = $q->row_array();
- $berth_no = $row['berth_no'];
- $from_station = $row['from_station'];
- $to_station = $row['to_station'];
- $status = $row['status'];
- $array = array('berth_no' => '$berth_no', 'from_station' => '$from_station', 'to_station' => '$to_station', 'status' => '$status');
- return $berth_no;
- }
- function getDb($table, $rl1)
- {
- $q = $this->db->get($table, 1, $rl1);
- //$q = $this->db->query('SELECT * FROM $table LIMIT "$rl1" , 1');
- $row = $q->row_array();
- $berth_no = $row['berth_no'];
- $from_station = $row['from_station'];
- $to_station = $row['to_station'];
- $status = $row['status'];
- $array = array('berth_no' => $berth_no, 'from_station' => $from_station, 'to_station' => $to_station, 'status' => $status);
- return $array;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement