function AlternativeBuildMonthSelect($view, $link, $month, $year)
 {
     for ($a = -6; $a < 6; $a++) {
         $m = $month + $a;
         $y = $year;
         if ($m <= 0) {
             $m += 12;
             $y -= 1;
         }
         if ($m > 12) {
             $m -= 12;
             $y += 1;
         }
         $name_of_month = JEVHelper::getMonthName($m) . " {$y}";
         $monthslist[] = JHTML::_('select.option', "{$m}|{$y}", $name_of_month);
     }
     $link = str_replace(array("day.listevents", "week.listevents", "year.listevents", "cat.listevents", "icalrepeat.detail", "icalevent.detail"), "month.calendar", $link);
     $tosend = "<script type='text/javascript'>\n";
     $tosend .= "/* <![CDATA[ */\n";
     $tosend .= " function selectMD(elem) {\n        var ym = elem.options[elem.selectedIndex].value.split('|');\n";
     $link .= "day=1&month=MMMMmmmm&year=YYYYyyyy";
     $link2 = JRoute::_($link, false);
     $tosend .= "var link = '{$link2}';\n";
     // This is needed in case SEF is not activated
     $tosend .= "link = link.replace(/&/g,'&');\n";
     $tosend .= "link = link.replace(/MMMMmmmm/g,ym[0]);\n";
     $tosend .= "link = link.replace(/YYYYyyyy/g,ym[1]);\n";
     $tosend .= "location.replace(link);\n";
     $tosend .= "}\n";
     $tosend .= "/* ]]> */\n";
     $tosend .= "</script>\n";
     $tosend .= JHTML::_('select.genericlist', $monthslist, 'monthyear', "onchange=\"selectMD(this);\"", 'value', 'text', "{$month}|{$year}");
     $this->result = $tosend;
 }
Exemplo n.º 2
0
 public static function buildMonthSelect($month, $args)
 {
     for ($a = 1; $a < 13; $a++) {
         $mnh = $a;
         if ($mnh <= '9') {
             $mnh = '0' . $mnh;
         }
         $name_of_month = JEVHelper::getMonthName($mnh);
         $monthslist[] = JHTML::_('select.option', $mnh, $name_of_month);
     }
     $tosend = JHTML::_('select.genericlist', $monthslist, 'month', $args, 'value', 'text', $month);
     echo $tosend;
 }
