/** * jDateTime::Constructor * * Pass these parameteres when creating a new instance * of this Class, and they will be used as defaults. * e.g $obj = new jDateTime(false, true, 'Asia/Tehran'); * To use system defaults pass null for each one or just * create the object without any parameters. * * @author Sallar Kaboli * @param $convert bool Converts numbers to Farsi * @param $jalali bool Converts date to Jalali * @param $timezone string Timezone string */ public function __construct($convert = null, $jalali = null, $timezone = null) { if ($jalali !== null) { self::$jalali = (bool) $jalali; } if ($convert !== null) { self::$convert = (bool) $convert; } if ($timezone !== null) { self::$timezone = $timezone; } }
public function loadHeader($titles, $subTitle) { $miladiCurrentYear = date('Y'); $miladiCurrentMonth = date('m'); $miladiCurrentDay = date('d'); $currentShamsiDate = Jdate_time::toJalali($miladiCurrentYear, $miladiCurrentMonth, $miladiCurrentDay); $currentShamsiDate = implode('/', $currentShamsiDate); $data['currentDate'] = $currentShamsiDate; $data['currentClock'] = date('H:i'); $data['dayName'] = Jdate_time::getDayNames(date('D')); $data['dayTime'] = Jdate_time::date('A'); $data['title'] = $titles['title']; $data['child_title'] = $titles['child_title']; $data['code'] = $titles['code']; $data['subTitle'] = $subTitle; $this->load->view('template/header', $data); }
public function getFlightStatusReport($start = 0) { $jdateTime = new Jdate_time(); $joinTable = ["ticket", "reserve_tmp", "flight_reserve"]; $onField = ["refrence.id", "refrence.id", "flight_reserve.tflight"]; $joinOnField = ["ticket.refrence_id", "reserve_tmp.refrence_id", "reserve_tmp.tflight"]; $selectField = ["`refrence`.`id`", "`refrence`.`total`", "`refrence`.`status`", "`ticket`.`fname`", "`ticket`.`lname`", "`reserve_tmp`.`flight_id`", "`voucher_id`", "`adl`", "`chd`", "`inf`", "`flight_reserve`.`flight_number`", "`flight_reserve`.`tflight`", "`flight_reserve`.`to_city`", "`flight_reserve`.`from_city`", "`fdate`", "`ftime`", "`ltime`"]; //$res = $this->db_extra->selectWithJoin('refrence', $joinTable, $onField, $joinOnField, 'ticket.refrence_id', $selectField, '', 0, 'type', 1); $accountId = $this->session->userdata['admin']['id']; $customerId = $this->session->userdata['admin']['customer_id']; $query = "SELECT `refrence`.`id` , `refrence`.`status` , `refrence`.`total`,\r\n `ticket`.`fname` , `ticket`.`lname` , `flight_reserve`.`flight_number` , \r\n `voucher_id` , `adl` , `chd` , `inf` , `flight_reserve`.`tflight` , \r\n `flight_reserve`.`to_city` , `flight_reserve`.`from_city` , `fdate` , `ftime` , `ltime` \r\n FROM `refrence` \r\n LEFT JOIN `ticket` ON refrence.id = ticket.refrence_id\r\n AND TYPE =1 and `refrence`.`user_id` in ( select id from user where customer_id={$customerId} )\r\n JOIN `reserve_tmp` ON refrence.id = reserve_tmp.refrence_id\r\n LEFT JOIN `flight_reserve` ON flight_reserve.tflight = reserve_tmp.tflight\r\n group by ticket.refrence_id\r\n ORDER BY `refrence`.`id` DESC limit {$start},10"; $res = $this->db->query($query); $data = $res->result_array(); $result = []; $return = ""; foreach ($data as $info) { $fDate = []; //$info['fdate']='2016-01-12'; if (strpos($info['fdate'], '-') !== false) { $fDate = explode('-', $info['fdate']); $fDate = $jdateTime->toJalali($fDate[0], $fDate[1], $fDate[2]); $fDate = implode('/', $fDate); $fDate .= $info['ftime']; } else { $fDate = $info['fdate']; } $passengerNumber = intval($info['adl'] + intval($info['chd'] + intval($info['inf']))); $result[] = ['refrenceId' => $info['id'], 'passengerNumber' => $passengerNumber, 'path' => $info['from_city'] . '-' . $info['to_city'], 'fDate' => $fDate, 'total' => $info['total'], 'voucher' => $info['voucher_id'], 'name' => $info['fname'] . ' ' . $info['lname'], 'flight_number' => $info['flight_number'], 'ltime' => $info['ltime'], 'statusCode' => $info['status'], 'status' => $this->getStatusText($info['status']), 'statusClass' => $this->getStatusClass($info['status'])]; } $this->db->close(); return $result; }