Esempio n. 1
0
function load_tickets($user, $pass, $sanad_record_ids)
{
    $tmp_arr = array();
    $my = new mysql_class();
    $u = new user_class();
    $u->loadByUser($user);
    $customer_id = $u->customer_id;
    $my->ex_sql("select * from ticket where customer_id={$customer_id} and  sanad_record_id in ({$sanad_record_ids})", $q);
    foreach ($q as $r) {
        $tick = new ticket_class();
        //$tick->id = (int)$r['id'];
        unset($tick->sanad_record_id);
        $tick->fname = $r["fname"];
        $tick->lname = $r["lname"];
        $tick->tel = $r["tel"];
        $tick->adult = (int) $r["adult"];
        $tick->rahgiri = (int) $r["sanad_record_id"];
        $tick->parvaz_det_id = (int) $r["parvaz_det_id"];
        $tick->customer_id = (int) $r["customer_id"];
        $tick->user_id = (int) $r["user_id"];
        $tick->shomare = (int) $r["shomare"];
        $tick->typ = (int) $r["typ"];
        $tick->en = (int) $r["en"];
        $tick->regtime = $r["regtime"];
        $tick->mablagh = (int) $r["mablagh"];
        $tick->tour_mablagh = (int) $r["tour_mablagh"];
        $tick->poorsant = (int) $r["poorsant"];
        $tick->gender = (int) $r["gender"];
        $tmp_arr[] = $tick;
    }
    $out = xml_class::export($tmp_arr);
    return $out;
}
Esempio n. 2
0
 public function export($arr)
 {
     $out = '<root>' . "\n";
     foreach ($arr as $key => $val) {
         $out .= '<row>' . "\n" . xml_class::export_small(array($key => $val)) . '</row>' . "\n";
     }
     $out .= '</root>' . "\n";
     return $out;
 }
