• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Limit calendar events to display not working correct

#1
Question 
I can add & view multiple calendar event on different days.

But if I have multiple dates shown it takes up to much room.

My question is how can I limit the number of events to show on that day.

I have tried $this->db->limit(2) but the only shows 2 on the whole calendar?

PHP Code:
   public function get_events($year$month) {
 
       $calendar = array();

 
       $this->db->where('year'$year);
 
       $this->db->where('month'$month);
 
       $query $this->db->get('events');

 
       $results $query->result_array();

 
       foreach ($results as $event) {

 
       if (array_key_exists($event['day'], $calendar)) {
     
                   
        $calendar
[$event['day']] = $calendar[$event['day']] .'
        <hr/>

           <div class="text-center">
        <span class="label label-info">New</span>
        </div>
        <br/>
        <div class="clearfix">
        <div class="pull-left">
        <ul class="list-unstyled text-center">
        <li >' 
        
word_limiter(anchor(base_url('report/events/'$year .'/'$month .'/?event_id='$event['events_id']), $event['event']), 4) . '
        </li>
        </ul>
        </div>
        <div class="pull-right">
        <form id="form-event" action="'
.base_url('dashboard/calendar').'" class="form-inline" method="post" enctype="multipart/form-data" onsubmit="return confirm(\'Are you sure you want to remove this!\')";>
        <input type="hidden" name="delete_id" value="'
.$event['events_id'].'">
        <a href="'
.base_url('report/events/edit' .'/?event_id='$event['events_id']).'" role="button" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
        <button type"submit" class="btn btn-danger"><i class="fa fa-trash"></i></button>
        </form>
        </div>
        </div>'
;
     
               
        
} else {
     
               
        $calendar
[$event['day']] = '
        <div class="text-center">
        <span class="label label-info">New</span>
        </div>
        <br/>
        <div class="clearfix">
        <div class="pull-left">
        <ul class="list-unstyled text-center">
        <li >' 
        
word_limiter(anchor(base_url('report/events/'$year .'/'$month .'/?event_id='$event['events_id']), $event['event']), 4) . '
        </li>
        </ul>
        </div>
        <div class="pull-right">
        <form id="form-event" action="'
.base_url('dashboard/calendar').'" class="form-inline" method="post" enctype="multipart/form-data" onsubmit="return confirm(\'Are you sure you want to remove this!\')";>
        <input type="hidden" name="delete_id" value="'
.$event['events_id'].'">
        <a href="'
.base_url('report/events/edit' .'/?event_id='$event['events_id']).'" role="button" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
        <button type"submit" class="btn btn-danger"><i class="fa fa-trash"></i></button>
        </form>
        </div>
        </div>
        '
;
     
   
        
}
     
    
        
}

 
       return $calendar;
 
   


Attached Files Thumbnail(s)
   

.php   Model_calendar.php (Size: 3.78 KB / Downloads: 128)
.php   Calendar.php (Size: 4.11 KB / Downloads: 118)
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply

#2
I've used the calendar quite a bit, and done a lot of customizing. I guess my question to you is, how can you just remove things from the calendar? You want to limit to 2 per day, so what happens to the others? I just wonder if you are heading down the wrong path. Perhaps the thing to do is to make the contents of the day smaller so more things fit. Maybe if you show the calendar, you could put the number of things for the day, and then when you click on them a modal pops up with the details. [Y/n]?
Reply

#3
(12-25-2015, 06:45 PM)skunkbad Wrote: I've used the calendar quite a bit, and done a lot of customizing. I guess my question to you is, how can you just remove things from the calendar? You want to limit to 2 per day, so what happens to the others? I just wonder if you are heading down the wrong path. Perhaps the thing to do is to make the contents of the day smaller so more things fit. Maybe if you show the calendar, you could put the number of things for the day, and then when you click on them a modal pops up with the details. [Y/n]?

I prefer the contents the way the are at the moment.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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