Exemplo n.º 3
0
 function _displayCalendarMod($time, $startday, $linkString, $day_name, $monthMustHaveEvent = false, $basedate = false)
 {
     $db =& JFactory::getDBO();
     $cfg =& JEVConfig::getInstance();
     $option = JEV_COM_COMPONENT;
     $cal_year = date("Y", $time);
     $cal_month = date("m", $time);
     // do not use $cal_day since it's not reliable due to month offset calculation
     //$cal_day=date("d",$time);
     if (!$basedate) {
         $basedate = $time;
     }
     $base_year = date("Y", $basedate);
     $base_month = date("m", $basedate);
     $basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
     $requestYear = JRequest::getInt("year", 0);
     $requestMonth = JRequest::getInt("month", 0);
     // special case when site link set the dates for the mini-calendar in the URL but not in the ajax request
     if ($requestMonth && $requestYear && JRequest::getString("task", "") != "modcal.ajax" && $this->modparams->get("minical_usedate", 0)) {
         $requestDay = JRequest::getInt("day", 1);
         $requestTime = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
         if ($time - $basedate > 100000) {
             $requestTime = JevDate::strtotime("+1 month", $requestTime);
         } else {
             if ($time - $basedate < -100000) {
                 $requestTime = JevDate::strtotime("-1 month", $requestTime);
             }
         }
         $cal_year = date("Y", $requestTime);
         $cal_month = date("m", $requestTime);
         $base_year = $requestYear;
         $base_month = $requestMonth;
         $basefirst_of_month = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
     } else {
         if ($requestYear && $requestMonth) {
             $cal_year = $requestYear;
             $cal_month = $requestMonth;
         } else {
             $cal_year = date("Y", $time);
             $cal_month = date("m", $time);
         }
     }
     $reg =& JFactory::getConfig();
     $reg->setValue("jev.modparams", $this->modparams);
     $data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, true, $this->modparams->get("noeventcheck", 0));
     $reg->setValue("jev.modparams", false);
     $month_name = JEVHelper::getMonthName($cal_month);
     $first_of_month = JevDate::mktime(0, 0, 0, $cal_month, 1, $cal_year);
     //$today = JevDate::mktime(0,0,0,$cal_month, $cal_day, $cal_year);
     $today = JevDate::strtotime(date('Y-m-d', $this->timeWithOffset));
     $content = '';
     if ($this->minical_showlink) {
         $content .= "\n" . '<table cellpadding="0" cellspacing="0" align="center" class="mod_events_monthyear" >' . "\n" . '<tr >' . "\n";
         if ($this->minical_showlink == 1) {
             if ($this->minical_prevyear) {
                 $content .= $this->monthYearNavigation($basefirst_of_month, "-1 year", '&laquo;', JText::_('JEV_CLICK_TOSWITCH_PY'));
             }
             if ($this->minical_prevmonth) {
                 $content .= $this->monthYearNavigation($basefirst_of_month, "-1 month", '&lt;', JText::_('JEV_CLICK_TOSWITCH_PM'));
             }
             if ($this->minical_actmonth == 1) {
                 // combination of actual month and year: view month
                 $seflinkActMonth = JRoute::_($this->linkpref . 'month.calendar&month=' . $cal_month . '&year=' . $cal_year);
                 $content .= '<td align="center">';
                 $content .= $this->htmlLinkCloaking($seflinkActMonth, $month_name, array('class' => "mod_events_link", 'title' => JText::_('JEV_CLICK_TOSWITCH_MON'))) . " ";
                 if ($this->minical_actyear < 1) {
                     $content .= '</td>';
                 }
             } elseif ($this->minical_actmonth == 2) {
                 $content .= '<td align="center">';
                 $content .= $month_name . "\n";
                 if ($this->minical_actyear < 1) {
                     $content .= '</td>';
                 }
             }
             if ($this->minical_actyear == 1) {
                 // combination of actual month and year: view year
                 $seflinkActYear = JRoute::_($this->linkpref . 'year.listevents' . '&month=' . $cal_month . '&year=' . $cal_year);
                 if ($this->minical_actmonth < 1) {
                     $content .= '<td align="center">';
                 }
                 $content .= $this->htmlLinkCloaking($seflinkActYear, $cal_year, array('class' => "mod_events_link", 'title' => JText::_('JEV_CLICK_TOSWITCH_YEAR'))) . " ";
                 $content .= '</td>';
             } elseif ($this->minical_actyear == 2) {
                 if ($this->minical_actmonth < 1) {
                     $content .= '<td align="center">';
                 }
                 $content .= $cal_year . "\n";
                 $content .= '</td>';
             }
             if ($this->minical_nextmonth) {
                 $content .= $this->monthYearNavigation($basefirst_of_month, "+1 month", '&gt;', JText::_('JEV_CLICK_TOSWITCH_NM'));
             }
             if ($this->minical_nextyear) {
                 $content .= $this->monthYearNavigation($basefirst_of_month, "+1 year", '&raquo;', JText::_('JEV_CLICK_TOSWITCH_NY'));
             }
             // combination of actual month and year: view year & month [ mic: not used here ]
             // $seflinkActYM   = JRoute::_( $link . 'month.calendar' . '&month=' . $cal_month
             // . '&year=' . $cal_year );
         } else {
             // show only text
             $content .= '<td>';
             $content .= $month_name . ' ' . $cal_year;
             $content .= '</td>';
         }
         $content .= "</tr>\n" . "</table>\n";
     }
     $lf = "\n";
     $content .= '<table align="center" class="mod_events_table" cellspacing="3" cellpadding="0" >' . $lf . '<tr class="mod_events_dayname">' . $lf;
     // Days name rows
     for ($i = 0; $i < 7; $i++) {
         $content .= "<td class=\"mod_events_td_dayname\">" . $day_name[($i + $startday) % 7] . "</td>" . $lf;
     }
     $content .= '</tr>' . $lf;
     $datacount = count($data["dates"]);
     $dn = 0;
     for ($w = 0; $w < 6 && $dn < $datacount; $w++) {
         $content .= "<tr>\n";
         for ($d = 0; $d < 7 && $dn < $datacount; $d++) {
             $currentDay = $data["dates"][$dn];
             switch ($currentDay["monthType"]) {
                 case "prior":
                 case "following":
                     $content .= '<td class="mod_events_td_dayoutofmonth">' . $currentDay["d"] . "</td>\n";
                     break;
                 case "current":
                     if ($currentDay["events"] || $this->modparams->get("noeventcheck", 0)) {
                         if ($currentDay['cellDate'] == $today) {
                             $class = "mod_events_td_todaywithevents";
                         } else {
                             if ($currentDay["articles"]) {
                                 $class = "mod_events_td_todayeventsarticles";
                             } else {
                                 $class = "mod_events_td_daywithevents";
                             }
                         }
                     } else {
                         if ($currentDay['cellDate'] == $today) {
                             $class = "mod_events_td_todaynoevents";
                         } else {
                             if ($currentDay["articles"]) {
                                 $class = "mod_events_td_todayarticles";
                             } else {
                                 $class = "mod_events_td_daynoevents";
                             }
                         }
                     }
                     $content .= "<td class='" . $class . "'>\n";
                     $content .= $this->htmlLinkCloaking($currentDay["link"], $currentDay['d'], array('class' => "mod_events_daylink", 'title' => JText::_('JEV_CLICK_TOSWITCH_DAY')));
                     $content .= "</td>\n";
                     break;
             }
             $dn++;
         }
         $content .= "</tr>\n";
     }
     $content .= '</table>' . $lf;
     return $content;
 }
