PEAK XOOPS - hide "coming events" block when no coming events in englishin japanese

hide "coming events" block when no coming events

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2006/7/13 7:13
fallenturtle  二等兵   Posts: 5
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!
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/7/13 17:42
GIJOE  先任軍曹   Posts: 4110
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 ;
}


Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/7/13 22:18
fallenturtle  二等兵   Posts: 5
You sir, are my hero. Thank you so much! :)
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/7/25 1:54
fallenturtle  二等兵   Posts: 5
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?
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2006/7/26 4:56
fallenturtle  二等兵   Posts: 5
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?
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2006/8/2 6:25
GIJOE  先任軍曹   Posts: 4110
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
Votes:0 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!