Я пытаюсь отключить дату в зависимости от выходных дней, используя этот синтаксис, но вместо этого я получаю дату, когда все отключены.
function GetHariLibur(){
$tanggal = date('Y');
$sql = ("select DATE_FORMAT(TANGGAL, '%d-%m-%Y') as TANGGAL from m_hari_libur where TANGGAL like '" . $tanggal . "%'");
$rows = $this->db->Execute($sql)->GetRows();
return $rows;
}
"m_hari_libur - это таблица, содержащая список отпускные дни », а« Танггал - пример даты 01-02-2020 »
это еще одна функция, которая называется« GetHariLibur »
function jurnal_harian_form() {
setlocale(LC_ALL,"US");
echo "<h3 id='title'>Jurnal Harian :: Daftar SKP :: Form Jurnal Harian</h3>";
$_GET['nip'] = ($_SESSION['NIP']);
$data_profil_pegawai = $this->jurnal_mdl->get_data_statistik_Jabatan();
$harilibur = $this->jurnal_mdl->GetHariLibur();
$currentYear = date("Y");
$month = strftime("%B");
$min = date('Y-m-d', strtotime("$month $currentYear +5 days"));
$now = date('Y-m-d');
$r =0;
for ($i=1; $i < 6 ; $i++) {
$gg = date('Y-m-d',strtotime("$i $month $currentYear"));
$issun = date('w',strtotime("$gg"));
if ($issun == '6' || $issun == '0') {
$min = date('Y-m-d', strtotime("$min +1 days"));
$r++;
}
}
$hasilmin = '';
$hasilmax = '';
if($now >= $min){
$hasilmin = date('Y-m-d', strtotime("first day of $month $currentYear"));
if ($r == 1) {
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +1 month +6 days"));
} elseif($r == 2) {
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +1 month +7 days"));
}else{
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +1 month +5 days"));
}
}else if($now == $min){
$hasilmin = date('Y-m-d', strtotime("first day of $month $currentYear -1 month"));
if ($r == 1) {
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +5 days"));
} elseif($r == 2) {
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +6 days"));
}else{
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +4 days"));
}
}else{
$hasilmin = date('Y-m-d', strtotime("first day of $month $currentYear -1 month"));
if ($r == 1) {
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +5 days"));
} elseif($r == 2) {
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +6 days"));
}else{
$hasilmax = date('Y-m-d', strtotime("$month $currentYear +4 days"));
}
}
$data = array(
"html_store" => $this->get_store_form_tambah_jurnal(),
"pegawai" => $data_profil_pegawai,
"harilibur" => $harilibur,
"minvalue" => $hasilmin,
"maxvalue" => $hasilmax
);
$this->load->view('jurnal/grid_jurnal_harian2', $data);
}
Ниже представлено представление с именем grid_jurnal_harian2. php это представление предназначено для отключения даты с помощью ext- js
items: [{
xtype: 'datefield',
name: 'TANGGAL',
fieldLabel: 'Tanggal',
value: tanggal,
disabledDays : [0,6],
disabledDates: '<?php echo $harilibur ?>',
// disabledDates: ["01-01-2020", "25-01-2020", "22-03-2020", "25-03-2020", "10-04-2020", "01-05-2020", "07-05-2020", "21-05-2020", "22-05-2020", "24-05-2020", "25-05-2020", "26-05-2020", "27-05-2020", "01-06-2020", "31-07-2020", "17-08-2020", "20-08-2020", "29-11-2020", "25-12-2020"],
maxValue: '<?php echo $maxvalue; ?>',
minValue: '<?php echo $minvalue; ?>',
format: 'd-m-Y',
submitFormat: 'Y-m-d',
allowBlank: false,
anchor: '50%',
handler: function() {
}
},