CodeIgniter Forums
Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! (/showthread.php?tid=60139)



Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-23-2014

[eluser]GeorgeWeb[/eluser]
Hello dear friends,

I am glad that this forum exists. It is amazing and I can find whatever I need except the thing I am asking for right now.

Here it is:
I am not sure how to pass the year and the month by this link to my funcion called "date" in the "NotebookController" where I will do something only if I get the full date not only the {day}.

// The code
{cal_cell_no_content}
<b href="'.base_url().'NotebookController/date/'.$year.'/'.$month.'/{day}">{day}</a>
{/cal_cell_no_content}
// I wrote <b> only here in this msg, because <a> shows as a link...
// This code is from my model. If you need anything else like more code or even files I am ready to send you

I really got to nowhere with this and I tried and I tried a couple of hours... I have searched but there is no answer wherever I look at and everyone says: Try http://ellislab.com/forums, because only they may help you with this.
I hope there is a way to do this. I really need and appreciate the help Smile

Yours faithfully,
George Mirazchiiski!
Smile


Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-23-2014

[eluser]Alucemet[/eluser]
In reality your calendar template is just a view. It should be in a view, and if you want the current month and year, simply pass the month and year to the view from the controller or model you are generating the calendar with.

Code:
$view_data['year'] = $year;
$view_data['month'] = $month;

$this->load->view('calendar_template', $view_data, TRUE );

If you need to tweak the actual {content} of the cell, you're going to have to extend the generate method of the calendar class.


Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-23-2014

[eluser]GeorgeWeb[/eluser]
Man, you are great!
This helps but it works only when I get another month and them click on day as link, because in the beggining when I load the calendar my $year and $month are set to NULL, it is because they will show error if there's no value for them.
So I wanted to say that if I go to another month it will add it as a param in the url - Example: 2014/02/ and then if I click on a day it will be how I want to be - myfunction/2014/02/{day} but when I firstly load MyController/calendar/ with no params in the url and it shows me the current month but when I click on a day it will be myfunction///{day} and only the day will have value.
I am not sure if I explained it very well... Any ideas how to fix this?


Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-23-2014

[eluser]Alucemet[/eluser]
You can use if statements or ternary operators to switch the month and year between uri segments or defaults. For defaults you can just use date('Y') and date('m').


Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-24-2014

[eluser]GeorgeWeb[/eluser]
Dear Alucemet,

I have to say that you are great guy! Wow, I haven't thought of this solution... it is pretty simple. Thank you very much! Now, I can mark it as done.
I wish you all the best! Thank you again! Smile

Yours truly,
George Mirazchiiski!
Smile


Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-24-2014

[eluser]Unknown[/eluser]
GeorgeWeb,

You may find this author’s work interesting…

http://zawaruddin.blogspot.com/2012/12/event-calendar-with-codeigniter.html

http://zawaruddin.blogspot.com/2013/06/multiple-event-calendar-with-codeigniter.html




Codeigniter Calendar Class misunderstandment! It is rlly important for me to be done untill Sunday! - El Forum - 01-24-2014

[eluser]GeorgeWeb[/eluser]
Good job sadfrog! I really like your this event cal Smile My idea is a bit different not exactly connected to events but this can really help in the future. Thanks !Smile