• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving multiple events on the same day

#1
[eluser]Unknown[/eluser]
Hi all,

Im having difficulty with retrieving multiple events on the same day.

I modified the Calendar Class as told on:
http://ellislab.com/forums/viewthread/119477

The array i need to return must look like this:
Code:
array(
    3  => array("event1", "event2"), // these are the multiple events
    7  => "event3",
    21 => "event4",
    30 => "event5"
);

This is my model function:
Code:
function get_calendar_data($year, $month) {
                
        $calendar_items = array();
        $calendar_activiteiten = array();
        
        $this->db->from('calendar');
        $this->db->like('calendar_date', "$year-$month");
        $query = $this->db->get();
                
        foreach($query->result() as $row) {
            
            $this->db->from('activiteiten');
            $this->db->where('activiteiten_id', $row->calendar_activiteiten_id);
            $query2 = $this->db->get();
                        
            foreach($query2->result() as $row2) {
                $calendar_activiteiten[$row2->activiteiten_id] = $row2->activiteiten_naam."<br />";
                $calendar_items[intval(substr($row->calendar_date,8,2))] = $calendar_activiteiten;
            }
                        
        }
        return $calendar_items;
        
    }

This is my db structure:

calendar
-----------------------------------
calendar_id int(11)
calendar_date date
calendar_data text
calendar_activiteiten_id int(11)
-----------------------------------

activiteiten
-----------------------------------
activiteiten_id int(11)
activiteiten_naam varchar(255)
-----------------------------------

Could someone please tell me what i should do ?

Thanks in advance !

#2
[eluser]Unknown[/eluser]
Hey I am trying to do the same thing? Did you ever accomplish your goal?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.