OrdaSoft forum
Welcome, Guest
Please Login or Register.    Lost Password?
RealEstateManager component support
Go to bottom Favoured: 0
TOPIC: how calendar works ?
#9368
nickg (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Adventures of globetrotter
how calendar works ? 3 Years, 2 Months ago Karma: 0  
hello,
I'am testing calendar .In backend I chossed dates rent for a one house but in frontend nothing is display in calendar. Why?
 
Logged Logged  
 
Last Edit: 2013/09/24 13:25 By nickg.
  The administrator has disabled public write access.
#9369
admin (Admin)
Admin
Posts: 4861
graph
User Offline Click here to see the profile of this user
Re:how calendar works ? 3 Years, 2 Months ago Karma: 61  
Hello,

I am sorry, for me not clear what language you use.

all look like you show "Rent request manager", there are you see only requests for rent
For property go to rent and appear on calendar - first upi need accept that rent request

Thanks,
OrdaSoft team
 
Logged Logged  
  The administrator has disabled public write access.
#9371
nickg (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Adventures of globetrotter
Re:how calendar works ? 3 Years, 2 Months ago Karma: 0  
I use french language.
With this image it will be better for the compréhension
I have not received any rent request. I just I inserted dates directly from backend
 
Logged Logged  
  The administrator has disabled public write access.
#9378
admin (Admin)
Admin
Posts: 4861
graph
User Offline Click here to see the profile of this user
Re:how calendar works ? 3 Years, 2 Months ago Karma: 61  
Hello,

Please in file
{site}/components/com_realestatemanager/realestatemanager.php

find function: getMonthCal

and replace it to below
Code:

 static function getMonthCal($month, $year, $id)
    {
        
        global $database;

        $query = "SELECT rent_from, rent_until FROM #__rem_rent WHERE fk_houseid='$id'";

        $database->setQuery($query);
        $calenDate = $database->loadObjectList();
        $skip = date("w", mktime(0, 0, 0, $month, 1, $year)) - 1;

        if ($skip < 0)
        {
            $skip = 6;
        }

        $daysInMonth = date("t", mktime(0, 0, 0, $month, 1, $year));
        
        $rent = array();

        foreach ($calenDate as $key) {
            $rent_from = explode("-", $key->rent_from);
            $rent_until = explode("-", $key->rent_until);
            
            
            
            if (((int) $rent_from[0] == $year) && ((int) $rent_from[1] <= $month))
            {
                if ((int) $rent_from[1] == (int) $rent_until[1] and $rent_from[1]==$month)
                {   
                    for ($i = (int) $rent_from[2]; $i <= (int) $rent_until[2]; $i++) {
                        $rent[] = $i;
                    } 
                } elseif ((int) $rent_from[1] == $month)
                {
                    for ($i = (int) $rent_from[2]; $i <= $daysInMonth; $i++) {
                        $rent[] = $i;
                    }
                } elseif ((int) $rent_until[1] == $month and $rent_until[0]==$year)
                {
                    for ($i = 1; $i <= (int) $rent_until[2]; $i++) {
                        $rent[] = $i;
                    }
                }
                elseif((int) $rent_from[1] == (int) $rent_until[1]){
                    
                }
                else
                {
                    for ($i = 1; $i <= $daysInMonth; $i++) {
                        $rent[] = $i;
                    }
                }
            }
           elseif
                (((int) $rent_from[0] < $year and (int) $rent_until[0] > $year ) ){
                    for ($i = 1; $i <= $daysInMonth; $i++) {
                        $rent[] = $i;
                    }
                }
           elseif (((int) $rent_until[0] == $year) && ((int) $rent_until[1] >= $month) and $rent_until[0]!=$rent_from[0])
            {
                if ((int) $rent_from[1] == (int) $rent_until[1])
                {
                    for ($i = (int) $rent_from[2]; $i <= (int) $rent_until[2]; $i++) {
                        $rent[] = $i;
                    }
                } else if ((int) $rent_from[1] == $month and $rent_from[0]==$year )
                {
                    for ($i = (int) $rent_from[2]; $i <= $daysInMonth; $i++) {
                        $rent[] = $i;
                    }
                } elseif ((int) $rent_until[1] == $month and $rent_until[0]==$year)
                {
                    for ($i = 1; $i <= (int) $rent_until[2]; $i++) {
                        $rent[] = $i;
                    }
                } else
                {
                    for ($i = 1; $i <= $daysInMonth; $i++) {
                        $rent[] = $i;
                    }
                }
            }
             
        }


        $calendar = '';
        $day = 1;

        $smonth = PHP_realestatemanager::getMonth($month);

        $calendar = '<table class="tableC" style="border-collapse: separate; border-spacing: 2px;text-align:center"><tr class="year"><th colspan = "7">' . $smonth . ' ' . $year . '</th></tr><tr class="days"><th>' . JText::_('MON') . '</th><th>' . JText::_('TUE') . '</th><th>' . JText::_('WED') . '</th><th>' . JText::_('THU') . '</th><th>' . JText::_('FRI') . '</th><th>' . JText::_('SAT') . '</th><th>' . JText::_('SUN') . '</th></tr>';

        for ($i = 0; $i < 6; $i++) {
            $calendar .= '<tr>';
            for ($j = 0; $j < 7; $j++) {
                if (($skip > 0) or ($day > $daysInMonth))
                {
                    $calendar .= '<td> &nbsp; </td>';
                    $skip--;
                } else
                {
                    if ($j == 0)
                        if (in_array($day, $rent))
                        {
                            $calendar .= '<td class="calendar_not_available">' . $day . '</td>';
                        } else
                        {
                            $calendar .= '<td class="calendar_available">' . $day . '</td>';
                        }
                    else{ 
                        if (in_array($day, $rent))
                        {
                            $calendar .= '<td class="calendar_not_available">' . $day . '</td>';
                        } else
                        {
                            $calendar .= '<td class="calendar_available">' . $day . '</td>';
                        }
                    }
                    $day++;
                }
            }
            $calendar .= '</tr>';
        }
        $calendar .= '</table>';
       
        return $calendar;
    }



Thanks,
OrdaSoft team
 
Logged Logged  
  The administrator has disabled public write access.
Go to top
What are you looking for?
Anti-spam question: How many eyes has a typical person?