hi urgent question about callback calendar ?
Posted: Fri Sep 22, 2023 12:24 pm
hi i want add more month to calendar callbacks more 12 months on agent side.
is there anyone can help me on the javascript code.
for exemple i want do a callback for april 2025 or 2026 how can i do it ?
is there anyone can help me on the javascript code.
for exemple i want do a callback for april 2025 or 2026 how can i do it ?
- Code: Select all
################################################################
### BEGIN - build the callback calendar (12 months) ###
################################################################
define ('ADAY', (60*60*24));
$CdayARY = getdate();
$Cmon = $CdayARY['mon'];
$Cyear = $CdayARY['year'];
$CTODAY = date("Y-m");
$CTODAYmday = date("j");
$CINC=0;
$live_days=0;
$limit_days=999;
if ($callback_days_limit > 0)
{$limit_days=$callback_days_limit;}
$cb_display_days=999;
if ($callback_display_days > 0)
{$cb_display_days=$callback_display_days;}
# gather any holidays associated with the Local Call Time that is set for this campaign
$ct_holidays='';
$ct_holiday_dates='|';
$ct_holiday_dateARY=array();
$ct_holiday_nameARY=array();
$stmt = "SELECT ct_holidays FROM vicidial_call_times where call_time_id='$local_call_time';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01097',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$ct_conf_ct = mysqli_num_rows($rslt);
if ($ct_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$ct_holidays = $row[0];
$ct_holidays = preg_replace("/^\||\|$/","','",$ct_holidays);
$ct_holidays = preg_replace("/\|/","','",$ct_holidays);
$ct_holidays = "'$ct_holidays'";
}
if (strlen($ct_holidays) > 2)
{
$stmt = "SELECT holiday_date,holiday_name FROM vicidial_call_time_holidays where holiday_id IN($ct_holidays) and holiday_status='ACTIVE';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01098',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$hd_conf_ct = mysqli_num_rows($rslt);
if ($DB) {echo "$hd_conf_ct|$stmt\n";}
$hd_ct=0;
while ($hd_conf_ct > $hd_ct)
{
$row=mysqli_fetch_row($rslt);
$ct_holiday_dates .= "$row[0]|";
$ct_holiday_dateARY[$hd_ct]=$row[0];
$ct_holiday_nameARY[$hd_ct]=$row[1];
$hd_ct++;
}
echo "<!-- ACTIVE HOLIDAYS: $ct_holiday_dates -->\n";
}
$Cmonths = Array('0',_QXZ('January'),_QXZ('February'),_QXZ('March'),_QXZ('April'),_QXZ('May'),_QXZ('June'),_QXZ('July'),_QXZ('August'),_QXZ('September'),_QXZ('October'),_QXZ('November'),_QXZ('December'));
$Cdays = Array(_QXZ('Sun'),_QXZ('Mon'),_QXZ('Tue'),_QXZ('Wed'),_QXZ('Thu'),_QXZ('Fri'),_QXZ('Sat'));
$CCAL_OUT = '';
$CCAL_OUT .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">";
while ($CINC < 12)
{
if ( ($CINC == 0) || ($CINC == 4) ||($CINC == 8) )
{$CCAL_OUT .= "<tr>";}
$CCAL_OUT .= "<td valign=\"top\">";
$CYyear = $Cyear;
$Cmonth= ($Cmon + $CINC);
if ($Cmonth > 12)
{
$Cmonth = ($Cmonth - 12);
$CYyear++;
}
$Cstart= mktime(11,0,0,$Cmonth,1,$CYyear);
$CfirstdayARY = getdate($Cstart);
#echo "|$Cmon|$Cmonth|$CINC|\n";
$CPRNTDAY = date("Y-m", $Cstart);
$hDAYcheck = date("Y-m-d", $Cstart);
$temp_Cmonths = $Cmonths[$CfirstdayARY['mon']];
$temp_Cfirstday = $CfirstdayARY['year'];
$future_color='#ffffff';
$holiday_bg='';
$CCAL_OUT .= "<table border=\"1\" cellpadding=\"1\" bordercolor=\"000000\" cellspacing=\"0\" bgcolor=\"white\">";
$CCAL_OUT .= "<tr>";
$CCAL_OUT .= "<td colspan=\"7\" bordercolor=\"#ffffff\" bgcolor=\"#FFFFCC\">";
$CCAL_OUT .= "<div align=\"center\"><font color=\"#000066\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">";
$CCAL_OUT .= _QXZ($temp_Cmonths)." $temp_Cfirstday";
$CCAL_OUT .= "</font></b></font></div>";
$CCAL_OUT .= "</td>";
$CCAL_OUT .= "</tr>";
foreach($Cdays as $Cday)
{
$CDCLR="#ffffff";
$CCAL_OUT .= "<td bordercolor=\"$CDCLR\" $holiday_bg>";
$CCAL_OUT .= "<div align=\"center\"><font color=\"#000066\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">";
$CCAL_OUT .= _QXZ("$Cday", 3);
$CCAL_OUT .= "</font></b></font></div>";
$CCAL_OUT .= "</td>";
}
for( $Ccount=0;$Ccount<(6*7);$Ccount++)
{
$Cdayarray = getdate($Cstart);
if((($Ccount) % 7) == 0)
{
if($Cdayarray['mon'] != $CfirstdayARY['mon'])
break;
$CCAL_OUT .= "</tr><tr>";
}
if($Ccount < $CfirstdayARY['wday'] || $Cdayarray['mon'] != $Cmonth)
{
$CCAL_OUT .= "<td bordercolor=\"$future_color\" $holiday_bg><font color=\"#000066\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\"> </font></b></font></td>";
}
else
{
if( ($Cdayarray['mday'] == $CTODAYmday) and ($CPRNTDAY == $CTODAY) )
{
$CPRNTmday = $Cdayarray['mday'];
if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";}
if ($limit_days > $live_days)
{
$CB_date_onclick="onclick=\"CB_date_pick('$CPRNTDAY-$CPRNTmday');return false;\"";
$CBL = "<a href=\"#\" $CB_date_onclick>";
$CEL = "</a>";
}
else
{$CBL=''; $CEL=''; $CB_date_onclick='';}
$CCAL_OUT .= "<td bgcolor=\"#FFCCCC\" bordercolor=\"#FFCCCC\" $CB_date_onclick>";
$CCAL_OUT .= "<div align=\"center\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">";
$CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL";
$CCAL_OUT .= "</font></div>";
$CCAL_OUT .= "</td>";
$Cstart += ADAY;
$live_days++;
}
else
{
$holiday_hover='';
$CDCLR="#ffffff";
if ( ($Cdayarray['mday'] < $CTODAYmday) and ($CPRNTDAY == $CTODAY) )
{
$CDCLR="$MAIN_COLOR";
$CBL = '';
$CEL = '';
$CB_date_onclick='';
}
else
{
$CPRNTmday = $Cdayarray['mday'];
if ($CPRNTmday < 10) {$CPRNTmday = "0$CPRNTmday";}
if (preg_match("/\|$CPRNTDAY-$CPRNTmday\|/",$ct_holiday_dates))
{
$hd_loop=0;
while ($hd_loop < $hd_ct)
{
if ($ct_holiday_dateARY[$hd_loop] == "$CPRNTDAY-$CPRNTmday")
{
$holiday_hover="onMouseOver=\"holiday_display('$ct_holiday_nameARY[$hd_loop]');\"; onMouseOut=\"hideDiv('HolidayDisplayDiv');\"";
}
$CDCLR="#FFCC66";
$hd_loop++;
}
}
if ($limit_days > $live_days)
{
$CB_date_onclick="onclick=\"CB_date_pick('$CPRNTDAY-$CPRNTmday');return false;\"";
$CBL = "<a href=\"#\" $CB_date_onclick>";
$CEL = "</a>";
}
else
{$CBL=''; $CEL=''; $CB_date_onclick='';}
$live_days++;
}
$CCAL_OUT .= "<td bgcolor=\"$CDCLR\" bordercolor=\"$future_color\" $CB_date_onclick $holiday_hover>";
$CCAL_OUT .= "<div align=\"center\"><font face=\"Arial, Helvetica, sans-serif\" size=1>";
$CCAL_OUT .= "$CBL$Cdayarray[mday]$CEL";
$CCAL_OUT .= "</font></div>";
$CCAL_OUT .= "</td>";
$Cstart += ADAY;
}
}
}
$CCAL_OUT .= "</tr>";
$CCAL_OUT .= "</table>";
$CCAL_OUT .= "</td>";
if ( ($CINC == 3) || ($CINC == 7) ||($CINC == 11) )
{$CCAL_OUT .= "</tr>";}
$CINC++;
}
$CCAL_OUT .= "</table>";
#echo "$CCAL_OUT\n";
################################################################
### END - build the callback calendar (12 months) ###
################################################################