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
5 changes: 5 additions & 0 deletions Mastery Transcript/CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,8 @@
++$count;
$sql[$count][0] = '1.6.00';
$sql[$count][1] = "";

//v1.6.01
++$count;
$sql[$count][0] = '1.6.01';
$sql[$count][1] = "";
4 changes: 4 additions & 0 deletions Mastery Transcript/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
CHANGELOG
=========
v1.6.01
-------
Added comprehensive file upload tracking system to monitor and manage all file uploads across the system

v1.6.00
-------
Gibbon v28 Compatibility
Expand Down
16 changes: 13 additions & 3 deletions Mastery Transcript/credits_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\MasteryTranscript\Domain\CreditGateway;
use Gibbon\Module\MasteryTranscript\Domain\CreditMentorGateway;

Expand Down Expand Up @@ -67,21 +67,31 @@
}

//Deal with file upload
$fileMetaData = null;
if (!empty($_FILES['file']['tmp_name'])) {
$fileUploader = new FileUploader($pdo, $session);
$logo = $fileUploader->uploadFromPost($_FILES['file'], 'masteryTranscript_creditLogo_'.$data['name']);

if (empty($logo)) {
$partialFail = true;
}
else {
} else {
$data['logo'] = $logo;
$fileMetaData = $fileUploader->getFileMetaData($logo);
}
}

// Create the record
$masteryTranscriptCreditID = $creditGateway->insert($data);

// Record file tracking
if (!empty($fileMetaData) && !empty($masteryTranscriptCreditID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'masteryTranscriptCredit', $masteryTranscriptCreditID, 'logo');

if (empty($gibbonFileID)) {
$partialFail = true;
}
}

//Deal with mentors
$creditMentorGateway = $container->get(CreditMentorGateway::class);
$gibbonPersonIDs = (isset($_POST['gibbonPersonID']) && is_array($_POST['gibbonPersonID'])) ? $_POST['gibbonPersonID'] : array();
Expand Down
29 changes: 26 additions & 3 deletions Mastery Transcript/credits_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\MasteryTranscript\Domain\CreditGateway;
use Gibbon\Module\MasteryTranscript\Domain\CreditMentorGateway;

Expand Down Expand Up @@ -66,22 +66,45 @@
}

//Deal with file upload
$fileMetaData = null;
$data['logo'] = $_POST['logo'];
if (!empty($_FILES['file']['tmp_name'])) {
$fileUploader = new FileUploader($pdo, $session);
$logo = $fileUploader->uploadFromPost($_FILES['file'], 'masteryTranscript_domainLogo_'.$data['name']);

if (empty($logo)) {
$partialFail = true;
}
else {
} else {
$data['logo'] = $logo;
$fileMetaData = $fileUploader->getFileMetaData($logo);
}
}

// Get old record for file deletion check
$oldRecord = $creditGateway->getByID($masteryTranscriptCreditID);

// Update the record
$updated = $creditGateway->update($masteryTranscriptCreditID, $data);

// Record file tracking
if (!empty($fileMetaData) && !empty($masteryTranscriptCreditID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload(
$fileMetaData,
'masteryTranscriptCredit',
$masteryTranscriptCreditID,
'logo'
);

if (empty($gibbonFileID)) {
$partialFail = true;
}
}

// Handle file deletion when user removes logo
if (empty($data['logo']) && !empty($oldRecord['logo'])) {
$deleted = $container->get(FileHandler::class)->deleteFile('masteryTranscriptCredit', $masteryTranscriptCreditID, 'logo');
}

//Deal with mentors
$creditMentorGateway = $container->get(CreditMentorGateway::class);
if (!$creditMentorGateway->deleteMentorsByCredit($masteryTranscriptCreditID)) {
Expand Down
21 changes: 18 additions & 3 deletions Mastery Transcript/domains_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\MasteryTranscript\Domain\DomainGateway;

require_once '../../gibbon.php';
Expand Down Expand Up @@ -60,21 +60,36 @@
}

//Deal with file upload
$fileMetaData = null;
if (!empty($_FILES['file']['tmp_name'])) {
$fileUploader = new FileUploader($pdo, $session);
$logo = $fileUploader->uploadFromPost($_FILES['file'], 'masteryTranscript_domainLogo_'.$data['name']);

if (empty($logo)) {
$partialFail = true;
}
else {
} else {
$data['logo'] = $logo;
$fileMetaData = $fileUploader->getFileMetaData($logo);
}
}

// Create the record
$masteryTranscriptDomainID = $domainGateway->insert($data);

// Record file tracking
if (!empty($fileMetaData) && !empty($masteryTranscriptDomainID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload(
$fileMetaData,
'masteryTranscriptDomain',
$masteryTranscriptDomainID,
'logo'
);

if (empty($gibbonFileID)) {
$partialFail = true;
}
}

if ($masteryTranscriptDomainID && !$partialFail) {
$URL .= "&return=success0&editID=$masteryTranscriptDomainID";
}
Expand Down
30 changes: 26 additions & 4 deletions Mastery Transcript/domains_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\MasteryTranscript\Domain\DomainGateway;

require_once '../../gibbon.php';
Expand Down Expand Up @@ -60,10 +60,9 @@
header("Location: {$URL}");
exit;
}




//Deal with file upload
$fileMetaData = null;
$data['logo'] = $_POST['logo'];
if (!empty($_FILES['file']['tmp_name'])) {
$fileUploader = new FileUploader($pdo, $session);
Expand All @@ -74,12 +73,35 @@
}
else {
$data['logo'] = $logo;
$fileMetaData = $fileUploader->getFileMetaData($logo);
}
}

