PEAK XOOPS - Re: xcgal Plugin for PiCal in englishin japanese

Re: xcgal Plugin for PiCal

List posts in the topic

question Re: xcgal Plugin for PiCal

msg# 1.1.1.1.1.1.1.1.1
depth:
8
Previous post - Next post | Parent - Children.1 | Posted on 2006/2/16 6:56
Quantum  一等兵   Posts: 16
As promised, here is the code for the xcgal Plugin (monthly & calendar view). Thanks to NAO8 for providing this code!

==
///xcGalCode
<?php

        // a plugin for xcgal

        if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;

        /*
                $db : db instance
                $myts : MyTextSanitizer instance
                $this->year : year
                $this->month : month
                $this->user_TZ : user's timezone (+1.5 etc)
                $this->server_TZ : server's timezone (-2.5 etc)
                $tzoffset_s2u : the offset from server to user
                $now : the result of time()
                $plugin = array('dirname'=>'dirname','name'=>'name','dotgif'=>'*.gif')
                $just1gif : 0 or 1
                
                $plugin_returns[ DATE ][]
        */

        // set range (added 86400 second margin "begin" & "end")
        $range_start_s = mktime(0,0,0,$this->month,0,$this->year) ;
        $range_end_s = mktime(0,0,0,$this->month+1,1,$this->year) ;

        // query
          $result = $db->query( "SELECT title,pid,`ctime` FROM ".$db->prefix("xcgal_pictures")." WHERE
`ctime` >= $range_start_s AND `ctime` < $range_end_s" ) ;

        while( list( $title , $id , $server_time ) = $db->fetchRow( $result ) ) {
                $user_time = $server_time + $tzoffset_s2u ;
                if( date( 'n' , $user_time ) != $this->month ) continue ;
                $target_date = date('j',$user_time) ;
                $tmp_array = array(
                        'dotgif' => $plugin['dotgif'] ,
                        'dirname' => $plugin['dirname'] ,
                        'link' => XOOPS_URL."/modules/{$plugin['dirname']}/displayimage.php?pid=$id" ,
                        'id' => $id ,
                        'server_time' => $server_time ,
                        'user_time' => $user_time ,
                        'name' => 'pid' ,
                        'title' => $myts->makeTboxData4Show( $title )
                ) ;
                if( $just1gif ) {
                        // just 1 gif per a plugin & per a day
                        $plugin_returns[ $target_date ][ $plugin['dirname'] ] = $tmp_array ;
                } else {
                        // multiple gifs allowed per a plugin & per a day
                        $plugin_returns[ $target_date ][] = $tmp_array ;
                }
        }


?>
///end

Edit: Added codes.
Votes:19 Average:10.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!