Exemplo n.º 4
0
 /**
  * Support all JevDate::strftime() parameter for Window systems
  *
  * @param string $format
  * @param int $timestamp
  * @return string formated string
  */
 function jev_strftime($format = '', $timestamp = null)
 {
     if (!$timestamp) {
         $timestamp = time();
     }
     // Replace names by own translation to get rid of improper os system library
     if (strpos($format, '%a') !== false) {
         $format = str_replace('%a', JEVHelper::getShortDayName(date('w', $timestamp)), $format);
     }
     if (strpos($format, '%A') !== false) {
         $format = str_replace('%A', JEVHelper::getDayName(date('w', $timestamp)), $format);
     }
     if (strpos($format, '%b') !== false) {
         $format = str_replace('%b', JEVHelper::getShortMonthName(date('n', $timestamp)), $format);
     }
     if (strpos($format, '%B') !== false) {
         $format = str_replace('%B', JEVHelper::getMonthName(date('n', $timestamp)), $format);
     }
     if (JUtility::isWinOS()) {
         if (!class_exists('JEV_CompatWin')) {
             require_once dirname(__FILE__) . '/compatwin.php';
         }
         return JEV_CompatWin::win_strftime($format, $timestamp);
     } else {
         return JevDate::strftime($format, $timestamp);
     }
 }
Exemplo n.º 5
0
    function _displayCalendarMod($time, $startday, $linkString, &$day_name, $monthMustHaveEvent = false, $basedate = false)
    {
        $db = JFactory::getDBO();
        $cfg = JEVConfig::getInstance();
        $compname = JEV_COM_COMPONENT;
        $cal_day = date("d", $time);
        //$cal_year=date("Y",$time);
        //$cal_month=date("m",$time);
        //list($cal_year,$cal_month,$cal_day) = JEVHelper::getYMD();
        if (!$basedate) {
            $basedate = $time;
        }
        $base_year = date("Y", $basedate);
        $base_month = date("m", $basedate);
        $basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
        $requestYear = JRequest::getInt("year", 0);
        $requestMonth = JRequest::getInt("month", 0);
        // special case when site link set the dates for the mini-calendar in the URL but not in the ajax request
        if ($requestMonth && $requestYear && JRequest::getString("task", "") != "modcal.ajax" && $this->modparams->get("minical_usedate", 0)) {
            $requestDay = JRequest::getInt("day", 1);
            $requestTime = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
            if ($time - $basedate > 100000) {
                $requestTime = JevDate::strtotime("+1 month", $requestTime);
            } else {
                if ($time - $basedate < -100000) {
                    $requestTime = JevDate::strtotime("-1 month", $requestTime);
                }
            }
            $cal_year = date("Y", $requestTime);
            $cal_month = date("m", $requestTime);
            $base_year = $requestYear;
            $base_month = $requestMonth;
            $basefirst_of_month = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
        } else {
            $cal_year = date("Y", $time);
            $cal_month = date("m", $time);
        }
        $base_prev_month = $base_month - 1;
        $base_next_month = $base_month + 1;
        $base_next_month_year = $base_year;
        $base_prev_month_year = $base_year;
        if ($base_prev_month == 0) {
            $base_prev_month = 12;
            $base_prev_month_year -= 1;
        }
        if ($base_next_month == 13) {
            $base_next_month = 1;
            $base_next_month_year += 1;
        }
        $reg = JFactory::getConfig();
        $reg->set("jev.modparams", $this->modparams);
        if ($this->modparams->get("showtooltips", 0)) {
            $data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, false, false);
            $this->hasTooltips = true;
        } else {
            $data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, true, $this->modparams->get("noeventcheck", 0));
        }
        $reg->set("jev.modparams", false);
        $width = $this->modparams->get("mod_cal_width", "135px");
        $height = $this->modparams->get("mod_cal_height", "auto");
        $rowheight = $this->modparams->get("mod_cal_rowheight", "auto");
        $month_name = JEVHelper::getMonthName($cal_month);
        $to_day = date("Y-m-d", $this->timeWithOffset);
        $today = JevDate::mktime(0, 0, 0, $cal_month, $cal_day, $cal_year);
        $cal_prev_month = $cal_month - 1;
        $cal_next_month = $cal_month + 1;
        $cal_next_month_year = $cal_year;
        $cal_prev_month_year = $cal_year;
        // additional EBS
        if ($cal_prev_month == 0) {
            $cal_prev_month = 12;
            $cal_prev_month_year -= 1;
        }
        if ($cal_next_month == 13) {
            $cal_next_month = 1;
            $cal_next_month_year += 1;
        }
        $viewname = $this->getTheme();
        $viewpath = JURI::root(true) . "/components/{$compname}/views/" . $viewname . "/assets";
        $viewimages = $viewpath . "/images";
        $linkpref = "index.php?option={$compname}&Itemid=" . $this->myItemid . $this->cat . "&task=";
        /*
        $linkprevious = $linkpref."month.calendar&day=$cal_day&month=$cal_prev_month&year=$cal_prev_month_year";
        $linkprevious = JRoute::_($linkprevious);
        $linkprevious = $this->htmlLinkCloaking($linkprevious, '<img border="0" title="' . JText::_("JEV_PREVIOUSMONTH") . '" alt="' . JText::_("JEV_PREVIOUSMONTH") . '" src="'.$viewimages.'/mini_arrowleft.gif"/>' );
        */
        $jev_component_name = JEV_COM_COMPONENT;
        $this->_navigationJS($this->_modid);
        $scriptlinks = "";
        if ($this->minical_prevmonth) {
            $linkprevious = htmlentities(JURI::base() . "index.php?option={$jev_component_name}&task=modcal.ajax&day=1&month={$base_prev_month}&year={$base_prev_month_year}&modid={$this->_modid}&tmpl=component" . $this->cat);
            $scriptlinks .= "linkprevious = '" . $linkprevious . "';\n";
            $linkprevious = '<img border="0" title="' . JText::_("JEV_PREVIOUSMONTH") . '" alt="' . JText::_("JEV_LAST_MONTH") . '" class="mod_events_link" src="' . $viewimages . '/mini_arrowleft.gif" onmousedown="callNavigation(\'' . $linkprevious . '\');" />';
        } else {
            $linkprevious = "";
        }
        if ($this->minical_actmonth == 1) {
            $linkcurrent = $linkpref . "month.calendar&day={$cal_day}&month={$cal_month}&year={$cal_year}";
            $linkcurrent = JRoute::_($linkcurrent);
            $linkcurrent = $this->htmlLinkCloaking($linkcurrent, $month_name . " " . $cal_year, array("style" => "text-decoration:none;color:inherit;"));
        } elseif ($this->minical_actmonth == 2) {
            $linkcurrent = $month_name . " " . $cal_year;
        } else {
            $linkcurrent = "";
        }
        /*
        $linknext = $linkpref."month.calendar&day=$cal_day&month=$cal_next_month&year=$cal_next_month_year";
        $linknext = JRoute::_($linknext);
        $linknext = $this->htmlLinkCloaking($linknext, '<img border="0" title="' . JText::_("JEV_NEXT_MONTH") . '" alt="' . JText::_("JEV_NEXT_MONTH") . '" src="'.$viewimages.'/mini_arrowright.gif"/>' );
        */
        $this->_navigationJS($this->_modid);
        if ($this->minical_nextmonth) {
            $linknext = htmlentities(JURI::base() . "index.php?option={$jev_component_name}&task=modcal.ajax&day=1&month={$base_next_month}&year={$base_next_month_year}&modid={$this->_modid}&tmpl=component" . $this->cat);
            $scriptlinks .= "linknext = '" . $linknext . "';\n";
            $linknext = '<img border="0" title="' . JText::_("JEV_NEXT_MONTH") . '" alt="' . JText::_("JEV_NEXT_MONTH") . '" class="mod_events_link" src="' . $viewimages . '/mini_arrowright.gif" onmousedown="callNavigation(\'' . $linknext . '\');" />';
        } else {
            $linknext = "";
        }
        $content = <<<START
