1
blindman
Let's make resmanager work
  • 2006/7/16 15:10

  • blindman

  • Not too shy to talk

  • Posts: 120

  • Since: 2005/6/26


I don't want to break any rules, but loudo seems to be gone from XOOPS community. May I try to make resmanager work?
IMHO resmanager is a usefull module. I have been searching a reservation module for medical appointments (with confirmation email, etc). So far, resmanager seems to be the best choice but it has a fatal error.
Since I am not a coder, but I need this module, I call for help from those can manage XOOPS code.
I will try to make it work, and, if anybody could guide me, will be great.
So far, like other people here, I got a fatal error.
I think is because of managing date formats calling php function
$cal_jd = unixtojd($cal_timestamp);
I am sure that smarty or XOOPS classes have the ability to manage date format. So I want to change unixtojd with formatTimestamp or something.
If I'll change succsesfully unixtojd and cal_from_jd functions, I'll will let you know. Actually I did it , and fatal error message is gone, but the date values are wrong.
So the replacement of those functions could be a solution.
Anybody could help me with those changes ?

sorry for mypoor English, I hope I made myself clear.
Thank you for your help.
Don't follow me. I'm lost too.

2
blindman
Re: Let's make resmanager work
  • 2006/7/17 8:35

  • blindman

  • Not too shy to talk

  • Posts: 120

  • Since: 2005/6/26


Well, I tried to change some code.
Fore some reasons, even I have required setting in php, I get fatal error if unixtojd and other calendar functions are used.
Therefore, I have found at http://www.php.net/calendar this :
if (!function_exists('unix_to_greg')){
    function 
unix_to_greg($unix_timestamp) {
           
$julian = floor(((($unix_timestamp / "60") / "60") / "24") + "2440588");
           
$julian = $julian - 1721119;
           
$calc1 = 4 * $julian - 1;
          
$year = floor($calc1 / 146097);
           
$julian = floor($calc1 - 146097 * $year);
           
$day = floor($julian / 4);
           
$calc2 = 4 * $day + 3;
           
$julian = floor($calc2 / 1461);
           
$day = $calc2 - 1461 * $julian;
           
$day = floor(($day + 4) / 4);
           
$calc3 = 5 * $day - 3;
           
$month = floor($calc3 / 153);
           
$day = $calc3 - 153 * $month;
           
$day = floor(($day + 5) / 5);
           
$year = 100 * $year + $julian;
   
           if (
$month < 10){
               
$month = $month + 3;
               }else{
               
$month = $month - 9;
               
$year = $year + 1;
               }
           return 
"$day.$month.$year";
    }
}
    
//cal_days_in_month
if (!function_exists('cal_days_in_month')){
           function 
cal_days_in_month($a_null, $a_month, $a_year) {
               return 
date('t', mktime(0, 0, 0, $a_month+1, 0, $a_year));
           }
}
    
// cal to jd
if (!function_exists('cal_to_jd')){
       function 
cal_to_jd($a_null, $a_month, $a_day, $a_year){
               if ( 
$a_month <= 2 ){
                     
$a_month = $a_month + 12 ;
                     
$a_year = $a_year - 1 ;
               }
               
$A = intval($a_year/100);
               
$B = intval($A/4) ;
               
$C = 2-$A+$B ;
               
$E = intval(365.25*($a_year+4716)) ;
               
$F = intval(30.6001*($a_month+1));
               return 
intval($C+$a_day+$E+$F-1524) ;
       }
}

So, maybe, if I don't have those functions on the server settings, I could write some functions right there. In /resmanager/include/functions.php.
Than, replace the script that take an unix timestamp and convert in jd timestamp, after that converting in gregorian calendar.
I must tell you that I don't have fatal errors anymore, but I have problems with passing values and array stuff or something.
Any other fun of resmanager there?
Don't follow me. I'm lost too.