MX Calendar Bi-Weekly Events hack

MX Calendar Bi-Weekly Events hack

MX Calendar Bi-Weekly Events hack
divider

Edit the following file

/includes/cal/CAL_ViewBase.class.php

Change Line 223 from

if ($fn_RECURRING !== NULL && in_array(strtoupper($rs->Fields($fn_RECURRING)),array('DAY','WEEK','MONTH','YEAR')) ) {

to this

if ($fn_RECURRING !== NULL && in_array(strtoupper($rs->Fields($fn_RECURRING)),array('DAY','WEEK','BIWEEK','MONTH','YEAR')) ) {

Add this code snippet before line 338

Line 338:

case 'MONTH':
// Code for Bi-Weekly Events
case 'BIWEEK': $tmp_bi_week_day = CAL_extract('w',$startDate);
tmp_bi_week_day2 = CAL_extract('w',$this->startDate);
$tmp_bi_week_day -= ($tmp_bi_week_day2-7);
$cDate = CAL_addDate($this->startDate, $tmp_bi_week_day, 'd');
$cDate = CAL_extract('Y-m-d', $cDate) . ' ' . CAL_extract('H:i:s',$startDate);
$arrDates = array();
while ($cDate <= $end) {
     if ($cDate>=$startDate && $cDate >= $this->startDate && $cDate <= $this->endDate) {$arrDates[] = $cDate;
     $cDate = CAL_addDate($cDate, 14, 'd');}
// Create events array;
$t_title = $rs->Fields($fn_TITLE);
$t_desc = "";
$t_link = "";
    if ($this->calendar->type == 'view') {
   if ($fn_DESCRIPTION != null) {
   $t_desc = KT_FormatForList($rs->Fields($fn_DESCRIPTION),255);}
  $t_link = KT_DynamicData($this->calendar->getEventLink(), '', '', false, array(), false);
if ($this->calendar->sendKTBack) {
  $t_link = KT_addReplaceParam($t_link, 'KT_back', 1);} else
  {foreach($_GET as $key => $value) {
  $t_link = CAL_glueQueryStrings($t_link, $key . '=' . $value);
  //$t_link = KT_addReplaceParam($t_link, $key, $value);}}
$tmp_hour = CAL_extract('H',$endDate);
$tmp_minute = CAL_extract('i',$endDate);
for ($i=0;$i<count($arrDates);$i++) {
   $tmp_sdate = $arrDates[$i];
   $cDate = CAL_extract('Y-m-d',$tmp_sdate) . ' 00:00:00';
   $tmp_edate = CAL_addDate($cDate, 60*$tmp_hour+$tmp_minute, 'i');
   if ($tmp_edate <= $tmp_sdate) {
   $tmp_edate = CAL_addDate($tmp_sdate, 1, 'H');}
  if ($this->calendar->type == 'view') {
  $t_link = KT_addReplaceParam($t_link, $this->calendar->dateParam, KT_convertDate($cDate, 'yyyy-mm-dd HH:ii:ss', $GLOBALS['KT_db_date_format']));
  $tmp_arr = array('start' => $tmp_sdate, 'end' => $tmp_edate, 'title' => $t_title, 'desc' => $t_desc, 'link' => $t_link, 'class' => $specificClass);
  $this->data['body'][$cDate]['event'][] = $tmp_arr;
  break;
  // End Code for Bi-Weekly Events
Written by:  - 8 Apr, 2010