I'm trying to make a recurrence record of dates for an event, I have this calendar: link
I wanted to be able to click on each date, preferably from the one who is creating the event, since it would select multiple dates, to make a recurrence, and this recurrence be registered in the database, I need to be saved, the day / month / year, I even tried to put Checkbox, but when it starts for jQuery, I can not make the array work.
I ask everyone to help me solve my problem!
Codes:
<?php
function num($num){
return ($num < 10) ? '0'.$num : $num;
}
function diasMeses(){
$retorno = array();
for($i = 1; $i<=12;$i++){
$retorno[$i] = cal_days_in_month(CAL_GREGORIAN, $i, date('Y'));
}
return $retorno;
}
function montaCalendario(){
$daysWeek = array(
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat'
);
$diasSemana = array(
'Dom',
'Seg',
'Ter',
'Qua',
'Qui',
'Sex',
'Sab'
);
$arrayMes = array(
1 => 'Janeiro',
2 => 'Fevereiro',
3 => 'Março',
4 => 'Abril',
5 => 'Maio',
6 => 'Junho',
7 => 'Julho',
8 => 'Agosto',
9 => 'Setembro',
10 => 'Outubro',
11 => 'Novembro',
12 => 'Dezembro'
);
$diasMeses = diasMeses();
$arrayRetorno = array();
for($i =1; $i <= 12; $i++){
$arrayRetorno[$i] = array();
for($n=1; $n<= $diasMeses[$i]; $n++){
$dayMonth = gregoriantojd($i, $n, date('Y'));
$weekMonth = substr(jddayofweek($dayMonth, 1),0,3);
if($weekMonth == 'Mun') $weekMonth = 'Mon';
$arrayRetorno[$i][$n] = $weekMonth;
}
}
echo '<a href="#" id="volta"><i class="fa fa-angle-double-left"></i></a><a href="#" id="vai"><i class="fa fa-angle-double-right"></i></a>';
echo '<table border="0" width="100%">';
foreach($arrayMes as $num => $mes){
echo '<tbody id="mes_'.$num.'" class="mes">';
echo '<tr class="mes_title">
<td colspan="7"><strong>'.$mes.'</strong></td></tr>';
echo '<tr class="dias_title">';
foreach($diasSemana as $i => $day){
echo '<td><strong>'.$day.'</strong></td>';
}
echo '</tr><tr>';
$y = 0;
foreach($arrayRetorno[$num] as $numero => $dia){
$y++;
if($numero == 1){
$qtd = array_search($dia, $daysWeek);
for($i=1; $i<=$qtd; $i++){
echo '<td></td>';
$y+=1;
}
}
$month = num($num);
echo '<td class="dia_'.$numero.'">
<strong>'.$numero.'</strong></td>';
if($y == 7){
$y=0;
echo '</tr><tr>';
}
}
echo '</tr></tbody>';
}
echo '</table>';
}
? >
Someone?