Welcome Guest, Not a member yet? Register   Sign In
calendar plugin
#5

[eluser]xwero[/eluser]
After a good nights sleep i realised a week view can have days in a previous or next month too. Maybe it's better not to put the item data in a single array but in a two dimensional array which is how the data comes from the database anyway. And just read it out assuming the data is in synch with the period items

But then there is the problem if previous and/or next month days get generated you have to run the function before you can add data. I think there is no other choice than to put in in a library if you want this to be possible. In my framework independent way of creating libraries the database call will look like this
Code:
function pad_period($type,$date,$columns,$get_data=false,$framework='CI')
{
    // recycle the shown controller code here
    // fetch the first and last item to use in the period_data method if needed
    if($get_data)
    {
       $framework_data = 'period_data_'.strtolower($framework);
       $data = $this->$framework_data($first,$last);
    }
    // add data to the items
}

period_data_ci($start,$end)
{
    $CI =& get_instance();
    $CI->load->model($this->model,$this->model_name,true); // to be safe
    return $CI->{$this->model_name}->{$this->method_name}($start,$end);
}
The problem here is the way people store data and how to format the first and last item for the database retrieval. Or you can make it easy and just pass as much data as possible for the first and last item to the model function and the developer has to deal with it in the model method.

But i'm going to stick with the function for now because i think it can work.


Messages In This Thread
calendar plugin - by El Forum - 04-03-2009, 09:07 AM
calendar plugin - by El Forum - 04-03-2009, 03:17 PM
calendar plugin - by El Forum - 04-03-2009, 04:21 PM
calendar plugin - by El Forum - 04-03-2009, 07:39 PM
calendar plugin - by El Forum - 04-04-2009, 01:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB