I am trying to develop a calendar module which has the following class that prints the calendar
class modJeventsCalHelper
{
public function showcal() {
$year == null;
$month == null;
if(null==$year&&isset($_GET['year'])){
$year = $_GET['year'];
}else if(null==$year){
$year = date("Y",time());
}
if(null==$month&&isset($_GET['month'])){
$month = $_GET['month'];
}else if(null==$month){
$month = date("m",time());
}
$this->currentYear=$year;
$this->currentMonth=$month;
$this->daysInMonth=$this->_daysInMonth($month,$year);
$content='<div id="calendar">'.
'<div class="box">'.
$this->_createNavi().
'</div>'.
'<div class="box-content">'.
'<ul class="label">'.$this->_createLabels().'</ul>';
$content.='<div class="clear"></div>';
$content.='<ul class="dates">';
$weeksInMonth = $this->_weeksInMonth($month,$year);
// Create weeks in a month
for( $i=0; $i<$weeksInMonth; $i++ ){
//Create days in a week
for($j=1;$j<=7;$j++){
$content.=$this->_showDay($i*7+$j);
}
}
$content.='</ul>';
$content.='<div class="clear"></div>';
$content.='</div>';
$content.='</div>';
return $content;
}
}
I have then stored the content in $calendar
$calendar = modeventscrollerHelper::showcal();
However I get an error
Using $this when not in object context
I have placed a test class to print hello
public static function getscroller($params)
{
return 'Hello, World!';
}
Which works just fine when I use
$scroller = modeventscrollerHelper::getscroller($params);
Could you please help me resolve this?
Thanks, Sai.