Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index_parentPhotoDeleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

//Gibbon system-wide includes

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Http\Url;

include './gibbon.php';
Expand All @@ -47,6 +48,8 @@
header("Location: {$URL->withReturn('error2')}");
} else {
//UPDATE
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonPerson', $gibbonPersonID, 'image_240');

try {
$data = array('gibbonPersonID' => $gibbonPersonID);
$sql = "UPDATE gibbonPerson SET image_240='' WHERE gibbonPersonID=:gibbonPersonID";
Expand Down
5 changes: 5 additions & 0 deletions modules/Activities/activities_categories_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Data\Validator;
use Gibbon\Domain\Activities\ActivityCategoryGateway;

Expand Down Expand Up @@ -51,6 +52,10 @@

$deleted = $categoryGateway->delete($gibbonActivityCategoryID);

if ($deleted) {
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonActivityCategory', $gibbonActivityCategoryID, 'backgroundImage');
}

$URL .= !$deleted
? '&return=error2'
: '&return=success0';
Expand Down
10 changes: 10 additions & 0 deletions modules/Activities/activities_manage_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\Activities\ActivityPhotoGateway;

include '../../gibbon.php';

$gibbonActivityID = $_POST['gibbonActivityID'] ?? '';
Expand Down Expand Up @@ -50,6 +53,13 @@
$URL .= '&return=error2';
header("Location: {$URL}");
} else {
// Delete file attachments for all activity photos before deleting the activity
$activityPhotos = $container->get(ActivityPhotoGateway::class)->selectBy(['gibbonActivityID' => $gibbonActivityID], ['gibbonActivityPhotoID'])->fetchAll();

foreach ($activityPhotos as $photo) {
$photoDeleted = $container->get(FileHandler::class)->deleteFile('gibbonActivityPhoto', $photo['gibbonActivityPhotoID'], 'filePath');
}

//Write to database
try {
$data = array('gibbonActivityID' => $gibbonActivityID);
Expand Down
11 changes: 11 additions & 0 deletions modules/Data Updater/data_medical_manage_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\DataUpdater\MedicalConditionUpdateGateway;

include '../../gibbon.php';

$gibbonSchoolYearID = $_POST['gibbonSchoolYearID'] ?? $session->get('gibbonSchoolYearID');
Expand Down Expand Up @@ -51,6 +54,9 @@
$URL .= '&return=error2';
header("Location: {$URL}");
} else {
// Fetch child condition update IDs before deleting the parent record
$conditionUpdates = $container->get(MedicalConditionUpdateGateway::class)->selectBy(['gibbonPersonMedicalUpdateID' => $gibbonPersonMedicalUpdateID], ['gibbonPersonMedicalConditionUpdateID'])->fetchAll();

//Write to database
try {
$data = array('gibbonPersonMedicalUpdateID' => $gibbonPersonMedicalUpdateID);
Expand All @@ -62,6 +68,11 @@
header("Location: {$URL}");
exit();
}

// Delete file attachments for all condition updates linked to this medical update
foreach ($conditionUpdates as $conditionUpdate) {
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonPersonMedicalConditionUpdate', $conditionUpdate['gibbonPersonMedicalConditionUpdateID'], 'attachment');
}

$URLDelete = $URLDelete.'&return=success0';
header("Location: {$URLDelete}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\Departments\DepartmentResourceGateway;

include '../../gibbon.php';
Expand Down Expand Up @@ -73,6 +74,8 @@
exit();
}

$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonDepartmentResource', $gibbonDepartmentResourceID, 'url');

$URL .= '&return=success0';
header("Location: {$URL}");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

use Gibbon\Domain\FormalAssessment\ExternalAssessmentStudentGateway;
/*
Gibbon: the flexible, open school platform
Founded by Ross Parker at ICHK Secondary. Built by Ross Parker, Sandra Kuipers and the Gibbon community (https://gibbonedu.org/about/)
Expand All @@ -21,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\FormalAssessment\ExternalAssessmentStudentGateway;

include '../../gibbon.php';

$gibbonExternalAssessmentStudentID = $_POST['gibbonExternalAssessmentStudentID'] ?? '';
Expand Down Expand Up @@ -80,6 +81,8 @@
exit();
}

$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonExternalAssessmentStudent', $gibbonExternalAssessmentStudentID, 'attachment');

$URLDelete = $URLDelete.'&return=success0';
header("Location: {$URLDelete}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\FormalAssessment\InternalAssessmentColumnGateway;

include '../../gibbon.php';
Expand Down Expand Up @@ -57,6 +58,8 @@
exit();
}

$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonInternalAssessmentColumn', $gibbonInternalAssessmentColumnID, 'attachment');

$URLDelete = $URLDelete.'&return=success0';
header("Location: {$URLDelete}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/

use Gibbon\Data\Validator;
use Gibbon\Domain\FormalAssessment\InternalAssessmentEntryGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

require_once '../../gibbon.php';

Expand Down Expand Up @@ -55,6 +57,13 @@
}

$URL .= '&return=success0';

$entryRow = $container->get(InternalAssessmentEntryGateway::class)->selectBy(['gibbonPersonIDStudent' => $gibbonPersonID, 'gibbonInternalAssessmentColumnID' => $gibbonInternalAssessmentColumnID], ['gibbonInternalAssessmentEntryID'])->fetch();

if (!empty($entryRow)) {
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonInternalAssessmentEntry', $entryRow['gibbonInternalAssessmentEntryID'], 'response');
}

//Success 0
header("Location: {$URL}");
}
Expand Down
4 changes: 4 additions & 0 deletions modules/Library/library_manage_catalog_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;

include '../../gibbon.php';

include './moduleFunctions.php';
Expand Down Expand Up @@ -57,6 +59,8 @@
}

//Success 0
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonLibraryItem', $queryArr['gibbonLibraryItemID'], 'imageLocation');

$queryArr['q'] = "/modules/".getModuleName($_POST['address'])."/library_manage_catalog.php";
$queryArr['return'] = "success0";
header("Location: " . $baseURL . http_build_query($queryArr));
Expand Down
10 changes: 10 additions & 0 deletions modules/Markbook/markbook_edit_data_responseDeleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Data\Validator;
use Gibbon\Domain\Markbook\MarkbookEntryGateway;

require_once '../../gibbon.php';

Expand Down Expand Up @@ -55,6 +57,14 @@
}

$URL .= '&return=success0';

// Delete the file attachment for this entry response
$entryRow = $container->get(MarkbookEntryGateway::class)->selectBy(['gibbonPersonIDStudent' => $gibbonPersonID, 'gibbonMarkbookColumnID' => $gibbonMarkbookColumnID], ['gibbonMarkbookEntryID'])->fetch();

if (!empty($entryRow)) {
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonMarkbookEntry', $entryRow['gibbonMarkbookEntryID'], 'response');
}

//Success 0
header("Location: {$URL}");
}
Expand Down
12 changes: 12 additions & 0 deletions modules/Markbook/markbook_edit_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\Markbook\MarkbookEntryGateway;

include '../../gibbon.php';

$gibbonCourseClassID = $_POST['gibbonCourseClassID'] ?? '';
Expand Down Expand Up @@ -64,6 +67,15 @@
exit();
}

// Delete file attachments for all markbook entry responses for this column
$entryRows = $container->get(MarkbookEntryGateway::class)->selectBy(['gibbonMarkbookColumnID' => $gibbonMarkbookColumnID], ['gibbonMarkbookEntryID'])->fetchAll();

foreach ($entryRows as $entryRow) {
$entryFileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonMarkbookEntry', $entryRow['gibbonMarkbookEntryID'], 'response');
}

$columnFileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonMarkbookColumn', $gibbonMarkbookColumnID, 'attachment');

$URLDelete = $URLDelete.'&return=success0';
header("Location: {$URLDelete}");
}
Expand Down
13 changes: 12 additions & 1 deletion modules/Planner/planner_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\Planner\PlannerEntryHomeworkGateway;

include '../../gibbon.php';

$gibbonPlannerEntryID = $_POST['gibbonPlannerEntryID'] ?? '';
Expand Down Expand Up @@ -85,7 +88,15 @@
$URL .= "&return=error2$params";
header("Location: {$URL}");
} else {
//Write to database
//Write to database

// Delete file attachments for all homework entries before deleting the planner entry
$homeworkRows = $container->get(PlannerEntryHomeworkGateway::class)->selectBy(['gibbonPlannerEntryID' => $gibbonPlannerEntryID], ['gibbonPlannerEntryHomeworkID'])->fetchAll();

foreach ($homeworkRows as $homework) {
$homeWorkFileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonPlannerEntryHomework', $homework['gibbonPlannerEntryHomeworkID'], 'location');
}

try {
$data = array('gibbonPlannerEntryID' => $gibbonPlannerEntryID);
$sql = 'DELETE FROM gibbonPlannerEntryOutcome WHERE gibbonPlannerEntryID=:gibbonPlannerEntryID';
Expand Down
4 changes: 4 additions & 0 deletions modules/Planner/planner_view_full_submit_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;

//Gibbon system-wide includes
include '../../gibbon.php';

Expand Down Expand Up @@ -71,6 +73,8 @@
exit();
}

$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonPlannerEntryHomework', $gibbonPlannerEntryHomeworkID, 'location');

$URL .= '&return=success0';
header("Location: {$URL}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Data\Validator;

require_once '../../gibbon.php';
Expand Down Expand Up @@ -74,6 +75,8 @@
exit();
}

$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonPlannerEntryHomework', $gibbonPlannerEntryHomeworkID, 'location');

$URL .= '&return=success0';
header("Location: {$URL}");
}
Expand Down
3 changes: 3 additions & 0 deletions modules/Planner/units_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\Timetable\CourseGateway;

include '../../gibbon.php';
Expand Down Expand Up @@ -111,6 +112,8 @@
header("Location: {$URL}");
exit();
}

$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonUnit', $gibbonUnitID, 'attachment');

$URLDelete = $URLDelete.'&return=success0';
header("Location: {$URLDelete}");
Expand Down
9 changes: 9 additions & 0 deletions modules/Reports/archive_manage_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\Reports\Domain\ReportArchiveGateway;
use Gibbon\Module\Reports\Domain\ReportArchiveEntryGateway;

require_once '../../gibbon.php';

Expand Down Expand Up @@ -48,6 +50,13 @@
exit;
}

// Delete file attachments for all entries in this archive before deleting the archive
$archiveEntries = $container->get(ReportArchiveEntryGateway::class)->selectBy(['gibbonReportArchiveID' => $gibbonReportArchiveID], ['gibbonReportArchiveEntryID'])->fetchAll();

foreach ($archiveEntries as $entry) {
$fileDeleted = $container->get(FileHandler::class)->deleteFile('gibbonReportArchiveEntry', $entry['gibbonReportArchiveEntryID'], 'filePath');
}

$deleted = $reportArchiveGateway->delete($gibbonReportArchiveID);
$partialFail &= !$deleted;

Expand Down
9 changes: 9 additions & 0 deletions modules/Reports/templates_manage_section_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\System\FilePointerGateway;
use Gibbon\Module\Reports\Domain\ReportTemplateGateway;
use Gibbon\Module\Reports\Domain\ReportTemplateSectionGateway;

Expand Down Expand Up @@ -53,6 +55,13 @@
exit;
}

// Delete any file attachments associated with this section (dynamic config columns)
$pointers = $container->get(FilePointerGateway::class)->selectBy(['foreignTable' => 'gibbonReportTemplateSection', 'foreignTableID' => $gibbonReportTemplateSectionID])->fetchAll();

foreach ($pointers as $pointer) {
$fileDeleted = $container->get(FileHandler::class)->deleteFile($pointer['foreignTable'], $pointer['foreignTableID'], $pointer['foreignColumn']);
}

$deleted = $templateSectionGateway->delete($gibbonReportTemplateSectionID);

$URL .= !$deleted
Expand Down
16 changes: 16 additions & 0 deletions modules/School Admin/department_manage_deleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Domain\Departments\DepartmentResourceGateway;

include '../../gibbon.php';

$gibbonDepartmentID = $_POST['gibbonDepartmentID'] ?? '';
Expand Down Expand Up @@ -72,6 +75,19 @@
exit();
}

// Delete related department resources and files
$fileHandler = $container->get(FileHandler::class);
$departmentResourceGateway = $container->get(DepartmentResourceGateway::class);
$resourceResult = $departmentResourceGateway->selectBy(['gibbonDepartmentID' => $gibbonDepartmentID, 'type' => 'File'], ['gibbonDepartmentResourceID'])->fetchAll();

foreach ($resourceResult as $resource) {
$resourceDeleted = $fileHandler->deleteFile('gibbonDepartmentResource', $resource['gibbonDepartmentResourceID'], 'url');
}

$deleted = $departmentResourceGateway->deleteWhere(['gibbonDepartmentID' => $gibbonDepartmentID]);

$fileDeleted = $fileHandler->deleteFile('gibbonDepartment', $gibbonDepartmentID, 'logo');

$URLDelete = $URLDelete.'&return=success0';
header("Location: {$URLDelete}");
}
Expand Down
Loading
Loading