Skip to content
Snippets Groups Projects
Commit 3b6cc5ce authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

Add handling of confirmation messages

parent 2d92feb3
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ class UNL_Procurement_Submission extends UNL_Procurement_LoginRequired
$this->handlePost();
}
} catch(Exception $e) {
throw new Exception('Saving bid failed'.$e, 403);
throw new Exception('Saving bid failed: '.$e, 403);
}
if (isset($this->options['id'])) {
......@@ -50,9 +50,7 @@ class UNL_Procurement_Submission extends UNL_Procurement_LoginRequired
throw new Exception('Could not save the bid');
}
if ($newbid) {
UNL_Procurement_Controller::redirect(UNL_Procurement_Controller::getURL().'?view=edit&id='.$bid->id.'&notice=newbid');
}
$_SESSION['notice'] = 'editbid';
break;
case 'fileadd':
foreach ($_FILES["upFiles"]["error"] as $key => $error) {
......@@ -84,6 +82,7 @@ class UNL_Procurement_Submission extends UNL_Procurement_LoginRequired
}
}
}
$_SESSION['notice'] = 'fileadd';
break;
case 'filedelete':
if (!($user = UNL_Procurement_User::getByUID(UNL_Procurement_Controller::getUser(true)->uid))) {
......@@ -95,10 +94,16 @@ class UNL_Procurement_Submission extends UNL_Procurement_LoginRequired
throw new Exception('Error deleting file '.$file->name);
}
}
$_SESSION['notice'] = 'filedelete';
break;
}//end switch
}//end foreach
UNL_Procurement_Controller::redirect(UNL_Procurement_Controller::getURL().'?'.$_SERVER['QUERY_STRING'].'&notice=bid');
if ($newbid) {
$_SESSION['notice'] = 'newbid';
UNL_Procurement_Controller::redirect(UNL_Procurement_Controller::getURL().'?view=edit&id='.$bid->id.'&notice=newbid');
}
UNL_Procurement_Controller::redirect(UNL_Procurement_Controller::getURL().'?'.$_SERVER['QUERY_STRING']);
}
function __get($var)
......
......@@ -7,12 +7,20 @@ WDN.initializePlugin('notice');
<a href="#" title="Close this notice">Close this notice</a>
</div>
<div class="message">
<?php if ($context->type == 'sendnews'): ?>
<h4>Distribution Successful.</h4>
<p>Your newsletter has been submitted to the distribution queue.</p>
<?php if ($context->type == 'newbid'): ?>
<h4>New Bid Added</h4>
<p>Your bid has been added to the 'pending' tab in the manager.</p>
<?php elseif ($context->type == 'editbid'): ?>
<h4>Bid Successfully Edited</h4>
<p>Changes have been saved.</p>
<?php elseif ($context->type == 'fileadd'): ?>
<h4>File(s) Added</h4>
<p>Your file(s) has/have been uploaded and attached to the bid.</p>
<?php elseif ($context->type == 'filedelete'): ?>
<h4>File(s) Deleted</h4>
<p>Successfully removed from the bid and deleted.</p>
<?php else: ?>
<h4>Thank you for submitting your newstip.</h4>
<p>If you have any questions, please contact us.</p>
<h4>Success!</h4>
<?php endif;?>
</div>
</div>
\ No newline at end of file
......@@ -76,6 +76,12 @@ if ($user = UNL_Procurement_Controller::getUser()) {
<div id="maincontent">
<!--THIS IS THE MAIN CONTENT AREA; WDN: see glossary item 'main content area' -->
<!-- InstanceBeginEditable name="maincontentarea" -->
<?php
if (isset($_SESSION['notice'])) {
echo $savvy->render(new UNL_Procurement_Confirmation($options = array('_type'=>$_SESSION['notice'])));
unset($_SESSION['notice']);
}
?>
<?php echo $savvy->render($context->actionable); ?>
<!-- InstanceEndEditable -->
<div class="clear"></div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment