12345678910111213141516171819202122232425262728 |
- <?php
- class GetAbandonedUploads {
- public function get() {
- $userId = $_SESSION['user_id'];
-
- $data['abandoned_uploads'] = array();
- $sql = "select distinct project_id, uploadtime as upload_timestamp, display_name as project_name from upload_logs join projects on upload_logs.project_id = projects.rowid WHERE user_id = :user_id;";
- $db = SqliteDatabase::getSingleton();
- $preparedQuery = $db->prepare($sql);
- $preparedQuery->bindValue(':user_id', $userId);
- $result = $preparedQuery->execute();
- $incompleteUploads = array();
- while($row = $result->fetchArray(SQLITE3_ASSOC)) {
- //$row['upload_timestamp'] = date("Y/m/d H:i", $row['upload_timestamp']);
- $sql = "SELECT count(*) as count FROM upload_logs where user_id = :user_id AND project_id = :project_id";
- $preparedQuery = $db->prepare($sql);
- $preparedQuery->bindValue(':user_id', $userId);
- $preparedQuery->bindValue(':project_id', $row['project_id']);
- $countResult = $preparedQuery->execute();
- $count = $countResult->fetchArray(SQLITE3_ASSOC)['count'];
- $row['count'] = $count;
- $incompleteUploads[] = $row;
- }
- return $incompleteUploads;
- }
- }
|