Generating week |
[eluser]sojic[/eluser]
I need current week navigation! Example: Code: <p>
[eluser]Bogdan Tanase[/eluser]
.. and I need a beer! Lookup Calendaring Class. It might have something usefull. If not, PHP date/time functions...
[eluser]xwero[/eluser]
The calendar class only creates a month calendar view. To get a weeks worth of dates you can get the week number of the day, date('w'). And based on that you set the date for sunday (0) and saturday (6). And then its a matter of looping from sunday until saturday.
[eluser]Spir[/eluser]
It would be nice if people would share some code for that matter
[eluser]xwero[/eluser]
This function accepts a unix timestamp an returns an array of date based on the weekday numbering used by the date function, meaning 0 as sunday and 6 as saturday. The function can be the base of a week view. Code: function get_week($date)
[eluser]Spir[/eluser]
Nice. I have tried this : Code: // July 1, 2000 Which output this : Quote:25 06 2000 So now if I want my week to start with monday I have to change the range right? Code: $week_days = range(1,7);
[eluser]Spir[/eluser]
Ok so I have build something using your function, but I have a small issue. Let me show you what I have : In my controller : Code: class week extends Controller { In my view I only have this : Code: <?php echo $this->calendar_week->generate($data); ?> And here is my lib called calendar_week (it use the language file of the Calendar) : http://rafb.net/p/HzRvNf45.html It works fine. The only issue is when I press previous week, I shows the same week.I think the issue comes from your function ''set_week()'' that does not set the propper week because I send the sunday of the previous week.
[eluser]Spir[/eluser]
I have temporary fixed the bug by setting : $before = strtotime('-4 day',$this->week_days[0]); In calendar lib.
[eluser]darky84[/eluser]
Dear Spir the link you posted for downloading your lib calendar_week is not working, could you please resubmit the link or share your code, i need this week view please thanks
[eluser]Spir[/eluser]
[quote author="darky84" date="1366808947"]Dear Spir the link you posted for downloading your lib calendar_week is not working, could you please resubmit the link or share your code, i need this week view please thanks [/quote]You are damn lucky I still look at ellisLab mail and had this lib somewhere in my backups! This is a 4 years old topic/lib. Here you go: http://pastebin.com/7NHwZENK |
Welcome Guest, Not a member yet? Register Sign In |