<div id="extcal_minical">
\t<table cellspacing="1" cellpadding="0" style="width:{$width}; text-align:center;border: 1px solid rgb(190, 194, 195); background-color: rgb(255, 255, 255);">
\t\t<tr>
\t\t\t<td style="vertical-align: top;">
START;
        if ($this->minical_showlink) {
            $content .= <<<START

\t\t\t\t<table style="width:{$width};" cellspacing="0" cellpadding="2" border="0" class="extcal_navbar">
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td valign="middle" height="18" align="center">
\t\t\t\t\t\t\t{$linkprevious}
                \t\t</td>
\t\t                <td width="98%" valign="middle" nowrap="nowrap" height="18" align="center" class="extcal_month_label">
\t\t\t\t\t\t\t{$linkcurrent}
\t\t                </td>
\t\t\t\t\t\t<td valign="middle" height="18" align="center" style="margin: 0 auto; min-width: 4px;">
\t\t                    {$linknext}
                \t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t</table>
START;
        }
        $content .= <<<START
\t\t\t\t<table style="width:{$width};height:{$height}; " class="extcal_weekdays">
START;
        $lf = "\n";
        // Days name rows - with blank week no.
        $content .= "<tr>\n<td/>\n";
        for ($i = 0; $i < 7; $i++) {
            $content .= "<td  class='extcal_weekdays'>" . $day_name[($i + $startday) % 7] . "</td>" . $lf;
        }
        $content .= "</tr>\n";
        $datacount = count($data["dates"]);
        $dn = 0;
        for ($w = 0; $w < 6 && $dn < $datacount; $w++) {
            $content .= "<tr style='height:{$rowheight};'>\n";
            // the week column
            list($week, $link) = each($data['weeks']);
            $content .= '<td class="extcal_weekcell">';
            $content .= $this->htmlLinkCloaking($link, "<img width='5' height='20' border='0' alt='week " . $week . "' src='" . $viewimages . "/icon-mini-week.gif'/>");
            $content .= "</td>\n";
            for ($d = 0; $d < 7 && $dn < $datacount; $d++) {
                $currentDay = $data["dates"][$dn];
                switch ($currentDay["monthType"]) {
                    case "prior":
                    case "following":
                        $content .= "<td class='extcal_othermonth'/>\n";
                        break;
                    case "current":
                        $dayOfWeek = JevDate::strftime("%w", $currentDay["cellDate"]);
                        $class = $currentDay["today"] ? "extcal_todaycell" : "extcal_daycell";
                        $linkclass = "extcal_daylink";
                        if ($dayOfWeek == 0 && !$currentDay["today"]) {
                            $class = "extcal_sundaycell";
                            $linkclass = "extcal_sundaylink";
                        }
                        if ($currentDay["events"] || $this->modparams->get("noeventcheck", 0)) {
                            $linkclass = "extcal_busylink";
                        }
                        $content .= "<td class='" . $class . "'>\n";
                        $tooltip = $this->getTooltip($currentDay, array('class' => $linkclass));
                        if ($tooltip) {
                            $content .= $tooltip;
                        } else {
                            if ($this->modparams->get("emptydaylinks", 1) || $currentDay["events"] || $this->modparams->get("noeventcheck", 0)) {
                                $content .= $this->htmlLinkCloaking($currentDay["link"], $currentDay['d'], array('class' => $linkclass, 'title' => JText::_('JEV_CLICK_TOSWITCH_DAY')));
                            } else {
                                $content .= $currentDay['d'];
                            }
                        }
                        $content .= "</td>\n";
                        break;
                }
                $dn++;
            }
            $content .= "</tr>\n";
        }
        $content .= "</table>\n";
        $content .= "</td></tr></table></div>\n";
        if ($scriptlinks != "") {
            $content .= "<script style='text/javascript'>xyz=1;" . $scriptlinks . "zyx=1;</script>";
        }
        // Now check to see if this month needs to have at least 1 event in order to display
        //			if (!$monthMustHaveEvent || $monthHasEvent) return $content;
        //			else return '';
        return $content;
    }