// Get old record for file deletion check
$oldRecord = $domainGateway->getByID($masteryTranscriptDomainID);

// Update the record
$updated = $domainGateway->update($masteryTranscriptDomainID, $data);

// Handle file deletion when user removes logo
if (empty($data['logo']) && !empty($oldRecord['logo'])) {
$deleted = $container->get(FileHandler::class)->deleteFile('masteryTranscriptDomain', $masteryTranscriptDomainID, 'logo');
}

// Record file tracking
if (!empty($fileMetaData) && !empty($masteryTranscriptDomainID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload(
$fileMetaData,
'masteryTranscriptDomain',
$masteryTranscriptDomainID,
'logo'
);

if (empty($gibbonFileID)) {
$partialFail = true;
}
}

$URL .= !$updated
? "&return=error2"
: "&return=success0";
Expand Down
25 changes: 21 additions & 4 deletions Mastery Transcript/journey_record_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\MasteryTranscript\Domain\JourneyGateway;
use Gibbon\Domain\System\DiscussionGateway;
use Gibbon\Comms\NotificationSender;
Expand All @@ -44,6 +45,7 @@
} else {
// Proceed!
$journeyGateway = $container->get(JourneyGateway::class);
$discussionGateway = $container->get(DiscussionGateway::class);
$result = $container->get(JourneyGateway::class)->selectJourneyByID($masteryTranscriptJourneyID);

if ($result->rowCount() != 1) {
Expand All @@ -59,9 +61,7 @@
header("Location: {$URL}");
exit;
}

$discussionGateway = $container->get(DiscussionGateway::class);


$data = [
'foreignTable' => 'masteryTranscriptJourney',
'foreignTableID' => $masteryTranscriptJourneyID,
Expand All @@ -76,12 +76,14 @@
];

//Deal with file upload
$fileMetaData = null;
if ($data['attachmentType'] == 'File' && !empty($_FILES['evidenceFile']['tmp_name'])) {
$fileUploader = new FileUploader($pdo, $session);
$logo = $fileUploader->uploadFromPost($_FILES['evidenceFile'], 'masteryTranscript_evidence_'.$session->get('gibbonPersonID'));

if (!empty($logo)) {
$data['attachmentLocation'] = $logo;
$fileMetaData = $fileUploader->getFileMetaData($logo);
}
}

Expand All @@ -93,7 +95,22 @@
}

// Insert the record
$inserted = $discussionGateway->insert($data);
$gibbonDiscussionID = $discussionGateway->insert($data);
$inserted = $gibbonDiscussionID;

// Record file tracking
if (!empty($fileMetaData) && !empty($gibbonDiscussionID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload(
$fileMetaData,
'gibbonDiscussion',
$gibbonDiscussionID,
'attachmentLocation'
);

if (empty($gibbonFileID)) {
$inserted = false;
}
}

//Update the journey
$data = [
Expand Down
2 changes: 1 addition & 1 deletion Mastery Transcript/manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$entryURL = 'index.php';
$type = 'Additional';
$category = 'Assess';
$version = '1.6.00';
$version = '1.6.01';
$author = "Gibbon Foundation";
$url = "https://gibbonedu.org";

Expand Down
18 changes: 17 additions & 1 deletion Mastery Transcript/opportunities_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Contracts\Filesystem\FileHandler;
use Gibbon\Module\MasteryTranscript\Domain\OpportunityGateway;
use Gibbon\Module\MasteryTranscript\Domain\OpportunityMentorGateway;
use Gibbon\Module\MasteryTranscript\Domain\OpportunityCreditGateway;
Expand Down Expand Up @@ -64,6 +64,7 @@
}

//Deal with file upload
$fileMetaData = null;
if (!empty($_FILES['file']['tmp_name'])) {
$fileUploader = new FileUploader($pdo, $session);
$logo = $fileUploader->uploadFromPost($_FILES['file'], 'masteryTranscript_opportunityLogo_'.$data['name']);
Expand All @@ -73,12 +74,27 @@
}
else {
$data['logo'] = $logo;
$fileMetaData = $fileUploader->getFileMetaData($logo);
}
}

// Create the record
$masteryTranscriptOpportunityID = $opportunityGateway->insert($data);

// Record file tracking
if (!empty($fileMetaData) && !empty($masteryTranscriptOpportunityID)) {
$gibbonFileID = $container->get(FileHandler::class)->recordFileUpload(
$fileMetaData,
'masteryTranscriptOpportunity',
$masteryTranscriptOpportunityID,
'logo'
);

if (empty($gibbonFileID)) {
$partialFail = true;
}
}

//Deal with mentors
$opportunityMentorGateway = $container->get(OpportunityMentorGateway::class);
$gibbonPersonIDs = (isset($_POST['gibbonPersonID']) && is_array($_POST['gibbonPersonID'])) ? $_POST['gibbonPersonID'] : array();
Expand Down
Loading