12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- class ProjectsAdminDashboard {
- public function display() {
- //http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-s3.html
- $database = SqliteDatabase::getSingleton();
- $projects = $database->queryArray("SELECT rowid AS project_id, * FROM projects;");
- foreach($projects as $index => $project) {
- $accounts = $database->queryArray("SELECT accounts.rowid as client_id, subdomain, display_name FROM account_projects JOIN accounts ON accounts.rowid = account_projects.account_id WHERE project_id = " . $project['project_id']. ";");
- foreach($accounts as $account) {
- $projects[$index]['clients'][] = $account;
- }
- }
- $resumeProjectId = $_GET['resume'] ?? null;
- $data = array();
- $data['sectionName'] = "Data";
- $data['displayName'] = $_SESSION['display_name'];
- $data['buckets'] = array(
- "ccld-us-east" => "us-east-north-virginia",
- "ccld-us-mid" => "us-east-ohio",
- "ccld-us-west" => "us-west-north-california",
- "ccld-us-pnw" => "us-west-oregon",
- "ccld-test" => "ccld-test",
- "ccld-public-test" => "ccld-public-test",
- );
- $data['projects'] = $projects;
- $data['resume'] = $resumeProjectId;
- $data['superadmin'] = $_SESSION['superadmin'] ?? false;
- $abandonedUploads = new GetAbandonedUploads();
- $data['abandoned_uploads'] = $abandonedUploads->get();
- $sql = "select count(ul.rowid) as count, p.display_name as project_name, ul.uploadtime, u.display_name as user_name, u.username FROM upload_logs ul JOIN users u ON ul.user_id = u.rowid JOIN projects p on ul.project_id = p.rowid GROUP BY (uploadtime);";
- $uploads = $database->queryArray($sql);
- $data['active_uploads'] = $uploads;
- return (new View())->render("admin/data.php", $data);
- }
- }
|