* Select all log records for a given course and user
*
* @uses $CFG
+ * @uses DAYSECS
* @param int $userid The id of the user as found in the 'user' table.
* @param int $courseid The id of the course as found in the 'course' table.
* @param string $coursestart ?
$courseselect = '';
}
- return get_records_sql("SELECT floor((`time` - $coursestart)/".DAYSECS.") as day, count(*) as num
+ return get_records_sql("SELECT floor((`time` - $coursestart)/". DAYSECS .") as day, count(*) as num
FROM {$CFG->prefix}log
WHERE userid = '$userid'
AND `time` > '$coursestart' $courseselect
* Select all log records for a given course, user, and day
*
* @uses $CFG
+ * @uses HOURSECS
* @param int $userid The id of the user as found in the 'user' table.
* @param int $courseid The id of the course as found in the 'course' table.
* @param string $daystart ?
$courseselect = '';
}
- return get_records_sql("SELECT floor((`time` - $daystart)/".HOURSECS.") as hour, count(*) as num
+ return get_records_sql("SELECT floor((`time` - $daystart)/". HOURSECS .") as hour, count(*) as num
FROM {$CFG->prefix}log
WHERE userid = '$userid'
AND `time` > '$daystart' $courseselect
define('VISIBLEGROUPS', 2);
/**
- * Time constants
+ * Time constant - the number of seconds in a week
*/
-
define('WEEKSECS', 604800);
+
+/**
+ * Time constant - the number of seconds in a day
+ */
define('DAYSECS', 86400);
+
+/**
+ * Time constant - the number of seconds in an hour
+ */
define('HOURSECS', 3600);
+
+/**
+ * Time constant - the number of seconds in a minute
+ */
define('MINSECS', 60);
+
+/**
+ * Time constant - the number of minutes in a day
+ */
define('DAYMINS', 1440);
+
+/**
+ * Time constant - the number of minutes in an hour
+ */
define('HOURMINS', 60);
/// PARAMETER HANDLING ////////////////////////////////////////////////////
* Given an amount of time in seconds, returns string
* formatted nicely as months, days, hours etc as needed
*
+ * @uses MINSECS
+ * @uses HOURSECS
+ * @uses DAYSECS
* @param int $totalsecs ?
* @param array $str ?
* @return string
* If parameter fixday = true (default), then take off leading
* zero from %d, else mantain it.
*
+ * @uses HOURSECS
* @param int $date ?
* @param string $format ?
* @param int $timezone ?
* Given a $date timestamp in GMT (seconds since epoch),
* returns an array that represents the date in user time
*
+ * @uses HOURSECS
* @param int $date Timestamp in GMT
* @param int $timezone ?
* @return array An array that represents the date in user time
* Given a GMT timestamp (seconds since epoch), offsets it by
* the timezone. eg 3pm in India is 3pm GMT - 7 * 3600 seconds
*
+ * @uses HOURSECS
* @param int $date Timestamp in GMT
* @param int $timezone ?
* @return int
* Sets a moodle cookie with an encrypted string
*
* @uses $CFG
+ * @uses DAYSECS
+ * @uses HOURSECS
* @param string $thing The string to encrypt and place in a cookie
*/
function set_moodle_cookie($thing) {
*
* @uses $CFG
* @uses $db
+ * @uses HOURSECS
* @todo Finish documenting this function. Add long description with more detail on what it does.
*/
function notify_login_failures() {
* Given dates in seconds, how many weeks is the date from startdate
* The first week is 1, the second 2 etc ...
*
+ * @uses WEEKSECS
* @param ? $startdate ?
* @param ? $thedate ?
* @return string