echo $e->getMessage(); } break; case 'addPlatform': $platform = new Platform(); $platform->name = $_POST['platformName']; $platform->reportDisplayName = $_POST['platformName']; try { $platform->save(); echo $platform->primaryKey; } catch (Exception $e) { echo $e->getMessage(); } break; case 'deletePlatformNote': $platformNote = new PlatformNote(new NamedArguments(array('primaryKey' => $_GET['platformNoteID']))); try { $platformNote->delete(); } catch (Exception $e) { echo $e->getMessage(); } break; case 'submitPublisherNote': //update if (isset($_POST['publisherPlatformNoteID']) && $_POST['publisherPlatformNoteID'] != '') { $publisherPlatformNote = new PublisherPlatformNote(new NamedArguments(array('primaryKey' => $_POST['publisherPlatformNoteID']))); } else { $publisherPlatformNote = new PublisherPlatformNote(); } $publisherPlatformNote->publisherPlatformID = $_POST['publisherPlatformID']; $publisherPlatformNote->startYear = $_POST['startYear'];
//If Platform does not already exist, insert it and get the new ID if (!$platformID && $platformName) { $platform = new Platform(); $platform->platformID = ''; $platform->name = $platformName; $platform->reportDisplayName = $platformName; $platform->reportDropDownInd = '0'; $platform->organizationID = ''; try { $platform->save(); $platformID = $platform->primaryKey; } catch (Exception $e) { echo $e->getMessage(); } //also insert into Platform Note $platformNote = new PlatformNote(); $platformNote->platformID = $platformID; $platformNote->startYear = date('Y'); $platformNote->counterCompliantInd = ''; try { $platformNote->save(); } catch (Exception $e) { echo $e->getMessage(); } #add to output on screen $screenOutput .= "<br /><b>" . _("New Platform set up: ") . $platformName . " <a href='publisherPlatform.php?platformID=" . $platformID . "'>" . _("edit") . "</a></b>"; } $platformArray[] = $platformID; ################################################################# // PUBLISHER // Query to see if the Publisher already exists, if so, get the ID