suggestion regarding my "question of the week" project - php

I am going to start on a new project for my school. I have to create a "question of the week" forum, where the members can post questions and their questions could then be voted by other members. The best question of that week will be discussed the week after, and the posting of the questions will take place again.
I am going to use MySQL as database, with backend in php.
Does anyone have some examples of something that I could use? Also, how will I be able to see a week in my project? I mean, how am I going to decide that a week has passed? I can not figure that out.
Do let me know about your suggestions.
Thank you!
Best
Zeeshan

Pick a handful of the free php / mysql
forum software programs. These
should be a good starting point;
phpBB, Vanilla, SMF, BBpress.
Install
and configure each of them, and
figure out which one makes most sense
to you in terms of ease of use, ease
of customisation, etc.
You may find
that these forums have enough
features to achieve what you are
after without any extra effort, but
if not, then start customising!

To see a weeks worth of data, you would create a database query that would view only the current weeks questions posts. The algorith would look like:
Get current day
From the current day, find the last day of the week (you have to decide what you consider the last day of the week)
Subtract 7 days from the last day of the week
Write you query
SELECT * FROM questions WHERE postdate >= #7DaysFromLastDayOfWeek
Hope that helps and makes sense.

If you don't want to go the trouble of hosting your own solution (even if it is the implementation of a existing application), google have an application called Moderator which you can either use standalone or embed into another web page - not sure if this is suitable?

Related

PHP - Updating data yearly. -Process advice-

I have made an employee management system as such, and it calcualtes leave days. Although I am trying to work out how to make the leave days update yearly according to the staffs starting date.
I think I know how I will do this easily. Except it will involve the software being open on that date.
How would I account for each day, without the software having to be open?
Heres the process i was thinking:
-Loop through array of staff data and determine if starting date matches current date.
-If it matches then add an ammount of days to their leave days
I know this is very basic, and it has some flaws. Here are the flaws i am thinking:
-If the page were to be refreshed, or page opened again then it would add x2 of the staff days.
-Also, if the software was not to be opened on this day then the staff would not get the added leave days.
How would I get around this issues? I feel like it should be an easy thing, but I cant think on how to do it properly.
Any help would be greatly appreciated,
Create your php script I'll call it leavetime.php
Then if you have c-panel on your server, there is a thing called cron, in there you can select the time to call it. typically it will be something like this for the command
usr/bin/php -q locationof/leavetime.php
https://www.youtube.com/watch?v=ZAbefcWLxrw
As for the actual php code to do this, it's to broad a topic to cover in a single question.

Job planification: looking for UI design to make my own

I'm developping an admin panel with ExtJS.
I've almost finished it except one thing: I need the "partner" who logs in to be able to configure when he/she works.
I'm like re-inventing the wheel, but thanks to ExtJS and my structure this won't be a problem.
The actual problem is about UI design:
I want to make very simple so that it's possible to enter very simple values like "I'm working each working days from 8 to 12 then 14 to 18"
I want to make it more configurable and be able to precise "I'm on vacation from july,1st until august,31th"
I want to make it even more configurable and be able to precise "the month of january, I'm working every single day from 8 to 20 non-stop".
I was looking for some inspiration with Microsoft Scheduler but to be honest, a basic user will never ever (ever x 87) be able to use such a UI to configure when he/she works
Same for unix cronjob. From my point of view, this is very hard to understand from a basic user's point of view.
So my question is: do you know where I could find some inspiration for this? And maybe if there are some Php components well written out there to handle such things...
Here's the way I did it: a "list" of rows that contains:
start hour
end hour
start date
end date
and a list of associated days.
This way it's possible to configure any kind of scenarii, even though it requires a bit of thinking, because you do not have to enter it a "natural" way (= you usually think first days of week you work, the hours and maybe the start/end days = it's the opposite of my configuration).

Building a one week calendar / schedule

My website involves scheduling recurring lessons and events. At present I have built a table using php and javascript which scans through my mysql DB, time slot by timeslot, day by day to see if there is an event scheduled or if the timeslot is free.
It works fine, but is quite clunky and ugly and to be honest, not user friendly enough. I have now built the rest of the site using JQuery along with php, JS, HTML.
I have searched far and wide for a JQuery module to sort me out for this, but every calendar/scheduler I find is for ongoing time, i.e. like the Outlook Calendar.
I want one that ONLY displays Monday - Sunday, with time intervals of a half hour - what's the best way for me to achieve this?
Many thanks in advance,
Brett
may be this can be of help if you haven checked it out already https://github.com/robmonie/jquery-week-calendar/wiki/

PHP Date Booking and Review methods

A bit of brainstorming is required.
We are building a booking system that allows users to book a date and a half an hour time slot on that day. Some days however based on a weekly timetable will not be available and others may be unavailable at certain time.
What would be the best way to go about something like this. There should be some information in the database saying what day of the week certain times are not available but I am not sure what the best way of going about this is.
Any ideas?
Marvellous

gmt or without gmt

this might be stupid question, but ill ask anyway.
do i really need to implement gmt on site to get proper timestamp on a post? well im building a site like twitter. my feeds are working fine and showing me the time i need, like it shows "posted 11 minutes, posted yesterday, posted 5 days ago.. " just like this site, so i was thinking it should work for everyone properly, what you think? or do you think i need to implement gmt on it and do you recommand or have any article on it for implementing it proper way?
sorry if this sound stupid :O
In the long term, it is best to store time stamps always in GMT/UTC, no matter how the user interface is rendered. This has two advantages:
when changing the UI at some point, you won't need to touch the data
it gives a clear design guideline (in terms of a clear right/wrong decision): any specific function dealing with time can be independently reviewed wrt. processing timestamps in UTC
As for specific programming guidelines: these depend very much on the functionality you want to execute. Most of the time, you need either from-utc or to-utc operations.
It's a good point, but consider the case when 1 day ago suggests "yesterday", and it's currently 1:05am for some user. I suppose if you're using days = hours % 24 rather than days = datediff(then, now).days, then it would work fine.
I think the issue is: how accurate does your site need to be? If it's for medical readings, so someone can know when their medication is due, then yes, you want to account for timezones properly, and give accurate times rather than just "x ago". If it's just for "joe said hi two days ago", though, then it's not a big deal.
When you're talking about time periods like hours, minutes and seconds, then that's not even anything to do with timezones. Look at the timestamp of when it was created, and look at the timestamp now. Do some subtraction and voila!
The only time it's slightly strange is when you are in the range of a couple of days. Does yesterday mean "some time in the 24 hours prior to the last midnight", or does it mean "over 24 hours ago"? In any case, if the only level of granularity you are providing is "days", then once it's gone past about 2 days, then it doesn't really matter.
One nice way to avoid confusion is the same method used here on SO: put the readable, friendly date on the screen ("yesterday"), but put the exact time (in GMT or in the user's TZ) as a tooltip.

Categories