Beispiel #1
0
 /**
  * Renders grid column
  *
  * @param Varien_Object $row
  * @return string
  */
 public function render(Varien_Object $row)
 {
     if ($data = $row->getData($this->getColumn()->getIndex())) {
         if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
             require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
             $time = strtotime($data);
             $data = pdate('Y-m-d H:i:s', $time);
         }
         switch ($this->getColumn()->getPeriodType()) {
             case 'month':
                 $dateFormat = 'yyyy-MM';
                 break;
             case 'year':
                 $dateFormat = 'yyyy';
                 break;
             default:
                 $dateFormat = Varien_Date::DATE_INTERNAL_FORMAT;
                 break;
         }
         $format = $this->_getFormat();
         try {
             $data = $this->getColumn()->getGmtoffset() ? Mage::app()->getLocale()->date($data, $dateFormat)->toString($format) : Mage::getSingleton('core/locale')->date($data, Zend_Date::ISO_8601, null, false)->toString($format);
         } catch (Exception $e) {
             $data = $this->getColumn()->getTimezone() ? Mage::app()->getLocale()->date($data, $dateFormat)->toString($format) : Mage::getSingleton('core/locale')->date($data, $dateFormat, null, false)->toString($format);
         }
         return $data;
     }
     return $this->getColumn()->getDefault();
 }
Beispiel #2
0
 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     if ($data = $row->getData($this->getColumn()->getIndex())) {
         if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
             require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
             $time = strtotime($data);
             $data = pdate('Y-m-d H:i:s', $time);
         }
         $format = $this->_getFormat();
         try {
             if ($this->getColumn()->getGmtoffset()) {
                 $data = Mage::app()->getLocale()->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
             } else {
                 $data = Mage::getSingleton('core/locale')->date($data, Zend_Date::ISO_8601, null, false)->toString($format);
             }
         } catch (Exception $e) {
             if ($this->getColumn()->getTimezone()) {
                 $data = Mage::app()->getLocale()->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
             } else {
                 $data = Mage::getSingleton('core/locale')->date($data, null, null, false)->toString($format);
             }
         }
         return $data;
     }
     return $this->getColumn()->getDefault();
 }