Esempio n. 3
0
function city($user, $pass)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $my = new mysql_class();
        $my->ex_sql("select * from shahr order by name", $q);
        $out = xml_class::export($q);
    }
    return $out;
}
Esempio n. 4
0
function sherkat($user, $pass)
{
    $tmp_arr = array();
    $my = new mysql_class();
    $my->ex_sql("select * from sherkat order by name", $q);
    foreach ($q as $r) {
        $tmp_arr[] = array('id' => $r['id'], 'name' => $r['name']);
    }
    $out = xml_class::export($tmp_arr);
    return $out;
}
Esempio n. 5
0
function dabel($user, $enc_pass, $id)
{
    $id = (int) $id;
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $my = new mysql_class();
        $my->ex_sql("select jid from parvaz_jid where parvaz_det_id = {$id}", $q);
        $out = xml_class::export($q);
    }
    return $out;
}
Esempio n. 6
0
function search($user, $enc_pass, $st_date, $en_date, $st_city_id, $en_city_id, $load_go_return, $load_both_ways, $load_phone)
{
    $out = "auth_error";
    if (user_class::is_authonticated($enc_pass, $user)) {
        $fieldsArray = array('parvaz_det.id', 'ghimat', 'zarfiat', 'mabda_id', 'maghsad_id', 'shomare', 'havapiema_id', 'sherkat_id', 'tarikh', 'saat', 'saat_kh', 'j_id');
        $fields = implode(',', $fieldsArray);
        $whereClause = '';
        $leftJoin = FALSE;
        $hasOr = (int) trim($load_both_ways) == 1 || trim($load_both_ways) == '';
        if (trim($st_date) != '' && strtotime(trim($st_date)) > strtotime(date("Y-m-d"))) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) >= \'' . date("Y-m-d", strtotime($st_date)) . '\'';
        } else {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) >= \'' . date("Y-m-d") . '\'';
        }
        if (trim($en_date) != '') {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . '  date(tarikh) <= \'' . date("Y-m-d", strtotime($en_date)) . '\'';
        }
        if ((int) trim($st_city_id) > 0) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . ($hasOr ? '((' : '') . '  mabda_id = ' . trim($st_city_id) . ' ' . ($hasOr && (int) trim($en_city_id) <= 0 ? ') or (' : '');
            $leftJoin = TRUE;
        }
        if ((int) trim($en_city_id) > 0) {
            $whereClause .= ($whereClause == '' ? '' : ' and ') . ($hasOr && (int) trim($st_city_id) <= 0 ? '((' : '') . '  maghsad_id = ' . trim($en_city_id) . ' ' . ($hasOr ? ') or (' : '');
            $leftJoin = TRUE;
        }
        if ($hasOr) {
            if ((int) trim($st_city_id) > 0) {
                $whereClause .= '  maghsad_id = ' . trim($st_city_id) . ' ' . ($hasOr && (int) trim($en_city_id) <= 0 ? '))' : '');
            }
            if ((int) trim($en_city_id) > 0) {
                $whereClause .= ($whereClause != '' && (int) trim($st_city_id) > 0 ? ' and ' : '') . '  mabda_id = ' . trim($en_city_id) . ' ' . ($hasOr ? '))' : '');
            }
        }
        $whereClause = ' where ' . $whereClause;
        $searchQuery = "select {$fields} from parvaz_det left join parvaz on (parvaz.id=parvaz_id)  {$whereClause}";
        $my = new mysql_class();
        $my->ex_sql($searchQuery, $q);
        /*
        			foreach($q as $in=>$r)
        			{
        				$r['jid'] = (int)trim($r['jid']);
        				$q[$in] = $r;
        			}
        			//$out = $q;
        */
        $out = xml_class::export($q);
        //$searchQuery
    }
    //return($searchQuery);
    return $out;
}
Esempio n. 7
0
function havapeima($user, $pass)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $my = new mysql_class();
        $my->ex_sql("select * from havapeima order by name", $q);
        foreach ($q as $r) {
            $tmp_arr[] = array('id' => $r['id'], 'name' => $r['name']);
        }
        $out = xml_class::export($tmp_arr);
    }
    return $out;
}
Esempio n. 8
0
function flight($user, $pass, $flight_id)
{
    $out = 'auth_error';
    if (user_class::is_authonticated($pass, $user)) {
        $tmp_arr = array();
        $fieldsArray = array('parvaz_det.id', 'ghimat', 'zarfiat', 'mabda_id', 'maghsad_id', 'shomare', 'havapiema_id', 'sherkat_id', 'tarikh', 'saat', 'saat_kh', 'j_id');
        $my = new mysql_class();
        $feildStr = '';
        foreach ($fieldsArray as $i => $str) {
            $feildStr .= ($feildStr == '' ? '' : ',') . $str;
        }
        $my->ex_sql("select {$feildStr} from parvaz_det left join parvaz on (parvaz_det.parvaz_id=parvaz.id) where parvaz_det.id={$flight_id}  order by tarikh", $q);
        //foreach($q as $r)
        $out = xml_class::export($q);
    }
    return $out;
}
Esempio n. 9
0
 public function load_reserve_tmp_times_by_ids($reserve_tmp_ids)
 {
     $out = array();
     if ($reserve_tmp_ids != '') {
         $qu = '';
         $tmp = explode(',', $reserve_tmp_ids);
         foreach ($tmp as $id) {
             if ((int) $id > 0) {
                 $qu .= ($qu == '' ? '' : ',') . $id;
             }
         }
         if ($qu != '') {
             $mysql = new mysql_class();
             $mysql->ex_sql("select tarikh,id from reserve_tmp where id in ({$qu})", $q);
             foreach ($q as $r) {
                 $d1 = strtotime(date("Y-m-d H:i:s"));
                 $d2 = strtotime($r['tarikh']);
                 $out[] = array('id' => $r['id'], 'tarikh' => $d1 - $d2);
             }
         }
     }
     return xml_class::export($out);
 }