if ($_POST['resourceURL'] != 'http://') { $resource->resourceURL = $_POST['resourceURL']; } else { $resource->resourceURL = ''; } if ($_POST['resourceAltURL'] != 'http://') { $resource->resourceAltURL = $_POST['resourceAltURL']; } else { $resource->resourceAltURL = ''; } try { $resource->save(); echo $resource->primaryKey; $resourceID = $resource->primaryKey; //get the provider ID in case we insert what was entered in the provider text box as an organization link $organizationRole = new OrganizationRole(); $organizationRoleID = $organizationRole->getProviderID(); //add notes if ($_POST['noteText'] || $_POST['providerText'] && !$_POST['organizationID']) { //first, remove existing notes in case this was saved before $resource->removeResourceNotes(); //this is just to figure out what the creator entered note type ID is $noteType = new NoteType(); $resourceNote = new ResourceNote(); $resourceNote->resourceNoteID = ''; $resourceNote->updateLoginID = $loginID; $resourceNote->updateDate = date('Y-m-d'); $resourceNote->noteTypeID = $noteType->getInitialNoteTypeID(); $resourceNote->tabName = 'Product'; $resourceNote->resourceID = $resourceID; //only insert provider as note if it's been submitted
echo "display:none;"; } ?> margin-left:123px;'><input type='button' name='btn_searchOrganizationName' value='go!' class='searchButton' /></div> </td> </tr> <tr> <td class='searchRow'><label for='searchOrganizationRoleID'><b>Role</b></label> <br /> <select name='searchOrganizationRoleID' id='searchOrganizationRoleID' style='width:150px' onchange='javsacript:updateSearch();'> <option value=''>All</option> <?php $display = array(); $organizationRole = new OrganizationRole(); foreach ($organizationRole->allAsArray() as $display) { if ($_SESSION['org_organizationRoleID'] == $display['organizationRoleID'] && $reset != 'Y') { echo "<option value='" . $display['organizationRoleID'] . "' selected>" . $display['shortName'] . "</option>"; } else { echo "<option value='" . $display['organizationRoleID'] . "'>" . $display['shortName'] . "</option>"; } if ($letter == "N") { echo "<br />"; } } ?> </select> </td> </tr>
?> '> <?php if ($config->settings->resourcesModule == 'Y') { ?> <div style="width: 303px; float:right; border: 1px solid #DAD5C9; padding:5px;"> <h3>Helpful Links</h3> <div class='rightPanelLink' style='padding-left:10px;'><a href='summary.php?organizationID=<?php echo $organizationID; ?> ' target='_blank' class='helpfulLink'>Print View</a></div> <?php //get all possible roles, sort by name, get associated resources $org_role_obj = new OrganizationRole(); $org_roles = $org_role_obj->allAsArray(); usort($org_roles, function ($a, $b) { return strcmp($a["shortName"], $b["shortName"]); }); foreach ($org_roles as $role) { $resources = $organization->getResources($role["organizationRoleID"]); if (count($resources) > 0) { ?> <h4 style="margin-top:8px"><?php echo $role["shortName"]; ?> of:</h4> <div style="padding-left:10px;"> <?php foreach ($resources as $resource) {
//get aliases $sanitizedInstance = array(); $instance = new Alias(); $aliasArray = array(); foreach ($resource->getAliases() as $instance) { foreach (array_keys($instance->attributeNames) as $attributeName) { $sanitizedInstance[$attributeName] = $instance->{$attributeName}; } $sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey; $aliasType = new AliasType(new NamedArguments(array('primaryKey' => $instance->aliasTypeID))); $sanitizedInstance['aliasTypeShortName'] = $aliasType->shortName; array_push($aliasArray, $sanitizedInstance); } //get all organization roles for output in drop down $organizationRoleArray = array(); $organizationRoleObj = new OrganizationRole(); $organizationRoleArray = $organizationRoleObj->getArray(); //get organizations (already returned in an array) $orgArray = $resource->getOrganizationArray(); ?> <div id='div_resourceForm'> <form id='resourceForm'> <input type='hidden' name='editResourceID' id='editResourceID' value='<?php echo $resourceID; ?> '> <div class='formTitle' style='width:715px; margin-bottom:5px;position:relative;'><span class='headerText'><?php echo _("Edit Resource"); ?> </span></div>
$resource->createDate = date('Y-m-d'); $resource->updateLoginID = ''; $resource->updateDate = ''; $resource->titleText = $data[$_POST['titleText']]; $resource->resourceURL = $data[$_POST['resourceURL']]; $resource->resourceAltURL = $data[$_POST['resourceAltURL']]; $resource->providerText = $data[$_POST['providerText']]; $resource->statusID = 1; $resource->save(); $resource->setIsbnOrIssn($deduping_values); $inserted++; // Do we have to create an organization or attach the resource to an existing one? if ($data[$_POST['organization']]) { $organizationName = $data[$_POST['organization']]; $organization = new Organization(); $organizationRole = new OrganizationRole(); $organizationID = false; // If we use the Organizations module if ($config->settings->organizationsModule == 'Y') { $dbName = $config->settings->organizationsDatabaseName; // Does the organization already exists? $query = "SELECT count(*) AS count FROM {$dbName}.Organization WHERE UPPER(name) = '" . str_replace("'", "''", strtoupper($organizationName)) . "'"; $result = $organization->db->processQuery($query, 'assoc'); // If not, we try to create it if ($result['count'] == 0) { $query = "INSERT INTO {$dbName}.Organization SET createDate=NOW(), createLoginID='{$loginID}', name='" . mysql_escape_string($organizationName) . "'"; try { $result = $organization->db->processQuery($query); $organizationID = $result; $organizationsInserted++; array_push($arrayOrganizationsCreated, $organizationName);
foreach (array_keys($instance->attributeNames) as $attributeName) { $sanitizedInstance[$attributeName] = $instance->{$attributeName}; } $sanitizedInstance[$instance->primaryKeyName] = $instance->primaryKey; array_push($parentOrganizationArray, $sanitizedInstance); } //get organization roles $sanitizedInstance = array(); $instance = new OrganizationRole(); $organizationRoleProfileArray = array(); foreach ($organization->getOrganizationRoles() as $instance) { $organizationRoleProfileArray[] = $instance->organizationRoleID; } //get all org roles for output in drop down $organizationRoleArray = array(); $organizationRoleObj = new OrganizationRole(); $organizationRoleArray = $organizationRoleObj->allAsArray(); ?> <div id='div_organizationForm'> <form id='organizationForm'> <input type='hidden' name='editOrganizationID' id='editOrganizationID' value='<?php echo $organizationID; ?> '> <table class="thickboxTable" style="background-image:url('images/title.gif');background-repeat:no-repeat;width:340px;"> <tr> <td colspan='2'><span class='headerText'><?php if ($organizationID != "") { echo "Update Organization"; } else {