I must say, I've tried all the calendar modules for xoops, and thus far this is the best one... but it's missing one feature. I'd like the "coming events" block (pical_coming_schedule) to only appear when there are events coming up. I see that the block template has "if $block.num_rows == 0", so it can tell that there are no events, but how can I get it to not even display the block at all. I've been trying to mess around with the pical_coming_schedule_show_tpl function from pical_coming_schedule.php since it's (I assume) "return $block;" that actually tells xoops to display it, so I was trying to figure out how to have it check num_rows before returning $block. is it something like this?
if( $num_rows > 0) {
return $block ; }
I'm pretty much faking my way through PHP, so I apolgize if I'm seeming retarded. :/
Thanks!
You have to hack a php file directory.
blocks/pical_coming_schedule.php
// setting properties of piCal
$cal->conn = $xoopsDB->conn ;
include( "$mod_path/include/read_configs.php" ) ;
$cal->base_url = $mod_url ;
$cal->base_path = $mod_path ;
$cal->images_url = "$mod_url/images/$skin_folder" ;
$cal->images_path = "$mod_path/images/$skin_folder" ;
$block = $cal->get_blockarray_coming_event( "$mod_url/index.php" , $maxitem , true , $untildays ) ;
if( $block['num_rows'] <= 0 ) {
return array() ;
}
return $block ;
}
You sir, are my hero. Thank you so much! :)
Apparently, I celebrated too soon. The block only disappears when there are no events coming up ever... it shows an empty box if there are upcoming events beyond the untildays limit. Any ideas?
It seems that despite being outside of the untildays limit, that num_rows is returning a value that includes all future events. Is $count suppose to be the value of events beyond the untildays limit?
OK.
I didn't think the option of "untildays".
It is also a bug of piCal_xoops.php
Fix this:
line 404 of piCal_xoops.php
wrong:
if( ++ $count > $num ) break ;
// 開始日が$untildaysより先であれば、そこで打ち切り
if( $untildays > 0 && $event->start > $this->unixtime + $untildays * 86400 ) {
$num_rows = $count ;
break ;
}
right:
if( $count >= $num ) break ;
// 開始日が$untildaysより先であれば、そこで打ち切り
if( $untildays > 0 && $event->start > $this->unixtime + $untildays * 86400 ) {
$num_rows = $count ;
$block['num_rows'] = $num_rows ;
break ;
}
$count ++ ;
I've just fixed piCal_xoops.php as 0.87b.
Download the latest archive and update piCal_xoops.php