/** * Create an object in the DB through a preset stored procedure (with same name as object's class). * Ignore specified variables within the object. * * @param unknown $object * @return multitype:boolean string */ function createObject($object) { // check for variable to have been initialized if (!isset($object) || empty($object)) { return array(false, "Invalid object specified"); } // get object's class $objClass = get_class($object); // build sql $sql = "EXEC dbo.Create" . $objClass; // get class variables $variables = get_class_vars($objClass); // get ignore vars $ignore_vars = null; if (isset($object->ignore_vars)) { $ignore_vars = $object->ignore_vars; } // add to sql query, each set variable foreach ($variables as $key => $value) { // skip certain variables if ($key == "ignore_vars" || isset($ignore_vars) && in_array($key, $ignore_vars)) { continue; } // get value $objVarVal = $object->{$key}; // add to sql if variable is set if (isset($objVarVal) and (!is_string($objVarVal) or is_string($objVarVal) and $objVarVal != "")) { // add to sql $sql .= " @" . $key . "='" . $objVarVal . "',"; } } // trim off last "," $sql = substr($sql, 0, -1); // execute non query $result = nonQuery($sql); // error check if (!$result[0]) { return array(false, "CREATE error. Object Class: " . $objClass . ". " . $result[1]); } // return positive result return array(true, "Object has been created"); }
getExtraParams(array("CompanyID", "Refresh", "OtherName", "AddAlias", "CompanyName", "SearchCompanyName", "NewAliasName")); // get the company name $CompanyName = getCompanyName($CompanyID); // set the title name to be displayed in the header $title = "Associated Names for: " . $CompanyName . ". Company ID: " . $CompanyID; // add the jqx workflow list script which generates the jqxgrid $scripts = "<script type=\"text/javascript\" src=\"PreviousOtherNames.js\" />"; // was the add selected company button hit MAKE COMPANY NAME GET ASSIGNED IN OTHERNAMES AND COMPANYID SET TO CURRENT ON SITE if (isset($AddAlias)) { // validate that the alias name is good if (isset($NewAliasName) && !empty($NewAliasName)) { $NewAliasName = htmlspecialchars($NewAliasName, ENT_QUOTES); // create the SQL statement for the insert $sql = "EXEC dbo.CreatePreviousOtherName @CompanyID=" . $CompanyID . ", @OtherName=" . "'" . $NewAliasName . "'"; // insert the record $result = nonQuery($sql); // message for the end user $validationMessage = "Update successful."; //clear text field $validated = true; $NewAliasName = ""; } else { $validated = false; $validationMessage = "You must add a valid alias."; } } // output the basic header HTML include "../Includes/header.php"; //QuickLinksBar dumpQuickLinks(array(array("ID" => "CompanyDetails", "url" => '../Company/CompanyDetails.php?CompanyID=' . $CompanyID, "name" => "Back To Company Details"))); echo '</br>';
function doDeleteFounder($founderID) { try { // include the data access class include_once "SQLUtils.php"; // init the return code $retVal = array(false, "No data."); // create sql statement $sql = "EXEC dbo.DeleteFounder @FounderID=" . $founderID; // remove the record $retVal = nonQuery($sql); } catch (Exception $e) { // set the success code $retVal[0] = false; // return the data formatted for a jqx grid $retVal[1] = $e->getMessage(); } // return to the caller return $retVal; }
/** * deletes the gene list item from the dx * */ function doDeleteDxListGene($extraParams) { try { // include the data access class include_once "SQLUtils.php"; // init the return code $retVal = array(false, "No data."); // create sql statement $sql = "EXEC dbo.DeleteDxListGene @ID=" . $extraParams[0]; // get the data $retVal = nonQuery($sql); } catch (Exception $e) { // set the success code $retVal[0] = False; // return the data formatted for a jqx grid $retVal[1] = $e->getMessage(); } // return to the caller return $retVal; }
/** * remove a Company/Affiliation association * * param int $founderID * param int $companyID */ function doUpdateCompanyAffiliationJoin($CompanyID, $ID) { try { // include the data access class include_once "SQLUtils.php"; // init the return code $retVal = array(false, "No data."); // create sql statement $sql = "EXEC dbo.UpdateCompanyAffiliationJoin @ID=" . $ID . ", @CompanyID=" . $CompanyID; // remove the record $retVal = nonQuery($sql); } catch (Exception $e) { // set the success code $retVal[0] = false; // return the data formatted for a jqx grid $retVal[1] = $e->getMessage(); } // return to the caller return $retVal; }