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 Enrichment and Flow/CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,8 @@
$sql[$count][1] = "
ALTER TABLE `enfPlannerEntry` ADD `timestampCreated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `date`;end
";

//v1.4.06
++$count;
$sql[$count][0] = '1.4.06';
$sql[$count][1] = "";
5 changes: 5 additions & 0 deletions Enrichment and Flow/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CHANGELOG
=========

v1.4.06
-------
Added comprehensive file upload tracking system to monitor and manage all file uploads across the system

v1.4.00
-------
Added session planning tools and streamlined the student planner
Expand Down
11 changes: 10 additions & 1 deletion Enrichment and Flow/credits_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

use Gibbon\Data\Validator;
use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Module\EnrichmentandFlow\Domain\CreditGateway;
use Gibbon\Module\EnrichmentandFlow\Domain\CreditMentorGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand Down Expand Up @@ -69,6 +69,7 @@
}

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

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

// Record file upload tracking
if (!empty($fileMetaData) && !empty($enfCreditID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'enfCredit', $enfCreditID, 'logo')) {
$partialFail = true;
}
}

//Deal with mentors
$creditMentorGateway = $container->get(CreditMentorGateway::class);
$gibbonPersonIDs = (isset($_POST['gibbonPersonID']) && is_array($_POST['gibbonPersonID'])) ? $_POST['gibbonPersonID'] : array();
Expand Down
16 changes: 15 additions & 1 deletion Enrichment and Flow/credits_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

use Gibbon\Data\Validator;
use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Module\EnrichmentandFlow\Domain\CreditGateway;
use Gibbon\Module\EnrichmentandFlow\Domain\CreditMentorGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand All @@ -43,6 +43,7 @@

// Proceed!
$creditGateway = $container->get(CreditGateway::class);
$credit = $creditGateway->getByID($enfCreditID);

$data = [
'enfDomainID' => $_POST['enfDomainID'] ?? '',
Expand All @@ -68,6 +69,7 @@
}

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

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

// Record file upload tracking
if (!empty($fileMetaData) && !empty($enfCreditID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'enfCredit', $enfCreditID, 'logo')) {
$partialFail = true;
}
}

if (empty($data['logo']) && !empty($credit['logo'])) {
$deleted = $container->get(FileHandler::class)->deleteFile('enfCredit', $enfCreditID, 'logo');
}

//Deal with mentors
$creditMentorGateway = $container->get(CreditMentorGateway::class);
if (!$creditMentorGateway->deleteMentorsByCredit($enfCreditID)) {
Expand Down
11 changes: 10 additions & 1 deletion Enrichment and Flow/domains_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

use Gibbon\Data\Validator;
use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Module\EnrichmentandFlow\Domain\DomainGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand Down Expand Up @@ -63,6 +63,7 @@
}

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

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

// Record file upload tracking
if (!empty($fileMetaData) && !empty($enfDomainID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'enfDomain', $enfDomainID, 'logo')) {
$partialFail = true;
}
}

if ($enfDomainID && !$partialFail) {
$URL .= "&return=success0&editID=$enfDomainID";
}
Expand Down
18 changes: 15 additions & 3 deletions Enrichment and Flow/domains_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

use Gibbon\Data\Validator;
use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Module\EnrichmentandFlow\Domain\DomainGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand All @@ -40,6 +40,7 @@

// Proceed!
$domainGateway = $container->get(DomainGateway::class);
$domain = $domainGateway->getByID($enfDomainID);

$data = [
'name' => $_POST['name'] ?? '',
Expand All @@ -64,9 +65,8 @@
exit;
}



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

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

// Record file upload tracking
if (!empty($fileMetaData) && !empty($enfDomainID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'enfDomain', $enfDomainID, 'logo')) {
$partialFail = true;
}
}

if (empty($data['logo']) && !empty($domain['logo'])) {
$deleted = $container->get(FileHandler::class)->deleteFile('enfDomain', $enfDomainID, 'logo');
}

$URL .= !$updated
? "&return=error2"
: "&return=success0";
Expand Down
19 changes: 14 additions & 5 deletions Enrichment and Flow/journey_record_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Gibbon\Domain\System\DiscussionGateway;
use Gibbon\Comms\NotificationSender;
use Gibbon\Domain\System\NotificationGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand All @@ -46,8 +47,9 @@
exit;
} else {
// Proceed!
$discussionGateway = $container->get(DiscussionGateway::class);
$journeyGateway = $container->get(JourneyGateway::class);
$result = $container->get(JourneyGateway::class)->selectJourneyByID($enfJourneyID);
$result = $journeyGateway->selectJourneyByID($enfJourneyID);

if ($result->rowCount() != 1) {
$URL .= '&return=error2';
Expand All @@ -63,8 +65,6 @@
exit;
}

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

$data = [
'foreignTable' => 'enfJourney',
'foreignTableID' => $enfJourneyID,
Expand All @@ -78,12 +78,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'], 'enf_evidence_'.$session->get('gibbonPersonID'));

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

Expand All @@ -95,7 +97,14 @@
}

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

// Record file upload tracking (file belongs to enfJourney, not gibbonDiscussion)
if (!empty($fileMetaData) && !empty($gibbonDiscussionID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'gibbonDiscussion', $gibbonDiscussionID, 'attachmentLocation')) {
$partialFail = true;
}
}

//Update the journey
$data = [
Expand All @@ -117,7 +126,7 @@
$notificationSender->sendNotifications();


$URL .= !$inserted && !$updated
$URL .= !$gibbonDiscussionID && !$updated
? "&return=error2"
: "&return=success0";

Expand Down
2 changes: 1 addition & 1 deletion Enrichment and Flow/manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$entryURL = 'planner.php';
$type = 'Additional';
$category = 'Learn';
$version = '1.4.05';
$version = '1.4.06';
$author = "Gibbon Foundation";
$url = "https://gibbonedu.org";

Expand Down
11 changes: 10 additions & 1 deletion Enrichment and Flow/opportunities_manage_addProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

use Gibbon\Data\Validator;
use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Module\EnrichmentandFlow\Domain\OpportunityGateway;
use Gibbon\Module\EnrichmentandFlow\Domain\OpportunityMentorGateway;
use Gibbon\Module\EnrichmentandFlow\Domain\OpportunityCreditGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand Down Expand Up @@ -67,6 +67,7 @@
}

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

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

// Record file upload tracking
if (!empty($fileMetaData) && !empty($enfOpportunityID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'enfOpportunity', $enfOpportunityID, 'logo')) {
$partialFail = true;
}
}

//Deal with mentors
$opportunityMentorGateway = $container->get(OpportunityMentorGateway::class);
$gibbonPersonIDs = (isset($_POST['gibbonPersonID']) && is_array($_POST['gibbonPersonID'])) ? $_POST['gibbonPersonID'] : array();
Expand Down
16 changes: 15 additions & 1 deletion Enrichment and Flow/opportunities_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

use Gibbon\Data\Validator;
use Gibbon\FileUploader;
use Gibbon\Services\Format;
use Gibbon\Module\EnrichmentandFlow\Domain\OpportunityGateway;
use Gibbon\Module\EnrichmentandFlow\Domain\OpportunityMentorGateway;
use Gibbon\Module\EnrichmentandFlow\Domain\OpportunityCreditGateway;
use Gibbon\Contracts\Filesystem\FileHandler;

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

Expand All @@ -43,6 +43,7 @@

// Proceed!
$opportunityGateway = $container->get(OpportunityGateway::class);
$opportunity = $opportunityGateway->getByID($enfOpportunityID);

$data = [
'name' => $_POST['name'] ?? '',
Expand All @@ -68,6 +69,7 @@
}

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

// Update the record
$updated = $opportunityGateway->update($enfOpportunityID, $data);

// Record file upload tracking
if (!empty($fileMetaData) && !empty($enfOpportunityID)) {
if (!$container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'enfOpportunity', $enfOpportunityID, 'logo')) {
$partialFail = true;
}
}

if (empty($data['logo']) && !empty($opportunity['logo'])) {
$deleted = $container->get(FileHandler::class)->deleteFile('enfOpportunity', $enfOpportunityID, 'logo');
}

//Deal with mentors
$opportunityMentorGateway = $container->get(OpportunityMentorGateway::class);
if (!$opportunityMentorGateway->deleteMentorsByOpportunity($enfOpportunityID)) {
Expand Down
2 changes: 1 addition & 1 deletion Enrichment and Flow/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
/**
* Sets version information.
*/
$moduleVersion = '1.4.05';
$moduleVersion = '1.4.06';
$coreVersion = '31.0.00';