Exemplo n.º 6
0
 function getAdjacentMonth($data, $direction = 1)
 {
     $cfg =& JEVConfig::getInstance();
     $monthResult = array();
     $d1 = JevDate::mktime(0, 0, 0, intval($data['month']) + $direction, 1, $data['year']);
     $monthResult['day1'] = $d1;
     $monthResult['lastday'] = date("t", $d1);
     $year = JevDate::strftime("%Y", $d1);
     $cfg =& JEVConfig::getInstance();
     $earliestyear = $cfg->get('com_earliestyear');
     $latestyear = $cfg->get('com_latestyear');
     if ($year > $latestyear || $year < $earliestyear) {
         return false;
     }
     $monthResult['year'] = $year;
     $month = JevDate::strftime("%m", $d1);
     $monthResult['month'] = $month;
     $monthResult['name'] = JEVHelper::getMonthName($month);
     $task = JRequest::getString('jevtask');
     $Itemid = JEVHelper::getItemid();
     if (isset($Itemid)) {
         $item = "&Itemid={$Itemid}";
     } else {
         $item = "";
     }
     // URL suffix to preserver catids!
     $cat = $this->getCatidsOutLink();
     $monthResult['link'] = JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}" . $cat);
     return $monthResult;
 }
Exemplo n.º 7
0
    ?>
           
	<tr valign="top" style="height:80px;">				
        <?php 
    echo "<td width='2%' class='cal_td_weeklink'>";
    list($week, $link) = each($this->data['weeks']);
    echo "<a href='" . $link . "'>{$week}</a></td>\n";
    for ($d = 0; $d < 7 && $dn < $datacount; $d++) {
        $currentDay = $this->data["dates"][$dn];
        switch ($currentDay["monthType"]) {
            case "prior":
            case "following":
                ?>
            <td width="14%" class="cal_td_daysoutofmonth" valign="middle">
                <?php 
                echo JEVHelper::getMonthName($currentDay["month"]);
                ?>
            </td>
            	<?php 
                break;
            case "current":
                $cellclass = $currentDay["today"] ? 'class="cal_td_today"' : 'class="cal_td_daysnoevents"';
                // stating the height here is needed for konqueror and safari
                ?>
            <td <?php 
                echo $cellclass;
                ?>
 width="14%" valign="top" style="height:80px;">
                <?php 
                $this->_datecellAddEvent($this->year, $this->month, $currentDay["d"]);
                ?>
Exemplo n.º 8
0
 function _displayCalendarMod($time, $startday, $linkString, &$day_name, $monthMustHaveEvent = false, $basedate = false)
 {
     $db = JFactory::getDBO();
     $cfg = JEVConfig::getInstance();
     $option = JEV_COM_COMPONENT;
     $cal_year = date("Y", $time);
     $cal_month = date("m", $time);
     // do not use $cal_day since it's not reliable due to month offset calculation
     //$cal_day=date("d",$time);
     if (!$basedate) {
         $basedate = $time;
     }
     $base_year = date("Y", $basedate);
     $base_month = date("m", $basedate);
     $basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
     $base_prev_month = $base_month - 1;
     $base_next_month = $base_month + 1;
     $base_next_month_year = $base_year;
     $base_prev_month_year = $base_year;
     if ($base_prev_month == 0) {
         $base_prev_month = 12;
         $base_prev_month_year -= 1;
     }
     if ($base_next_month == 13) {
         $base_next_month = 1;
         $base_next_month_year += 1;
     }
     $requestYear = JRequest::getInt("year", 0);
     $requestMonth = JRequest::getInt("month", 0);
     // special case when site link set the dates for the mini-calendar in the URL but not in the ajax request
     if ($requestMonth && $requestYear && JRequest::getString("task", "") != "modcal.ajax" && $this->modparams->get("minical_usedate", 0)) {
         $requestDay = JRequest::getInt("day", 1);
         $requestTime = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
         if ($time - $basedate > 100000) {
             $requestTime = JevDate::strtotime("+1 month", $requestTime);
         } else {
             if ($time - $basedate < -100000) {
                 $requestTime = JevDate::strtotime("-1 month", $requestTime);
             }
         }
         $cal_year = date("Y", $requestTime);
         $cal_month = date("m", $requestTime);
         $base_year = $requestYear;
         $base_month = $requestMonth;
         $basefirst_of_month = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
     } else {
         $cal_year = date("Y", $time);
         $cal_month = date("m", $time);
     }
     $reg = JFactory::getConfig();
     $reg->set("jev.modparams", $this->modparams);
     if ($this->modparams->get("showtooltips", 0)) {
         $data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, false, false);
         $this->hasTooltips = true;
     } else {
         $data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, true, $this->modparams->get("noeventcheck", 0));
     }
     $reg->set("jev.modparams", false);
     $width = $this->modparams->get("mod_cal_width", "140px");
     $height = $this->modparams->get("mod_cal_height", "");
     $month_name = JEVHelper::getMonthName($cal_month);
     $first_of_month = JevDate::mktime(0, 0, 0, $cal_month, 1, $cal_year);
     //$today = JevDate::mktime(0,0,0,$cal_month, $cal_day, $cal_year);
     $today = JevDate::strtotime(date('Y-m-d', $this->timeWithOffset));
     $content = '';
     if ($this->minical_showlink) {
         $content .= "\n" . '<table style="width:' . $width . ';" cellpadding="0" cellspacing="0" align="center" class="mod_events_monthyear" >' . "\n" . '<tr >' . "\n";
         $scriptlinks = "";
         if ($this->minical_showlink == 1) {
             if ($this->minical_prevyear) {
                 $content .= $this->monthYearNavigation($basefirst_of_month, "-1 year", '&laquo;', JText::_('JEV_CLICK_TOSWITCH_PY'));
             }
             if ($this->minical_prevmonth) {
                 $linkprevious = htmlentities(JURI::base() . "index.php?option={$option}&task=modcal.ajax&day=1&month={$base_prev_month}&year={$base_prev_month_year}&modid={$this->_modid}&tmpl=component" . $this->cat);
                 $scriptlinks .= "linkprevious = '" . $linkprevious . "';\n";
                 $content .= $this->monthYearNavigation($basefirst_of_month, "-1 month", '&lt;', JText::_('JEV_CLICK_TOSWITCH_PM'));
             }
             if ($this->minical_actmonth == 1) {
                 // combination of actual month and year: view month
                 $seflinkActMonth = JRoute::_($this->linkpref . 'month.calendar&month=' . $cal_month . '&year=' . $cal_year);
                 $content .= '<td align="center">';
                 $content .= $this->htmlLinkCloaking($seflinkActMonth, $month_name, array('class' => "mod_events_link", 'title' => JText::_('JEV_CLICK_TOSWITCH_MON'))) . " ";
                 if ($this->minical_actyear < 1) {
                     $content .= '</td>';
                 }
             } elseif ($this->minical_actmonth == 2) {
                 $content .= '<td align="center">';
                 $content .= $month_name . "\n";
                 if ($this->minical_actyear < 1) {
                     $content .= '</td>';
                 }
             }
             if ($this->minical_actyear == 1) {
                 // combination of actual month and year: view year
                 $seflinkActYear = JRoute::_($this->linkpref . 'year.listevents' . '&month=' . $cal_month . '&year=' . $cal_year);
                 if ($this->minical_actmonth < 1) {
                     $content .= '<td align="center">';
                 }
                 $content .= $this->htmlLinkCloaking($seflinkActYear, $cal_year, array('class' => "mod_events_link", 'title' => JText::_('JEV_CLICK_TOSWITCH_YEAR'))) . " ";
                 $content .= '</td>';
             } elseif ($this->minical_actyear == 2) {
                 if ($this->minical_actmonth < 1) {
                     $content .= '<td align="center">';
                 }
                 $content .= $cal_year . "\n";
                 $content .= '</td>';
             }
             if ($this->minical_nextmonth) {
                 $linknext = htmlentities(JURI::base() . "index.php?option=\${$option}&task=modcal.ajax&day=1&month={$base_next_month}&year={$base_next_month_year}&modid={$this->_modid}&tmpl=component" . $this->cat);
                 $scriptlinks .= "linknext = '" . $linknext . "';\n";
                 $content .= $this->monthYearNavigation($basefirst_of_month, "+1 month", '&gt;', JText::_('JEV_CLICK_TOSWITCH_NM'));
             }
             if ($this->minical_nextyear) {
                 $content .= $this->monthYearNavigation($basefirst_of_month, "+1 year", '&raquo;', JText::_('JEV_CLICK_TOSWITCH_NY'));
             }
             // combination of actual month and year: view year & month [ mic: not used here ]
             // $seflinkActYM   = JRoute::_( $link . 'month.calendar' . '&month=' . $cal_month
             // . '&year=' . $cal_year );
         } else {
             // show only text
             $content .= '<td>';
             $content .= $month_name . ' ' . $cal_year;
             $content .= '</td>';
         }
         $content .= "</tr>\n" . "</table>\n";
     }
     $lf = "\n";
     $content .= '<table style="width:' . $width . ';height:' . $height . ';" align="center" class="mod_events_table" cellspacing="0" cellpadding="2" >' . $lf . '<tr class="mod_events_dayname">' . $lf;
     // Days name rows
     for ($i = 0; $i < 7; $i++) {
         $content .= "<td class=\"mod_events_td_dayname\">" . $day_name[($i + $startday) % 7] . "</td>" . $lf;
     }
     $content .= '</tr>' . $lf;
     $datacount = count($data["dates"]);
     $dn = 0;
     for ($w = 0; $w < 6 && $dn < $datacount; $w++) {
         $content .= "<tr>\n";
         /*
         echo "<td width='2%' class='cal_td_weeklink'>";
         list($week,$link) = each($data['weeks']);
         echo "<a href='".$link."'>$week</a></td>\n";
         */
         for ($d = 0; $d < 7 && $dn < $datacount; $d++) {
             $currentDay = $data["dates"][$dn];
             switch ($currentDay["monthType"]) {
                 case "prior":
                 case "following":
                     $content .= '<td class="mod_events_td_dayoutofmonth">' . $currentDay["d"] . "</td>\n";
                     break;
                 case "current":
                     if ($currentDay["events"] || $this->modparams->get("noeventcheck", 0)) {
                         $class = $currentDay["cellDate"] == $today ? "mod_events_td_todaywithevents" : "mod_events_td_daywithevents";
                     } else {
                         $class = $currentDay["cellDate"] == $today ? "mod_events_td_todaynoevents" : "mod_events_td_daynoevents";
                     }
                     $content .= "<td class='" . $class . "'>\n";
                     $tooltip = $this->getTooltip($currentDay, array('class' => "mod_events_daylink"));
                     if ($tooltip) {
                         $content .= $tooltip;
                     } else {
                         if ($this->modparams->get("emptydaylinks", 1) || $currentDay["events"] || $this->modparams->get("noeventcheck", 0)) {
                             $content .= $this->htmlLinkCloaking($currentDay["link"], $currentDay['d'], array('class' => "mod_events_daylink", 'title' => JText::_('JEV_CLICK_TOSWITCH_DAY')));
                         } else {
                             $content .= $currentDay['d'];
                         }
                     }
                     $content .= "</td>\n";
                     break;
             }
             $dn++;
         }
         $content .= "</tr>\n";
     }
     $content .= '</table>' . $lf;
     if ($scriptlinks != "") {
         $content .= "<script style='text/javascript'>xyz=1;" . $scriptlinks . "zyx=1;</script>";
     }
     return $content;
 }