Beispiel #3
0
 /**
  * Renders grid column
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     if ($data = $this->_getValue($row)) {
         if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
             require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
             $time = strtotime($data);
             $data = pdate('Y-m-d H:i:s', $time);
         }
         $format = $this->_getFormat();
         try {
             $data = Mage::app()->getLocale()->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
         } catch (Exception $e) {
             $data = Mage::app()->getLocale()->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format);
         }
         return $data;
     }
     return $this->getColumn()->getDefault();
 }
Beispiel #4
0
 public function makeTime()
 {
     switch (Pi::config('date_calendar')) {
         // Set for Iran time
         case 'persian':
             require_once Pi::path('module') . '/event/src/Api/pdate.php';
             $thisMonth = pdate('m');
             $nextMonth = pdate('m') + 1;
             $nextTwoMonth = pdate('m') + 2;
             $nextThreeMonth = pdate('m') + 3;
             $nextFourMonth = pdate('m') + 4;
             $year = pdate('Y');
             if ($nextMonth > 12) {
                 $nextMonth = $nextMonth - 12;
                 $year = $year + 1;
             }
             if ($nextTwoMonth > 12) {
                 $nextTwoMonth = $nextTwoMonth - 12;
                 $year = $year + 1;
             }
             if ($nextThreeMonth > 12) {
                 $nextThreeMonth = $nextThreeMonth - 12;
                 $year = $year + 1;
             }
             if ($nextFourMonth > 12) {
                 $nextFourMonth = $nextFourMonth - 12;
                 $year = $year + 1;
             }
             $time = array('expired' => time(), 'thisWeek' => pmktime(0, 0, 0, pdate('m', strtotime("-1 Saturday")), pdate('d', strtotime("-1 Saturday")), pdate('Y', strtotime("-1 Saturday"))), 'nextWeek' => pmktime(0, 0, 0, pdate('m', strtotime("+1 Saturday")), pdate('d', strtotime("+1 Saturday")), pdate('Y', strtotime("+1 Saturday"))), 'nextTwoWeek' => pmktime(0, 0, 0, pdate('m', strtotime("+2 Saturday")), pdate('d', strtotime("+2 Saturday")), pdate('Y', strtotime("+2 Saturday"))), 'thisMonth' => pmktime(0, 0, 0, $thisMonth, 1, $year), 'nextMonth' => pmktime(0, 0, 0, $nextMonth, 1, $year), 'nextTwoMonth' => pmktime(0, 0, 0, $nextTwoMonth, 1, $year), 'nextThreeMonth' => pmktime(0, 0, 0, $nextThreeMonth, 1, $year), 'nextFourMonth' => pmktime(0, 0, 0, $nextFourMonth, 1, $year));
             break;
         default:
             $time = array('expired' => time(), 'thisWeek' => strtotime("-1 Monday"), 'nextWeek' => strtotime("+1 Monday"), 'nextTwoWeek' => strtotime("+2 Monday"), 'thisMonth' => strtotime('first day of this month'), 'nextMonth' => strtotime('first day of +1 month'), 'nextTwoMonth' => strtotime('first day of +2 month'), 'nextThreeMonth' => strtotime('first day of +3 month'), 'nextFourMonth' => strtotime('first day of +4 month'));
             break;
     }
     return $time;
 }
Beispiel #5
0
    // leng=35
    $string = '';
    for ($p = 0; $p < $length; $p++) {
        $string .= $characters[mt_rand(0, 35)];
    }
    //35 in leng
    return $string;
}
////////////////////
$reserve = strtoupper(getRandomString());
$availability = $book->availability;
$mobile = $_POST['mobile'] = '09358622156';
$address = $_POST['address'] = "ladan12";
$email = $_POST['email'] = "galiver_h";
$description = $_POST['description'] = "des";
$regdate = pdate("Y-m-d");
$currency = $transaction->currency;
$rooms = $_POST['number_rooms'];
/////////// check for inspect
if (isset($_POST['total_amount'])) {
    $amount = $_POST['total_amount'];
    $db->query("update tbl_transaction set amount={$amount} where voucher_id={$voucher_id} and type=8");
} else {
    $amount = $transaction->amount;
}
$transfer_currency = $transaction->transfer_currency;
if ($_POST['random'] == $_SESSION['random']) {
    $_SESSION['random'] = NULL;
    if ($availability == 1) {
        $status_transaction = 1;
    } elseif ($availability == 2) {
Beispiel #6
0
     //$db->debug();
     $flight = $db->get_row("select *,{$source_city},{$destination_city} from tbl_flight where id ={$tikcet_row->flight_id}");
     echo $flight->source_city . ' ' . $flight->destination_city . ' ' . _az_tarikhe . ' : <span dir="ltr">' . pdate("Y-m-d", $t2->rdate) . '</span> ' . _ta_tarikh . ' :<span dir="ltr">' . pdate("Y-m-d", $t2->bdate) . '</span> ' . _sh_p_raft . ' : ' . $tikcet_row->f_number1 . ' ' . _sh_p_bargasht . ' : ' . $tikcet_row->f_number2 . ' ';
     $hotel_name = "(SELECT `fa_hotel` FROM `htl_hotel` WHERE `hotel_id`=`id`)AS hotel_name";
     $h2 = $db->get_row("select *,{$hotel_name} from htl_book where voucher_id='{$voucher_id}'");
     echo 'هتل ' . $h2->hotel_name . ' ' . _conferm . ' : ' . $h2->hotel_id . '0' . $h2->confirm_num;
 }
 if ($row['type'] == '31') {
     $voucher_id = $row['voucher_id'];
     //$tour_name="(SELECT `name` FROM `tur_tour` WHERE `id`=`tour_id`)AS tour_name";
     $t2 = $db->get_row("select * from ntur_book where voucher_id='{$voucher_id}' ");
     $tikcet_row = $db->get_row("select flight_id,(select f_number from tbl_flight where id=flight_id)as f_number1,(select f_number from tbl_flight where id=bflight_id)as f_number2 from tbl_ticket where voucher_id='{$voucher_id}'");
     $source_city = "(SELECT `fa_name` FROM `tbl_city` WHERE `city_id`=`source`)AS source_city";
     $destination_city = "(SELECT `fa_name` FROM `tbl_city` WHERE `city_id`=`destination`)AS destination_city";
     $flight = $db->get_row("select *,{$source_city},{$destination_city} from tbl_flight where id ={$tikcet_row->flight_id}");
     echo $flight->source_city . ' ' . $flight->destination_city . ' ' . _az_tarikhe . ' : <span dir="ltr">' . pdate("Y-m-d", $t2->rdate) . '</span> ' . _ta_tarikh . ' :<span dir="ltr">' . pdate("Y-m-d", $t2->bdate) . '</span> ' . _sh_p_raft . ' : ' . $tikcet_row->f_number1 . ' ' . _sh_p_bargasht . ' : ' . $tikcet_row->f_number2 . ' ';
     $hotel_name = "(SELECT `fa_hotel` FROM `htl_hotel` WHERE `hotel_id`=`id`)AS hotel_name";
     $h2 = $db->get_row("select *,{$hotel_name} from htl_book where voucher_id='{$voucher_id}'");
     echo 'هتل ' . $h2->hotel_name . ' ' . _conferm . ' : ' . $h2->hotel_id . '0' . $h2->confirm_num;
     $v2 = $db->get_row("select * from tbl_transaction where voucher_id='{$voucher_id}' and id<>" . $row['id']);
     echo _factor . $v2->id;
 }
 if ($row['type'] == '20') {
 }
 if ($row['type'] == '21') {
 }
 ////////////////
 ////////////////
 if ($row['type'] == '40') {
     echo _shomare . ' :' . $newvoucher;
 }
Beispiel #7
0
 $Ticket .= _cd_6 - 2;
 $Ticket .= "</th>";
 $Ticket .= "<th>";
 $Ticket .= _cd_2 - 0;
 $Ticket .= "</th>";
 $Ticket .= "</tr></thead>\r\n   \t\t\t<tr>";
 $Ticket .= "<td style='width:30%;' align='center'>";
 if ($row_hotel['country_id'] == 1) {
     $Ticket .= pdate('Y-m-d', $row_book['rdate']);
 } else {
     $Ticket .= date('Y-m-d', $row_book['rdate']);
 }
 $Ticket .= "</td>";
 $Ticket .= "<td style='width:30%;' align='center'>";
 if ($row_hotel['country_id'] == 1) {
     $Ticket .= pdate('Y-m-d', $row_book['bdate']);
 } else {
     $Ticket .= date('Y-m-d', $row_book['bdate']);
 }
 $Ticket .= "</td>";
 $Ticket .= "<td align='center'>";
 $diff_seconds = $row_book['bdate'] - $row_book['rdate'];
 $diff_days = ceil($diff_seconds / 86400);
 $Ticket .= $diff_days;
 $Ticket .= "</td>";
 $child0 = $row_book['child' . $room_num][0];
 $child2 = $row_book['child' . $room_num][1];
 $child12 = $row_book['child' . $room_num][2];
 $Ticket .= "<td align='center'>";
 $Ticket .= $row_book['adult' . $room_num] + $row_book['exadult' . $room_num];
 $Ticket .= "</td>";
Beispiel #8
0
function pgetdate($timestamp = "")
{
    if ($timestamp === "") {
        $timestamp = mktime();
    }
    list($seconds, $minutes, $hours, $mday, $wday, $mon, $year, $yday, $weekday, $month) = explode("-", pdate("s-i-G-j-w-n-Y-z-l-F", $timestamp));
    return array(0 => $timestamp, "seconds" => $seconds, "minutes" => $minutes, "hours" => $hours, "mday" => $mday, "wday" => $wday, "mon" => $mon, "year" => $year, "yday" => $yday, "weekday" => $weekday, "month" => $month);
}
Beispiel #9
0
 /**
  * Set Fieldset to Form
  *
  * @param array $attributes attributes that are to be added
  * @param Varien_Data_Form_Element_Fieldset $fieldset
  * @param array $exclude attributes that should be skipped
  */
 protected function _setFieldset($attributes, $fieldset, $exclude = array())
 {
     $this->_addElementTypes($fieldset);
     foreach ($attributes as $attribute) {
         /* @var $attribute Mage_Eav_Model_Entity_Attribute */
         if (!$attribute || $attribute->hasIsVisible() && !$attribute->getIsVisible()) {
             continue;
         }
         if (($inputType = $attribute->getFrontend()->getInputType()) && !in_array($attribute->getAttributeCode(), $exclude) && 'media_image' != $inputType) {
             $fieldType = $inputType;
             $rendererClass = $attribute->getFrontend()->getInputRendererClass();
             if (!empty($rendererClass)) {
                 $fieldType = $inputType . '_' . $attribute->getAttributeCode();
                 $fieldset->addType($fieldType, $rendererClass);
             }
             if ($fieldType == 'date') {
                 if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
                     require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
                     $code = $attribute->getAttributeCode();
                     if (Mage::registry('product') != null) {
                         $object = Mage::registry('product');
                     } elseif (Mage::registry('category') != null) {
                         $object = Mage::registry('category');
                     }
                     if (isset($object)) {
                         $data = $object->getData($code);
                         if ($data != NULL) {
                             $time = strtotime($data);
                             $data = pdate('Y-m-d H:i:s', $time);
                             $object->setData($code, $data);
                         }
                     }
                 }
             }
             $element = $fieldset->addField($attribute->getAttributeCode(), $fieldType, array('name' => $attribute->getAttributeCode(), 'label' => $attribute->getFrontend()->getLabel(), 'class' => $attribute->getFrontend()->getClass(), 'required' => $attribute->getIsRequired(), 'note' => $attribute->getNote()))->setEntityAttribute($attribute);
             $element->setAfterElementHtml($this->_getAdditionalElementHtml($element));
             if ($inputType == 'select') {
                 $element->setValues($attribute->getSource()->getAllOptions(true, true));
             } else {
                 if ($inputType == 'multiselect') {
                     $element->setValues($attribute->getSource()->getAllOptions(false, true));
                 } else {
                     if ($inputType == 'date') {
                         $element->setImage($this->getSkinUrl('images/grid-cal.gif'));
                         if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
                             $dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
                         } else {
                             $dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
                         }
                         $element->setFormat($dateFormat);
                     } else {
                         if ($inputType == 'multiline') {
                             $element->setLineCount($attribute->getMultilineCount());
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #10
0
</td>
						</tr>
						<tr>
							<td height="40px"><?php 
echo __MTR_07 . $row['kanter_name'];
?>
</td>
							<td></td>
							<td><?php 
echo __Agency . ':' . $row['customer_name'];
?>
</td>
						</tr>
						<tr>
							<td colspan="3" height="40px" dir="ltr"><?php 
echo 'DESCRIPTION : ' . '<br>' . $row2['source_country'] . "  " . $row2['source_city'] . ' hotel ' . $row2['en_hotel'] . __MTR_20 . "<span dir=ltr>" . pdate("Y-m-d", $row['regdate']) . "</span><br>";
if ($bflight_id) {
    echo '' . $row5['source_city'] . "  " . $row5['destination_city'] . __bargasht . $row5['f_number'] . "&nbsp&nbsp&nbsp" . __MTI_02 . "<span dir=ltr>" . $row5['date'] . "</span><br>";
}
while ($row3 = mysql_fetch_array($result3)) {
    echo $row3['name'] . "&nbsp;" . $row3['family'] . "_";
}
echo __MTR_11 . $row['reserve'] . __MTR_22 . $row['voucher_id'];
if ($row4['description']) {
    echo '<br>' . $row4['description'];
}
?>
                            
                            </td>
						</tr>
						<tr>
Beispiel #11
0
function pgetdate($timestamp = NULL)
{
    if (!$timestamp) {
        $timestamp = mktime();
    }
    list($seconds, $minutes, $hours, $mday, $wday, $mon, $year, $yday, $weekday, $month) = explode('-', pdate('s-i-G-j-w-n-Y-z-l-F', $timestamp));
    return array(0 => $timestamp, 'seconds' => $seconds, 'minutes' => $minutes, 'hours' => $hours, 'mday' => $mday, 'wday' => $wday, 'mon' => $mon, 'year' => $year, 'yday' => $yday, 'weekday' => $weekday, 'month' => $month);
}
Beispiel #12
0
 /**
  * Format date using current locale options
  *
  * @param   date|Zend_Date|null $date in GMT timezone
  * @param   string $format
  * @param   bool $showTime
  * @return  string
  */
 public function formatDate($date = null, $format = 'short', $showTime = false)
 {
     if (Mage_Core_Model_Locale::FORMAT_TYPE_FULL !== $format && Mage_Core_Model_Locale::FORMAT_TYPE_LONG !== $format && Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM !== $format && Mage_Core_Model_Locale::FORMAT_TYPE_SHORT !== $format) {
         return $date;
     }
     if (!$date instanceof Zend_Date && $date && !strtotime($date)) {
         return '';
     }
     if (is_null($date)) {
         $date = Mage::app()->getLocale()->date(Mage::getSingleton('core/date')->gmtTimestamp(), null, null);
     } elseif (!$date instanceof Zend_Date) {
         $date = Mage::app()->getLocale()->date(strtotime($date), null, null, $showTime);
     }
     if ($showTime) {
         $format = Mage::app()->getLocale()->getDateTimeFormat($format);
     } else {
         $format = Mage::app()->getLocale()->getDateFormat($format);
     }
     if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
         require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
         $time = strtotime($date);
         $pdate = pdate('Y-m-d H:i:s', $time);
         $date = new Zend_Date($pdate, null, 'fa_IR');
     }
     return $date->toString($format);
 }