$sql = "DELETE\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `type` = 'tool_access'"; if (claro_sql_query($sql)) { return true; } else { return false; } } public function deleteBefore($date) { $sql = "DELETE\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `type` = 'tool_access'\n AND `date` < FROM_UNIXTIME('" . (int) $date . "')"; if (claro_sql_query($sql)) { return true; } else { return false; } } public function deleteForUser($userId, $date = null) { if (!is_null($date) && !empty($date)) { $dateCondition = " AND `date` < FROM_UNIXTIME('" . (int) $date . "')"; } $sql = "DELETE\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `type` = 'tool_access'\n AND `user_id` = " . (int) $userId . $dateCondition; if (claro_sql_query($sql)) { return true; } else { return false; } } } TrackingManagerRegistry::register('CLTRACK_ToolAccessTrackingManager');
} } return true; } public function deleteForUser($userId, $date = null) { if (!is_null($date) && !empty($date)) { $dateCondition = " AND `date` < FROM_UNIXTIME('" . (int) $date . "') "; } // get data to delete from exercise tracking table $sql = "SELECT `id`\n FROM `" . $this->tbl_qwz_tracking . "`\n WHERE `user_id` = " . (int) $userId . $dateCondition; $exeList = claro_sql_query_fetch_all_cols($sql); if (is_array($exeList['id']) && !empty($exeList['id'])) { // delete $sql = "DELETE FROM `" . $this->tbl_qwz_tracking . "`\n WHERE `user_id` = " . (int) $userId . $dateCondition; claro_sql_query($sql); // get data to delete $sql = "SELECT `id` FROM `" . $this->tbl_qwz_tracking_questions . "` WHERE `exercise_track_id` IN ('" . implode("', '", $exeList['id']) . "')"; $detailList = claro_sql_query_fetch_all_cols($sql); if (is_array($detailList['id']) && !empty($detailList['id'])) { $sql = "DELETE FROM `" . $this->tbl_qwz_tracking_questions . "` WHERE `exercise_track_id` IN ('" . implode("', '", $exeList['id']) . "')"; claro_sql_query($sql); $sql = "DELETE FROM `" . $this->tbl_qwz_tracking_answers . "` WHERE details_id IN ('" . implode("', '", $detailList['id']) . "')"; claro_sql_query($sql); } } return true; } } TrackingManagerRegistry::register('CLQWZ_TrackingManager');
$sql = "DELETE\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `type` = 'download'"; if (claro_sql_query($sql)) { return true; } else { return false; } } public function deleteBefore($date) { $sql = "DELETE\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `type` = 'download'\n AND `date` < FROM_UNIXTIME('" . (int) $date . "')"; if (claro_sql_query($sql)) { return true; } else { return false; } } public function deleteForUser($userId, $date = null) { if (!is_null($date) && !empty($date)) { $dateCondition = " AND `T`.`date` < FROM_UNIXTIME('" . (int) $date . "')"; } $sql = "DELETE\n FROM `" . $this->tbl_course_tracking_event . "`\n WHERE `type` = 'download'\n AND `user_id` = " . (int) $userId . $dateCondition; if (claro_sql_query($sql)) { return true; } else { return false; } } } TrackingManagerRegistry::register('CLDOC_TrackingManager');