";
+
+ return $string;
+ }
+// -------------------------------------------------------------------------
+ /**
+ * Return resource name extract from XML metadata
+ * @param $record /SimpleXMLElement results of getRecord request
+ * @return string name of the resource
+ */
+ function getResourceName($record){
+ return (string) $record->{'name'};
+ }
+// -------------------------------------------------------------------------
+ /**
+ * Return the number of TIPPs of the resource, extract from XML metadata
+ * @param $record /SimpleXMLElement results of getRecord request
+ * @return int number of TIPPs
+ */
+ function getNbTipps($record){
+ $tipps = $record->{'TIPPs'};
+ $tmp = $tipps->attributes();
+ return (int) $tmp[0];
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * Perform a 'GetRecord' request
+ * @param string $type resource's type (title or package)
+ * @param string $id GOKb ID
+ * @return XMLElement Record: resource's informations
+ */
+ function getRecord($type, $id){
+
+ switch ($type) {
+ case 'title':
+ $record = $this->titleEndpoint->getRecord($id, 'gokb');
+ break;
+ case 'package':
+ $record = $this->packageEndpoint->getRecord($id, 'gokb');
+ break;
+ default:
+ return null;
+ }
+
+ $rec = $record->{'GetRecord'}->{'record'};
+ return $rec;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * create an array to stock identifiers for import treatment
+ * @param array $ids array(XML elements)
+ * @return type
+ */
+ function createIdentifiersArrayToImport($ids) {
+ foreach ($ids as $key => $value) {
+ $tmp = $value->attributes();
+ $identifiers["$tmp[0]"] = (string) $tmp[1];
+ }
+ return $identifiers;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Convert a string date (from XML GOKb record) into DateTime object
+ * @param string $xmlDate the date from XML record
+ * @return DateTIme
+ */
+ function convertXmlDateToDateTime($xmlDate){
+ $format = "Y-m-d H:i:s.u";
+ $date = DateTime::createFromFormat($format, $xmlDate);
+ return $date;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/admin/classes/domain/Identifier.php b/admin/classes/domain/Identifier.php
new file mode 100644
index 0000000..931f0c6
--- /dev/null
+++ b/admin/classes/domain/Identifier.php
@@ -0,0 +1,51 @@
+.
+ * *
+ * *************************************************************************************************************************
+ */
+
+/* Put in admin/classes/domain */
+
+class Identifier extends DatabaseObject {
+
+ //protected function overridePrimaryKeyName() {}; //TODO_A quoi ça sert ?? idem pour defineRelationShip etc ...
+
+
+ public function getIdentifierTypeID($type) {
+ $config = new Configuration();
+ $dbName = $config->settings->resourcesDatabaseName;
+ $query = "SELECT identifierTypeID FROM IdentifierType WHERE UPPER(identifierName) = '" . str_replace("'", "''", strtoupper($type)) . "'";
+ $result = $this->db->processQuery($query);
+
+ if (count($result) == 0) {//this type doesn't exist
+ //Have we to create this type ?
+ if (is_numeric($type)) { //this identifier type will be considered as "isxn" (come from csv import)
+ $id = 1;
+ } else { //we need to create this type
+ $query = "INSERT INTO $dbName.IdentifierType SET identifierName='" . mysql_escape_string($type) . "'"; //TODO_mysql_escape_string() OBSOLETE --> mysqli_escape_string
+ $result = $this->db->processQuery($query);
+ $id = $result[0];
+ }
+ } else {
+ $id = $result[0];
+ }
+
+ return $id;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/admin/classes/domain/ImportTool.php b/admin/classes/domain/ImportTool.php
new file mode 100644
index 0000000..da21874
--- /dev/null
+++ b/admin/classes/domain/ImportTool.php
@@ -0,0 +1,501 @@
+config = new Configuration();
+ self::$row = 0;
+ self::$inserted = 0;
+ self::$parentInserted = 0;
+ self::$parentAttached = 0;
+ self::$organizationsInserted = 0;
+ self::$organizationsAttached = 0;
+ self::$arrayOrganizationsCreated = array();
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * add a resource to the database
+ * @param $datas array all datas about the resource
+ * @param $identifiers array list of identifiers (type =>identifier)
+ */
+ public function addResource($datas, $identifiers) {
+ $res_tmp = new Resource();
+ $org = null;
+ $parentName = null;
+ $resourceType = null;
+ $aliases = null;
+
+ /* * *****************************************
+ * * Has the resource to be inserted ? **
+ * ***************************************** */
+ $hasToBeInserted = $this->hasResourceToBeInserted($datas, $identifiers);
+
+ /* * **************************************
+ * * Datas insertion **
+ * ************************************** */
+ if ($hasToBeInserted) {
+ $res = $res_tmp->getNewInitializedResource();
+
+//Resource treatment
+ foreach ($datas as $key => $value) {
+ switch ($key) {
+ case "organization":
+ $org = $value;
+ break;
+ case "parentResource":
+ $parentName = $value;
+ break;
+ case "resourceType":
+ $resourceType = $value;
+ break;
+ case "alias":
+ $aliases = $value;
+ break;
+ default:
+ $res->$key = (string) $value;
+ break;
+ }
+ }
+
+//ResourceType treatment
+ if ($resourceType != NULL) {
+ $res->resourceTypeID = ResourceType::getResourceTypeID((string) $resourceType);
+ }
+
+ $res->save();
+
+//Resource identifiers treatment
+ $res->setIdentifiers($identifiers);
+
+//Aliases treatment (history name change/ variant name)
+ if ($aliases != null) {
+ $this->aliasesTreatment($aliases, $res->resourceID);
+ }
+
+//Parent treatment
+ if ($parentName != null) {
+ $parentID = $this->parentTreatment($parentName);
+ $this->setResourcesRelationship($res->resourceID, $parentID);
+ }
+
+ if ($org != null) { // Do we have to create an organization or attach the resource to an existing one?
+ $this->organizationTreatment($org, $res->resourceID);
+ }
+ self::$inserted++;
+ }
+ self::$row++;
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * Link a resource with an organization
+ * @param int $roleID ID of the organization's role (DB primaryKey)
+ * @param int $resourceID ID of the resource (DB primaryKey)
+ * @param int $organizationID ID of the organization (DB primaryKey)
+ */
+ private function setResourceOrganizationLink($roleID, $resourceID, $organizationID) {
+ $organizationLink = new ResourceOrganizationLink();
+ $organizationLink->organizationRoleID = $roleID;
+ $organizationLink->resourceID = $resourceID;
+ $organizationLink->organizationID = $organizationID;
+ $organizationLink->save();
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * Check if this resource already exist and if we have to add it in DB
+ * @param type $datas array, all resource datas
+ * @param type $identifiers array, all resource's identifiers
+ * @return boolean true if the resource has to be inserterted, false else
+ */
+ private function hasResourceToBeInserted($datas, $identifiers) {
+ $res_tmp = new Resource();
+ $hasToBeInserted = true;
+
+ $resource = $res_tmp->getResourceByIdentifiers($identifiers);
+ $nbRes = count($resource);
+
+ if ($nbRes == 0) { //resource doesn't exist, we have to create it
+ $hasToBeInserted = true;
+ } else {
+ $ii = 0;
+ while ($hasToBeInserted && $ii<$nbRes){
+ $res = $resource[$ii];
+ $parents = $res->getParentResources(); // getParentResources return an array of relationship
+ $nbParents = count($parents);
+
+ if (($datas['parentResource']) && $nbParents == 0) {
+ $hasToBeInserted = true;
+ } elseif ($datas['parentResource']) { //both resources have a parent
+ $hasToBeInserted = true;
+ foreach ($parents as $relationship) {
+ $parentResource = new Resource(new NamedArguments(array('primaryKey' => "$relationship->relatedResourceID")));
+ if ($parentResource->titleText == $datas['parentResource']) {
+ $hasToBeInserted = false;
+ }
+ }
+ } elseif ($nbParents != 0) { //existing resource got a parent but not the new one
+ $hasToBeInserted = true;
+ } else {
+ $hasToBeInserted = false;
+ }
+ $ii++;
+ }
+ }
+ return $hasToBeInserted;
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * Create resource's parent or attach it
+ * @param string $parentName
+ * @return int ID of the parent resource
+ */
+ private function parentTreatment($parentName) {
+ $resource = new Resource();
+ $parentResource = $resource->getResourceByTitle($parentName);
+
+// Search if such parent exists
+ $numberOfParents = count($parentResource);
+ $parentID = null;
+
+ if ($numberOfParents == 0) { // If not, create parent
+ $parentResource = $resource->getNewInitializedResource();
+ $parentResource->titleText = $parentName; //TODO _ appel à addResource avec $datas complètes
+ $parentResource->save();
+ $parentID = $parentResource->resourceID;
+ self::$parentInserted++;
+ } elseif ($numberOfParents == 1) {// Else, attach the resource to its parent.
+ $parentID = $parentResource[0]->resourceID;
+ self::$parentAttached++;
+ }
+
+ return $parentID;
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * Link a resource with its parent
+ * @param int $resourceID ID of the resource
+ * @param int $parentID ID of the parent resouce
+ */
+ private function setResourcesRelationship($resourceID, $parentID) {
+ if ($parentID != NULL) {
+ $resourceRelationship = new ResourceRelationship();
+ $resourceRelationship->resourceID = $resourceID;
+ $resourceRelationship->relatedResourceID = $parentID;
+ $resourceRelationship->relationshipTypeID = '1'; //hardcoded because we're only allowing parent relationships
+ if (!$resourceRelationship->exists()) {
+ $resourceRelationship->save();
+ }
+ }
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * create reosurce's organization or attach it
+ * @param array $organizations array(role => organization)
+ * @param int $resourceID ID of the resource
+ */
+ private function organizationTreatment($organizations, $resourceID) {
+ $loginID = $_SESSION['loginID'];
+ $htmlContent = '';
+
+//Organizations module is used
+ if ($this->config->settings->organizationsModule == 'Y') {
+ $dbName = $this->config->settings->organizationsDatabaseName;
+ foreach ($organizations as $role => $orgName) {
+ $organization = new Organization();
+ $organizationRole = new OrganizationRole();
+ $organizationID = false;
+
+// Does the organization already exists?
+ $query = "SELECT count(*) AS count FROM $dbName.Organization WHERE UPPER(name) = '" . str_replace("'", "''", strtoupper($orgName)) . "'";
+ $result = $organization->db->processQuery($query, 'assoc');
+
+ if ($result['count'] == 0) { // If not, we try to create it
+ $organizationID = $this->createOrgWithOrganizationModule($orgName);
+ }
+// If yes, we attach it to our resource
+ elseif ($result['count'] == 1) {
+ $query = "SELECT name, organizationID FROM $dbName.Organization WHERE UPPER(name) = '" . str_replace("'", "''", strtoupper($orgName)) . "'";
+ $result = $organization->db->processQuery($query, 'assoc');
+ $organizationID = $result['organizationID'];
+ self::$organizationsAttached++;
+ } else {
+ $htmlContent .= "
Error: more than one organization is called $orgName. Please consider deduping.
";
+ }
+
+ if ($organizationID) {
+// Get role
+ $query = "SELECT organizationRoleID from OrganizationRole WHERE shortName='" . mysql_escape_string($role) . "'";
+ $result = $organization->db->processQuery($query);
+ $roleID = ($result[0]) ? $result[0] : 1;
+// Does the organizationRole already exists?
+ $query = "SELECT count(*) AS count FROM $dbName.OrganizationRoleProfile WHERE organizationID=$organizationID AND organizationRoleID=$roleID";
+ $result = $organization->db->processQuery($query, 'assoc');
+// If not, we try to create it
+ if ($result['count'] == 0) {
+ $query = "INSERT INTO $dbName.OrganizationRoleProfile SET organizationID=$organizationID, organizationRoleID=$roleID";
+ try {
+ $result = $organization->db->processQuery($query);
+ if (!in_array($orgName, self::$arrayOrganizationsCreated)) {
+ self::$organizationsInserted++;
+ array_push(self::$arrayOrganizationsCreated, $orgName);
+ }
+ } catch (Exception $e) {
+ $htmlContent .= "
Unable to associate organization $orgName with its role.
";
+ }
+ }
+ }
+
+// Let's link the resource and the organization.
+// (this has to be done whether the module Organization is in use or not)
+ if ($organizationID && $roleID) {
+ $this->setResourceOrganizationLink($roleID, $resourceID, $organizationID);
+ }
+ }
+
+//Hierarchy platform/provider ( gokb packages)
+ if ($organizations['platform']) {
+ $platformName = $organizations['platform'];
+ $providerName = $organizations['provider'];
+ $this->setOrganizationsHierarchy($platformName, $providerName);
+ }
+ }
+// If we do not use the Organizations module
+ else {
+ foreach ($organizations as $role => $orgName) {
+ $organization = new Organization();
+ $organizationRole = new OrganizationRole();
+ $organizationID = false;
+// Search if such organization already exists
+ $organizationExists = $organization->alreadyExists($orgName);
+
+ if (!$organizationExists) { // If not, create it
+ $organization->shortName = $orgName;
+ $organization->save();
+ $organizationID = $organization->organizationID();
+ self::$organizationsInserted++;
+ array_push(self::$arrayOrganizationsCreated, $orgName);
+ } elseif ($organizationExists == 1) { // Else,
+ $organizationID = $organization->getOrganizationIDByName($orgName);
+ self::$organizationsAttached++;
+ } else {
+ $htmlContent .= "
Error: more than one organization is called $orgName. Please consider deduping.
";
+ }
+
+ $organizationRoles = $organizationRole->getArray();
+ if (($roleID = array_search($role, $organizationRoles)) == 0) {
+// If role is not found, fallback to the first one.
+ $roleID = '1';
+ }
+
+// Let's link the resource and the organization.
+// (this has to be done whether the module Organization is in use or not)
+ if ($organizationID && $roleID) {
+ $this->setResourceOrganizationLink($roleID, $resourceID, $organizationID);
+ }
+ }
+ }
+ echo $htmlContent;
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * create a new organization when Organization module is activated
+ * @param string $orgName
+ * @return int ID of the created organization
+ */
+ private function createOrgWithOrganizationModule($orgName) {
+ $dbName = $this->config->settings->organizationsDatabaseName;
+ $loginID = $_SESSION['loginID'];
+
+ $organization = new Organization();
+ $query = "INSERT INTO $dbName.Organization SET createDate=NOW(), createLoginID='$loginID', name='" . mysql_escape_string($orgName) . "'";
+ try {
+ $result = $organization->db->processQuery($query);
+ $organizationID = $result;
+ self::$organizationsInserted++;
+ array_push(self::$arrayOrganizationsCreated, $orgName);
+ } catch (Exception $e) {
+// $htmlContent .= "
Organization $orgName could not be added.
";
+ }
+ return $organizationID;
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * child/parent organizations treatment
+ * @param string $orgName
+ * @param string $parentOrgName
+ */
+ private function setOrganizationsHierarchy($orgName, $parentOrgName) {
+ $orgID = null;
+ $parentID = null;
+ $relation = new OrganizationHierarchy();
+ $dbName = $this->config->settings->organizationsDatabaseName;
+
+ $query = "SELECT organizationID "
+ . "FROM $dbName.Organization "
+ . "WHERE upper(name) = '" . str_replace("'", "''", strtoupper($orgName)) . "'";
+ $result = $relation->db->processQuery($query);
+
+ if (count($result) > 0)
+ $orgID = $result[0];
+
+
+ $query = "SELECT organizationID "
+ . "FROM $dbName.Organization "
+ . "WHERE upper(name) = '" . str_replace("'", "''", strtoupper($parentOrgName)) . "'";
+ $result = $relation->db->processQuery($query);
+ if (count($result) > 0)
+ $parentID = $result[0];
+
+
+ if (($orgID != null) &&
+ ($parentID != null) &&
+ (!($relation->relationExists($orgID, $parentID)))) {
+// $relation->organizationID = $orgID;
+// $relation->parentOrganizationID = $parentID;
+// $relation->save();
+//$query = "INSERT INTO $dbName.OrganizationHierarchy SET `organizationID`=$orgID, `parentOrganizationID`=$parentID ;";
+ $query = "INSERT INTO $dbName.OrganizationHierarchy VALUES ($orgID, $parentID);";
+ $relation->db->processQuery($query);
+ }
+ }
+
+// -------------------------------------------------------------------------
+
+ /**
+ * Add resource aliases to resource object in DB
+ * @param array $aliases array (alias type => array (alias name))
+ * @param int $resourceID ID of the resource
+ */
+ private function aliasesTreatment($aliases, $resourceID) {
+ foreach ($aliases as $aliasType => $aliasArray) {
+ $typeID = AliasType::getAliasTypeID((string) $aliasType);
+ foreach ($aliasArray as $alias) {
+ $al = new Alias();
+ $al->resourceID = $resourceID;
+ $al->aliasTypeID = $typeID;
+ $al->shortName = (string) $alias;
+ $al->save();
+ }
+ }
+ }
+
+// -------------------------------------------------------------------------
+ /* * ******************************
+ * Accessors *
+ * ****************************** */
+ public static function getNbRow() {
+ return self::$row;
+ }
+
+// -------------------------------------------------------------------------
+ public static function getNbInserted() {
+ return self::$inserted;
+ }
+
+// -------------------------------------------------------------------------
+ public static function getNbParentInserted() {
+ return self::$parentInserted;
+ }
+
+// -------------------------------------------------------------------------
+ public static function getNbParentAttached() {
+ return self::$parentAttached;
+ }
+
+// -------------------------------------------------------------------------
+ public static function getNbOrganizationsInserted() {
+ return self::$organizationsInserted;
+ }
+
+// -------------------------------------------------------------------------
+ public static function getNbOrganizationsAttached() {
+ return self::$organizationsAttached;
+ }
+
+// -------------------------------------------------------------------------
+ public static function getArrayOrganizationsCreated() {
+ return self::$arrayOrganizationsCreated;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/admin/classes/domain/MyClient.php b/admin/classes/domain/MyClient.php
new file mode 100644
index 0000000..a5364a6
--- /dev/null
+++ b/admin/classes/domain/MyClient.php
@@ -0,0 +1,18 @@
+.
-**
-**************************************************************************************************************************
-*/
+ * *************************************************************************************************************************
+ * * CORAL Resources Module v. 1.2
+ * *
+ * * Copyright (c) 2010 University of Notre Dame
+ * *
+ * * This file is part of CORAL.
+ * *
+ * * CORAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * *
+ * * CORAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License along with CORAL. If not, see .
+ * *
+ * *************************************************************************************************************************
+ */
+include_once $_SERVER['DOCUMENT_ROOT'] . "resources/admin/classes/domain/Identifier.php";
+include_once $_SERVER['DOCUMENT_ROOT'] . "resources/admin/classes/domain/IsbnOrIssn.php";
class Resource extends DatabaseObject {
- protected function defineRelationships() {}
-
- protected function defineIsbnOrIssn() {}
+ protected function defineRelationships() {
+
+ }
- protected function overridePrimaryKeyName() {}
+ protected function defineIsbnOrIssn() {
+
+ }
- //returns resource objects by title
- public function getResourceByTitle($title){
+ protected function overridePrimaryKeyName() {
+
+ }
- $query = "SELECT *
+ //returns resource objects by title
+ public function getResourceByTitle($title) {
+
+ $query = "SELECT *
FROM Resource
WHERE UPPER(titleText) = '" . str_replace("'", "''", strtoupper($title)) . "'
ORDER BY 1";
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceID'])){
- $object = new Resource(new NamedArguments(array('primaryKey' => $result['resourceID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new Resource(new NamedArguments(array('primaryKey' => $row['resourceID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
- }
-
- //returns resource objects by title
- public function getResourceByIsbnOrISSN($isbnOrISSN){
-
- $query = "SELECT DISTINCT(resourceID)
- FROM IsbnOrIssn";
+ $result = $this->db->processQuery($query, 'assoc');
- $i = 0;
+ $objects = array();
- if (!is_array($isbnOrISSN)) {
- $value = $isbnOrISSN;
- $isbnOrISSN = array($value);
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceID'])) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $result['resourceID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $row['resourceID'])));
+ array_push($objects, $object);
+ }
+ }
- foreach ($isbnOrISSN as $value) {
- $query .= ($i == 0) ? " WHERE " : " OR ";
- $query .= "isbnOrIssn = '" . $this->db->escapeString($value) . "'";
- $i++;
- }
-
- $query .= " ORDER BY 1";
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceID'])){
- $object = new Resource(new NamedArguments(array('primaryKey' => $result['resourceID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new Resource(new NamedArguments(array('primaryKey' => $row['resourceID'])));
- array_push($objects, $object);
- }
- }
+ return $objects;
+ }
- return $objects;
- }
+ //returns resource objects by title
+ public function getResourceByIsbnOrISSN($isbnOrISSN) {
+
+ // $query = "SELECT DISTINCT(resourceID)
+ //FROM IsbnOrIssn";
+ $query = "SELECT DISTINCT(resourceID)
+ FROM Identifier";
+
+ $i = 0;
+
+ if (!is_array($isbnOrISSN)) {
+ $value = $isbnOrISSN;
+ $isbnOrISSN = array($value);
+ }
+
+ foreach ($isbnOrISSN as $value) {
+ $query .= ($i == 0) ? " WHERE " : " OR ";
+ // $query .= "isbnOrIssn = '" . $this->db->escapeString($value) . "'";
+ $query .= "identifier = '" . $this->db->escapeString($value) . "'"
+ . " AND identifierTypeID < 6";
+ $i++;
+ }
+
+ $query .= " ORDER BY 1";
+
+ $result = $this->db->processQuery($query, 'assoc');
+
+ $objects = array();
+
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceID'])) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $result['resourceID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $row['resourceID'])));
+ array_push($objects, $object);
+ }
+ }
+
+ return $objects;
+ }
- public function getIsbnOrIssn() {
- $query = "SELECT *
- FROM IsbnOrIssn
+ public function getIsbnOrIssn() {
+// $query = "SELECT *
+// FROM IsbnOrIssn
+// WHERE resourceID = '" . $this->resourceID . "'
+// ORDER BY 1";
+ $query = "SELECT *
+ FROM Identifier
WHERE resourceID = '" . $this->resourceID . "'
+ AND identifierTypeID < 6
ORDER BY 1";
+
+
+
+ $result = $this->db->processQuery($query, 'assoc');
+
+ $objects = array();
+
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+// if (isset($result['isbnOrIssnID'])) {
+// $object = new IsbnOrIssn(new NamedArguments(array('primaryKey' => $result['isbnOrIssnID'])));
+// array_push($objects, $object);
+// } else {
+// foreach ($result as $row) {
+// $object = new IsbnOrIssn(new NamedArguments(array('primaryKey' => $row['isbnOrIssnID'])));
+// array_push($objects, $object);
+// }
+// }
+
+ if (isset($result['identifierID'])) {
+ $object = new Identifier(new NamedArguments(array('primaryKey' => $result['identifierID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Identifier(new NamedArguments(array('primaryKey' => $row['identifierID'])));
+ array_push($objects, $object);
+ }
+ }
+
+
+ return $objects;
+ }
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['isbnOrIssnID'])){
- $object = new IsbnOrIssn(new NamedArguments(array('primaryKey' => $result['isbnOrIssnID'])));
- array_push($objects, $object);
- } else {
- foreach ($result as $row) {
- $object = new IsbnOrIssn(new NamedArguments(array('primaryKey' => $row['isbnOrIssnID'])));
- array_push($objects, $object);
- }
-
- }
-
- return $objects;
-
- }
-
- //returns array of parent resource objects
- public function getParentResources(){
- return $this->getRelatedResources('resourceID');
- }
+ //returns array of parent resource objects
+ public function getParentResources() {
+ return $this->getRelatedResources('resourceID');
+ }
+ //returns array of child resource objects
+ public function getChildResources() {
+ return $this->getRelatedResources('relatedResourceID');
+ }
- //returns array of child resource objects
- public function getChildResources(){
- return $this->getRelatedResources('relatedResourceID');
- }
-
- // return array of related resource objects
- private function getRelatedResources($key) {
+ // return array of related resource objects
+ private function getRelatedResources($key) {
- $query = "SELECT *
+ $query = "SELECT *
FROM ResourceRelationship
WHERE $key = '" . $this->resourceID . "'
AND relationshipTypeID = '1'
ORDER BY 1";
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result[$key])){
- $object = new ResourceRelationship(new NamedArguments(array('primaryKey' => $result['resourceRelationshipID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ResourceRelationship(new NamedArguments(array('primaryKey' => $row['resourceRelationshipID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
-
- }
-
- //returns array of purchase site objects
- public function getResourcePurchaseSites(){
-
- $query = "SELECT PurchaseSite.* FROM PurchaseSite, ResourcePurchaseSiteLink RPSL where RPSL.purchaseSiteID = PurchaseSite.purchaseSiteID AND resourceID = '" . $this->resourceID . "'";
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['purchaseSiteID'])){
- $object = new PurchaseSite(new NamedArguments(array('primaryKey' => $result['purchaseSiteID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new PurchaseSite(new NamedArguments(array('primaryKey' => $row['purchaseSiteID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
- }
-
-
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
- //returns array of ResourcePayment objects
- public function getResourcePayments(){
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result[$key])) {
+ $object = new ResourceRelationship(new NamedArguments(array('primaryKey' => $result['resourceRelationshipID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ResourceRelationship(new NamedArguments(array('primaryKey' => $row['resourceRelationshipID'])));
+ array_push($objects, $object);
+ }
+ }
- $query = "SELECT * FROM ResourcePayment WHERE resourceID = '" . $this->resourceID . "' ORDER BY year DESC, fundName, subscriptionStartDate DESC";
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourcePaymentID'])){
- $object = new ResourcePayment(new NamedArguments(array('primaryKey' => $result['resourcePaymentID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ResourcePayment(new NamedArguments(array('primaryKey' => $row['resourcePaymentID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
- }
-
-
- //returns array of associated licenses
- public function getLicenseArray(){
- $config = new Configuration;
-
- //if the lic module is installed get the lic name from lic database
- if ($config->settings->licensingModule == 'Y'){
- $dbName = $config->settings->licensingDatabaseName;
-
- $resourceLicenseArray = array();
-
- $query = "SELECT * FROM ResourceLicenseLink WHERE resourceID = '" . $this->resourceID . "'";
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['licenseID'])){
- $licArray = array();
-
- //first, get the license name
- $query = "SELECT shortName FROM " . $dbName . ".License WHERE licenseID = " . $result['licenseID'];
-
- if ($licResult = mysql_query($query)){
- while ($licRow = mysql_fetch_assoc($licResult)){
- $licArray['license'] = $licRow['shortName'];
- $licArray['licenseID'] = $result['licenseID'];
- }
- }
-
- array_push($resourceLicenseArray, $licArray);
- }else{
- foreach ($result as $row) {
- $licArray = array();
-
- //first, get the license name
- $query = "SELECT shortName FROM " . $dbName . ".License WHERE licenseID = " . $row['licenseID'];
-
- if ($licResult = mysql_query($query)){
- while ($licRow = mysql_fetch_assoc($licResult)){
- $licArray['license'] = $licRow['shortName'];
- $licArray['licenseID'] = $row['licenseID'];
- }
- }
-
- array_push($resourceLicenseArray, $licArray);
+ return $objects;
+ }
- }
+ //returns array of purchase site objects
+ public function getResourcePurchaseSites() {
- }
+ $query = "SELECT PurchaseSite.* FROM PurchaseSite, ResourcePurchaseSiteLink RPSL where RPSL.purchaseSiteID = PurchaseSite.purchaseSiteID AND resourceID = '" . $this->resourceID . "'";
- return $resourceLicenseArray;
- }
- }
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['purchaseSiteID'])) {
+ $object = new PurchaseSite(new NamedArguments(array('primaryKey' => $result['purchaseSiteID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new PurchaseSite(new NamedArguments(array('primaryKey' => $row['purchaseSiteID'])));
+ array_push($objects, $object);
+ }
+ }
+ return $objects;
+ }
- //returns array of resource license status objects
- public function getResourceLicenseStatuses(){
+ //returns array of ResourcePayment objects
+ public function getResourcePayments() {
- $query = "SELECT * FROM ResourceLicenseStatus WHERE resourceID = '" . $this->resourceID . "' ORDER BY licenseStatusChangeDate desc;";
+ $query = "SELECT * FROM ResourcePayment WHERE resourceID = '" . $this->resourceID . "' ORDER BY year DESC, fundName, subscriptionStartDate DESC";
- $result = $this->db->processQuery($query, 'assoc');
+ $result = $this->db->processQuery($query, 'assoc');
- $objects = array();
+ $objects = array();
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceLicenseStatusID'])){
- $object = new ResourceLicenseStatus(new NamedArguments(array('primaryKey' => $result['resourceLicenseStatusID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ResourceLicenseStatus(new NamedArguments(array('primaryKey' => $row['resourceLicenseStatusID'])));
- array_push($objects, $object);
- }
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourcePaymentID'])) {
+ $object = new ResourcePayment(new NamedArguments(array('primaryKey' => $result['resourcePaymentID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ResourcePayment(new NamedArguments(array('primaryKey' => $row['resourcePaymentID'])));
+ array_push($objects, $object);
+ }
+ }
- return $objects;
- }
+ return $objects;
+ }
+ //returns array of associated licenses
+ public function getLicenseArray() {
+ $config = new Configuration;
+ //if the lic module is installed get the lic name from lic database
+ if ($config->settings->licensingModule == 'Y') {
+ $dbName = $config->settings->licensingDatabaseName;
+ $resourceLicenseArray = array();
- //returns LicenseStatusID of the most recent resource license status
- public function getCurrentResourceLicenseStatus(){
+ $query = "SELECT * FROM ResourceLicenseLink WHERE resourceID = '" . $this->resourceID . "'";
- $query = "SELECT licenseStatusID FROM ResourceLicenseStatus RLS WHERE resourceID = '" . $this->resourceID . "' AND licenseStatusChangeDate = (SELECT MAX(licenseStatusChangeDate) FROM ResourceLicenseStatus WHERE ResourceLicenseStatus.resourceID = '" . $this->resourceID . "') LIMIT 0,1;";
+ $result = $this->db->processQuery($query, 'assoc');
- $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['licenseStatusID'])){
- return $result['licenseStatusID'];
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['licenseID'])) {
+ $licArray = array();
- }
+ //first, get the license name
+ $query = "SELECT shortName FROM " . $dbName . ".License WHERE licenseID = " . $result['licenseID'];
+ if ($licResult = mysql_query($query)) {
+ while ($licRow = mysql_fetch_assoc($licResult)) {
+ $licArray['license'] = $licRow['shortName'];
+ $licArray['licenseID'] = $result['licenseID'];
+ }
+ }
- //returns array of authorized site objects
- public function getResourceAuthorizedSites(){
+ array_push($resourceLicenseArray, $licArray);
+ } else {
+ foreach ($result as $row) {
+ $licArray = array();
- $query = "SELECT AuthorizedSite.* FROM AuthorizedSite, ResourceAuthorizedSiteLink RPSL where RPSL.authorizedSiteID = AuthorizedSite.authorizedSiteID AND resourceID = '" . $this->resourceID . "'";
+ //first, get the license name
+ $query = "SELECT shortName FROM " . $dbName . ".License WHERE licenseID = " . $row['licenseID'];
- $result = $this->db->processQuery($query, 'assoc');
+ if ($licResult = mysql_query($query)) {
+ while ($licRow = mysql_fetch_assoc($licResult)) {
+ $licArray['license'] = $licRow['shortName'];
+ $licArray['licenseID'] = $row['licenseID'];
+ }
+ }
- $objects = array();
+ array_push($resourceLicenseArray, $licArray);
+ }
+ }
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['authorizedSiteID'])){
- $object = new AuthorizedSite(new NamedArguments(array('primaryKey' => $result['authorizedSiteID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new AuthorizedSite(new NamedArguments(array('primaryKey' => $row['authorizedSiteID'])));
- array_push($objects, $object);
- }
- }
+ return $resourceLicenseArray;
+ }
+ }
- return $objects;
- }
+ //returns array of resource license status objects
+ public function getResourceLicenseStatuses() {
+ $query = "SELECT * FROM ResourceLicenseStatus WHERE resourceID = '" . $this->resourceID . "' ORDER BY licenseStatusChangeDate desc;";
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
- //returns array of administering site objects
- public function getResourceAdministeringSites(){
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceLicenseStatusID'])) {
+ $object = new ResourceLicenseStatus(new NamedArguments(array('primaryKey' => $result['resourceLicenseStatusID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ResourceLicenseStatus(new NamedArguments(array('primaryKey' => $row['resourceLicenseStatusID'])));
+ array_push($objects, $object);
+ }
+ }
- $query = "SELECT AdministeringSite.* FROM AdministeringSite, ResourceAdministeringSiteLink RPSL where RPSL.administeringSiteID = AdministeringSite.administeringSiteID AND resourceID = '" . $this->resourceID . "'";
+ return $objects;
+ }
- $result = $this->db->processQuery($query, 'assoc');
+ //returns LicenseStatusID of the most recent resource license status
+ public function getCurrentResourceLicenseStatus() {
- $objects = array();
+ $query = "SELECT licenseStatusID FROM ResourceLicenseStatus RLS WHERE resourceID = '" . $this->resourceID . "' AND licenseStatusChangeDate = (SELECT MAX(licenseStatusChangeDate) FROM ResourceLicenseStatus WHERE ResourceLicenseStatus.resourceID = '" . $this->resourceID . "') LIMIT 0,1;";
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['administeringSiteID'])){
- $object = new AdministeringSite(new NamedArguments(array('primaryKey' => $result['administeringSiteID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new AdministeringSite(new NamedArguments(array('primaryKey' => $row['administeringSiteID'])));
- array_push($objects, $object);
- }
- }
+ $result = $this->db->processQuery($query, 'assoc');
- return $objects;
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['licenseStatusID'])) {
+ return $result['licenseStatusID'];
+ }
+ }
+ //returns array of authorized site objects
+ public function getResourceAuthorizedSites() {
+ $query = "SELECT AuthorizedSite.* FROM AuthorizedSite, ResourceAuthorizedSiteLink RPSL where RPSL.authorizedSiteID = AuthorizedSite.authorizedSiteID AND resourceID = '" . $this->resourceID . "'";
+ $result = $this->db->processQuery($query, 'assoc');
- //deletes all parent resources associated with this resource
- public function removeParentResources(){
+ $objects = array();
- $query = "DELETE FROM ResourceRelationship WHERE resourceID = '" . $this->resourceID . "'";
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['authorizedSiteID'])) {
+ $object = new AuthorizedSite(new NamedArguments(array('primaryKey' => $result['authorizedSiteID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new AuthorizedSite(new NamedArguments(array('primaryKey' => $row['authorizedSiteID'])));
+ array_push($objects, $object);
+ }
+ }
- return $this->db->processQuery($query);
- }
+ return $objects;
+ }
+ //returns array of administering site objects
+ public function getResourceAdministeringSites() {
+ $query = "SELECT AdministeringSite.* FROM AdministeringSite, ResourceAdministeringSiteLink RPSL where RPSL.administeringSiteID = AdministeringSite.administeringSiteID AND resourceID = '" . $this->resourceID . "'";
+ $result = $this->db->processQuery($query, 'assoc');
- //returns array of alias objects
- public function getAliases(){
+ $objects = array();
- $query = "SELECT * FROM Alias WHERE resourceID = '" . $this->resourceID . "' order by shortName";
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['administeringSiteID'])) {
+ $object = new AdministeringSite(new NamedArguments(array('primaryKey' => $result['administeringSiteID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new AdministeringSite(new NamedArguments(array('primaryKey' => $row['administeringSiteID'])));
+ array_push($objects, $object);
+ }
+ }
- $result = $this->db->processQuery($query, 'assoc');
+ return $objects;
+ }
- $objects = array();
+ //deletes all parent resources associated with this resource
+ public function removeParentResources() {
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['aliasID'])){
- $object = new Alias(new NamedArguments(array('primaryKey' => $result['aliasID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new Alias(new NamedArguments(array('primaryKey' => $row['aliasID'])));
- array_push($objects, $object);
- }
- }
+ $query = "DELETE FROM ResourceRelationship WHERE resourceID = '" . $this->resourceID . "'";
- return $objects;
- }
+ return $this->db->processQuery($query);
+ }
+ //returns array of alias objects
+ public function getAliases() {
+ $query = "SELECT * FROM Alias WHERE resourceID = '" . $this->resourceID . "' order by shortName";
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['aliasID'])) {
+ $object = new Alias(new NamedArguments(array('primaryKey' => $result['aliasID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Alias(new NamedArguments(array('primaryKey' => $row['aliasID'])));
+ array_push($objects, $object);
+ }
+ }
+ return $objects;
+ }
- //returns array of contact objects
- public function getUnarchivedContacts(){
+ //returns array of contact objects
+ public function getUnarchivedContacts() {
- $config = new Configuration;
- $contactsArray = array();
+ $config = new Configuration;
+ $contactsArray = array();
- //get resource specific contacts first
- $query = "SELECT C.*, GROUP_CONCAT(CR.shortName SEPARATOR ' ') contactRoles
+ //get resource specific contacts first
+ $query = "SELECT C.*, GROUP_CONCAT(CR.shortName SEPARATOR ' ') contactRoles
FROM Contact C, ContactRole CR, ContactRoleProfile CRP
WHERE (archiveDate = '0000-00-00' OR archiveDate is null)
AND C.contactID = CRP.contactID
@@ -413,36 +410,35 @@ public function getUnarchivedContacts(){
GROUP BY C.contactID
ORDER BY C.name";
- $result = $this->db->processQuery($query, 'assoc');
-
+ $result = $this->db->processQuery($query, 'assoc');
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['contactID'])){
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['contactID'])) {
- array_push($contactsArray, $resultArray);
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
+ array_push($contactsArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
- array_push($contactsArray, $resultArray);
- }
- }
+ array_push($contactsArray, $resultArray);
+ }
+ }
- //if the org module is installed also get the org contacts from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
+ //if the org module is installed also get the org contacts from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- $query = "SELECT distinct OC.*, O.name organizationName, GROUP_CONCAT(DISTINCT CR.shortName SEPARATOR ' ') contactRoles
+ $query = "SELECT distinct OC.*, O.name organizationName, GROUP_CONCAT(DISTINCT CR.shortName SEPARATOR ' ') contactRoles
FROM " . $dbName . ".Contact OC, " . $dbName . ".ContactRole CR, " . $dbName . ".ContactRoleProfile CRP, " . $dbName . ".Organization O, Resource R, ResourceOrganizationLink ROL
WHERE (OC.archiveDate = '0000-00-00' OR OC.archiveDate is null)
AND R.resourceID = ROL.resourceID
@@ -454,48 +450,41 @@ public function getUnarchivedContacts(){
GROUP BY OC.contactID, O.name
ORDER BY OC.name";
- $result = $this->db->processQuery($query, 'assoc');
-
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['contactID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($contactsArray, $resultArray);
-
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
-
- array_push($contactsArray, $resultArray);
- }
- }
-
+ $result = $this->db->processQuery($query, 'assoc');
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['contactID'])) {
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- return $contactsArray;
- }
+ array_push($contactsArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($contactsArray, $resultArray);
+ }
+ }
+ }
+ return $contactsArray;
+ }
- //returns array of contact objects
- public function getArchivedContacts(){
+ //returns array of contact objects
+ public function getArchivedContacts() {
- $config = new Configuration;
- $contactsArray = array();
+ $config = new Configuration;
+ $contactsArray = array();
- //get resource specific contacts
- $query = "SELECT C.*, GROUP_CONCAT(CR.shortName SEPARATOR ' ') contactRoles
+ //get resource specific contacts
+ $query = "SELECT C.*, GROUP_CONCAT(CR.shortName SEPARATOR ' ') contactRoles
FROM Contact C, ContactRole CR, ContactRoleProfile CRP
WHERE (archiveDate != '0000-00-00' && archiveDate != '')
AND C.contactID = CRP.contactID
@@ -504,36 +493,35 @@ public function getArchivedContacts(){
GROUP BY C.contactID
ORDER BY C.name";
- $result = $this->db->processQuery($query, 'assoc');
-
+ $result = $this->db->processQuery($query, 'assoc');
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['contactID'])){
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['contactID'])) {
- array_push($contactsArray, $resultArray);
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
+ array_push($contactsArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
- array_push($contactsArray, $resultArray);
- }
- }
+ array_push($contactsArray, $resultArray);
+ }
+ }
- //if the org module is installed also get the org contacts from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
+ //if the org module is installed also get the org contacts from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- $query = "SELECT DISTINCT OC.*, O.name organizationName, GROUP_CONCAT(DISTINCT CR.shortName SEPARATOR ' ') contactRoles
+ $query = "SELECT DISTINCT OC.*, O.name organizationName, GROUP_CONCAT(DISTINCT CR.shortName SEPARATOR ' ') contactRoles
FROM " . $dbName . ".Contact OC, " . $dbName . ".ContactRole CR, " . $dbName . ".ContactRoleProfile CRP, " . $dbName . ".Organization O, Resource R, ResourceOrganizationLink ROL
WHERE (OC.archiveDate != '0000-00-00' && OC.archiveDate is not null)
AND R.resourceID = ROL.resourceID
@@ -546,130 +534,112 @@ public function getArchivedContacts(){
ORDER BY OC.name";
- $result = $this->db->processQuery($query, 'assoc');
-
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['contactID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($contactsArray, $resultArray);
-
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
-
- array_push($contactsArray, $resultArray);
- }
- }
-
+ $result = $this->db->processQuery($query, 'assoc');
- }
-
- return $contactsArray;
-
-
-
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['contactID'])) {
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
+ array_push($contactsArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($contactsArray, $resultArray);
+ }
+ }
+ }
+ return $contactsArray;
+ }
- //returns array of contact objects
- public function getCreatorsArray(){
+ //returns array of contact objects
+ public function getCreatorsArray() {
- $creatorsArray = array();
- $resultArray = array();
+ $creatorsArray = array();
+ $resultArray = array();
- //get resource specific creators
- $query = "SELECT distinct loginID, firstName, lastName
+ //get resource specific creators
+ $query = "SELECT distinct loginID, firstName, lastName
FROM Resource R, User U
WHERE U.loginID = R.createLoginID
ORDER BY lastName, firstName, loginID";
- $result = $this->db->processQuery($query, 'assoc');
-
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['loginID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($creatorsArray, $resultArray);
+ $result = $this->db->processQuery($query, 'assoc');
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
- array_push($creatorsArray, $resultArray);
- }
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['loginID'])) {
- return $creatorsArray;
-
-
- }
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
+ array_push($creatorsArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($creatorsArray, $resultArray);
+ }
+ }
+ return $creatorsArray;
+ }
- //returns array of external login records
- public function getExternalLoginArray(){
+ //returns array of external login records
+ public function getExternalLoginArray() {
- $config = new Configuration;
- $elArray = array();
+ $config = new Configuration;
+ $elArray = array();
- //get resource specific accounts first
- $query = "SELECT EL.*, ELT.shortName externalLoginType
+ //get resource specific accounts first
+ $query = "SELECT EL.*, ELT.shortName externalLoginType
FROM ExternalLogin EL, ExternalLoginType ELT
WHERE EL.externalLoginTypeID = ELT.externalLoginTypeID
AND resourceID = '" . $this->resourceID . "'
ORDER BY ELT.shortName;";
- $result = $this->db->processQuery($query, 'assoc');
+ $result = $this->db->processQuery($query, 'assoc');
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['externalLoginID'])){
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['externalLoginID'])) {
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- array_push($elArray, $resultArray);
+ array_push($elArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
+ array_push($elArray, $resultArray);
+ }
+ }
- array_push($elArray, $resultArray);
- }
- }
+ //if the org module is installed also get the external logins from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- //if the org module is installed also get the external logins from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
-
- $query = "SELECT DISTINCT EL.*, ELT.shortName externalLoginType, O.name organizationName
+ $query = "SELECT DISTINCT EL.*, ELT.shortName externalLoginType, O.name organizationName
FROM " . $dbName . ".ExternalLogin EL, " . $dbName . ".ExternalLoginType ELT, " . $dbName . ".Organization O,
Resource R, ResourceOrganizationLink ROL
WHERE EL.externalLoginTypeID = ELT.externalLoginTypeID
@@ -680,488 +650,460 @@ public function getExternalLoginArray(){
ORDER BY ELT.shortName;";
- $result = $this->db->processQuery($query, 'assoc');
-
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['externalLoginID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($elArray, $resultArray);
-
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
+ $result = $this->db->processQuery($query, 'assoc');
- array_push($elArray, $resultArray);
- }
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['externalLoginID'])) {
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- }
+ array_push($elArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($elArray, $resultArray);
+ }
+ }
+ }
- return $elArray;
- }
-
+ return $elArray;
+ }
- //returns array of notes objects
- public function getNotes($tabName = NULL){
+ //returns array of notes objects
+ public function getNotes($tabName = NULL) {
- if ($tabName){
- $query = "SELECT * FROM ResourceNote RN
+ if ($tabName) {
+ $query = "SELECT * FROM ResourceNote RN
WHERE resourceID = '" . $this->resourceID . "'
AND UPPER(tabName) = UPPER('" . $tabName . "')
ORDER BY updateDate desc";
- }else{
- $query = "SELECT RN.*
+ } else {
+ $query = "SELECT RN.*
FROM ResourceNote RN
LEFT JOIN NoteType NT ON NT.noteTypeID = RN.noteTypeID
WHERE resourceID = '" . $this->resourceID . "'
ORDER BY updateDate desc, NT.shortName";
- }
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceNoteID'])){
- $object = new ResourceNote(new NamedArguments(array('primaryKey' => $result['resourceNoteID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ResourceNote(new NamedArguments(array('primaryKey' => $row['resourceNoteID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
- }
-
+ }
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceNoteID'])) {
+ $object = new ResourceNote(new NamedArguments(array('primaryKey' => $result['resourceNoteID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ResourceNote(new NamedArguments(array('primaryKey' => $row['resourceNoteID'])));
+ array_push($objects, $object);
+ }
+ }
+ return $objects;
+ }
- //returns array of the initial note object
- public function getInitialNote(){
- $noteType = new NoteType();
+ //returns array of the initial note object
+ public function getInitialNote() {
+ $noteType = new NoteType();
- $query = "SELECT * FROM ResourceNote RN
+ $query = "SELECT * FROM ResourceNote RN
WHERE resourceID = '" . $this->resourceID . "'
AND noteTypeID = " . $noteType->getInitialNoteTypeID . "
ORDER BY noteTypeID desc LIMIT 0,1";
- $result = $this->db->processQuery($query, 'assoc');
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceNoteID'])){
- $resourceNote = new ResourceNote(new NamedArguments(array('primaryKey' => $result['resourceNoteID'])));
- return $resourceNote;
- } else{
- $resourceNote = new ResourceNote();
- return $resourceNote;
- }
-
- }
-
-
-
-
-
+ $result = $this->db->processQuery($query, 'assoc');
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceNoteID'])) {
+ $resourceNote = new ResourceNote(new NamedArguments(array('primaryKey' => $result['resourceNoteID'])));
+ return $resourceNote;
+ } else {
+ $resourceNote = new ResourceNote();
+ return $resourceNote;
+ }
+ }
- //returns array of attachments objects
- public function getAttachments(){
+ //returns array of attachments objects
+ public function getAttachments() {
- $query = "SELECT * FROM Attachment A, AttachmentType AT
+ $query = "SELECT * FROM Attachment A, AttachmentType AT
WHERE AT.attachmentTypeID = A.attachmentTypeID
AND resourceID = '" . $this->resourceID . "'
ORDER BY AT.shortName";
- $result = $this->db->processQuery($query, 'assoc');
+ $result = $this->db->processQuery($query, 'assoc');
+
+ $objects = array();
+
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['attachmentID'])) {
+ $object = new Attachment(new NamedArguments(array('primaryKey' => $result['attachmentID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Attachment(new NamedArguments(array('primaryKey' => $row['attachmentID'])));
+ array_push($objects, $object);
+ }
+ }
- $objects = array();
+ return $objects;
+ }
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['attachmentID'])){
- $object = new Attachment(new NamedArguments(array('primaryKey' => $result['attachmentID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new Attachment(new NamedArguments(array('primaryKey' => $row['attachmentID'])));
- array_push($objects, $object);
- }
- }
+ //returns array of contact objects
+ public function getContacts() {
- return $objects;
- }
+ $query = "SELECT * FROM Contact
+ WHERE resourceID = '" . $this->resourceID . "'";
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['contactID'])) {
+ $object = new Contact(new NamedArguments(array('primaryKey' => $result['contactID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Contact(new NamedArguments(array('primaryKey' => $row['contactID'])));
+ array_push($objects, $object);
+ }
+ }
- //returns array of contact objects
- public function getContacts(){
+ return $objects;
+ }
- $query = "SELECT * FROM Contact
+ //returns array of externalLogin objects
+ public function getExternalLogins() {
+
+ $query = "SELECT * FROM ExternalLogin
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query, 'assoc');
+ $result = $this->db->processQuery($query, 'assoc');
- $objects = array();
+ $objects = array();
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['contactID'])){
- $object = new Contact(new NamedArguments(array('primaryKey' => $result['contactID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new Contact(new NamedArguments(array('primaryKey' => $row['contactID'])));
- array_push($objects, $object);
- }
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['externalLoginID'])) {
+ $object = new ExternalLogin(new NamedArguments(array('primaryKey' => $result['externalLoginID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ExternalLogin(new NamedArguments(array('primaryKey' => $row['externalLoginID'])));
+ array_push($objects, $object);
+ }
+ }
- return $objects;
- }
+ return $objects;
+ }
+ public static function setSearch($search) {
+ $config = new Configuration;
+
+ if ($config->settings->defaultsort) {
+ $orderBy = $config->settings->defaultsort;
+ } else {
+ $orderBy = "R.createDate DESC, TRIM(LEADING 'THE ' FROM UPPER(R.titleText)) asc";
+ }
+
+ $defaultSearchParameters = array(
+ "orderBy" => $orderBy,
+ "page" => 1,
+ "recordsPerPage" => 25,
+ );
+ foreach ($defaultSearchParameters as $key => $value) {
+ if (!$search[$key]) {
+ $search[$key] = $value;
+ }
+ }
+ foreach ($search as $key => $value) {
+ $search[$key] = trim($value);
+ }
+ $_SESSION['resourceSearch'] = $search;
+ }
+
+ public static function resetSearch() {
+ Resource::setSearch(array());
+ }
+ public static function getSearch() {
+ if (!isset($_SESSION['resourceSearch'])) {
+ Resource::resetSearch();
+ }
+ return $_SESSION['resourceSearch'];
+ }
+ public static function getSearchDetails() {
+ // A successful mysql_connect must be run before mysql_real_escape_string will function. Instantiating a resource model will set up the connection
+ $resource = new Resource();
+
+ $search = Resource::getSearch();
+
+ $whereAdd = array();
+ $searchDisplay = array();
+ $config = new Configuration();
+
+
+ //if name is passed in also search alias, organizations and organization aliases
+ if ($search['name']) {
+ $nameQueryString = mysql_real_escape_string(strtoupper($search['name']));
+ $nameQueryString = preg_replace("/ +/", "%", $nameQueryString);
+ $nameQueryString = "'%" . $nameQueryString . "%'";
+
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
+
+ $whereAdd[] = "((UPPER(R.titleText) LIKE " . $nameQueryString . ") OR (UPPER(A.shortName) LIKE " . $nameQueryString . ") OR (UPPER(O.name) LIKE " . $nameQueryString . ") OR (UPPER(OA.name) LIKE " . $nameQueryString . ") OR (UPPER(RP.titleText) LIKE " . $nameQueryString . ") OR (UPPER(RC.titleText) LIKE " . $nameQueryString . ") OR (UPPER(R.recordSetIdentifier) LIKE " . $nameQueryString . "))";
+ } else {
+
+ $whereAdd[] = "((UPPER(R.titleText) LIKE " . $nameQueryString . ") OR (UPPER(A.shortName) LIKE " . $nameQueryString . ") OR (UPPER(O.shortName) LIKE " . $nameQueryString . ") OR (UPPER(RP.titleText) LIKE " . $nameQueryString . ") OR (UPPER(RC.titleText) LIKE " . $nameQueryString . ") OR (UPPER(R.recordSetIdentifier) LIKE " . $nameQueryString . "))";
+ }
+
+ $searchDisplay[] = "Name contains: " . $search['name'];
+ }
+
+ //get where statements together (and escape single quotes)
+ if ($search['resourceID']) {
+ $whereAdd[] = "R.resourceID = '" . mysql_real_escape_string($search['resourceID']) . "'";
+ $searchDisplay[] = "Resource ID: " . $search['resourceID'];
+ }
+ if ($search['resourceISBNOrISSN']) {
+ $resourceISBNOrISSN = mysql_real_escape_string(str_replace("-", "", $search['resourceISBNOrISSN']));
+ $whereAdd[] = "REPLACE(I.identifier,'-','') = '" . $resourceISBNOrISSN . "'";
+ $searchDisplay[] = "ISSN/ISBN: " . $search['resourceISBNOrISSN'];
+ }
+ if ($search['fund']) {
+ $fund = mysql_real_escape_string(str_replace("-", "", $search['fund']));
+ $whereAdd[] = "REPLACE(RPAY.fundName,'-','') = '" . $fund . "'";
+ $searchDisplay[] = "Fund: " . $search['fund'];
+ }
+
+ if ($search['stepName']) {
+ $status = new Status();
+ $completedStatusID = $status->getIDFromName('complete');
+ $whereAdd[] = "(R.statusID != $completedStatusID AND RS.stepName = '" . mysql_real_escape_string($search['stepName']) . "' AND RS.stepStartDate IS NOT NULL AND RS.stepEndDate IS NULL)";
+ $searchDisplay[] = "Routing Step: " . $search['stepName'];
+ }
+
+
+ if ($search['parent'] != null) {
+ $parentadd = "(" . $search['parent'] . ".relationshipTypeID = 1";
+ $parentadd .= ")";
+ $whereAdd[] = $parentadd;
+ }
+
+
+
+ if ($search['statusID']) {
+ $whereAdd[] = "R.statusID = '" . mysql_real_escape_string($search['statusID']) . "'";
+ $status = new Status(new NamedArguments(array('primaryKey' => $search['statusID'])));
+ $searchDisplay[] = "Status: " . $status->shortName;
+ }
+
+ if ($search['creatorLoginID']) {
+ $whereAdd[] = "R.createLoginID = '" . mysql_real_escape_string($search['creatorLoginID']) . "'";
+
+ $createUser = new User(new NamedArguments(array('primaryKey' => $search['creatorLoginID'])));
+ if ($createUser->firstName) {
+ $name = $createUser->lastName . ", " . $createUser->firstName;
+ } else {
+ $name = $createUser->loginID;
+ }
+ $searchDisplay[] = "Creator: " . $name;
+ }
+
+ if ($search['resourceFormatID']) {
+ $whereAdd[] = "R.resourceFormatID = '" . mysql_real_escape_string($search['resourceFormatID']) . "'";
+ $resourceFormat = new ResourceFormat(new NamedArguments(array('primaryKey' => $search['resourceFormatID'])));
+ $searchDisplay[] = "Resource Format: " . $resourceFormat->shortName;
+ }
+
+ if ($search['acquisitionTypeID']) {
+ $whereAdd[] = "R.acquisitionTypeID = '" . mysql_real_escape_string($search['acquisitionTypeID']) . "'";
+ $acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $search['acquisitionTypeID'])));
+ $searchDisplay[] = "Acquisition Type: " . $acquisitionType->shortName;
+ }
+
+
+ if ($search['resourceNote']) {
+ $whereAdd[] = "UPPER(RN.noteText) LIKE UPPER('%" . mysql_real_escape_string($search['resourceNote']) . "%')";
+ $searchDisplay[] = "Note contains: " . $search['resourceNote'];
+ }
+
+ if ($search['createDateStart']) {
+ $whereAdd[] = "R.createDate >= STR_TO_DATE('" . mysql_real_escape_string($search['createDateStart']) . "','%m/%d/%Y')";
+ if (!$search['createDateEnd']) {
+ $searchDisplay[] = "Created on or after: " . $search['createDateStart'];
+ } else {
+ $searchDisplay[] = "Created between: " . $search['createDateStart'] . " and " . $search['createDateEnd'];
+ }
+ }
+
+ if ($search['createDateEnd']) {
+ $whereAdd[] = "R.createDate <= STR_TO_DATE('" . mysql_real_escape_string($search['createDateEnd']) . "','%m/%d/%Y')";
+ if (!$search['createDateStart']) {
+ $searchDisplay[] = "Created on or before: " . $search['createDateEnd'];
+ }
+ }
+
+ if ($search['startWith']) {
+ $whereAdd[] = "TRIM(LEADING 'THE ' FROM UPPER(R.titleText)) LIKE UPPER('" . mysql_real_escape_string($search['startWith']) . "%')";
+ $searchDisplay[] = "Starts with: " . $search['startWith'];
+ }
+
+ //the following are not-required fields with dropdowns and have "none" as an option
+ if ($search['resourceTypeID'] == 'none') {
+ $whereAdd[] = "((R.resourceTypeID IS NULL) OR (R.resourceTypeID = '0'))";
+ $searchDisplay[] = "Resource Type: none";
+ } else if ($search['resourceTypeID']) {
+ $whereAdd[] = "R.resourceTypeID = '" . mysql_real_escape_string($search['resourceTypeID']) . "'";
+ $resourceType = new ResourceType(new NamedArguments(array('primaryKey' => $search['resourceTypeID'])));
+ $searchDisplay[] = "Resource Type: " . $resourceType->shortName;
+ }
+
+
+ if ($search['generalSubjectID'] == 'none') {
+ $whereAdd[] = "((GDLINK.generalSubjectID IS NULL) OR (GDLINK.generalSubjectID = '0'))";
+ $searchDisplay[] = "Resource Type: none";
+ } else if ($search['generalSubjectID']) {
+ $whereAdd[] = "GDLINK.generalSubjectID = '" . mysql_real_escape_string($search['generalSubjectID']) . "'";
+ $generalSubject = new GeneralSubject(new NamedArguments(array('primaryKey' => $search['generalSubjectID'])));
+ $searchDisplay[] = "General Subject: " . $generalSubject->shortName;
+ }
+
+ if ($search['detailedSubjectID'] == 'none') {
+ $whereAdd[] = "((GDLINK.detailedSubjectID IS NULL) OR (GDLINK.detailedSubjectID = '0') OR (GDLINK.detailedSubjectID = '-1'))";
+ $searchDisplay[] = "Resource Type: none";
+ } else if ($search['detailedSubjectID']) {
+ $whereAdd[] = "GDLINK.detailedSubjectID = '" . mysql_real_escape_string($search['detailedSubjectID']) . "'";
+ $detailedSubject = new DetailedSubject(new NamedArguments(array('primaryKey' => $search['detailedSubjectID'])));
+ $searchDisplay[] = "Detailed Subject: " . $detailedSubject->shortName;
+ }
+
+ if ($search['noteTypeID'] == 'none') {
+ $whereAdd[] = "(RN.noteTypeID IS NULL) AND (RN.noteText IS NOT NULL)";
+ $searchDisplay[] = "Note Type: none";
+ } else if ($search['noteTypeID']) {
+ $whereAdd[] = "RN.noteTypeID = '" . mysql_real_escape_string($search['noteTypeID']) . "'";
+ $noteType = new NoteType(new NamedArguments(array('primaryKey' => $search['noteTypeID'])));
+ $searchDisplay[] = "Note Type: " . $noteType->shortName;
+ }
+
+
+ if ($search['purchaseSiteID'] == 'none') {
+ $whereAdd[] = "RPSL.purchaseSiteID IS NULL";
+ $searchDisplay[] = "Purchase Site: none";
+ } else if ($search['purchaseSiteID']) {
+ $whereAdd[] = "RPSL.purchaseSiteID = '" . mysql_real_escape_string($search['purchaseSiteID']) . "'";
+ $purchaseSite = new PurchaseSite(new NamedArguments(array('primaryKey' => $search['purchaseSiteID'])));
+ $searchDisplay[] = "Purchase Site: " . $purchaseSite->shortName;
+ }
+
+
+ if ($search['authorizedSiteID'] == 'none') {
+ $whereAdd[] = "RAUSL.authorizedSiteID IS NULL";
+ $searchDisplay[] = "Authorized Site: none";
+ } else if ($search['authorizedSiteID']) {
+ $whereAdd[] = "RAUSL.authorizedSiteID = '" . mysql_real_escape_string($search['authorizedSiteID']) . "'";
+ $authorizedSite = new AuthorizedSite(new NamedArguments(array('primaryKey' => $search['authorizedSiteID'])));
+ $searchDisplay[] = "Authorized Site: " . $authorizedSite->shortName;
+ }
+
+
+ if ($search['administeringSiteID'] == 'none') {
+ $whereAdd[] = "RADSL.administeringSiteID IS NULL";
+ $searchDisplay[] = "Administering Site: none";
+ } else if ($search['administeringSiteID']) {
+ $whereAdd[] = "RADSL.administeringSiteID = '" . mysql_real_escape_string($search['administeringSiteID']) . "'";
+ $administeringSite = new AdministeringSite(new NamedArguments(array('primaryKey' => $search['administeringSiteID'])));
+ $searchDisplay[] = "Administering Site: " . $administeringSite->shortName;
+ }
+
+
+ if ($search['authenticationTypeID'] == 'none') {
+ $whereAdd[] = "R.authenticationTypeID IS NULL";
+ $searchDisplay[] = "Authentication Type: none";
+ } else if ($search['authenticationTypeID']) {
+ $whereAdd[] = "R.authenticationTypeID = '" . mysql_real_escape_string($search['authenticationTypeID']) . "'";
+ $authenticationType = new AuthenticationType(new NamedArguments(array('primaryKey' => $search['authenticationTypeID'])));
+ $searchDisplay[] = "Authentication Type: " . $authenticationType->shortName;
+ }
+
+ if ($search['catalogingStatusID'] == 'none') {
+ $whereAdd[] = "(R.catalogingStatusID IS NULL)";
+ $searchDisplay[] = "Cataloging Status: none";
+ } else if ($search['catalogingStatusID']) {
+ $whereAdd[] = "R.catalogingStatusID = '" . mysql_real_escape_string($search['catalogingStatusID']) . "'";
+ $catalogingStatus = new CatalogingStatus(new NamedArguments(array('primaryKey' => $search['catalogingStatusID'])));
+ $searchDisplay[] = "Cataloging Status: " . $catalogingStatus->shortName;
+ }
+
+
+
+ $orderBy = $search['orderBy'];
+
+
+ $page = $search['page'];
+ $recordsPerPage = $search['recordsPerPage'];
+ return array("where" => $whereAdd, "page" => $page, "order" => $orderBy, "perPage" => $recordsPerPage, "display" => $searchDisplay);
+ }
- //returns array of externalLogin objects
- public function getExternalLogins(){
+ public function searchQuery($whereAdd, $orderBy = '', $limit = '', $count = false) {
+ $config = new Configuration();
+ $status = new Status();
- $query = "SELECT * FROM ExternalLogin
- WHERE resourceID = '" . $this->resourceID . "'";
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['externalLoginID'])){
- $object = new ExternalLogin(new NamedArguments(array('primaryKey' => $result['externalLoginID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ExternalLogin(new NamedArguments(array('primaryKey' => $row['externalLoginID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
- }
-
-
- public static function setSearch($search) {
- $config = new Configuration;
-
- if ($config->settings->defaultsort) {
- $orderBy = $config->settings->defaultsort;
- } else {
- $orderBy = "R.createDate DESC, TRIM(LEADING 'THE ' FROM UPPER(R.titleText)) asc";
- }
-
- $defaultSearchParameters = array(
- "orderBy" => $orderBy,
- "page" => 1,
- "recordsPerPage" => 25,
- );
- foreach ($defaultSearchParameters as $key => $value) {
- if (!$search[$key]) {
- $search[$key] = $value;
- }
- }
- foreach ($search as $key => $value) {
- $search[$key] = trim($value);
- }
- $_SESSION['resourceSearch'] = $search;
- }
-
- public static function resetSearch() {
- Resource::setSearch(array());
- }
-
- public static function getSearch() {
- if (!isset($_SESSION['resourceSearch'])) {
- Resource::resetSearch();
- }
- return $_SESSION['resourceSearch'];
- }
-
- public static function getSearchDetails() {
- // A successful mysql_connect must be run before mysql_real_escape_string will function. Instantiating a resource model will set up the connection
- $resource = new Resource();
-
- $search = Resource::getSearch();
-
- $whereAdd = array();
- $searchDisplay = array();
- $config = new Configuration();
-
-
- //if name is passed in also search alias, organizations and organization aliases
- if ($search['name']) {
- $nameQueryString = mysql_real_escape_string(strtoupper($search['name']));
- $nameQueryString = preg_replace("/ +/", "%", $nameQueryString);
- $nameQueryString = "'%" . $nameQueryString . "%'";
-
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
-
- $whereAdd[] = "((UPPER(R.titleText) LIKE " . $nameQueryString . ") OR (UPPER(A.shortName) LIKE " . $nameQueryString . ") OR (UPPER(O.name) LIKE " . $nameQueryString . ") OR (UPPER(OA.name) LIKE " . $nameQueryString . ") OR (UPPER(RP.titleText) LIKE " . $nameQueryString . ") OR (UPPER(RC.titleText) LIKE " . $nameQueryString . ") OR (UPPER(R.recordSetIdentifier) LIKE " . $nameQueryString . "))";
-
- }else{
-
- $whereAdd[] = "((UPPER(R.titleText) LIKE " . $nameQueryString . ") OR (UPPER(A.shortName) LIKE " . $nameQueryString . ") OR (UPPER(O.shortName) LIKE " . $nameQueryString . ") OR (UPPER(RP.titleText) LIKE " . $nameQueryString . ") OR (UPPER(RC.titleText) LIKE " . $nameQueryString . ") OR (UPPER(R.recordSetIdentifier) LIKE " . $nameQueryString . "))";
-
- }
-
- $searchDisplay[] = "Name contains: " . $search['name'];
- }
-
- //get where statements together (and escape single quotes)
- if ($search['resourceID']) {
- $whereAdd[] = "R.resourceID = '" . mysql_real_escape_string($search['resourceID']) . "'";
- $searchDisplay[] = "Resource ID: " . $search['resourceID'];
- }
- if ($search['resourceISBNOrISSN']) {
- $resourceISBNOrISSN = mysql_real_escape_string(str_replace("-","",$search['resourceISBNOrISSN']));
- $whereAdd[] = "REPLACE(I.isbnOrIssn,'-','') = '" . $resourceISBNOrISSN . "'";
- $searchDisplay[] = "ISSN/ISBN: " . $search['resourceISBNOrISSN'];
- }
- if ($search['fund']) {
- $fund = mysql_real_escape_string(str_replace("-","",$search['fund']));
- $whereAdd[] = "REPLACE(RPAY.fundName,'-','') = '" . $fund . "'";
- $searchDisplay[] = "Fund: " . $search['fund'];
- }
-
- if ($search['stepName']) {
- $status = new Status();
- $completedStatusID = $status->getIDFromName('complete');
- $whereAdd[] = "(R.statusID != $completedStatusID AND RS.stepName = '" . mysql_real_escape_string($search['stepName']) . "' AND RS.stepStartDate IS NOT NULL AND RS.stepEndDate IS NULL)";
- $searchDisplay[] = "Routing Step: " . $search['stepName'];
- }
-
-
- if ($search['parent'] != null) {
- $parentadd = "(" . $search['parent'] . ".relationshipTypeID = 1";
- $parentadd .= ")";
- $whereAdd[] = $parentadd;
- }
-
-
-
- if ($search['statusID']) {
- $whereAdd[] = "R.statusID = '" . mysql_real_escape_string($search['statusID']) . "'";
- $status = new Status(new NamedArguments(array('primaryKey' => $search['statusID'])));
- $searchDisplay[] = "Status: " . $status->shortName;
- }
-
- if ($search['creatorLoginID']) {
- $whereAdd[] = "R.createLoginID = '" . mysql_real_escape_string($search['creatorLoginID']) . "'";
-
- $createUser = new User(new NamedArguments(array('primaryKey' => $search['creatorLoginID'])));
- if ($createUser->firstName){
- $name = $createUser->lastName . ", " . $createUser->firstName;
- }else{
- $name = $createUser->loginID;
- }
- $searchDisplay[] = "Creator: " . $name;
- }
-
- if ($search['resourceFormatID']) {
- $whereAdd[] = "R.resourceFormatID = '" . mysql_real_escape_string($search['resourceFormatID']) . "'";
- $resourceFormat = new ResourceFormat(new NamedArguments(array('primaryKey' => $search['resourceFormatID'])));
- $searchDisplay[] = "Resource Format: " . $resourceFormat->shortName;
- }
-
- if ($search['acquisitionTypeID']) {
- $whereAdd[] = "R.acquisitionTypeID = '" . mysql_real_escape_string($search['acquisitionTypeID']) . "'";
- $acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $search['acquisitionTypeID'])));
- $searchDisplay[] = "Acquisition Type: " . $acquisitionType->shortName;
- }
-
-
- if ($search['resourceNote']) {
- $whereAdd[] = "UPPER(RN.noteText) LIKE UPPER('%" . mysql_real_escape_string($search['resourceNote']) . "%')";
- $searchDisplay[] = "Note contains: " . $search['resourceNote'];
- }
-
- if ($search['createDateStart']) {
- $whereAdd[] = "R.createDate >= STR_TO_DATE('" . mysql_real_escape_string($search['createDateStart']) . "','%m/%d/%Y')";
- if (!$search['createDateEnd']) {
- $searchDisplay[] = "Created on or after: " . $search['createDateStart'];
- } else {
- $searchDisplay[] = "Created between: " . $search['createDateStart'] . " and " . $search['createDateEnd'];
- }
- }
-
- if ($search['createDateEnd']) {
- $whereAdd[] = "R.createDate <= STR_TO_DATE('" . mysql_real_escape_string($search['createDateEnd']) . "','%m/%d/%Y')";
- if (!$search['createDateStart']) {
- $searchDisplay[] = "Created on or before: " . $search['createDateEnd'];
- }
- }
-
- if ($search['startWith']) {
- $whereAdd[] = "TRIM(LEADING 'THE ' FROM UPPER(R.titleText)) LIKE UPPER('" . mysql_real_escape_string($search['startWith']) . "%')";
- $searchDisplay[] = "Starts with: " . $search['startWith'];
- }
-
- //the following are not-required fields with dropdowns and have "none" as an option
- if ($search['resourceTypeID'] == 'none'){
- $whereAdd[] = "((R.resourceTypeID IS NULL) OR (R.resourceTypeID = '0'))";
- $searchDisplay[] = "Resource Type: none";
- }else if ($search['resourceTypeID']){
- $whereAdd[] = "R.resourceTypeID = '" . mysql_real_escape_string($search['resourceTypeID']) . "'";
- $resourceType = new ResourceType(new NamedArguments(array('primaryKey' => $search['resourceTypeID'])));
- $searchDisplay[] = "Resource Type: " . $resourceType->shortName;
- }
-
-
- if ($search['generalSubjectID'] == 'none'){
- $whereAdd[] = "((GDLINK.generalSubjectID IS NULL) OR (GDLINK.generalSubjectID = '0'))";
- $searchDisplay[] = "Resource Type: none";
- }else if ($search['generalSubjectID']){
- $whereAdd[] = "GDLINK.generalSubjectID = '" . mysql_real_escape_string($search['generalSubjectID']) . "'";
- $generalSubject = new GeneralSubject(new NamedArguments(array('primaryKey' => $search['generalSubjectID'])));
- $searchDisplay[] = "General Subject: " . $generalSubject->shortName;
- }
-
- if ($search['detailedSubjectID'] == 'none'){
- $whereAdd[] = "((GDLINK.detailedSubjectID IS NULL) OR (GDLINK.detailedSubjectID = '0') OR (GDLINK.detailedSubjectID = '-1'))";
- $searchDisplay[] = "Resource Type: none";
- }else if ($search['detailedSubjectID']){
- $whereAdd[] = "GDLINK.detailedSubjectID = '" . mysql_real_escape_string($search['detailedSubjectID']) . "'";
- $detailedSubject = new DetailedSubject(new NamedArguments(array('primaryKey' => $search['detailedSubjectID'])));
- $searchDisplay[] = "Detailed Subject: " . $detailedSubject->shortName;
- }
-
- if ($search['noteTypeID'] == 'none'){
- $whereAdd[] = "(RN.noteTypeID IS NULL) AND (RN.noteText IS NOT NULL)";
- $searchDisplay[] = "Note Type: none";
- }else if ($search['noteTypeID']){
- $whereAdd[] = "RN.noteTypeID = '" . mysql_real_escape_string($search['noteTypeID']) . "'";
- $noteType = new NoteType(new NamedArguments(array('primaryKey' => $search['noteTypeID'])));
- $searchDisplay[] = "Note Type: " . $noteType->shortName;
- }
-
-
- if ($search['purchaseSiteID'] == 'none'){
- $whereAdd[] = "RPSL.purchaseSiteID IS NULL";
- $searchDisplay[] = "Purchase Site: none";
- }else if ($search['purchaseSiteID']){
- $whereAdd[] = "RPSL.purchaseSiteID = '" . mysql_real_escape_string($search['purchaseSiteID']) . "'";
- $purchaseSite = new PurchaseSite(new NamedArguments(array('primaryKey' => $search['purchaseSiteID'])));
- $searchDisplay[] = "Purchase Site: " . $purchaseSite->shortName;
- }
-
-
- if ($search['authorizedSiteID'] == 'none'){
- $whereAdd[] = "RAUSL.authorizedSiteID IS NULL";
- $searchDisplay[] = "Authorized Site: none";
- }else if ($search['authorizedSiteID']){
- $whereAdd[] = "RAUSL.authorizedSiteID = '" . mysql_real_escape_string($search['authorizedSiteID']) . "'";
- $authorizedSite = new AuthorizedSite(new NamedArguments(array('primaryKey' => $search['authorizedSiteID'])));
- $searchDisplay[] = "Authorized Site: " . $authorizedSite->shortName;
- }
-
-
- if ($search['administeringSiteID'] == 'none'){
- $whereAdd[] = "RADSL.administeringSiteID IS NULL";
- $searchDisplay[] = "Administering Site: none";
- }else if ($search['administeringSiteID']){
- $whereAdd[] = "RADSL.administeringSiteID = '" . mysql_real_escape_string($search['administeringSiteID']) . "'";
- $administeringSite = new AdministeringSite(new NamedArguments(array('primaryKey' => $search['administeringSiteID'])));
- $searchDisplay[] = "Administering Site: " . $administeringSite->shortName;
- }
-
-
- if ($search['authenticationTypeID'] == 'none'){
- $whereAdd[] = "R.authenticationTypeID IS NULL";
- $searchDisplay[] = "Authentication Type: none";
- }else if ($search['authenticationTypeID']){
- $whereAdd[] = "R.authenticationTypeID = '" . mysql_real_escape_string($search['authenticationTypeID']) . "'";
- $authenticationType = new AuthenticationType(new NamedArguments(array('primaryKey' => $search['authenticationTypeID'])));
- $searchDisplay[] = "Authentication Type: " . $authenticationType->shortName;
- }
-
- if ($search['catalogingStatusID'] == 'none') {
- $whereAdd[] = "(R.catalogingStatusID IS NULL)";
- $searchDisplay[] = "Cataloging Status: none";
- } else if ($search['catalogingStatusID']) {
- $whereAdd[] = "R.catalogingStatusID = '" . mysql_real_escape_string($search['catalogingStatusID']) . "'";
- $catalogingStatus = new CatalogingStatus(new NamedArguments(array('primaryKey' => $search['catalogingStatusID'])));
- $searchDisplay[] = "Cataloging Status: " . $catalogingStatus->shortName;
- }
-
-
-
- $orderBy = $search['orderBy'];
-
-
- $page = $search['page'];
- $recordsPerPage = $search['recordsPerPage'];
- return array("where" => $whereAdd, "page" => $page, "order" => $orderBy, "perPage" => $recordsPerPage, "display" => $searchDisplay);
- }
-
- public function searchQuery($whereAdd, $orderBy = '', $limit = '', $count = false) {
- $config = new Configuration();
- $status = new Status();
-
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
-
- $orgJoinAdd = "LEFT JOIN " . $dbName . ".Organization O ON O.organizationID = ROL.organizationID
+ $orgJoinAdd = "LEFT JOIN " . $dbName . ".Organization O ON O.organizationID = ROL.organizationID
LEFT JOIN " . $dbName . ".Alias OA ON OA.organizationID = ROL.organizationID";
-
- }else{
- $orgJoinAdd = "LEFT JOIN Organization O ON O.organizationID = ROL.organizationID";
- }
-
- $savedStatusID = intval($status->getIDFromName('saved'));
- //also add to not retrieve saved records
- $whereAdd[] = "R.statusID != " . $savedStatusID;
-
- if (count($whereAdd) > 0){
- $whereStatement = " WHERE " . implode(" AND ", $whereAdd);
- }else{
- $whereStatement = "";
- }
-
- if ($count) {
- $select = "SELECT COUNT(DISTINCT R.resourceID) count";
- $groupBy = "";
- } else {
- $select = "SELECT R.resourceID, R.titleText, AT.shortName acquisitionType, R.createLoginID, CU.firstName, CU.lastName, R.createDate, S.shortName status,
- GROUP_CONCAT(DISTINCT A.shortName, I.isbnOrIssn ORDER BY A.shortName DESC SEPARATOR ' ') aliases";
- $groupBy = "GROUP BY R.resourceID";
- }
-
- $referenced_tables = array();
-
- $table_matches = array();
-
- // Build a list of tables that are referenced by the select and where statements in order to limit the number of joins performed in the search.
- preg_match_all("/[A-Z]+(?=[.][A-Z]+)/i", $select, $table_matches);
- $referenced_tables = array_unique($table_matches[0]);
-
- preg_match_all("/[A-Z]+(?=[.][A-Z]+)/i", $whereStatement, $table_matches);
- $referenced_tables = array_unique(array_merge($referenced_tables, $table_matches[0]));
-
- // These join statements will only be included in the query if the alias is referenced by the select and/or where.
- $conditional_joins = explode("\n", "LEFT JOIN ResourceFormat RF ON R.resourceFormatID = RF.resourceFormatID
+ } else {
+ $orgJoinAdd = "LEFT JOIN Organization O ON O.organizationID = ROL.organizationID";
+ }
+
+ $savedStatusID = intval($status->getIDFromName('saved'));
+ //also add to not retrieve saved records
+ $whereAdd[] = "R.statusID != " . $savedStatusID;
+
+ if (count($whereAdd) > 0) {
+ $whereStatement = " WHERE " . implode(" AND ", $whereAdd);
+ } else {
+ $whereStatement = "";
+ }
+
+ if ($count) {
+ $select = "SELECT COUNT(DISTINCT R.resourceID) count";
+ $groupBy = "";
+ } else {
+ $select = "SELECT R.resourceID, R.titleText, AT.shortName acquisitionType, R.createLoginID, CU.firstName, CU.lastName, R.createDate, S.shortName status,
+ GROUP_CONCAT(DISTINCT A.shortName, I.identifier ORDER BY A.shortName DESC SEPARATOR ' ') aliases";
+ $groupBy = "GROUP BY R.resourceID";
+ }
+
+ $referenced_tables = array();
+
+ $table_matches = array();
+
+ // Build a list of tables that are referenced by the select and where statements in order to limit the number of joins performed in the search.
+ preg_match_all("/[A-Z]+(?=[.][A-Z]+)/i", $select, $table_matches);
+ $referenced_tables = array_unique($table_matches[0]);
+
+ preg_match_all("/[A-Z]+(?=[.][A-Z]+)/i", $whereStatement, $table_matches);
+ $referenced_tables = array_unique(array_merge($referenced_tables, $table_matches[0]));
+
+ // These join statements will only be included in the query if the alias is referenced by the select and/or where.
+ $conditional_joins = explode("\n", "LEFT JOIN ResourceFormat RF ON R.resourceFormatID = RF.resourceFormatID
LEFT JOIN ResourceType RT ON R.resourceTypeID = RT.resourceTypeID
LEFT JOIN AcquisitionType AT ON R.acquisitionTypeID = AT.acquisitionTypeID
LEFT JOIN Status S ON R.statusID = S.statusID
@@ -1172,21 +1114,21 @@ public function searchQuery($whereAdd, $orderBy = '', $limit = '', $count = fals
LEFT JOIN ResourcePayment RPAY ON R.resourceID = RPAY.resourceID
LEFT JOIN ResourceNote RN ON R.resourceID = RN.resourceID
LEFT JOIN ResourceStep RS ON R.resourceID = RS.resourceID
- LEFT JOIN IsbnOrIssn I ON R.resourceID = I.resourceID
+ LEFT JOIN Identifier I ON R.resourceID = I.resourceID
");
- $additional_joins = array();
+ $additional_joins = array();
- foreach($conditional_joins as $join) {
- $match = array();
- preg_match("/[A-Z]+(?= ON )/i", $join, $match);
- $table_name = $match[0];
- if (in_array($table_name, $referenced_tables)) {
- $additional_joins[] = $join;
- }
- }
+ foreach ($conditional_joins as $join) {
+ $match = array();
+ preg_match("/[A-Z]+(?= ON )/i", $join, $match);
+ $table_name = $match[0];
+ if (in_array($table_name, $referenced_tables)) {
+ $additional_joins[] = $join;
+ }
+ }
- $query = $select . "
+ $query = $select . "
FROM Resource R
LEFT JOIN Alias A ON R.resourceID = A.resourceID
LEFT JOIN ResourceOrganizationLink ROL ON R.resourceID = ROL.resourceID
@@ -1201,131 +1143,125 @@ public function searchQuery($whereAdd, $orderBy = '', $limit = '', $count = fals
" . $whereStatement . "
" . $groupBy;
- if ($orderBy) {
- $query .= "\nORDER BY " . $orderBy;
- }
-
- if ($limit) {
- $query .= "\nLIMIT " . $limit;
- }
- return $query;
- }
-
- //returns array based on search
- public function search($whereAdd, $orderBy, $limit){
- $query = $this->searchQuery($whereAdd, $orderBy, $limit, false);
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $searchArray = array();
- $resultArray = array();
-
- //need to do this since it could be that there's only one result and this is how the dbservice returns result
- if (isset($result['resourceID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($searchArray, $resultArray);
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
- array_push($searchArray, $resultArray);
- }
- }
-
- return $searchArray;
- }
-
- public function searchCount($whereAdd) {
- $query = $this->searchQuery($whereAdd, '', '', true);
- $result = $this->db->processQuery($query, 'assoc');
-
- //echo $query;
-
- return $result['count'];
- }
-
-
- //used for A-Z on search (index)
- public function getAlphabeticalList(){
- $alphArray = array();
- $result = mysql_query("SELECT DISTINCT UPPER(SUBSTR(TRIM(LEADING 'The ' FROM titleText),1,1)) letter, COUNT(SUBSTR(TRIM(LEADING 'The ' FROM titleText),1,1)) letter_count
- FROM Resource R
- GROUP BY SUBSTR(TRIM(LEADING 'The ' FROM titleText),1,1)
- ORDER BY 1;");
+ if ($orderBy) {
+ $query .= "\nORDER BY " . $orderBy;
+ }
+
+ if ($limit) {
+ $query .= "\nLIMIT " . $limit;
+ }
+ return $query;
+ }
- while ($row = mysql_fetch_assoc($result)){
- $alphArray[$row['letter']] = $row['letter_count'];
- }
+ //returns array based on search
+ public function search($whereAdd, $orderBy, $limit) {
+ $query = $this->searchQuery($whereAdd, $orderBy, $limit, false);
- return $alphArray;
- }
+ $result = $this->db->processQuery($query, 'assoc');
+ $searchArray = array();
+ $resultArray = array();
+
+ //need to do this since it could be that there's only one result and this is how the dbservice returns result
+ if (isset($result['resourceID'])) {
+
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
+
+ array_push($searchArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($searchArray, $resultArray);
+ }
+ }
+
+ return $searchArray;
+ }
+
+ public function searchCount($whereAdd) {
+ $query = $this->searchQuery($whereAdd, '', '', true);
+ $result = $this->db->processQuery($query, 'assoc');
+
+ //echo $query;
+
+ return $result['count'];
+ }
+ //used for A-Z on search (index)
+ public function getAlphabeticalList() {
+ $alphArray = array();
+ $result = mysql_query("SELECT DISTINCT UPPER(SUBSTR(TRIM(LEADING 'The ' FROM titleText),1,1)) letter, COUNT(SUBSTR(TRIM(LEADING 'The ' FROM titleText),1,1)) letter_count
+ FROM Resource R
+ GROUP BY SUBSTR(TRIM(LEADING 'The ' FROM titleText),1,1)
+ ORDER BY 1;");
+ while ($row = mysql_fetch_assoc($result)) {
+ $alphArray[$row['letter']] = $row['letter_count'];
+ }
+ return $alphArray;
+ }
- //returns array based on search for excel output (export.php)
- public function export($whereAdd, $orderBy){
+ //returns array based on search for excel output (export.php)
+ public function export($whereAdd, $orderBy) {
- $config = new Configuration();
+ $config = new Configuration();
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- $orgJoinAdd = "LEFT JOIN " . $dbName . ".Organization O ON O.organizationID = ROL.organizationID
+ $orgJoinAdd = "LEFT JOIN " . $dbName . ".Organization O ON O.organizationID = ROL.organizationID
LEFT JOIN " . $dbName . ".Alias OA ON OA.organizationID = ROL.organizationID";
- $orgSelectAdd = "GROUP_CONCAT(DISTINCT O.name ORDER BY O.name DESC SEPARATOR '; ') organizationNames";
- }else{
- $orgJoinAdd = "LEFT JOIN Organization O ON O.organizationID = ROL.organizationID";
+ $orgSelectAdd = "GROUP_CONCAT(DISTINCT O.name ORDER BY O.name DESC SEPARATOR '; ') organizationNames";
+ } else {
+ $orgJoinAdd = "LEFT JOIN Organization O ON O.organizationID = ROL.organizationID";
- $orgSelectAdd = "GROUP_CONCAT(DISTINCT O.shortName ORDER BY O.shortName DESC SEPARATOR '; ') organizationNames";
- }
+ $orgSelectAdd = "GROUP_CONCAT(DISTINCT O.shortName ORDER BY O.shortName DESC SEPARATOR '; ') organizationNames";
+ }
- $licSelectAdd = '';
- $licJoinAdd = '';
- if ($config->settings->licensingModule == 'Y'){
- $dbName = $config->settings->licensingDatabaseName;
+ $licSelectAdd = '';
+ $licJoinAdd = '';
+ if ($config->settings->licensingModule == 'Y') {
+ $dbName = $config->settings->licensingDatabaseName;
- $licJoinAdd = " LEFT JOIN ResourceLicenseLink RLL ON RLL.resourceID = R.resourceID
+ $licJoinAdd = " LEFT JOIN ResourceLicenseLink RLL ON RLL.resourceID = R.resourceID
LEFT JOIN " . $dbName . ".License L ON RLL.licenseID = L.licenseID
LEFT JOIN ResourceLicenseStatus RLS ON RLS.resourceID = R.resourceID
LEFT JOIN LicenseStatus LS ON LS.licenseStatusID = RLS.licenseStatusID";
- $licSelectAdd = "GROUP_CONCAT(DISTINCT L.shortName ORDER BY L.shortName DESC SEPARATOR '; ') licenseNames,
+ $licSelectAdd = "GROUP_CONCAT(DISTINCT L.shortName ORDER BY L.shortName DESC SEPARATOR '; ') licenseNames,
GROUP_CONCAT(DISTINCT LS.shortName, ': ', DATE_FORMAT(RLS.licenseStatusChangeDate, '%m/%d/%Y') ORDER BY RLS.licenseStatusChangeDate DESC SEPARATOR '; ') licenseStatuses, ";
+ }
- }
+ $status = new Status();
+ //also add to not retrieve saved records
+ $savedStatusID = intval($status->getIDFromName('saved'));
+ $whereAdd[] = "R.statusID != " . $savedStatusID;
- $status = new Status();
- //also add to not retrieve saved records
- $savedStatusID = intval($status->getIDFromName('saved'));
- $whereAdd[] = "R.statusID != " . $savedStatusID;
-
- if (count($whereAdd) > 0){
- $whereStatement = " WHERE " . implode(" AND ", $whereAdd);
- }else{
- $whereStatement = "";
- }
+ if (count($whereAdd) > 0) {
+ $whereStatement = " WHERE " . implode(" AND ", $whereAdd);
+ } else {
+ $whereStatement = "";
+ }
- //now actually execute query
- $query = "SELECT R.resourceID, R.titleText, AT.shortName acquisitionType, CONCAT_WS(' ', CU.firstName, CU.lastName) createName,
+ //now actually execute query
+ $query = "SELECT R.resourceID, R.titleText, AT.shortName acquisitionType, CONCAT_WS(' ', CU.firstName, CU.lastName) createName,
R.createDate createDate, CONCAT_WS(' ', UU.firstName, UU.lastName) updateName,
R.updateDate updateDate, S.shortName status,
RT.shortName resourceType, RF.shortName resourceFormat, R.orderNumber, R.systemNumber, R.resourceURL, R.resourceAltURL,
R.currentStartDate, R.currentEndDate, R.subscriptionAlertEnabledInd, AUT.shortName authenticationType,
AM.shortName accessMethod, SL.shortName storageLocation, UL.shortName userLimit, R.authenticationUserName,
R.authenticationPassword, R.coverageText, CT.shortName catalogingType, CS.shortName catalogingStatus, R.recordSetIdentifier, R.bibSourceURL,
- R.numberRecordsAvailable, R.numberRecordsLoaded, R.hasOclcHoldings, I.isbnOrIssn,
+ R.numberRecordsAvailable, R.numberRecordsLoaded, R.hasOclcHoldings, I.identifier,
" . $orgSelectAdd . ",
" . $licSelectAdd . "
GROUP_CONCAT(DISTINCT A.shortName ORDER BY A.shortName DESC SEPARATOR '; ') aliases,
@@ -1368,595 +1304,545 @@ public function export($whereAdd, $orderBy){
LEFT JOIN AccessMethod AM ON AM.accessMethodID = R.accessMethodID
LEFT JOIN StorageLocation SL ON SL.storageLocationID = R.storageLocationID
LEFT JOIN UserLimit UL ON UL.userLimitID = R.userLimitID
- LEFT JOIN IsbnOrIssn I ON I.resourceID = R.resourceID
+ LEFT JOIN Identifier I ON I.resourceID = R.resourceID
" . $licJoinAdd . "
" . $whereStatement . "
GROUP BY R.resourceID
ORDER BY " . $orderBy;
-
- $result = $this->db->processQuery(stripslashes($query), 'assoc');
-
- $searchArray = array();
- $resultArray = array();
-
- //need to do this since it could be that there's only one result and this is how the dbservice returns result
- if (isset($result['resourceID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($searchArray, $resultArray);
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
- array_push($searchArray, $resultArray);
- }
- }
-
- return $searchArray;
- }
-
-
-
-
-
-
-
- //search used index page drop down
- public function getOrganizationList(){
- $config = new Configuration;
-
- $orgArray = array();
-
- //if the org module is installed get the org names from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
- $query = "SELECT name, organizationID FROM " . $dbName . ".Organization ORDER BY 1;";
-
- //otherwise get the orgs from this database
- }else{
- $query = "SELECT shortName name, organizationID FROM Organization ORDER BY 1;";
- }
-
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $resultArray = array();
-
- //need to do this since it could be that there's only one result and this is how the dbservice returns result
- if (isset($result['organizationID'])){
-
- foreach (array_keys($result) as $attributeName) {
- $resultArray[$attributeName] = $result[$attributeName];
- }
-
- array_push($orgArray, $resultArray);
- }else{
- foreach ($result as $row) {
- $resultArray = array();
- foreach (array_keys($row) as $attributeName) {
- $resultArray[$attributeName] = $row[$attributeName];
- }
- array_push($orgArray, $resultArray);
- }
- }
-
- return $orgArray;
-
- }
-
-
-
- //gets an array of organizations set up for this resource (organizationID, organization, organizationRole)
- public function getOrganizationArray(){
- $config = new Configuration;
-
- //if the org module is installed get the org name from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
-
- $resourceOrgArray = array();
-
- $query = "SELECT * FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['organizationID'])){
- $orgArray = array();
- //first, get the organization name
- $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $result['organizationID'];
+ $result = $this->db->processQuery(stripslashes($query), 'assoc');
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['name'];
- $orgArray['organizationID'] = $result['organizationID'];
- }
- }
+ $searchArray = array();
+ $resultArray = array();
- //then, get the role name
- $query = "SELECT * FROM " . $dbName . ".OrganizationRole WHERE organizationRoleID = " . $result['organizationRoleID'];
+ //need to do this since it could be that there's only one result and this is how the dbservice returns result
+ if (isset($result['resourceID'])) {
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
- $orgArray['organizationRole'] = $orgRow['shortName'];
- }
- }
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- array_push($resourceOrgArray, $orgArray);
- }else{
- foreach ($result as $row) {
+ array_push($searchArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($searchArray, $resultArray);
+ }
+ }
- $orgArray = array();
-
- //first, get the organization name
- $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $row['organizationID'];
-
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['name'];
- $orgArray['organizationID'] = $row['organizationID'];
- }
- }
-
- //then, get the role name
- $query = "SELECT * FROM " . $dbName . ".OrganizationRole WHERE organizationRoleID = " . $row['organizationRoleID'];
-
-
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
- $orgArray['organizationRole'] = $orgRow['shortName'];
- }
- }
-
- array_push($resourceOrgArray, $orgArray);
-
- }
+ return $searchArray;
+ }
- }
+ //search used index page drop down
+ public function getOrganizationList() {
+ $config = new Configuration;
+ $orgArray = array();
+ //if the org module is installed get the org names from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
+ $query = "SELECT name, organizationID FROM " . $dbName . ".Organization ORDER BY 1;";
+ //otherwise get the orgs from this database
+ } else {
+ $query = "SELECT shortName name, organizationID FROM Organization ORDER BY 1;";
+ }
+ $result = $this->db->processQuery($query, 'assoc');
- //otherwise if the org module is not installed get the org name from this database
- }else{
+ $resultArray = array();
+ //need to do this since it could be that there's only one result and this is how the dbservice returns result
+ if (isset($result['organizationID'])) {
+ foreach (array_keys($result) as $attributeName) {
+ $resultArray[$attributeName] = $result[$attributeName];
+ }
- $resourceOrgArray = array();
+ array_push($orgArray, $resultArray);
+ } else {
+ foreach ($result as $row) {
+ $resultArray = array();
+ foreach (array_keys($row) as $attributeName) {
+ $resultArray[$attributeName] = $row[$attributeName];
+ }
+ array_push($orgArray, $resultArray);
+ }
+ }
- $query = "SELECT * FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
+ return $orgArray;
+ }
- $result = $this->db->processQuery($query, 'assoc');
+ //gets an array of organizations set up for this resource (organizationID, organization, organizationRole)
+ public function getOrganizationArray() {
+ $config = new Configuration;
- $objects = array();
+ //if the org module is installed get the org name from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['organizationID'])){
- $orgArray = array();
+ $resourceOrgArray = array();
- //first, get the organization name
- $query = "SELECT shortName FROM Organization WHERE organizationID = " . $result['organizationID'];
+ $query = "SELECT * FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['shortName'];
- $orgArray['organizationID'] = $result['organizationID'];
- }
- }
+ $result = $this->db->processQuery($query, 'assoc');
- //then, get the role name
- $query = "SELECT * FROM OrganizationRole WHERE organizationRoleID = " . $result['organizationRoleID'];
+ $objects = array();
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
- $orgArray['organizationRole'] = $orgRow['shortName'];
- }
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['organizationID'])) {
+ $orgArray = array();
- array_push($resourceOrgArray, $orgArray);
- }else{
- foreach ($result as $row) {
+ //first, get the organization name
+ $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $result['organizationID'];
- $orgArray = array();
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['name'];
+ $orgArray['organizationID'] = $result['organizationID'];
+ }
+ }
- //first, get the organization name
- $query = "SELECT shortName FROM Organization WHERE organizationID = " . $row['organizationID'];
+ //then, get the role name
+ $query = "SELECT * FROM " . $dbName . ".OrganizationRole WHERE organizationRoleID = " . $result['organizationRoleID'];
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['shortName'];
- $orgArray['organizationID'] = $row['organizationID'];
- }
- }
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
+ $orgArray['organizationRole'] = $orgRow['shortName'];
+ }
+ }
- //then, get the role name
- $query = "SELECT * FROM OrganizationRole WHERE organizationRoleID = " . $row['organizationRoleID'];
+ array_push($resourceOrgArray, $orgArray);
+ } else {
+ foreach ($result as $row) {
+ $orgArray = array();
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
- $orgArray['organizationRole'] = $orgRow['shortName'];
- }
- }
+ //first, get the organization name
+ $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $row['organizationID'];
- array_push($resourceOrgArray, $orgArray);
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['name'];
+ $orgArray['organizationID'] = $row['organizationID'];
+ }
+ }
- }
+ //then, get the role name
+ $query = "SELECT * FROM " . $dbName . ".OrganizationRole WHERE organizationRoleID = " . $row['organizationRoleID'];
- }
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
+ $orgArray['organizationRole'] = $orgRow['shortName'];
+ }
+ }
+ array_push($resourceOrgArray, $orgArray);
+ }
+ }
- }
- return $resourceOrgArray;
- }
+ //otherwise if the org module is not installed get the org name from this database
+ } else {
+ $resourceOrgArray = array();
- //gets an array of distinct organizations set up for this resource (organizationID, organization)
- public function getDistinctOrganizationArray(){
- $config = new Configuration;
+ $query = "SELECT * FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
- //if the org module is installed get the org name from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
+ $result = $this->db->processQuery($query, 'assoc');
- $resourceOrgArray = array();
+ $objects = array();
- $query = "SELECT DISTINCT organizationID FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['organizationID'])) {
+ $orgArray = array();
- $result = $this->db->processQuery($query, 'assoc');
+ //first, get the organization name
+ $query = "SELECT shortName FROM Organization WHERE organizationID = " . $result['organizationID'];
- $objects = array();
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['shortName'];
+ $orgArray['organizationID'] = $result['organizationID'];
+ }
+ }
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['organizationID'])){
- $orgArray = array();
+ //then, get the role name
+ $query = "SELECT * FROM OrganizationRole WHERE organizationRoleID = " . $result['organizationRoleID'];
- //first, get the organization name
- $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $result['organizationID'];
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
+ $orgArray['organizationRole'] = $orgRow['shortName'];
+ }
+ }
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['name'];
- $orgArray['organizationID'] = $result['organizationID'];
- }
- }
+ array_push($resourceOrgArray, $orgArray);
+ } else {
+ foreach ($result as $row) {
- array_push($resourceOrgArray, $orgArray);
- }else{
- foreach ($result as $row) {
+ $orgArray = array();
- $orgArray = array();
+ //first, get the organization name
+ $query = "SELECT shortName FROM Organization WHERE organizationID = " . $row['organizationID'];
- //first, get the organization name
- $query = "SELECT DISTINCT name FROM " . $dbName . ".Organization WHERE organizationID = " . $row['organizationID'];
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['shortName'];
+ $orgArray['organizationID'] = $row['organizationID'];
+ }
+ }
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['name'];
- $orgArray['organizationID'] = $row['organizationID'];
- }
- }
+ //then, get the role name
+ $query = "SELECT * FROM OrganizationRole WHERE organizationRoleID = " . $row['organizationRoleID'];
- array_push($resourceOrgArray, $orgArray);
- }
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organizationRoleID'] = $orgRow['organizationRoleID'];
+ $orgArray['organizationRole'] = $orgRow['shortName'];
+ }
+ }
- }
+ array_push($resourceOrgArray, $orgArray);
+ }
+ }
+ }
+ return $resourceOrgArray;
+ }
+ //gets an array of distinct organizations set up for this resource (organizationID, organization)
+ public function getDistinctOrganizationArray() {
+ $config = new Configuration;
+ //if the org module is installed get the org name from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
+ $resourceOrgArray = array();
- //otherwise if the org module is not installed get the org name from this database
- }else{
+ $query = "SELECT DISTINCT organizationID FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
- $resourceOrgArray = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['organizationID'])) {
+ $orgArray = array();
- $query = "SELECT DISTINCT organizationID FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
+ //first, get the organization name
+ $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $result['organizationID'];
- $result = $this->db->processQuery($query, 'assoc');
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['name'];
+ $orgArray['organizationID'] = $result['organizationID'];
+ }
+ }
- $objects = array();
+ array_push($resourceOrgArray, $orgArray);
+ } else {
+ foreach ($result as $row) {
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['organizationID'])){
- $orgArray = array();
+ $orgArray = array();
- //first, get the organization name
- $query = "SELECT DISTINCT shortName FROM Organization WHERE organizationID = " . $result['organizationID'];
+ //first, get the organization name
+ $query = "SELECT DISTINCT name FROM " . $dbName . ".Organization WHERE organizationID = " . $row['organizationID'];
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['shortName'];
- $orgArray['organizationID'] = $result['organizationID'];
- }
- }
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['name'];
+ $orgArray['organizationID'] = $row['organizationID'];
+ }
+ }
- array_push($resourceOrgArray, $orgArray);
- }else{
- foreach ($result as $row) {
+ array_push($resourceOrgArray, $orgArray);
+ }
+ }
- $orgArray = array();
- //first, get the organization name
- $query = "SELECT DISTINCT shortName FROM Organization WHERE organizationID = " . $row['organizationID'];
- if ($orgResult = mysql_query($query)){
- while ($orgRow = mysql_fetch_assoc($orgResult)){
- $orgArray['organization'] = $orgRow['shortName'];
- $orgArray['organizationID'] = $row['organizationID'];
- }
- }
- array_push($resourceOrgArray, $orgArray);
- }
- }
+ //otherwise if the org module is not installed get the org name from this database
+ } else {
+ $resourceOrgArray = array();
+ $query = "SELECT DISTINCT organizationID FROM ResourceOrganizationLink WHERE resourceID = '" . $this->resourceID . "'";
- }
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
- return $resourceOrgArray;
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['organizationID'])) {
+ $orgArray = array();
+ //first, get the organization name
+ $query = "SELECT DISTINCT shortName FROM Organization WHERE organizationID = " . $result['organizationID'];
- public function hasCatalogingInformation() {
- return ($this->recordSetIdentifier || $this->recordSetIdentifier || $this->bibSourceURL || $this->catalogingTypeID || $this->catalogingStatusID || $this->numberRecordsAvailable || $this->numberRecordsLoaded || $this->hasOclcHoldings);
- }
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['shortName'];
+ $orgArray['organizationID'] = $result['organizationID'];
+ }
+ }
+ array_push($resourceOrgArray, $orgArray);
+ } else {
+ foreach ($result as $row) {
+ $orgArray = array();
+ //first, get the organization name
+ $query = "SELECT DISTINCT shortName FROM Organization WHERE organizationID = " . $row['organizationID'];
- //removes this resource and its children
- public function removeResourceAndChildren(){
+ if ($orgResult = mysql_query($query)) {
+ while ($orgRow = mysql_fetch_assoc($orgResult)) {
+ $orgArray['organization'] = $orgRow['shortName'];
+ $orgArray['organizationID'] = $row['organizationID'];
+ }
+ }
- // for each children
- foreach ($this->getChildResources() as $instance) {
- $removeChild = true;
- $child = new Resource(new NamedArguments(array('primaryKey' => $instance->resourceID)));
+ array_push($resourceOrgArray, $orgArray);
+ }
+ }
+ }
- // get parents of this children
- $parents = $child->getParentResources();
- // If the child ressource belongs to another parent than the one we're removing
- foreach ($parents as $pinstance) {
- $parentResourceObj = new Resource(new NamedArguments(array('primaryKey' => $pinstance->relatedResourceID)));
- if ($parentResourceObj->resourceID != $this->resourceID) {
- // We do not delete this child.
- $removeChild = false;
- }
- }
- if ($removeChild == true) {
- $child->removeResource();
+ return $resourceOrgArray;
}
- }
- // Finally, we remove the parent
- $this->removeResource();
- }
-
-
-
-
- //removes this resource
- public function removeResource(){
- //delete data from child linked tables
- $this->removeResourceRelationships();
- $this->removePurchaseSites();
- $this->removeAuthorizedSites();
- $this->removeAdministeringSites();
- $this->removeResourceLicenses();
- $this->removeResourceLicenseStatuses();
- $this->removeResourceOrganizations();
- $this->removeResourcePayments();
- $this->removeAllSubjects();
- $this->removeAllIsbnOrIssn();
-
-
- $instance = new Contact();
- foreach ($this->getContacts() as $instance) {
- $instance->removeContactRoles();
- $instance->delete();
- }
-
- $instance = new ExternalLogin();
- foreach ($this->getExternalLogins() as $instance) {
- $instance->delete();
- }
- $instance = new ResourceNote();
- foreach ($this->getNotes() as $instance) {
- $instance->delete();
- }
-
- $instance = new Attachment();
- foreach ($this->getAttachments() as $instance) {
- $instance->delete();
- }
-
- $instance = new Alias();
- foreach ($this->getAliases() as $instance) {
- $instance->delete();
- }
-
-
- $this->delete();
- }
+ public function hasCatalogingInformation() {
+ return ($this->recordSetIdentifier || $this->recordSetIdentifier || $this->bibSourceURL || $this->catalogingTypeID || $this->catalogingStatusID || $this->numberRecordsAvailable || $this->numberRecordsLoaded || $this->hasOclcHoldings);
+ }
+ //removes this resource and its children
+ public function removeResourceAndChildren() {
+
+ // for each children
+ foreach ($this->getChildResources() as $instance) {
+ $removeChild = true;
+ $child = new Resource(new NamedArguments(array('primaryKey' => $instance->resourceID)));
+
+ // get parents of this children
+ $parents = $child->getParentResources();
+
+ // If the child ressource belongs to another parent than the one we're removing
+ foreach ($parents as $pinstance) {
+ $parentResourceObj = new Resource(new NamedArguments(array('primaryKey' => $pinstance->relatedResourceID)));
+ if ($parentResourceObj->resourceID != $this->resourceID) {
+ // We do not delete this child.
+ $removeChild = false;
+ }
+ }
+ if ($removeChild == true) {
+ $child->removeResource();
+ }
+ }
+ // Finally, we remove the parent
+ $this->removeResource();
+ }
+ //removes this resource
+ public function removeResource() {
+ //delete data from child linked tables
+ $this->removeResourceRelationships();
+ $this->removePurchaseSites();
+ $this->removeAuthorizedSites();
+ $this->removeAdministeringSites();
+ $this->removeResourceLicenses();
+ $this->removeResourceLicenseStatuses();
+ $this->removeResourceOrganizations();
+ $this->removeResourcePayments();
+ $this->removeAllSubjects();
+ $this->removeResourceIdentifiers();
+
+
+ $instance = new Contact();
+ foreach ($this->getContacts() as $instance) {
+ $instance->removeContactRoles();
+ $instance->delete();
+ }
+
+ $instance = new ExternalLogin();
+ foreach ($this->getExternalLogins() as $instance) {
+ $instance->delete();
+ }
+
+ $instance = new ResourceNote();
+ foreach ($this->getNotes() as $instance) {
+ $instance->delete();
+ }
+
+ $instance = new Attachment();
+ foreach ($this->getAttachments() as $instance) {
+ $instance->delete();
+ }
+
+ $instance = new Alias();
+ foreach ($this->getAliases() as $instance) {
+ $instance->delete();
+ }
+
+
+ $this->delete();
+ }
- //removes resource hierarchy records
- public function removeResourceRelationships(){
+ //removes resource hierarchy records
+ public function removeResourceRelationships() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceRelationship
WHERE resourceID = '" . $this->resourceID . "' OR relatedResourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
-
+ $result = $this->db->processQuery($query);
+ }
- //removes resource purchase sites
- public function removePurchaseSites(){
+ //removes resource purchase sites
+ public function removePurchaseSites() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourcePurchaseSiteLink
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
-
-
+ $result = $this->db->processQuery($query);
+ }
- //removes resource authorized sites
- public function removeAuthorizedSites(){
+ //removes resource authorized sites
+ public function removeAuthorizedSites() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceAuthorizedSiteLink
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
-
+ $result = $this->db->processQuery($query);
+ }
- //removes resource administering sites
- public function removeAdministeringSites(){
+ //removes resource administering sites
+ public function removeAdministeringSites() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceAdministeringSiteLink
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
-
+ $result = $this->db->processQuery($query);
+ }
- //removes payment records
- public function removeResourcePayments(){
+ //removes payment records
+ public function removeResourcePayments() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourcePayment
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
+ $result = $this->db->processQuery($query);
+ }
- //removes resource licenses
- public function removeResourceLicenses(){
+ //removes resource licenses
+ public function removeResourceLicenses() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceLicenseLink
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
+ $result = $this->db->processQuery($query);
+ }
- //removes resource license statuses
- public function removeResourceLicenseStatuses(){
+ //removes resource license statuses
+ public function removeResourceLicenseStatuses() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceLicenseStatus
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
+ $result = $this->db->processQuery($query);
+ }
- //removes resource organizations
- public function removeResourceOrganizations(){
+ //removes resource organizations
+ public function removeResourceOrganizations() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceOrganizationLink
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
+ $result = $this->db->processQuery($query);
+ }
- //removes resource note records
- public function removeResourceNotes(){
+ //removes resource note records
+ public function removeResourceNotes() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceNote
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
-
-
+ $result = $this->db->processQuery($query);
+ }
- //removes resource steps
- public function removeResourceSteps(){
+ //removes resource steps
+ public function removeResourceSteps() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceStep
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
- }
-
-
-
+ $result = $this->db->processQuery($query);
+ }
+ //remove resource Identifiers
+ public function removeResourceIdentifiers() {
+ $query = "DELETE
+ FROM Identifier
+ WHERE resourceID = '" . $this->resourceID . "'";
+ $this->db->processQuery($query);
+ }
- //search used for the resource autocomplete
- public function resourceAutocomplete($q){
- $resourceArray = array();
- $result = mysql_query("SELECT titleText, resourceID
+ //search used for the resource autocomplete
+ public function resourceAutocomplete($q) {
+ $resourceArray = array();
+ $result = mysql_query("SELECT titleText, resourceID
FROM Resource
WHERE upper(titleText) like upper('%" . $q . "%')
ORDER BY 1;");
- while ($row = mysql_fetch_assoc($result)){
- $resourceArray[] = $row['titleText'] . "|" . $row['resourceID'];
- }
-
- return $resourceArray;
- }
+ while ($row = mysql_fetch_assoc($result)) {
+ $resourceArray[] = $row['titleText'] . "|" . $row['resourceID'];
+ }
+ return $resourceArray;
+ }
- //search used for the organization autocomplete
- public function organizationAutocomplete($q){
- $config = new Configuration;
- $organizationArray = array();
+ //search used for the organization autocomplete
+ public function organizationAutocomplete($q) {
+ $config = new Configuration;
+ $organizationArray = array();
- //if the org module is installed get the org name from org database
- if ($config->settings->organizationsModule == 'Y'){
- $dbName = $config->settings->organizationsDatabaseName;
+ //if the org module is installed get the org name from org database
+ if ($config->settings->organizationsModule == 'Y') {
+ $dbName = $config->settings->organizationsDatabaseName;
- $result = mysql_query("SELECT CONCAT(A.name, ' (', O.name, ')') shortName, O.organizationID
+ $result = mysql_query("SELECT CONCAT(A.name, ' (', O.name, ')') shortName, O.organizationID
FROM " . $dbName . ".Alias A, " . $dbName . ".Organization O
WHERE A.organizationID=O.organizationID
AND upper(A.name) like upper('%" . $q . "%')
@@ -1965,277 +1851,250 @@ public function organizationAutocomplete($q){
FROM " . $dbName . ".Organization
WHERE upper(name) like upper('%" . $q . "%')
ORDER BY 1;");
+ } else {
- }else{
-
- $result = mysql_query("SELECT organizationID, shortName
+ $result = mysql_query("SELECT organizationID, shortName
FROM Organization O
WHERE upper(O.shortName) like upper('%" . $q . "%')
ORDER BY shortName;");
-
- }
-
-
- while ($row = mysql_fetch_assoc($result)){
- $organizationArray[] = $row['shortName'] . "|" . $row['organizationID'];
- }
-
+ }
- return $organizationArray;
- }
+ while ($row = mysql_fetch_assoc($result)) {
+ $organizationArray[] = $row['shortName'] . "|" . $row['organizationID'];
+ }
+ return $organizationArray;
+ }
- //search used for the license autocomplete
- public function licenseAutocomplete($q){
- $config = new Configuration;
- $licenseArray = array();
+ //search used for the license autocomplete
+ public function licenseAutocomplete($q) {
+ $config = new Configuration;
+ $licenseArray = array();
- //if the org module is installed get the org name from org database
- if ($config->settings->licensingModule == 'Y'){
- $dbName = $config->settings->licensingDatabaseName;
+ //if the org module is installed get the org name from org database
+ if ($config->settings->licensingModule == 'Y') {
+ $dbName = $config->settings->licensingDatabaseName;
- $result = mysql_query("SELECT shortName, licenseID
+ $result = mysql_query("SELECT shortName, licenseID
FROM " . $dbName . ".License
WHERE upper(shortName) like upper('%" . $q . "%')
ORDER BY 1;");
+ }
- }
-
- while ($row = mysql_fetch_assoc($result)){
- $licenseArray[] = $row['shortName'] . "|" . $row['licenseID'];
- }
+ while ($row = mysql_fetch_assoc($result)) {
+ $licenseArray[] = $row['shortName'] . "|" . $row['licenseID'];
+ }
- return $licenseArray;
- }
-
+ return $licenseArray;
+ }
- ///////////////////////////////////////////////////////////////////////////////////
- //
+ ///////////////////////////////////////////////////////////////////////////////////
+ //
// Workflow functions follow
- //
+ //
///////////////////////////////////////////////////////////////////////////////////
+ //returns array of ResourceStep objects for this Resource
+ public function getResourceSteps() {
- //returns array of ResourceStep objects for this Resource
- public function getResourceSteps(){
-
-
- $query = "SELECT * FROM ResourceStep
+ $query = "SELECT * FROM ResourceStep
WHERE resourceID = '" . $this->resourceID . "'
ORDER BY displayOrderSequence, stepID";
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceStepID'])){
- $object = new ResourceStep(new NamedArguments(array('primaryKey' => $result['resourceStepID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ResourceStep(new NamedArguments(array('primaryKey' => $row['resourceStepID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
-
- }
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceStepID'])) {
+ $object = new ResourceStep(new NamedArguments(array('primaryKey' => $result['resourceStepID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ResourceStep(new NamedArguments(array('primaryKey' => $row['resourceStepID'])));
+ array_push($objects, $object);
+ }
+ }
+ return $objects;
+ }
- //returns current step location in the workflow for this resource
- //used to display the group on the tabs
- public function getCurrentStepGroup(){
+ //returns current step location in the workflow for this resource
+ //used to display the group on the tabs
+ public function getCurrentStepGroup() {
- $query = "SELECT groupName FROM ResourceStep RS, UserGroup UG
+ $query = "SELECT groupName FROM ResourceStep RS, UserGroup UG
WHERE resourceID = '" . $this->resourceID . "'
ORDER BY stepID";
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceStepID'])){
-
- }
-
- }
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceStepID'])) {
+
+ }
+ }
- //returns first steps (object) in the workflow for this resource
- public function getFirstSteps(){
+ //returns first steps (object) in the workflow for this resource
+ public function getFirstSteps() {
- $query = "SELECT * FROM ResourceStep
+ $query = "SELECT * FROM ResourceStep
WHERE resourceID = '" . $this->resourceID . "'
AND (priorStepID is null OR priorStepID = '0')
ORDER BY stepID";
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['resourceStepID'])){
- $object = new ResourceStep(new NamedArguments(array('primaryKey' => $result['resourceStepID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new ResourceStep(new NamedArguments(array('primaryKey' => $row['resourceStepID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
-
-
- }
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceStepID'])) {
+ $object = new ResourceStep(new NamedArguments(array('primaryKey' => $result['resourceStepID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new ResourceStep(new NamedArguments(array('primaryKey' => $row['resourceStepID'])));
+ array_push($objects, $object);
+ }
+ }
- //enters resource into new workflow
- public function enterNewWorkflow(){
- $config = new Configuration();
-
- //remove any current workflow steps
- $this->removeResourceSteps();
-
- //make sure this resource is marked in progress in case it was archived
- $status = new Status();
- $this->statusID = $status->getIDFromName('progress');
- $this->save();
-
-
- //Determine the workflow this resource belongs to
- $workflowObj = new Workflow();
- $workflowID = $workflowObj->getWorkflowID($this->resourceTypeID, $this->resourceFormatID, $this->acquisitionTypeID);
-
- if ($workflowID){
- $workflow = new Workflow(new NamedArguments(array('primaryKey' => $workflowID)));
+ return $objects;
+ }
+ //enters resource into new workflow
+ public function enterNewWorkflow() {
+ $config = new Configuration();
- //Copy all of the step attributes for this workflow to a new resource step
- foreach ($workflow->getSteps() as $step){
- $resourceStep = new ResourceStep();
+ //remove any current workflow steps
+ $this->removeResourceSteps();
- $resourceStep->resourceStepID = '';
- $resourceStep->resourceID = $this->resourceID;
- $resourceStep->stepID = $step->stepID;
- $resourceStep->priorStepID = $step->priorStepID;
- $resourceStep->stepName = $step->stepName;
- $resourceStep->userGroupID = $step->userGroupID;
- $resourceStep->displayOrderSequence = $step->displayOrderSequence;
+ //make sure this resource is marked in progress in case it was archived
+ $status = new Status();
+ $this->statusID = $status->getIDFromName('progress');
+ $this->save();
- $resourceStep->save();
- }
+ //Determine the workflow this resource belongs to
+ $workflowObj = new Workflow();
+ $workflowID = $workflowObj->getWorkflowID($this->resourceTypeID, $this->resourceFormatID, $this->acquisitionTypeID);
+ if ($workflowID) {
+ $workflow = new Workflow(new NamedArguments(array('primaryKey' => $workflowID)));
- //Start the first step
- //this handles updating the db and sending notifications for approval groups
- foreach ($this->getFirstSteps() as $resourceStep){
- $resourceStep->startStep();
- }
- }
+ //Copy all of the step attributes for this workflow to a new resource step
+ foreach ($workflow->getSteps() as $step) {
+ $resourceStep = new ResourceStep();
+ $resourceStep->resourceStepID = '';
+ $resourceStep->resourceID = $this->resourceID;
+ $resourceStep->stepID = $step->stepID;
+ $resourceStep->priorStepID = $step->priorStepID;
+ $resourceStep->stepName = $step->stepName;
+ $resourceStep->userGroupID = $step->userGroupID;
+ $resourceStep->displayOrderSequence = $step->displayOrderSequence;
- //send an email notification to the feedback email address and the creator
- $cUser = new User(new NamedArguments(array('primaryKey' => $this->createLoginID)));
- $acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $this->acquisitionTypeID)));
+ $resourceStep->save();
+ }
- if ($cUser->firstName){
- $creator = $cUser->firstName . " " . $cUser->lastName;
- }else if ($this->createLoginID){ //for some reason user isn't set up or their firstname/last name don't exist
- $creator = $this->createLoginID;
- }else{
- $creator = "(unknown user)";
- }
+ //Start the first step
+ //this handles updating the db and sending notifications for approval groups
+ foreach ($this->getFirstSteps() as $resourceStep) {
+ $resourceStep->startStep();
+ }
+ }
- if (($config->settings->feedbackEmailAddress) || ($cUser->emailAddress)){
- $email = new Email();
- $util = new Utility();
- $email->message = $util->createMessageFromTemplate('NewResourceMain', $this->resourceID, $this->titleText, '', '', $creator);
+ //send an email notification to the feedback email address and the creator
+ $cUser = new User(new NamedArguments(array('primaryKey' => $this->createLoginID)));
+ $acquisitionType = new AcquisitionType(new NamedArguments(array('primaryKey' => $this->acquisitionTypeID)));
- if ($cUser->emailAddress){
- $emailTo[] = $cUser->emailAddress;
- }
+ if ($cUser->firstName) {
+ $creator = $cUser->firstName . " " . $cUser->lastName;
+ } else if ($this->createLoginID) { //for some reason user isn't set up or their firstname/last name don't exist
+ $creator = $this->createLoginID;
+ } else {
+ $creator = "(unknown user)";
+ }
- if ($config->settings->feedbackEmailAddress != ''){
- $emailTo[] = $config->settings->feedbackEmailAddress;
- }
- $email->to = implode(",", $emailTo);
+ if (($config->settings->feedbackEmailAddress) || ($cUser->emailAddress)) {
+ $email = new Email();
+ $util = new Utility();
- if ($acquisitionType->shortName){
- $email->subject = "CORAL Alert: New " . $acquisitionType->shortName . " Resource Added: " . $this->titleText;
- }else{
- $email->subject = "CORAL Alert: New Resource Added: " . $this->titleText;
- }
+ $email->message = $util->createMessageFromTemplate('NewResourceMain', $this->resourceID, $this->titleText, '', '', $creator);
- $email->send();
+ if ($cUser->emailAddress) {
+ $emailTo[] = $cUser->emailAddress;
+ }
- }
+ if ($config->settings->feedbackEmailAddress != '') {
+ $emailTo[] = $config->settings->feedbackEmailAddress;
+ }
- }
+ $email->to = implode(",", $emailTo);
+ if ($acquisitionType->shortName) {
+ $email->subject = "CORAL Alert: New " . $acquisitionType->shortName . " Resource Added: " . $this->titleText;
+ } else {
+ $email->subject = "CORAL Alert: New Resource Added: " . $this->titleText;
+ }
+ $email->send();
+ }
+ }
+ //completes a workflow (changes status to complete and sends notifications to creator and "master email")
+ public function completeWorkflow() {
+ $config = new Configuration();
+ $util = new Utility();
+ $status = new Status();
+ $statusID = $status->getIDFromName('complete');
- //completes a workflow (changes status to complete and sends notifications to creator and "master email")
- public function completeWorkflow(){
- $config = new Configuration();
- $util = new Utility();
- $status = new Status();
- $statusID = $status->getIDFromName('complete');
+ if ($statusID) {
+ $this->statusID = $statusID;
+ $this->save();
+ }
- if ($statusID){
- $this->statusID = $statusID;
- $this->save();
- }
+ //send notification to creator and master email address
- //send notification to creator and master email address
+ $cUser = new User(new NamedArguments(array('primaryKey' => $this->createLoginID)));
- $cUser = new User(new NamedArguments(array('primaryKey' => $this->createLoginID)));
+ //formulate emil to be sent
+ $email = new Email();
+ $email->message = $util->createMessageFromTemplate('CompleteResource', $this->resourceID, $this->titleText, '', $this->systemNumber, '');
- //formulate emil to be sent
- $email = new Email();
- $email->message = $util->createMessageFromTemplate('CompleteResource', $this->resourceID, $this->titleText, '', $this->systemNumber, '');
+ if ($cUser->emailAddress) {
+ $emailTo[] = $cUser->emailAddress;
+ }
- if ($cUser->emailAddress){
- $emailTo[] = $cUser->emailAddress;
- }
+ if ($config->settings->feedbackEmailAddress != '') {
+ $emailTo[] = $config->settings->feedbackEmailAddress;
+ }
- if ($config->settings->feedbackEmailAddress != ''){
- $emailTo[] = $config->settings->feedbackEmailAddress;
- }
+ $email->to = implode(",", $emailTo);
- $email->to = implode(",", $emailTo);
+ $email->subject = "CORAL Alert: Workflow completion for " . $this->titleText;
- $email->subject = "CORAL Alert: Workflow completion for " . $this->titleText;
+ $email->send();
+ }
- $email->send();
- }
+ //returns array of subject objects
+ public function getGeneralDetailSubjectLinkID() {
- //returns array of subject objects
- public function getGeneralDetailSubjectLinkID(){
-
- $query = "SELECT
+ $query = "SELECT
GDL.generalDetailSubjectLinkID
FROM
Resource R
@@ -2248,30 +2107,30 @@ public function getGeneralDetailSubjectLinkID(){
ORDER BY
GS.shortName,
DS.shortName";
-
-
- $result = $this->db->processQuery($query, 'assoc');
-
- $objects = array();
-
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['generalDetailSubjectLinkID'])){
- $object = new GeneralDetailSubjectLink(new NamedArguments(array('primaryKey' => $result['generalDetailSubjectLinkID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new GeneralDetailSubjectLink(new NamedArguments(array('primaryKey' => $row['generalDetailSubjectLinkID'])));
- array_push($objects, $object);
- }
- }
-
- return $objects;
- }
-
- //returns array of subject objects
- public function getDetailedSubjects($resourceID, $generalSubjectID){
-
- $query = "SELECT
+
+
+ $result = $this->db->processQuery($query, 'assoc');
+
+ $objects = array();
+
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['generalDetailSubjectLinkID'])) {
+ $object = new GeneralDetailSubjectLink(new NamedArguments(array('primaryKey' => $result['generalDetailSubjectLinkID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new GeneralDetailSubjectLink(new NamedArguments(array('primaryKey' => $row['generalDetailSubjectLinkID'])));
+ array_push($objects, $object);
+ }
+ }
+
+ return $objects;
+ }
+
+ //returns array of subject objects
+ public function getDetailedSubjects($resourceID, $generalSubjectID) {
+
+ $query = "SELECT
RSUB.resourceID,
GDL.detailedSubjectID,
DetailedSubject.shortName,
@@ -2283,59 +2142,133 @@ public function getDetailedSubjects($resourceID, $generalSubjectID){
WHERE
RSUB.resourceID = " . $resourceID . " AND GDL.generalSubjectID = " . $generalSubjectID . " ORDER BY DetailedSubject.shortName";
- //echo $query . " ";
-
- $result = $this->db->processQuery($query, 'assoc');
+ //echo $query . " ";
- $objects = array();
+ $result = $this->db->processQuery($query, 'assoc');
- //need to do this since it could be that there's only one request and this is how the dbservice returns result
- if (isset($result['detailedSubjectID'])){
- $object = new DetailedSubject(new NamedArguments(array('primaryKey' => $result['detailedSubjectID'])));
- array_push($objects, $object);
- }else{
- foreach ($result as $row) {
- $object = new DetailedSubject(new NamedArguments(array('primaryKey' => $row['detailedSubjectID'])));
- array_push($objects, $object);
- }
- }
+ $objects = array();
- return $objects;
- }
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['detailedSubjectID'])) {
+ $object = new DetailedSubject(new NamedArguments(array('primaryKey' => $result['detailedSubjectID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new DetailedSubject(new NamedArguments(array('primaryKey' => $row['detailedSubjectID'])));
+ array_push($objects, $object);
+ }
+ }
+ return $objects;
+ }
- //removes all resource subjects
- public function removeAllSubjects(){
+ //removes all resource subjects
+ public function removeAllSubjects() {
- $query = "DELETE
+ $query = "DELETE
FROM ResourceSubject
WHERE resourceID = '" . $this->resourceID . "'";
- $result = $this->db->processQuery($query);
-
- }
+ $result = $this->db->processQuery($query);
+ }
+
+ /**
+ * Fill the Identifier table in DB
+ * @param $identifiers array array of all identifiers (type => id) (if type isn't known, don't put any key)
+ *
+ */
+ public function setIdentifiers($identifiers) {
+ // $isbnorissns = array();
+ foreach ($identifiers as $key => $value) {
+ $identifier = new Identifier();
+ $identifier->resourceID = $this->resourceID;
+ $identifier->identifierTypeID = $identifier->getIdentifierTypeID($key);
+ $identifier->identifier = $value;
+
+ $identifier->save();
+/*
+ //Temporary fill IsbnOrIssn table
+ if ($identifier->identifierTypeID <= 5) {
+ array_push($isbnorissns, $value);
+ } */
+ }
+ // $this->setIsbnOrIssn($isbnorissns);
+ }
- public function removeAllIsbnOrIssn() {
- $query = "DELETE
- FROM IsbnOrIssn
- WHERE resourceID = '" . $this->resourceID . "'";
+ public function getResourceByIdentifierAndType($identifier, $type = NULL) {
+ $query = "SELECT resourceID FROM Identifier WHERE upper(identifier) = '" . str_replace("'", "''", strtoupper($identifier)) . "'";
+ if ($type != NULL) {
+ $id = new Identifier();
+ $typeID = $id->getIdentifierTypeID($type);
+ $query .= " AND identifierTypeID = $typeID";
+ }
+ $query .= ";";
+
+ $result = $this->db->processQuery($query, 'assoc');
- $result = $this->db->processQuery($query);
- }
- public function setIsbnOrIssn($isbnorissns) {
- $this->removeAllIsbnOrIssn();
- foreach ($isbnorissns as $isbnorissn) {
- if (trim($isbnorissn) != '') {
- $isbnOrIssn = new IsbnOrIssn();
- $isbnOrIssn->resourceID = $this->resourceID;
- $isbnOrIssn->isbnOrIssn = $isbnorissn;
- $isbnOrIssn->save();
+ $objects = array();
+
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceID'])) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $result['resourceID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $row['resourceID'])));
+ array_push($objects, $object);
+ }
+ }
+
+ return $objects;
+ }
+
+ public function getResourceByIdentifiers($identifiers) {
+ $query = "SELECT DISTINCT(resourceID) FROM Identifier";
+ $i = 0;
+ /*
+ if (!is_array($identifiers)) {
+ $value = $identifiers;
+ $identifiers = array($value);
+ }
+ */
+ foreach ($identifiers as $value) {
+ $query .= ($i == 0) ? " WHERE " : " OR ";
+ $query .= "identifier = '" . $this->db->escapeString($value) . "'";
+ $i++;
+ }
+
+ $query .= " ORDER BY 1";
+ $result = $this->db->processQuery($query, 'assoc');
+ $objects = array();
+
+ //need to do this since it could be that there's only one request and this is how the dbservice returns result
+ if (isset($result['resourceID'])) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $result['resourceID'])));
+ array_push($objects, $object);
+ } else {
+ foreach ($result as $row) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $row['resourceID'])));
+ array_push($objects, $object);
+ }
+ }
+ return $objects;
}
- }
- }
+ public function &getNewInitializedResource() {
+ $loginID = $_SESSION['loginID'];
+ $res = new Resource();
+ $res->createLoginID = $loginID;
+ $res->createDate = date('Y-m-d');
+ $res->updateLoginID = '';
+ $res->updateDate = '';
+ $res->statusID = 1; //in progress, don't know why ...
+ //$res->save();
+
+ return $res;
+ }
+
}
?>
diff --git a/admin/classes/domain/ResourceFormat.php b/admin/classes/domain/ResourceFormat.php
index 4f8475e..bc40a82 100644
--- a/admin/classes/domain/ResourceFormat.php
+++ b/admin/classes/domain/ResourceFormat.php
@@ -61,7 +61,28 @@ public function getNumberOfChildren(){
}
-
+public static function getResourceFormatID($format) {
+ $object = new ResourceFormat();
+
+ $query = "SELECT resourceFormatID "
+ . "FROM ResourceFormat "
+ . "WHERE upper(shortName) = '" . str_replace("'", "''", strtoupper($format)) . "'";
+ $result = $object->db->processQuery($query);
+
+ if (count($result) == 0){ //this format doesn't exist, we create it
+ $object->shortName = $format;
+ $object->save();
+ $id = $object->resourceFormatID;
+
+ } else {
+ $id = $result[0];
+ }
+ return $id;
+
+
+
+}
+
}
diff --git a/admin/classes/domain/ResourceType.php b/admin/classes/domain/ResourceType.php
index 3963b54..c845083 100644
--- a/admin/classes/domain/ResourceType.php
+++ b/admin/classes/domain/ResourceType.php
@@ -34,6 +34,24 @@ public function getNumberOfChildren(){
return $result['childCount'];
}
+
+ public static function getResourceTypeID($type) {
+ $object = new ResourceType();
+ $id = null;
+ $query = "SELECT resourceTypeID FROM ResourceType WHERE upper(shortName) = '" . str_replace("'", "''", strtoupper($type)) . "'";
+
+ $result =$object->db->processQuery($query);
+
+ if (count($result) == 0){ //this type doesn't exist, we create it
+ $resType = new ResourceType();
+ $resType->shortName = $type;
+ $resType->save();
+ $id = $resType->resourceTypeID;
+ } else {
+ $id = $result[0];
+ }
+ return $id;
+ }
}
diff --git a/admin/classes/domain/composer.json b/admin/classes/domain/composer.json
new file mode 100644
index 0000000..7dbf539
--- /dev/null
+++ b/admin/classes/domain/composer.json
@@ -0,0 +1,14 @@
+
+
+{
+ "require": {
+ "caseyamcl/phpoaipmh": "~2.0",
+ "guzzlehttp/guzzle": "~5.0"
+ },
+ "autoload": {
+ "psr-0": {
+ "Phpoaipmh": "vendor/caseyamcl/phpoaipmh/src"
+ }
+ }
+}
+
diff --git a/admin/classes/domain/composer.lock b/admin/classes/domain/composer.lock
new file mode 100644
index 0000000..41cd578
--- /dev/null
+++ b/admin/classes/domain/composer.lock
@@ -0,0 +1,280 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "hash": "b880d2805471a908265960c193177fec",
+ "packages": [
+ {
+ "name": "caseyamcl/phpoaipmh",
+ "version": "v2.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/caseyamcl/phpoaipmh.git",
+ "reference": "8a8a10e34e6d6b7f30849617aa7100b52331d0ef"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/caseyamcl/phpoaipmh/zipball/8a8a10e34e6d6b7f30849617aa7100b52331d0ef",
+ "reference": "8a8a10e34e6d6b7f30849617aa7100b52331d0ef",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "guzzlehttp/guzzle": "~5.0",
+ "mockery/mockery": "~0.9",
+ "phpunit/phpunit": "~4.0",
+ "symfony/config": "~2.5",
+ "symfony/console": "~2.5",
+ "symfony/dependency-injection": "~2.5",
+ "symfony/yaml": "~2.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Phpoaipmh": [
+ "src/",
+ "tests"
+ ]
+ },
+ "psr-4": {
+ "Phpoaipmh\\Example\\": "example/src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Casey McLaughlin",
+ "email": "caseyamcl@gmail.com",
+ "homepage": "http://caseymclaughlin.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "A PHP OAI-PMH 2.0 Harvester library",
+ "homepage": "https://github.com/caseyamcl/phpoaipmh",
+ "keywords": [
+ "Harvester",
+ "OAI",
+ "OAI-PMH"
+ ],
+ "time": "2015-05-18 14:40:02"
+ },
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "5.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "f3c8c22471cb55475105c14769644a49c3262b93"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f3c8c22471cb55475105c14769644a49c3262b93",
+ "reference": "f3c8c22471cb55475105c14769644a49c3262b93",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/ringphp": "^1.1",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "^4.0",
+ "psr/log": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "rest",
+ "web service"
+ ],
+ "time": "2015-05-20 03:47:55"
+ },
+ {
+ "name": "guzzlehttp/ringphp",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/RingPHP.git",
+ "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
+ "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/streams": "~3.0",
+ "php": ">=5.4.0",
+ "react/promise": "~2.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "ext-curl": "Guzzle will use specific adapters if cURL is present"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Ring\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
+ "time": "2015-05-20 03:37:09"
+ },
+ {
+ "name": "guzzlehttp/streams",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/streams.git",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Stream\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Provides a simple abstraction over streams of data",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "Guzzle",
+ "stream"
+ ],
+ "time": "2014-10-12 19:18:40"
+ },
+ {
+ "name": "react/promise",
+ "version": "v2.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/reactphp/promise.git",
+ "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef",
+ "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "React\\Promise\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jan Sorgalla",
+ "email": "jsorgalla@googlemail.com"
+ }
+ ],
+ "description": "A lightweight implementation of CommonJS Promises/A for PHP",
+ "time": "2014-12-30 13:32:42"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
+}
diff --git a/admin/classes/domain/composer.phar b/admin/classes/domain/composer.phar
new file mode 100755
index 0000000..c611c4e
Binary files /dev/null and b/admin/classes/domain/composer.phar differ
diff --git a/admin/classes/domain/vendor/autoload.php b/admin/classes/domain/vendor/autoload.php
new file mode 100644
index 0000000..fc09035
--- /dev/null
+++ b/admin/classes/domain/vendor/autoload.php
@@ -0,0 +1,7 @@
+identify();
+var_dump($result);
+
+// Results will be iterator of SimpleXMLElement objects
+$results = $myEndpoint->listMetadataFormats();
+foreach($results as $item) {
+ var_dump($item);
+}
+```
+
+Get a lists of records:
+
+
+```php
+// Recs will be an iterator of SimpleXMLElement objects
+$recs = $myEndpoint->listRecords('someMetaDataFormat');
+
+// The iterator will continue retrieving items across multiple HTTP requests.
+// You can keep running this loop through the *entire* collection you
+// are harvesting. All OAI-PMH and HTTP pagination logic is hidden neatly
+// behind the iterator API.
+foreach($recs as $rec) {
+ var_dump($rec);
+}
+```
+
+Optionally, specify a date/time granularity level to use for date-based queries:
+
+```php
+use Phpoaipmh\Client,
+ Phpoaipmh\Endpoint,
+ Phpoaipmh\Granularity;
+
+$client = new Client('http://some.service.com/oai');
+$myEndpoint = new Endpoint($client, Granularity::DATE_AND_TIME);
+```
+
+Handling Results
+----------------
+Depending on the verb you use, the library will send back either a `SimpleXMLELement`
+or an iterator containing `SimpleXMLElement` objects.
+
+* For `identify` and `getRecord`, a `SimpleXMLElement` object is returned
+* For `listMetadataFormats`, `listSets`, `listIdentifiers`, and `listRecords` a `Phpoaipmh\ResponseIterator` is returned
+
+The `Phpoaipmh\ResponseIterator` object encapsulates the logic to iterate through paginated sets of records.
+
+
+Handling Errors
+---------------
+
+This library will throw different exceptions under different circumstances:
+
+* HTTP request errors will generate a `Phpoaipmh\Exception\HttpException`
+* Response body parsing issues (e.g. invalid XML) will generate a `Phpoaipmh\Exception\MalformedResponseException`
+* OAI-PMH protocol errors (e.g. invalid verb or missing params) will generate a `Phpoaipmh\Exception\OaipmhException`
+
+All exceptions extend the `Phpoaipmh\Exception\BaseoaipmhException` class.
+
+Customizing Default Request Parameters
+--------------------------------------
+
+You can customize the default request parameters (for example, request timeout) for both cURL and Guzzle
+clients by building the adapter objects manually.
+
+To customize cURL parameters, pass them in as an array of key/value items to `CurlAdapter::setCurlOpts()`:
+
+```php
+use Phpoaipmh\Client,
+ Phpoaipmh\HttpAdapter\CurlAdapter;
+
+$adapter = new CurlAdapter();
+$adapter->setCurlOpts([CURLOPT_TIMEOUT => 120]);
+$client = new Client('http://some.service.com/oai', $adapter);
+
+$myEndpoint = new Endpoint($client);
+```
+
+If you're using Guzzle, you can set the parameters in a similar way:
+
+```php
+use Phpoaipmh\Client,
+ Phpoaipmh\HttpAdapter\GuzzleAdapter;
+
+$adapter = new GuzzleAdapter();
+$adapter->getGuzzleClient()->setDefaultOption('timeout', 120);
+$client = new Client('http://some.service.com/oai', $adapter);
+
+$myEndpoint = new Endpoint($client);
+```
+
+Dealing with XML Namespaces
+---------------------------
+
+Many OAI-PMH XML documents make use of XML Namespaces. For non-XML experts, it can be confusing to implement
+these in PHP. SitePoint has a brief but excellent [overview of how to use Namespaces in SimpleXML](http://www.sitepoint.com/simplexml-and-namespaces/).
+
+
+Iterator Metadata
+-----------------
+
+The `Phpoaipmh\RecordIterator` iterator contains some helper methods:
+
+* `getNumRequests()` - Returns the number of HTTP requests made thus far
+* `getNumRetrieved()` - Returns the number of individual records retrieved
+* `getTotalRecordsInCollection()` - Returns the total number of records in the collection
+ * *Note* - This number should be treated as an estimate at best. The number of records
+ can change while the records are being retrieved, so it is not guaranteed to be accurate.
+ Also, many OAI-PMH endpoints do not provide this information, in which case, this method will
+ return `null`.
+* `reset()` - Resets the iterator, which will restart the record retrieval from scratch.
+
+
+Handling 503 `Retry-After` Responses
+------------------------------------
+
+Some OAI-PMH endpoints employ rate-limiting so that you can only make X number
+of requests in a given time period. These endpoints will return a `503 Retry-AFter`
+HTTP status code if your code generates too many HTTP requests too quickly.
+
+If you have installed [Guzzle](http://guzzlephp.org), then you can use the
+[Retry-Subscriber](https://github.com/guzzle/retry-subscriber) to automatically
+adhere to the OAI-PMH endpoint rate-limiting rules.
+
+First, make sure you include the retry-subscriber as a dependency in your
+`composer.json`:
+
+ require: {
+ /* ... */
+ "guzzlehttp/retry-subscriber": "~2.0"
+ }
+
+Then, when loading the Phpoaipmh libraries, instantiate the Guzzle adapter
+manually, and add the subscriber as indicated in the code below:
+
+```php
+// Create a Retry Guzzle Subscriber
+$retrySubscriber = new \GuzzleHttp\Subscriber\Retry\RetrySubscriber([
+ 'delay' => function($numRetries, \GuzzleHttp\Event\AbstractTransferEvent $event) {
+ $waitSecs = $event->getResponse()->getHeader('Retry-After') ?: '5';
+ return ($waitSecs * 1000) + 1000; // wait one second longer than the server said to
+ },
+ 'filter' => \GuzzleHttp\Subscriber\Retry\RetrySubscriber::createStatusFilter(),
+]);
+
+// Manually create a Guzzle HTTP adapter
+$guzzleAdapter = new \Phpoaipmh\HttpAdapter\Guzzle();
+$guzzleAdapter->getGuzzleClient()->getEmitter()->attach($retrySubscriber);
+
+$client = new \Phpoaipmh\Client('http://some.service.com/oai', $guzzleAdapter);
+```
+
+This will create a client that adheres to the rate-limiting rules enforced by the OAI-PMH record provider.
+
+
+Sending Arbitrary Query Parameters
+----------------------------------
+
+If you wish to send arbitrary HTTP query parameters with your requests, you can
+send them via the `\Phpoaipmh\Client` class:
+
+ $client = new \Phpoaipmh\Client('http://some.service.com/oai');
+ $client->request('Identify', ['some' => 'extra-param']);
+
+Alternatively, if you wish to send arbitrary parameters while taking advantage of the
+convenience of the `\Phpoaipmh\Endpoint` class, you can use the Guzzle event system:
+
+```php
+// Create a function or class to add parameters to a request
+$addParamsListener = function(\GuzzleHttp\Event\BeforeEvent $event) {
+ $req = $event->getRequest();
+ $req->getQuery()->add('api_key', 'xyz123');
+
+ // You could do other things to the request here, too, like adding a header..
+ $req->addHeader('Some-Header', 'some-header-value');
+};
+
+// Manually create a Guzzle HTTP adapter
+$guzzleAdapter = new \Phpoaipmh\HttpAdapter\Guzzle();
+$guzzleAdapter->getGuzzleClient()->getEmitter()->on('before', $addParamsListener);
+
+$client = new \Phpoaipmh\Client('http://some.service.com/oai', $guzzleAdapter);
+```
+
+Implementation Tips
+-------------------
+
+Harvesting data from a OAI-PMH endpoint can be a time-consuming task, especially when there are lots of records.
+Typically, this kind of task is done via a CLI script or background process that can run for a long time.
+It is not normally a good idea to make it part of a web request.
+
+Credits
+-------
+
+* [Casey McLaughlin](http://github.com/caseyamcl)
+* [Christian Scheb](https://github.com/scheb)
+* [Matthias Vandermaesen](https://github.com/netsensei)
+* [All Contributors](https://github.com/caseyamcl/phpoaipmh/contributors)
+
+License
+-------
+
+MIT License; see [LICENSE](LICENSE) file for details
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/UPGRADE.md b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/UPGRADE.md
new file mode 100644
index 0000000..283dda2
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/UPGRADE.md
@@ -0,0 +1,20 @@
+Upgrading from Version 1.x to 2.x
+=================================
+
+* Usages of `Phpoaipmh\Http\Guzzle` should now instead use `Phpoaipmh\HttpAdapter\GuzzleAdapter`.
+* Usages of `Phpoaipmh\Http\Curl` should now instead use `Phpoaipmh\HttpAdapter\CurlAdapter`.
+* Any class that implemets the `Phpoaipmh\Http\Client` interface should now instead implement `Phpoaipmh\HttpAdapter\HttpAdapterInteraface`.
+* Change typhints or references for `Phpoaipmh\ResponseList` to `Phpoaipmh\RecordIterator`.
+* If using Guzzle, ensure that you upgrade to Version 5 or later.
+* Remove any usage of the `Phpoaipmh\Endpoint::processList()` method. It is no longer necessary, since
+ all methods now return an iterator object by default.
+ * If you absolutely must convert the iterator to an array, use PHP's built-in `iterator_to_array()` function. However,
+ this is not recommended, since it may take a very long time to execute.
+* Exception class names have changed:
+ * `Phpoaipmh\OaipmhRequestException` is now `Phpoaipmh\Exception\OaipmhException`
+ * `Phpoaipmh\Client\RequestException` is now `Phpoaipmh\Exception\HttpException`
+ * `Phpoaipmh\Exception\OaipmhException` is now `Phpoaipmh\Exception\BaseOaipmhException`
+ * Previously, malformed XML would throw a `Phpoaipmh\OaipmhRequestException`. It now throws a
+ `Phpoaipmh\Exception\MalformedResponseException`.
+ * All exceptions extend the `Phpoaipmh\Exception\BaseOaipmhException`, so you can use that as a catch-all.
+* Added example
\ No newline at end of file
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/composer.json b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/composer.json
new file mode 100644
index 0000000..1e7fc16
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/composer.json
@@ -0,0 +1,36 @@
+{
+ "name": "caseyamcl/phpoaipmh",
+ "type": "library",
+ "description": "A PHP OAI-PMH 2.0 Harvester library",
+ "keywords": ["OAI", "Harvester", "OAI-PMH"],
+ "homepage": "https://github.com/caseyamcl/phpoaipmh",
+ "authors": [
+ {
+ "name": "Casey McLaughlin",
+ "email": "caseyamcl@gmail.com",
+ "homepage": "http://caseymclaughlin.com",
+ "role": "Developer"
+ }
+ ],
+ "license": "MIT",
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "guzzlehttp/guzzle": "~5.0",
+ "phpunit/phpunit": "~4.0",
+ "mockery/mockery": "~0.9",
+ "symfony/console": "~2.5",
+ "symfony/dependency-injection": "~2.5",
+ "symfony/config": "~2.5",
+ "symfony/yaml": "~2.5"
+ },
+ "autoload": {
+ "psr-0": {
+ "Phpoaipmh": ["src/", "tests"]
+ },
+ "psr-4": {
+ "Phpoaipmh\\Example\\": "example/src/"
+ }
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Client.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Client.php
new file mode 100644
index 0000000..55d696e
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Client.php
@@ -0,0 +1,159 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh;
+
+use Phpoaipmh\Exception\HttpException;
+use Phpoaipmh\Exception\OaipmhException;
+use Phpoaipmh\Exception\MalformedResponseException;
+use Phpoaipmh\HttpAdapter\CurlAdapter;
+use Phpoaipmh\HttpAdapter\GuzzleAdapter;
+use Phpoaipmh\HttpAdapter\HttpAdapterInterface;
+use RuntimeException;
+
+/**
+ * OAI-PMH Client class retrieves and decodes OAI-PMH from a given URL
+ *
+ * @since v1.0
+ * @author Casey McLaughlin
+ */
+class Client
+{
+ /**
+ * @var string
+ */
+ private $url;
+
+ /**
+ * @var HttpAdapterInterface
+ */
+ private $httpClient;
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param string $url The URL of the OAI-PMH Endpoint
+ * @param HttpAdapterInterface $httpClient Optional HTTP HttpAdapterInterface class; attempt to auto-build dependency if not passed
+ */
+ public function __construct($url = null, HttpAdapterInterface $httpClient = null)
+ {
+ $this->setUrl($url);
+
+ if ($httpClient) {
+ $this->httpClient = $httpClient;
+ } else {
+ $this->httpClient = (class_exists('GuzzleHttp\Client'))
+ ? new GuzzleAdapter()
+ : new CurlAdapter();
+ }
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Set the URL
+ *
+ * @param string $url
+ */
+ public function setUrl($url)
+ {
+ $this->url = $url;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Perform a request and return a OAI SimpleXML Document
+ *
+ * @param string $verb Which OAI-PMH verb to use
+ * @param array $params An array of key/value parameters
+ * @return \SimpleXMLElement An XML document
+ */
+ public function request($verb, array $params = array())
+ {
+ if (! $this->url) {
+ throw new RuntimeException("Cannot perform request when URL not set. Use setUrl() method");
+ }
+
+ //Build the URL
+ $params = array_merge(array('verb' => $verb), $params);
+ $url = $this->url . (parse_url($this->url, PHP_URL_QUERY) ? '&' : '?') . http_build_query($params);
+
+ //Do the request
+ try {
+ $resp = $this->httpClient->request($url);
+ } catch (HttpException $e) {
+ $this->checkForOaipmhException($e);
+ $resp = '';
+ }
+
+ return $this->decodeResponse($resp);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Check for OAI-PMH Exception from HTTP Exception
+ *
+ * Converts a HttpException into an OAI-PMH exception if there is an
+ * OAI-PMH Error Code.
+ *
+ * @param HttpException $httpException
+ */
+ private function checkForOaipmhException(HttpException $httpException)
+ {
+ try {
+ if ($resp = $httpException->getBody()) {
+ $this->decodeResponse($resp); // Throw OaipmhException in case of an error
+ }
+ } catch (MalformedResponseException $e) {
+ // There was no valid OAI error in the response, therefore re-throw HttpException
+ }
+
+ throw $httpException;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Decode the response into XML
+ *
+ * @param string $resp The response body from a HTTP request
+ * @return \SimpleXMLElement An XML document
+ */
+ protected function decodeResponse($resp)
+ {
+ //Setup a SimpleXML Document
+ try {
+ $xml = @new \SimpleXMLElement($resp);
+ } catch (\Exception $e) {
+ throw new MalformedResponseException(sprintf("Could not decode XML Response: %s", $e->getMessage()));
+ }
+
+ //If we get back a OAI-PMH error, throw a OaipmhException
+ if (isset($xml->error)) {
+ $code = (string) $xml->error['code'];
+ $msg = (string) $xml->error;
+
+ throw new OaipmhException($code, $msg);
+ }
+
+ return $xml;
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Endpoint.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Endpoint.php
new file mode 100644
index 0000000..759997f
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Endpoint.php
@@ -0,0 +1,244 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh;
+
+use DateTime;
+
+/**
+ * OAI-PMH Endpoint Class
+ *
+ * @since v1.0
+ * @author Casey McLaughlin
+ */
+class Endpoint implements EndpointInterface
+{
+ const AUTO = null;
+
+ // ---------------------------------------------------------------
+
+ /**
+ * @var Client
+ */
+ private $client;
+
+ /**
+ * @var string
+ */
+ private $granularity;
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param Client $client Optional; will attempt to auto-build dependency if not passed
+ * @param string $granularity Optional; the OAI date format for fetching records, use constants from Granularity class
+ */
+ public function __construct(Client $client = null, $granularity = self::AUTO)
+ {
+ $this->client = $client ?: new Client();
+ $this->granularity = $granularity;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Set the URL in the client
+ *
+ * @param string $url
+ */
+ public function setUrl($url)
+ {
+ $this->client->setUrl($url);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Identify the OAI-PMH Endpoint
+ *
+ * @return \SimpleXMLElement A XML document with attributes describing the repository
+ */
+ public function identify()
+ {
+ $resp = $this->client->request('Identify');
+
+ return $resp;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * List Metadata Formats
+ *
+ * Return the list of supported metadata format for a particular record (if $identifier
+ * is provided), or the entire repository (if no arguments are provided)
+ *
+ * @param string $identifier If specified, will return only those metadata formats that a particular record supports
+ * @return RecordIterator
+ */
+ public function listMetadataFormats($identifier = null)
+ {
+ $params = ($identifier) ? array('identifier' => $identifier) : array();
+
+ return new RecordIterator($this->client, 'ListMetadataFormats', $params);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * List Record Sets
+ *
+ * @return RecordIterator
+ */
+ public function listSets()
+ {
+ return new RecordIterator($this->client, 'ListSets');
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get a single record
+ *
+ * @param string $id Record Identifier
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @return \SimpleXMLElement An XML document corresponding to the record
+ */
+ public function getRecord($id, $metadataPrefix)
+ {
+ $params = array(
+ 'identifier' => $id,
+ 'metadataPrefix' => $metadataPrefix
+ );
+
+ return $this->client->request('GetRecord', $params);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * List Record identifiers
+ *
+ * Corresponds to OAI Verb to list record identifiers
+ *
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @param \DateTime $from An optional 'from' date for selective harvesting
+ * @param \DateTime $until An optional 'until' date for selective harvesting
+ * @param string $set An optional setSpec for selective harvesting
+ * @return RecordIterator
+ */
+ public function listIdentifiers($metadataPrefix, $from = null, $until = null, $set = null)
+ {
+ return $this->createRecordIterator("ListIdentifiers", $metadataPrefix, $from, $until, $set);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * List Records
+ *
+ * Corresponds to OAI Verb to list records
+ *
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @param \DateTime $from An optional 'from' date for selective harvesting
+ * @param \DateTime $until An optional 'from' date for selective harvesting
+ * @param string $set An optional setSpec for selective harvesting
+ * @return RecordIterator
+ */
+ public function listRecords($metadataPrefix, $from = null, $until = null, $set = null)
+ {
+ return $this->createRecordIterator("ListRecords", $metadataPrefix, $from, $until, $set);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Create a record iterator
+ *
+ * @param string $verb OAI Verb
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @param \DateTime|null $from An optional 'from' date for selective harvesting
+ * @param \DateTime|null $until An optional 'from' date for selective harvesting
+ * @param string $set An optional setSpec for selective harvesting
+ *
+ * @return RecordIterator
+ */
+ private function createRecordIterator($verb, $metadataPrefix, $from, $until, $set)
+ {
+ $params = array('metadataPrefix' => $metadataPrefix);
+
+ if ($from instanceof \DateTime) {
+ $params['from'] = Granularity::formatDate($from, $this->getGranularity());
+ } elseif (null !== $from) {
+ trigger_error(sprintf(
+ 'Deprecated: %s::%s \'from\' parameter should be an instance of \DateTime (string param support to be removed in v3.0)',
+ get_called_class(),
+ lcfirst($verb)
+ ), E_USER_DEPRECATED);
+ }
+
+ if ($until instanceof \DateTime) {
+ $params['until'] = Granularity::formatDate($until, $this->getGranularity());
+ } elseif (null !== $until) {
+ trigger_error(sprintf(
+ 'Deprecated: %s::%s \'until\' parameter should be an instance of \DateTime (string param support to be removed in v3.0)',
+ get_called_class(),
+ lcfirst($verb)
+ ), E_USER_DEPRECATED);
+ }
+
+ if ($set) {
+ $params['set'] = $set;
+ }
+
+ return new RecordIterator($this->client, $verb, $params);
+ }
+
+ // ---------------------------------------------------------------
+
+ /**
+ * Lazy load granularity from Identify, if not specified
+ *
+ * @return string
+ */
+ private function getGranularity()
+ {
+ if ($this->granularity === null) {
+ $this->granularity = $this->fetchGranularity();
+ }
+
+ return $this->granularity;
+ }
+
+ // ---------------------------------------------------------------
+
+ /**
+ * Attempt to fetch date format from Identify endpoint (or use default)
+ *
+ * @return string
+ */
+ private function fetchGranularity()
+ {
+ $response = $this->identify();
+
+ return (isset($response->Identify->granularity))
+ ? (string) $response->Identify->granularity
+ : Granularity::DATE;
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/EndpointInterface.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/EndpointInterface.php
new file mode 100644
index 0000000..dbb97bd
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/EndpointInterface.php
@@ -0,0 +1,104 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh;
+
+/**
+ * OAI-PMH Endpoint Interface
+ *
+ * @since v2.3
+ * @author Casey McLaughlin
+ */
+interface EndpointInterface
+{
+ /**
+ * Set the URL in the client
+ *
+ * @param string $url
+ */
+ public function setUrl($url);
+
+ /**
+ * Identify the OAI-PMH Endpoint
+ *
+ * @return \SimpleXMLElement A XML document with attributes describing the
+ * repository
+ */
+ public function identify();
+
+ /**
+ * List Metadata Formats
+ *
+ * Return the list of supported metadata format for a particular record (if
+ * $identifier is provided), or the entire repository (if no arguments are
+ * provided)
+ *
+ * @param string $identifier If specified, will return only those
+ * metadata formats that a particular
+ * record supports
+ * @return RecordIterator
+ */
+ public function listMetadataFormats($identifier = null);
+
+ /**
+ * List Record Sets
+ *
+ * @return RecordIterator
+ */
+ public function listSets();
+
+ /**
+ * Get a single record
+ *
+ * @param string $id Record Identifier
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @return \SimpleXMLElement An XML document corresponding to the record
+ */
+ public function getRecord($id, $metadataPrefix);
+
+ /**
+ * List Record identifiers
+ *
+ * Corresponds to OAI Verb to list record identifiers
+ *
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @param \DateTime $from An optional 'from' date for
+ * selective harvesting
+ * @param \DateTime $until An optional 'until' date for
+ * selective harvesting
+ * @param string $set An optional setSpec for selective
+ * harvesting
+ * @return RecordIterator
+ */
+ public function listIdentifiers($metadataPrefix, $from = null, $until = null, $set = null);
+
+ /**
+ * List Records
+ *
+ * Corresponds to OAI Verb to list records
+ *
+ * @param string $metadataPrefix Required by OAI-PMH endpoint
+ * @param \DateTime $from An optional 'from' date for
+ * selective harvesting
+ * @param \DateTime $until An optional 'from' date for
+ * selective harvesting
+ * @param string $set An optional setSpec for selective
+ * harvesting
+ * @return RecordIterator
+ */
+ public function listRecords($metadataPrefix, $from = null, $until = null, $set = null);
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/BaseOaipmhException.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/BaseOaipmhException.php
new file mode 100644
index 0000000..716e1e9
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/BaseOaipmhException.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh\Exception;
+
+/**
+ * Base exception class for Phpoaipmh Library
+ *
+ * @author Casey McLaughlin
+ * @since v2.0
+ */
+class BaseOaipmhException extends \RuntimeException
+{
+ // pass..
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/HttpException.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/HttpException.php
new file mode 100644
index 0000000..9a453ab
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/HttpException.php
@@ -0,0 +1,51 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh\Exception;
+
+/**
+ * HttpAdapter Protocol Exception Class thrown when HTTP transmission errors occur
+ *
+ * @author Casey McLaughlin
+ * @since v2.0
+ */
+class HttpException extends BaseOaipmhException
+{
+ private $body;
+
+ /**
+ * Constructor
+ *
+ * @param string $responseBody Empty if no response body provided
+ * @param int $message
+ * @param int $code
+ * @param \Exception $previous
+ */
+ public function __construct($responseBody, $message, $code = 0, \Exception $previous = null)
+ {
+ $this->body = $responseBody;
+ parent::__construct($message, $code, $previous);
+ }
+
+ /**
+ * @return string
+ */
+ public function getBody()
+ {
+ return $this->body;
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/MalformedResponseException.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/MalformedResponseException.php
new file mode 100644
index 0000000..a005d14
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/MalformedResponseException.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh\Exception;
+
+/**
+ * Class MalformedResponseException
+ *
+ * Thrown when the HTTP response body cannot be parsed into valid OAI-PMH (usually XML errors)
+ *
+ * @author Casey McLaughlin
+ * @since v2.0
+ */
+class MalformedResponseException extends BaseOaipmhException
+{
+ // pass..
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/OaipmhException.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/OaipmhException.php
new file mode 100644
index 0000000..639c8c0
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Exception/OaipmhException.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh\Exception;
+
+/**
+ * OAI-PMH protocol Exception Class thrown when OAI-PMH protocol errors occur
+ *
+ * @author Casey McLaughlin
+ * @since v2.0
+ */
+class OaipmhException extends BaseOaipmhException
+{
+ private $oaiErrorCode;
+
+ // -------------------------------------------------------------------------
+
+ public function __construct($oaiErrorCode, $message, $code = 0, \Exception $previous = null)
+ {
+ $this->oaiErrorCode = $oaiErrorCode;
+ parent::__construct($message, $code, $previous);
+ }
+
+ // -------------------------------------------------------------------------
+
+ public function __toString()
+ {
+ $refl = new \ReflectionClass($this);
+ return $refl->getShortName() . ": [{$this->code}]: ({$this->oaiErrorCode}) {$this->message}";
+ }
+
+ public function getOaiErrorCode()
+ {
+ return $this->oaiErrorCode;
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Granularity.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Granularity.php
new file mode 100644
index 0000000..a4c6016
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/Granularity.php
@@ -0,0 +1,49 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+/**
+ * Granularity class provides utility for specifying date and constraint precision
+ *
+ * @author Christian Scheb
+ */
+class Granularity
+{
+ const DATE = "YYYY-MM-DD";
+ const DATE_AND_TIME = "YYYY-MM-DDThh:mm:ssZ";
+
+ // ---------------------------------------------------------------
+
+ /**
+ * Format DateTime string based on granularity
+ *
+ * @param \DateTime $dateTime
+ * @param string $format Either self::DATE or self::DATE_AND_TIME
+ *
+ * @return string
+ */
+ public static function formatDate(\DateTime $dateTime, $format)
+ {
+ $phpFormats = array(
+ self::DATE => "Y-m-d",
+ self::DATE_AND_TIME => 'Y-m-d\TH:i:s\Z',
+ );
+ $phpFormat = $phpFormats[$format];
+
+ return $dateTime->format($phpFormat);
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php
new file mode 100644
index 0000000..114d50f
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/CurlAdapter.php
@@ -0,0 +1,96 @@
+ true,
+ CURLOPT_CONNECTTIMEOUT => 10,
+ CURLOPT_DNS_CACHE_TIMEOUT => 10,
+ CURLOPT_TIMEOUT => 60,
+ CURLOPT_FOLLOWLOCATION => true,
+ CURLOPT_MAXREDIRS => 3,
+ CURLOPT_USERAGENT => 'PHP OAI-PMH Library',
+ ];
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * Checks for CURL libraries
+ *
+ * @param array $curlOpts Array of CURL directives and values (e.g. [CURLOPT_TIMEOUT => 120])
+ * @throws \Exception If CURL not installed.
+ */
+ public function __construct(array $curlOpts = [])
+ {
+ if (! is_callable('curl_exec')) {
+ throw new \Exception("OAI-PMH CurlAdapter HTTP HttpAdapterInterface requires the CURL PHP Extension");
+ }
+
+ $this->setCurlOpts($curlOpts);
+ }
+
+ // ---------------------------------------------------------------
+
+ /**
+ * Set cURL Options at runtime
+ *
+ * Sets cURL options. If $merge is true, then merges desired params with existing.
+ * If $merge is false, then clobbers the existing cURL options
+ *
+ * @param array $opts
+ * @param bool $merge
+ */
+ public function setCurlOpts(array $opts, $merge = true)
+ {
+ $this->curlOpts = ($merge)
+ ? array_replace($this->curlOpts, $opts)
+ : $opts;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Do CURL Request
+ *
+ * @param string $url The full URL
+ * @return string The response body
+ */
+ public function request($url)
+ {
+ $curlOpts = array_replace($this->curlOpts, [CURLOPT_URL => $url]);
+
+ $ch = curl_init();
+ foreach ($curlOpts as $opt => $optVal) {
+ curl_setopt($ch, $opt, $optVal);
+ }
+
+ $resp = curl_exec($ch);
+ $info = (object) curl_getinfo($ch);
+ curl_close($ch);
+
+ //Check response
+ $httpCode = (string) $info->http_code;
+ if ($httpCode{0} != '2') {
+ $msg = sprintf('HTTP Request Failed (code %s): %s', $info->http_code, $resp);
+ throw new HttpException($resp, $msg, $httpCode);
+ } elseif (strlen(trim($resp)) == 0) {
+ throw new HttpException($resp, 'HTTP Response Empty');
+ }
+
+ return $resp;
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/GuzzleAdapter.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/GuzzleAdapter.php
new file mode 100644
index 0000000..4200c3f
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/GuzzleAdapter.php
@@ -0,0 +1,67 @@
+guzzle = $guzzle ?: new GuzzleClient();
+ }
+
+ // ----------------------------------------------------------------
+
+ /**
+ * Get the Guzzle Client
+ *
+ * @return GuzzleClient
+ */
+ public function getGuzzleClient()
+ {
+ return $this->guzzle;
+ }
+
+ // ----------------------------------------------------------------
+
+ /**
+ * Do the request with GuzzleAdapter
+ *
+ * @param string $url
+ * @return string
+ * @throws HttpException
+ */
+ public function request($url)
+ {
+ try {
+ $resp = $this->guzzle->get($url);
+ return (string) $resp->getBody();
+ } catch (RequestException $e) {
+ $response = $e->getResponse();
+ throw new HttpException($response ? $response->getBody() : null, $e->getMessage(), $e->getCode(), $e);
+ } catch (TransferException $e) {
+ throw new HttpException('', $e->getMessage(), $e->getCode(), $e);
+ }
+ }
+}
diff --git a/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/HttpAdapterInterface.php b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/HttpAdapterInterface.php
new file mode 100644
index 0000000..d88f745
--- /dev/null
+++ b/admin/classes/domain/vendor/caseyamcl/phpoaipmh/src/Phpoaipmh/HttpAdapter/HttpAdapterInterface.php
@@ -0,0 +1,22 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * ------------------------------------------------------------------
+ */
+
+namespace Phpoaipmh;
+
+use Phpoaipmh\Exception\BaseOaipmhException;
+use Phpoaipmh\Exception\MalformedResponseException;
+
+/**
+ * Response List Entity iterates over records returned from an OAI-PMH Endpoint
+ *
+ * @author Casey McLaughlin
+ * @since v2.0
+ */
+class RecordIterator implements \Iterator
+{
+ /**
+ * @var Client
+ */
+ private $httpClient;
+
+ /**
+ * @var string The verb to use
+ */
+ private $verb;
+
+ /**
+ * @var array OAI-PMH parameters passed as part of the request
+ */
+ private $params;
+
+ /**
+ * @var int The number of total entities (if available)
+ */
+ private $totalRecordsInCollection;
+
+ /**
+ * @var \DateTime Recordset expiration date (if specified)
+ */
+ private $expireDate;
+
+ /**
+ * @var string The resumption token
+ */
+ private $resumptionToken;
+
+ /**
+ * @var array Array of records
+ */
+ private $batch;
+
+ /**
+ * @var int Total number of records processed
+ */
+ private $numProcessed = 0;
+
+ /**
+ * @var boolean Total number of requests made
+ */
+ private $numRequests = 0;
+
+ /**
+ * @var \SimpleXMLElement|null Used for tracking the iterator
+ */
+ private $currItem;
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param Client $httpClient The client to use
+ * @param string $verb The verb to use when retrieving results from the client
+ * @param array $params Optional parameters passed to OAI-PMH
+ */
+ public function __construct(Client $httpClient, $verb, array $params = array())
+ {
+ //Set parameters
+ $this->httpClient = $httpClient;
+ $this->verb = $verb;
+ $this->params = $params;
+
+ //Node name error?
+ if (! $this->getItemNodeName()) {
+ throw new BaseOaipmhException('Cannot determine item name for verb: ' . $this->verb);
+ }
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the total number of requests made during this run
+ *
+ * @return int The number of HTTP requests made
+ */
+ public function getNumRequests()
+ {
+ return $this->numRequests;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the total number of records processed during this run
+ *
+ * @return int The number of records processed
+ */
+ public function getNumRetrieved()
+ {
+ return $this->numProcessed;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the total number of records in the collection if available
+ *
+ * This only returns a value if the OAI-PMH server provides this information
+ * in the response, which not all servers do (it is optional in the OAI-PMH spec)
+ *
+ * Also, the number of records may change during the requests, so it should
+ * be treated as an estimate
+ *
+ * @return int|null
+ */
+ public function getTotalRecordsInCollection()
+ {
+ if ($this->currItem === null) {
+ $this->next();
+ }
+
+ return $this->totalRecordsInCollection;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the next item
+ *
+ * Return an item from the currently-retrieved batch, get next batch and
+ * return first record from it, or return false if no more records
+ *
+ * @return \SimpleXMLElement|bool
+ */
+ public function nextItem()
+ {
+ //If no items in batch, and we have a resumptionToken or need to make initial request...
+ if (count($this->batch) == 0 && ($this->resumptionToken or $this->numRequests == 0)) {
+ $this->retrieveBatch();
+ }
+
+ //if still items in current batch, return one
+ if (count($this->batch) > 0) {
+ $this->numProcessed++;
+
+ $item = array_shift($this->batch);
+ $this->currItem = new \SimpleXMLElement($item->asXML());
+ } else {
+ $this->currItem = false;
+ }
+
+ return $this->currItem;
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Do a request to get the next batch of items
+ *
+ * @return int The number of items in the batch after the retrieve
+ */
+ private function retrieveBatch()
+ {
+ // Set OAI-PMH parameters for request
+ // If resumptionToken, then we ignore params and just use that
+ $params = ($this->resumptionToken)
+ ? ['resumptionToken' => $this->resumptionToken]
+ : $this->params;
+
+ // Node name and verb
+ $nodeName = $this->getItemNodeName();
+ $verb = $this->verb;
+
+ //Do it..
+ $resp = $this->httpClient->request($verb, $params);
+ $this->numRequests++;
+
+ //Result format error?
+ if (! isset($resp->$verb->$nodeName)) {
+ throw new MalformedResponseException(sprintf("Expected XML element list '%s' missing for verb '%s'", $nodeName, $verb));
+ }
+
+ //Process the results
+ foreach ($resp->$verb->$nodeName as $node) {
+ $this->batch[] = $node;
+ }
+
+ //Set the resumption token and expiration date, if specified in the response
+ if (isset($resp->$verb->resumptionToken)) {
+ $this->resumptionToken = (string) $resp->$verb->resumptionToken;
+
+ if (isset($resp->$verb->resumptionToken['completeListSize'])) {
+ $this->totalRecordsInCollection = (int) $resp->$verb->resumptionToken['completeListSize'];
+ }
+ if (isset($resp->$verb->resumptionToken['expirationDate'])) {
+ $t = $resp->$verb->resumptionToken['expirationDate'];
+ $this->expireDate = \DateTime::createFromFormat(\DateTime::ISO8601, $t);
+ }
+ } else {
+ //Unset the resumption token when we're at the end of the list
+ $this->resumptionToken = null;
+ }
+
+ //Return a count
+ return count($this->batch);
+ }
+
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get Item Node Name
+ *
+ * Map the item node name based on the verb
+ *
+ * @return string|boolean The element name for the mapping, or false if unmapped
+ */
+ private function getItemNodeName()
+ {
+ $mappings = array(
+ 'ListMetadataFormats' => 'metadataFormat',
+ 'ListSets' => 'set',
+ 'ListIdentifiers' => 'header',
+ 'ListRecords' => 'record'
+ );
+
+ return (isset($mappings[$this->verb])) ? $mappings[$this->verb] : false;
+ }
+
+ // ----------------------------------------------------------------
+
+ /**
+ * Reset the request state
+ */
+ public function reset()
+ {
+ $this->numRequests = 0;
+ $this->numProcessed = 0;
+
+ $this->currItem = null;
+ $this->resumptionToken = null;
+ $this->totalRecordsInCollection = null;
+ $this->expireDate = null;
+
+ $this->batch = [];
+ }
+
+ // ----------------------------------------------------------------
+
+ public function current()
+ {
+ return ($this->currItem === null)
+ ? $this->nextItem()
+ : $this->currItem;
+ }
+
+ public function next()
+ {
+ return $this->nextItem();
+ }
+
+ public function key()
+ {
+ if ($this->currItem === null) {
+ $this->nextItem();
+ }
+
+ return $this->getNumRetrieved();
+ }
+
+ public function valid()
+ {
+ return ($this->currItem !== false);
+ }
+
+ public function rewind()
+ {
+ $this->reset();
+ }
+}
diff --git a/admin/classes/domain/vendor/composer/ClassLoader.php b/admin/classes/domain/vendor/composer/ClassLoader.php
new file mode 100644
index 0000000..4e05d3b
--- /dev/null
+++ b/admin/classes/domain/vendor/composer/ClassLoader.php
@@ -0,0 +1,413 @@
+
+ * Jordi Boggiano
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer\Autoload;
+
+/**
+ * ClassLoader implements a PSR-0 class loader
+ *
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
+ *
+ * $loader = new \Composer\Autoload\ClassLoader();
+ *
+ * // register classes with namespaces
+ * $loader->add('Symfony\Component', __DIR__.'/component');
+ * $loader->add('Symfony', __DIR__.'/framework');
+ *
+ * // activate the autoloader
+ * $loader->register();
+ *
+ * // to enable searching the include path (eg. for PEAR packages)
+ * $loader->setUseIncludePath(true);
+ *
+ * In this example, if you try to use a class in the Symfony\Component
+ * namespace or one of its children (Symfony\Component\Console for instance),
+ * the autoloader will first look for the class under the component/
+ * directory, and it will then fallback to the framework/ directory if not
+ * found before giving up.
+ *
+ * This class is loosely based on the Symfony UniversalClassLoader.
+ *
+ * @author Fabien Potencier
+ * @author Jordi Boggiano
+ */
+class ClassLoader
+{
+ // PSR-4
+ private $prefixLengthsPsr4 = array();
+ private $prefixDirsPsr4 = array();
+ private $fallbackDirsPsr4 = array();
+
+ // PSR-0
+ private $prefixesPsr0 = array();
+ private $fallbackDirsPsr0 = array();
+
+ private $useIncludePath = false;
+ private $classMap = array();
+
+ private $classMapAuthoritative = false;
+
+ public function getPrefixes()
+ {
+ if (!empty($this->prefixesPsr0)) {
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
+ }
+
+ return array();
+ }
+
+ public function getPrefixesPsr4()
+ {
+ return $this->prefixDirsPsr4;
+ }
+
+ public function getFallbackDirs()
+ {
+ return $this->fallbackDirsPsr0;
+ }
+
+ public function getFallbackDirsPsr4()
+ {
+ return $this->fallbackDirsPsr4;
+ }
+
+ public function getClassMap()
+ {
+ return $this->classMap;
+ }
+
+ /**
+ * @param array $classMap Class to filename map
+ */
+ public function addClassMap(array $classMap)
+ {
+ if ($this->classMap) {
+ $this->classMap = array_merge($this->classMap, $classMap);
+ } else {
+ $this->classMap = $classMap;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix, either
+ * appending or prepending to the ones previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
+ */
+ public function add($prefix, $paths, $prepend = false)
+ {
+ if (!$prefix) {
+ if ($prepend) {
+ $this->fallbackDirsPsr0 = array_merge(
+ (array) $paths,
+ $this->fallbackDirsPsr0
+ );
+ } else {
+ $this->fallbackDirsPsr0 = array_merge(
+ $this->fallbackDirsPsr0,
+ (array) $paths
+ );
+ }
+
+ return;
+ }
+
+ $first = $prefix[0];
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
+
+ return;
+ }
+ if ($prepend) {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ (array) $paths,
+ $this->prefixesPsr0[$first][$prefix]
+ );
+ } else {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ $this->prefixesPsr0[$first][$prefix],
+ (array) $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace, either
+ * appending or prepending to the ones previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-0 base directories
+ * @param bool $prepend Whether to prepend the directories
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function addPsr4($prefix, $paths, $prepend = false)
+ {
+ if (!$prefix) {
+ // Register directories for the root namespace.
+ if ($prepend) {
+ $this->fallbackDirsPsr4 = array_merge(
+ (array) $paths,
+ $this->fallbackDirsPsr4
+ );
+ } else {
+ $this->fallbackDirsPsr4 = array_merge(
+ $this->fallbackDirsPsr4,
+ (array) $paths
+ );
+ }
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
+ // Register directories for a new namespace.
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ } elseif ($prepend) {
+ // Prepend directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ (array) $paths,
+ $this->prefixDirsPsr4[$prefix]
+ );
+ } else {
+ // Append directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ $this->prefixDirsPsr4[$prefix],
+ (array) $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix,
+ * replacing any others previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 base directories
+ */
+ public function set($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr0 = (array) $paths;
+ } else {
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace,
+ * replacing any others previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function setPsr4($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr4 = (array) $paths;
+ } else {
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Turns on searching the include path for class files.
+ *
+ * @param bool $useIncludePath
+ */
+ public function setUseIncludePath($useIncludePath)
+ {
+ $this->useIncludePath = $useIncludePath;
+ }
+
+ /**
+ * Can be used to check if the autoloader uses the include path to check
+ * for classes.
+ *
+ * @return bool
+ */
+ public function getUseIncludePath()
+ {
+ return $this->useIncludePath;
+ }
+
+ /**
+ * Turns off searching the prefix and fallback directories for classes
+ * that have not been registered with the class map.
+ *
+ * @param bool $classMapAuthoritative
+ */
+ public function setClassMapAuthoritative($classMapAuthoritative)
+ {
+ $this->classMapAuthoritative = $classMapAuthoritative;
+ }
+
+ /**
+ * Should class lookup fail if not found in the current class map?
+ *
+ * @return bool
+ */
+ public function isClassMapAuthoritative()
+ {
+ return $this->classMapAuthoritative;
+ }
+
+ /**
+ * Registers this instance as an autoloader.
+ *
+ * @param bool $prepend Whether to prepend the autoloader or not
+ */
+ public function register($prepend = false)
+ {
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+ }
+
+ /**
+ * Unregisters this instance as an autoloader.
+ */
+ public function unregister()
+ {
+ spl_autoload_unregister(array($this, 'loadClass'));
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $class The name of the class
+ * @return bool|null True if loaded, null otherwise
+ */
+ public function loadClass($class)
+ {
+ if ($file = $this->findFile($class)) {
+ includeFile($file);
+
+ return true;
+ }
+ }
+
+ /**
+ * Finds the path to the file where the class is defined.
+ *
+ * @param string $class The name of the class
+ *
+ * @return string|false The path if found, false otherwise
+ */
+ public function findFile($class)
+ {
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
+ if ('\\' == $class[0]) {
+ $class = substr($class, 1);
+ }
+
+ // class map lookup
+ if (isset($this->classMap[$class])) {
+ return $this->classMap[$class];
+ }
+ if ($this->classMapAuthoritative) {
+ return false;
+ }
+
+ $file = $this->findFileWithExtension($class, '.php');
+
+ // Search for Hack files if we are running on HHVM
+ if ($file === null && defined('HHVM_VERSION')) {
+ $file = $this->findFileWithExtension($class, '.hh');
+ }
+
+ if ($file === null) {
+ // Remember that this class does not exist.
+ return $this->classMap[$class] = false;
+ }
+
+ return $file;
+ }
+
+ private function findFileWithExtension($class, $ext)
+ {
+ // PSR-4 lookup
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
+
+ $first = $class[0];
+ if (isset($this->prefixLengthsPsr4[$first])) {
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
+ if (0 === strpos($class, $prefix)) {
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-4 fallback dirs
+ foreach ($this->fallbackDirsPsr4 as $dir) {
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 lookup
+ if (false !== $pos = strrpos($class, '\\')) {
+ // namespaced class name
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
+ } else {
+ // PEAR-like class name
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
+ }
+
+ if (isset($this->prefixesPsr0[$first])) {
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
+ if (0 === strpos($class, $prefix)) {
+ foreach ($dirs as $dir) {
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-0 fallback dirs
+ foreach ($this->fallbackDirsPsr0 as $dir) {
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 include paths.
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
+ return $file;
+ }
+ }
+}
+
+/**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ */
+function includeFile($file)
+{
+ include $file;
+}
diff --git a/admin/classes/domain/vendor/composer/autoload_classmap.php b/admin/classes/domain/vendor/composer/autoload_classmap.php
new file mode 100644
index 0000000..7a91153
--- /dev/null
+++ b/admin/classes/domain/vendor/composer/autoload_classmap.php
@@ -0,0 +1,9 @@
+ array($vendorDir . '/caseyamcl/phpoaipmh/src', $vendorDir . '/caseyamcl/phpoaipmh/src', $vendorDir . '/caseyamcl/phpoaipmh/tests'),
+);
diff --git a/admin/classes/domain/vendor/composer/autoload_psr4.php b/admin/classes/domain/vendor/composer/autoload_psr4.php
new file mode 100644
index 0000000..1ae73db
--- /dev/null
+++ b/admin/classes/domain/vendor/composer/autoload_psr4.php
@@ -0,0 +1,14 @@
+ array($vendorDir . '/react/promise/src'),
+ 'Phpoaipmh\\Example\\' => array($vendorDir . '/caseyamcl/phpoaipmh/example/src'),
+ 'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'),
+ 'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'),
+ 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
+);
diff --git a/admin/classes/domain/vendor/composer/autoload_real.php b/admin/classes/domain/vendor/composer/autoload_real.php
new file mode 100644
index 0000000..99dadca
--- /dev/null
+++ b/admin/classes/domain/vendor/composer/autoload_real.php
@@ -0,0 +1,55 @@
+ $path) {
+ $loader->set($namespace, $path);
+ }
+
+ $map = require __DIR__ . '/autoload_psr4.php';
+ foreach ($map as $namespace => $path) {
+ $loader->setPsr4($namespace, $path);
+ }
+
+ $classMap = require __DIR__ . '/autoload_classmap.php';
+ if ($classMap) {
+ $loader->addClassMap($classMap);
+ }
+
+ $loader->register(true);
+
+ $includeFiles = require __DIR__ . '/autoload_files.php';
+ foreach ($includeFiles as $file) {
+ composerRequire97895f88b67d99b60b78f68d45e2b7d2($file);
+ }
+
+ return $loader;
+ }
+}
+
+function composerRequire97895f88b67d99b60b78f68d45e2b7d2($file)
+{
+ require $file;
+}
diff --git a/admin/classes/domain/vendor/composer/installed.json b/admin/classes/domain/vendor/composer/installed.json
new file mode 100644
index 0000000..0124f1d
--- /dev/null
+++ b/admin/classes/domain/vendor/composer/installed.json
@@ -0,0 +1,274 @@
+[
+ {
+ "name": "caseyamcl/phpoaipmh",
+ "version": "v2.4",
+ "version_normalized": "2.4.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/caseyamcl/phpoaipmh.git",
+ "reference": "8a8a10e34e6d6b7f30849617aa7100b52331d0ef"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/caseyamcl/phpoaipmh/zipball/8a8a10e34e6d6b7f30849617aa7100b52331d0ef",
+ "reference": "8a8a10e34e6d6b7f30849617aa7100b52331d0ef",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "guzzlehttp/guzzle": "~5.0",
+ "mockery/mockery": "~0.9",
+ "phpunit/phpunit": "~4.0",
+ "symfony/config": "~2.5",
+ "symfony/console": "~2.5",
+ "symfony/dependency-injection": "~2.5",
+ "symfony/yaml": "~2.5"
+ },
+ "time": "2015-05-18 14:40:02",
+ "type": "library",
+ "installation-source": "dist",
+ "autoload": {
+ "psr-0": {
+ "Phpoaipmh": [
+ "src/",
+ "tests"
+ ]
+ },
+ "psr-4": {
+ "Phpoaipmh\\Example\\": "example/src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Casey McLaughlin",
+ "email": "caseyamcl@gmail.com",
+ "homepage": "http://caseymclaughlin.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "A PHP OAI-PMH 2.0 Harvester library",
+ "homepage": "https://github.com/caseyamcl/phpoaipmh",
+ "keywords": [
+ "Harvester",
+ "OAI",
+ "OAI-PMH"
+ ]
+ },
+ {
+ "name": "react/promise",
+ "version": "v2.2.0",
+ "version_normalized": "2.2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/reactphp/promise.git",
+ "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef",
+ "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "time": "2014-12-30 13:32:42",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "React\\Promise\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jan Sorgalla",
+ "email": "jsorgalla@googlemail.com"
+ }
+ ],
+ "description": "A lightweight implementation of CommonJS Promises/A for PHP"
+ },
+ {
+ "name": "guzzlehttp/streams",
+ "version": "3.0.0",
+ "version_normalized": "3.0.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/streams.git",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "time": "2014-10-12 19:18:40",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Stream\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Provides a simple abstraction over streams of data",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "Guzzle",
+ "stream"
+ ]
+ },
+ {
+ "name": "guzzlehttp/ringphp",
+ "version": "1.1.0",
+ "version_normalized": "1.1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/RingPHP.git",
+ "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
+ "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/streams": "~3.0",
+ "php": ">=5.4.0",
+ "react/promise": "~2.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "ext-curl": "Guzzle will use specific adapters if cURL is present"
+ },
+ "time": "2015-05-20 03:37:09",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Ring\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function."
+ },
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "5.3.0",
+ "version_normalized": "5.3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "f3c8c22471cb55475105c14769644a49c3262b93"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f3c8c22471cb55475105c14769644a49c3262b93",
+ "reference": "f3c8c22471cb55475105c14769644a49c3262b93",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/ringphp": "^1.1",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "phpunit/phpunit": "^4.0",
+ "psr/log": "^1.0"
+ },
+ "time": "2015-05-20 03:47:55",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.0-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "rest",
+ "web service"
+ ]
+ }
+]
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/.editorconfig b/admin/classes/domain/vendor/guzzlehttp/guzzle/.editorconfig
new file mode 100644
index 0000000..eab48cc
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/.editorconfig
@@ -0,0 +1,11 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending for every file
+# Indent with 4 spaces
+[php]
+end_of_line = lf
+indent_style = space
+indent_size = 4
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/.gitignore b/admin/classes/domain/vendor/guzzlehttp/guzzle/.gitignore
new file mode 100644
index 0000000..83ec41e
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/.gitignore
@@ -0,0 +1,11 @@
+phpunit.xml
+composer.phar
+composer.lock
+composer-test.lock
+vendor/
+build/artifacts/
+artifacts/
+docs/_build
+docs/*.pyc
+.idea
+.DS_STORE
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/.travis.yml b/admin/classes/domain/vendor/guzzlehttp/guzzle/.travis.yml
new file mode 100644
index 0000000..55ec892
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/.travis.yml
@@ -0,0 +1,41 @@
+language: php
+
+php:
+ - 5.4
+ - 5.5
+ - 5.6
+ - 7.0
+ - hhvm
+
+before_script:
+ - curl --version
+ - pear config-set php_ini ~/.phpenv/versions/`php -r 'echo phpversion();'`/etc/php.ini || echo 'Error modifying PEAR'
+ - pecl install uri_template || echo 'Error installing uri_template'
+ - composer self-update
+ - composer install --no-interaction --prefer-source --dev
+ - ~/.nvm/nvm.sh install v0.6.14
+ - ~/.nvm/nvm.sh run v0.6.14
+
+script: make test
+
+matrix:
+ allow_failures:
+ - php: hhvm
+ - php: 7.0
+ fast_finish: true
+
+before_deploy:
+ - make package
+
+deploy:
+ provider: releases
+ api_key:
+ secure: UpypqlYgsU68QT/x40YzhHXvzWjFwCNo9d+G8KAdm7U9+blFfcWhV1aMdzugvPMl6woXgvJj7qHq5tAL4v6oswCORhpSBfLgOQVFaica5LiHsvWlAedOhxGmnJqMTwuepjBCxXhs3+I8Kof1n4oUL9gKytXjOVCX/f7XU1HiinU=
+ file:
+ - build/artifacts/guzzle.phar
+ - build/artifacts/guzzle.zip
+ on:
+ repo: guzzle/guzzle
+ tags: true
+ all_branches: true
+ php: 5.4
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/CHANGELOG.md b/admin/classes/domain/vendor/guzzlehttp/guzzle/CHANGELOG.md
new file mode 100644
index 0000000..b46278b
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/CHANGELOG.md
@@ -0,0 +1,1053 @@
+# CHANGELOG
+
+## 5.3.0 - 2015-05-19
+
+* Mock now supports `save_to`
+* Marked `AbstractRequestEvent::getTransaction()` as public.
+* Fixed a bug in which multiple headers using different casing would overwrite
+ previous headers in the associative array.
+* Added `Utils::getDefaultHandler()`
+* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated.
+* URL scheme is now always lowercased.
+
+## 5.2.0 - 2015-01-27
+
+* Added `AppliesHeadersInterface` to make applying headers to a request based
+ on the body more generic and not specific to `PostBodyInterface`.
+* Reduced the number of stack frames needed to send requests.
+* Nested futures are now resolved in the client rather than the RequestFsm
+* Finishing state transitions is now handled in the RequestFsm rather than the
+ RingBridge.
+* Added a guard in the Pool class to not use recursion for request retries.
+
+## 5.1.0 - 2014-12-19
+
+* Pool class no longer uses recursion when a request is intercepted.
+* The size of a Pool can now be dynamically adjusted using a callback.
+ See https://github.com/guzzle/guzzle/pull/943.
+* Setting a request option to `null` when creating a request with a client will
+ ensure that the option is not set. This allows you to overwrite default
+ request options on a per-request basis.
+ See https://github.com/guzzle/guzzle/pull/937.
+* Added the ability to limit which protocols are allowed for redirects by
+ specifying a `protocols` array in the `allow_redirects` request option.
+* Nested futures due to retries are now resolved when waiting for synchronous
+ responses. See https://github.com/guzzle/guzzle/pull/947.
+* `"0"` is now an allowed URI path. See
+ https://github.com/guzzle/guzzle/pull/935.
+* `Query` no longer typehints on the `$query` argument in the constructor,
+ allowing for strings and arrays.
+* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle
+ specific exceptions if necessary.
+
+## 5.0.3 - 2014-11-03
+
+This change updates query strings so that they are treated as un-encoded values
+by default where the value represents an un-encoded value to send over the
+wire. A Query object then encodes the value before sending over the wire. This
+means that even value query string values (e.g., ":") are url encoded. This
+makes the Query class match PHP's http_build_query function. However, if you
+want to send requests over the wire using valid query string characters that do
+not need to be encoded, then you can provide a string to Url::setQuery() and
+pass true as the second argument to specify that the query string is a raw
+string that should not be parsed or encoded (unless a call to getQuery() is
+subsequently made, forcing the query-string to be converted into a Query
+object).
+
+## 5.0.2 - 2014-10-30
+
+* Added a trailing `\r\n` to multipart/form-data payloads. See
+ https://github.com/guzzle/guzzle/pull/871
+* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs.
+* Status codes are now returned as integers. See
+ https://github.com/guzzle/guzzle/issues/881
+* No longer overwriting an existing `application/x-www-form-urlencoded` header
+ when sending POST requests, allowing for customized headers. See
+ https://github.com/guzzle/guzzle/issues/877
+* Improved path URL serialization.
+
+ * No longer double percent-encoding characters in the path or query string if
+ they are already encoded.
+ * Now properly encoding the supplied path to a URL object, instead of only
+ encoding ' ' and '?'.
+ * Note: This has been changed in 5.0.3 to now encode query string values by
+ default unless the `rawString` argument is provided when setting the query
+ string on a URL: Now allowing many more characters to be present in the
+ query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A
+
+## 5.0.1 - 2014-10-16
+
+Bugfix release.
+
+* Fixed an issue where connection errors still returned response object in
+ error and end events event though the response is unusable. This has been
+ corrected so that a response is not returned in the `getResponse` method of
+ these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867
+* Fixed an issue where transfer statistics were not being populated in the
+ RingBridge. https://github.com/guzzle/guzzle/issues/866
+
+## 5.0.0 - 2014-10-12
+
+Adding support for non-blocking responses and some minor API cleanup.
+
+### New Features
+
+* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`.
+* Added a public API for creating a default HTTP adapter.
+* Updated the redirect plugin to be non-blocking so that redirects are sent
+ concurrently. Other plugins like this can now be updated to be non-blocking.
+* Added a "progress" event so that you can get upload and download progress
+ events.
+* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers
+ requests concurrently using a capped pool size as efficiently as possible.
+* Added `hasListeners()` to EmitterInterface.
+* Removed `GuzzleHttp\ClientInterface::sendAll` and marked
+ `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the
+ recommended way).
+
+### Breaking changes
+
+The breaking changes in this release are relatively minor. The biggest thing to
+look out for is that request and response objects no longer implement fluent
+interfaces.
+
+* Removed the fluent interfaces (i.e., `return $this`) from requests,
+ responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`,
+ `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and
+ `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of
+ why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/.
+ This also makes the Guzzle message interfaces compatible with the current
+ PSR-7 message proposal.
+* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except
+ for the HTTP request functions from function.php, these functions are now
+ implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode`
+ moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
+ `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
+ `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
+ `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php
+ caused problems for many users: they aren't PSR-4 compliant, require an
+ explicit include, and needed an if-guard to ensure that the functions are not
+ declared multiple times.
+* Rewrote adapter layer.
+ * Removing all classes from `GuzzleHttp\Adapter`, these are now
+ implemented as callables that are stored in `GuzzleHttp\Ring\Client`.
+ * Removed the concept of "parallel adapters". Sending requests serially or
+ concurrently is now handled using a single adapter.
+ * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The
+ Transaction object now exposes the request, response, and client as public
+ properties. The getters and setters have been removed.
+* Removed the "headers" event. This event was only useful for changing the
+ body a response once the headers of the response were known. You can implement
+ a similar behavior in a number of ways. One example might be to use a
+ FnStream that has access to the transaction being sent. For example, when the
+ first byte is written, you could check if the response headers match your
+ expectations, and if so, change the actual stream body that is being
+ written to.
+* Removed the `asArray` parameter from
+ `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
+ value as an array, then use the newly added `getHeaderAsArray()` method of
+ `MessageInterface`. This change makes the Guzzle interfaces compatible with
+ the PSR-7 interfaces.
+* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add
+ custom request options using double-dispatch (this was an implementation
+ detail). Instead, you should now provide an associative array to the
+ constructor which is a mapping of the request option name mapping to a
+ function that applies the option value to a request.
+* Removed the concept of "throwImmediately" from exceptions and error events.
+ This control mechanism was used to stop a transfer of concurrent requests
+ from completing. This can now be handled by throwing the exception or by
+ cancelling a pool of requests or each outstanding future request individually.
+* Updated to "GuzzleHttp\Streams" 3.0.
+ * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a
+ `maxLen` parameter. This update makes the Guzzle streams project
+ compatible with the current PSR-7 proposal.
+ * `GuzzleHttp\Stream\Stream::__construct`,
+ `GuzzleHttp\Stream\Stream::factory`, and
+ `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second
+ argument. They now accept an associative array of options, including the
+ "size" key and "metadata" key which can be used to provide custom metadata.
+
+## 4.2.2 - 2014-09-08
+
+* Fixed a memory leak in the CurlAdapter when reusing cURL handles.
+* No longer using `request_fulluri` in stream adapter proxies.
+* Relative redirects are now based on the last response, not the first response.
+
+## 4.2.1 - 2014-08-19
+
+* Ensuring that the StreamAdapter does not always add a Content-Type header
+* Adding automated github releases with a phar and zip
+
+## 4.2.0 - 2014-08-17
+
+* Now merging in default options using a case-insensitive comparison.
+ Closes https://github.com/guzzle/guzzle/issues/767
+* Added the ability to automatically decode `Content-Encoding` response bodies
+ using the `decode_content` request option. This is set to `true` by default
+ to decode the response body if it comes over the wire with a
+ `Content-Encoding`. Set this value to `false` to disable decoding the
+ response content, and pass a string to provide a request `Accept-Encoding`
+ header and turn on automatic response decoding. This feature now allows you
+ to pass an `Accept-Encoding` header in the headers of a request but still
+ disable automatic response decoding.
+ Closes https://github.com/guzzle/guzzle/issues/764
+* Added the ability to throw an exception immediately when transferring
+ requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760
+* Updating guzzlehttp/streams dependency to ~2.1
+* No longer utilizing the now deprecated namespaced methods from the stream
+ package.
+
+## 4.1.8 - 2014-08-14
+
+* Fixed an issue in the CurlFactory that caused setting the `stream=false`
+ request option to throw an exception.
+ See: https://github.com/guzzle/guzzle/issues/769
+* TransactionIterator now calls rewind on the inner iterator.
+ See: https://github.com/guzzle/guzzle/pull/765
+* You can now set the `Content-Type` header to `multipart/form-data`
+ when creating POST requests to force multipart bodies.
+ See https://github.com/guzzle/guzzle/issues/768
+
+## 4.1.7 - 2014-08-07
+
+* Fixed an error in the HistoryPlugin that caused the same request and response
+ to be logged multiple times when an HTTP protocol error occurs.
+* Ensuring that cURL does not add a default Content-Type when no Content-Type
+ has been supplied by the user. This prevents the adapter layer from modifying
+ the request that is sent over the wire after any listeners may have already
+ put the request in a desired state (e.g., signed the request).
+* Throwing an exception when you attempt to send requests that have the
+ "stream" set to true in parallel using the MultiAdapter.
+* Only calling curl_multi_select when there are active cURL handles. This was
+ previously changed and caused performance problems on some systems due to PHP
+ always selecting until the maximum select timeout.
+* Fixed a bug where multipart/form-data POST fields were not correctly
+ aggregated (e.g., values with "&").
+
+## 4.1.6 - 2014-08-03
+
+* Added helper methods to make it easier to represent messages as strings,
+ including getting the start line and getting headers as a string.
+
+## 4.1.5 - 2014-08-02
+
+* Automatically retrying cURL "Connection died, retrying a fresh connect"
+ errors when possible.
+* cURL implementation cleanup
+* Allowing multiple event subscriber listeners to be registered per event by
+ passing an array of arrays of listener configuration.
+
+## 4.1.4 - 2014-07-22
+
+* Fixed a bug that caused multi-part POST requests with more than one field to
+ serialize incorrectly.
+* Paths can now be set to "0"
+* `ResponseInterface::xml` now accepts a `libxml_options` option and added a
+ missing default argument that was required when parsing XML response bodies.
+* A `save_to` stream is now created lazily, which means that files are not
+ created on disk unless a request succeeds.
+
+## 4.1.3 - 2014-07-15
+
+* Various fixes to multipart/form-data POST uploads
+* Wrapping function.php in an if-statement to ensure Guzzle can be used
+ globally and in a Composer install
+* Fixed an issue with generating and merging in events to an event array
+* POST headers are only applied before sending a request to allow you to change
+ the query aggregator used before uploading
+* Added much more robust query string parsing
+* Fixed various parsing and normalization issues with URLs
+* Fixing an issue where multi-valued headers were not being utilized correctly
+ in the StreamAdapter
+
+## 4.1.2 - 2014-06-18
+
+* Added support for sending payloads with GET requests
+
+## 4.1.1 - 2014-06-08
+
+* Fixed an issue related to using custom message factory options in subclasses
+* Fixed an issue with nested form fields in a multi-part POST
+* Fixed an issue with using the `json` request option for POST requests
+* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar`
+
+## 4.1.0 - 2014-05-27
+
+* Added a `json` request option to easily serialize JSON payloads.
+* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
+* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`.
+* Added the ability to provide an emitter to a client in the client constructor.
+* Added the ability to persist a cookie session using $_SESSION.
+* Added a trait that can be used to add event listeners to an iterator.
+* Removed request method constants from RequestInterface.
+* Fixed warning when invalid request start-lines are received.
+* Updated MessageFactory to work with custom request option methods.
+* Updated cacert bundle to latest build.
+
+4.0.2 (2014-04-16)
+------------------
+
+* Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
+* Added the ability to set scalars as POST fields (#628)
+
+## 4.0.1 - 2014-04-04
+
+* The HTTP status code of a response is now set as the exception code of
+ RequestException objects.
+* 303 redirects will now correctly switch from POST to GET requests.
+* The default parallel adapter of a client now correctly uses the MultiAdapter.
+* HasDataTrait now initializes the internal data array as an empty array so
+ that the toArray() method always returns an array.
+
+## 4.0.0 - 2014-03-29
+
+* For more information on the 4.0 transition, see:
+ http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/
+* For information on changes and upgrading, see:
+ https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
+* Added `GuzzleHttp\batch()` as a convenience function for sending requests in
+ parallel without needing to write asynchronous code.
+* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`.
+ You can now pass a callable or an array of associative arrays where each
+ associative array contains the "fn", "priority", and "once" keys.
+
+## 4.0.0.rc-2 - 2014-03-25
+
+* Removed `getConfig()` and `setConfig()` from clients to avoid confusion
+ around whether things like base_url, message_factory, etc. should be able to
+ be retrieved or modified.
+* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface
+* functions.php functions were renamed using snake_case to match PHP idioms
+* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and
+ `GUZZLE_CURL_SELECT_TIMEOUT` environment variables
+* Added the ability to specify custom `sendAll()` event priorities
+* Added the ability to specify custom stream context options to the stream
+ adapter.
+* Added a functions.php function for `get_path()` and `set_path()`
+* CurlAdapter and MultiAdapter now use a callable to generate curl resources
+* MockAdapter now properly reads a body and emits a `headers` event
+* Updated Url class to check if a scheme and host are set before adding ":"
+ and "//". This allows empty Url (e.g., "") to be serialized as "".
+* Parsing invalid XML no longer emits warnings
+* Curl classes now properly throw AdapterExceptions
+* Various performance optimizations
+* Streams are created with the faster `Stream\create()` function
+* Marked deprecation_proxy() as internal
+* Test server is now a collection of static methods on a class
+
+## 4.0.0-rc.1 - 2014-03-15
+
+* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
+
+## 3.8.1 - 2014-01-28
+
+* Bug: Always using GET requests when redirecting from a 303 response
+* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
+ `Guzzle\Http\ClientInterface::setSslVerification()`
+* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL
+* Bug: The body of a request can now be set to `"0"`
+* Sending PHP stream requests no longer forces `HTTP/1.0`
+* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of
+ each sub-exception
+* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than
+ clobbering everything).
+* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators)
+* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`.
+ For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`.
+* Now properly escaping the regular expression delimiter when matching Cookie domains.
+* Network access is now disabled when loading XML documents
+
+## 3.8.0 - 2013-12-05
+
+* Added the ability to define a POST name for a file
+* JSON response parsing now properly walks additionalProperties
+* cURL error code 18 is now retried automatically in the BackoffPlugin
+* Fixed a cURL error when URLs contain fragments
+* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were
+ CurlExceptions
+* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e)
+* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS`
+* Fixed a bug that was encountered when parsing empty header parameters
+* UriTemplate now has a `setRegex()` method to match the docs
+* The `debug` request parameter now checks if it is truthy rather than if it exists
+* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin
+* Added the ability to combine URLs using strict RFC 3986 compliance
+* Command objects can now return the validation errors encountered by the command
+* Various fixes to cache revalidation (#437 and 29797e5)
+* Various fixes to the AsyncPlugin
+* Cleaned up build scripts
+
+## 3.7.4 - 2013-10-02
+
+* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
+* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
+ (see https://github.com/aws/aws-sdk-php/issues/147)
+* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots
+* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420)
+* Updated the bundled cacert.pem (#419)
+* OauthPlugin now supports adding authentication to headers or query string (#425)
+
+## 3.7.3 - 2013-09-08
+
+* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
+ `CommandTransferException`.
+* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description
+* Schemas are only injected into response models when explicitly configured.
+* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of
+ an EntityBody.
+* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator.
+* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
+* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
+* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
+* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests
+* Bug fix: Properly parsing headers that contain commas contained in quotes
+* Bug fix: mimetype guessing based on a filename is now case-insensitive
+
+## 3.7.2 - 2013-08-02
+
+* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
+ See https://github.com/guzzle/guzzle/issues/371
+* Bug fix: Cookie domains are now matched correctly according to RFC 6265
+ See https://github.com/guzzle/guzzle/issues/377
+* Bug fix: GET parameters are now used when calculating an OAuth signature
+* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted
+* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched
+* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input.
+ See https://github.com/guzzle/guzzle/issues/379
+* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See
+ https://github.com/guzzle/guzzle/pull/380
+* cURL multi cleanup and optimizations
+
+## 3.7.1 - 2013-07-05
+
+* Bug fix: Setting default options on a client now works
+* Bug fix: Setting options on HEAD requests now works. See #352
+* Bug fix: Moving stream factory before send event to before building the stream. See #353
+* Bug fix: Cookies no longer match on IP addresses per RFC 6265
+* Bug fix: Correctly parsing header parameters that are in `<>` and quotes
+* Added `cert` and `ssl_key` as request options
+* `Host` header can now diverge from the host part of a URL if the header is set manually
+* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter
+* OAuth parameters are only added via the plugin if they aren't already set
+* Exceptions are now thrown when a URL cannot be parsed
+* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
+* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
+
+## 3.7.0 - 2013-06-10
+
+* See UPGRADING.md for more information on how to upgrade.
+* Requests now support the ability to specify an array of $options when creating a request to more easily modify a
+ request. You can pass a 'request.options' configuration setting to a client to apply default request options to
+ every request created by a client (e.g. default query string variables, headers, curl options, etc.).
+* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
+ See `Guzzle\Http\StaticClient::mount`.
+* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
+ created by a command (e.g. custom headers, query string variables, timeout settings, etc.).
+* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
+ headers of a response
+* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
+ (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`)
+* ServiceBuilders now support storing and retrieving arbitrary data
+* CachePlugin can now purge all resources for a given URI
+* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource
+* CachePlugin now uses the Vary header to determine if a resource is a cache hit
+* `Guzzle\Http\Message\Response` now implements `\Serializable`
+* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters
+* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable
+* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()`
+* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size
+* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message
+* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older
+ Symfony users can still use the old version of Monolog.
+* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`.
+ Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`.
+* Several performance improvements to `Guzzle\Common\Collection`
+* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
+ createRequest, head, delete, put, patch, post, options, prepareRequest
+* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
+* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
+* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
+ `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
+ resource, string, or EntityBody into the $options parameter to specify the download location of the response.
+* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
+ default `array()`
+* Added `Guzzle\Stream\StreamInterface::isRepeatable`
+* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
+ $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
+ $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`.
+* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`.
+* Removed `Guzzle\Http\ClientInterface::expandTemplate()`
+* Removed `Guzzle\Http\ClientInterface::setRequestFactory()`
+* Removed `Guzzle\Http\ClientInterface::getCurlMulti()`
+* Removed `Guzzle\Http\Message\RequestInterface::canCache`
+* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`
+* Removed `Guzzle\Http\Message\RequestInterface::isRedirect`
+* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
+* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting
+ `Guzzle\Common\Version::$emitWarnings` to true.
+* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use
+ `$request->getResponseBody()->isRepeatable()` instead.
+* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
+* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
+* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
+* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
+* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
+* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
+ These will work through Guzzle 4.0
+* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params].
+* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
+* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`.
+* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`.
+* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
+* Marked `Guzzle\Common\Collection::inject()` as deprecated.
+* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');`
+* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
+ CacheStorageInterface. These two objects and interface will be removed in a future version.
+* Always setting X-cache headers on cached responses
+* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
+* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
+ $request, Response $response);`
+* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
+* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
+* Added `CacheStorageInterface::purge($url)`
+* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
+ $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
+ CanCacheStrategyInterface $canCache = null)`
+* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
+
+## 3.6.0 - 2013-05-29
+
+* ServiceDescription now implements ToArrayInterface
+* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
+* Guzzle can now correctly parse incomplete URLs
+* Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
+* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
+* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
+* Specific header implementations can be created for complex headers. When a message creates a header, it uses a
+ HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
+ CacheControl header implementation.
+* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
+* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
+* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
+ Guzzle\Http\Curl\RequestMediator
+* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
+* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
+* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
+* Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
+* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
+* All response header helper functions return a string rather than mixing Header objects and strings inconsistently
+* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
+ directly via interfaces
+* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
+ but are a no-op until removed.
+* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
+ `Guzzle\Service\Command\ArrayCommandInterface`.
+* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
+ on a request while the request is still being transferred
+* The ability to case-insensitively search for header values
+* Guzzle\Http\Message\Header::hasExactHeader
+* Guzzle\Http\Message\Header::raw. Use getAll()
+* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
+ instead.
+* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
+* Added the ability to cast Model objects to a string to view debug information.
+
+## 3.5.0 - 2013-05-13
+
+* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
+* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove
+ itself from the EventDispatcher)
+* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
+* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
+* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a
+ non-existent key
+* Bug: All __call() method arguments are now required (helps with mocking frameworks)
+* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference
+ to help with refcount based garbage collection of resources created by sending a request
+* Deprecating ZF1 cache and log adapters. These will be removed in the next major version.
+* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it'sdeprecated). Use the
+ HistoryPlugin for a history.
+* Added a `responseBody` alias for the `response_body` location
+* Refactored internals to no longer rely on Response::getRequest()
+* HistoryPlugin can now be cast to a string
+* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests
+ and responses that are sent over the wire
+* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
+
+## 3.4.3 - 2013-04-30
+
+* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
+* Added a check to re-extract the temp cacert bundle from the phar before sending each request
+
+## 3.4.2 - 2013-04-29
+
+* Bug fix: Stream objects now work correctly with "a" and "a+" modes
+* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
+* Bug fix: AsyncPlugin no longer forces HEAD requests
+* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter
+* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails
+* Setting a response on a request will write to the custom request body from the response body if one is specified
+* LogPlugin now writes to php://output when STDERR is undefined
+* Added the ability to set multiple POST files for the same key in a single call
+* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default
+* Added the ability to queue CurlExceptions to the MockPlugin
+* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
+* Configuration loading now allows remote files
+
+## 3.4.1 - 2013-04-16
+
+* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
+ handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
+* Exceptions are now properly grouped when sending requests in parallel
+* Redirects are now properly aggregated when a multi transaction fails
+* Redirects now set the response on the original object even in the event of a failure
+* Bug fix: Model names are now properly set even when using $refs
+* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax
+* Added support for oauth_callback in OAuth signatures
+* Added support for oauth_verifier in OAuth signatures
+* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
+
+## 3.4.0 - 2013-04-11
+
+* Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289
+* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
+* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263
+* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264.
+* Bug fix: Added `number` type to service descriptions.
+* Bug fix: empty parameters are removed from an OAuth signature
+* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header
+* Bug fix: Fixed "array to string" error when validating a union of types in a service description
+* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream
+* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin.
+* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs.
+* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections.
+* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if
+ the Content-Type can be determined based on the entity body or the path of the request.
+* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder.
+* Added support for a PSR-3 LogAdapter.
+* Added a `command.after_prepare` event
+* Added `oauth_callback` parameter to the OauthPlugin
+* Added the ability to create a custom stream class when using a stream factory
+* Added a CachingEntityBody decorator
+* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized.
+* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar.
+* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies
+* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This
+ means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use
+ POST fields or files (the latter is only used when emulating a form POST in the browser).
+* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
+
+## 3.3.1 - 2013-03-10
+
+* Added the ability to create PHP streaming responses from HTTP requests
+* Bug fix: Running any filters when parsing response headers with service descriptions
+* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing
+* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across
+ response location visitors.
+* Bug fix: Removed the possibility of creating configuration files with circular dependencies
+* RequestFactory::create() now uses the key of a POST file when setting the POST file name
+* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
+
+## 3.3.0 - 2013-03-03
+
+* A large number of performance optimizations have been made
+* Bug fix: Added 'wb' as a valid write mode for streams
+* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned
+* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()`
+* BC: Removed `Guzzle\Http\Utils` class
+* BC: Setting a service description on a client will no longer modify the client's command factories.
+* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using
+ the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
+* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to
+ lowercase
+* Operation parameter objects are now lazy loaded internally
+* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses
+* Added support for instantiating responseType=class responseClass classes. Classes must implement
+ `Guzzle\Service\Command\ResponseClassInterface`
+* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These
+ additional properties also support locations and can be used to parse JSON responses where the outermost part of the
+ JSON is an array
+* Added support for nested renaming of JSON models (rename sentAs to name)
+* CachePlugin
+ * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
+ * Debug headers can now added to cached response in the CachePlugin
+
+## 3.2.0 - 2013-02-14
+
+* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
+* URLs with no path no longer contain a "/" by default
+* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url.
+* BadResponseException no longer includes the full request and response message
+* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface
+* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface
+* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription
+* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list
+* xmlEncoding can now be customized for the XML declaration of a XML service description operation
+* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value
+ aggregation and no longer uses callbacks
+* The URL encoding implementation of Guzzle\Http\QueryString can now be customized
+* Bug fix: Filters were not always invoked for array service description parameters
+* Bug fix: Redirects now use a target response body rather than a temporary response body
+* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
+* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
+
+## 3.1.2 - 2013-01-27
+
+* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
+ response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
+* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent
+* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444)
+* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
+* Setting default headers on a client after setting the user-agent will not erase the user-agent setting
+
+## 3.1.1 - 2013-01-20
+
+* Adding wildcard support to Guzzle\Common\Collection::getPath()
+* Adding alias support to ServiceBuilder configs
+* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
+
+## 3.1.0 - 2013-01-12
+
+* BC: CurlException now extends from RequestException rather than BadResponseException
+* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
+* Added getData to ServiceDescriptionInterface
+* Added context array to RequestInterface::setState()
+* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http
+* Bug: Adding required content-type when JSON request visitor adds JSON to a command
+* Bug: Fixing the serialization of a service description with custom data
+* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing
+ an array of successful and failed responses
+* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection
+* Added Guzzle\Http\IoEmittingEntityBody
+* Moved command filtration from validators to location visitors
+* Added `extends` attributes to service description parameters
+* Added getModels to ServiceDescriptionInterface
+
+## 3.0.7 - 2012-12-19
+
+* Fixing phar detection when forcing a cacert to system if null or true
+* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
+* Cleaning up `Guzzle\Common\Collection::inject` method
+* Adding a response_body location to service descriptions
+
+## 3.0.6 - 2012-12-09
+
+* CurlMulti performance improvements
+* Adding setErrorResponses() to Operation
+* composer.json tweaks
+
+## 3.0.5 - 2012-11-18
+
+* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
+* Bug: Response body can now be a string containing "0"
+* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert
+* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs
+* Added support for XML attributes in service description responses
+* DefaultRequestSerializer now supports array URI parameter values for URI template expansion
+* Added better mimetype guessing to requests and post files
+
+## 3.0.4 - 2012-11-11
+
+* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
+* Bug: Cookies can now be added that have a name, domain, or value set to "0"
+* Bug: Using the system cacert bundle when using the Phar
+* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures
+* Enhanced cookie jar de-duplication
+* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added
+* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
+* Added the ability to create any sort of hash for a stream rather than just an MD5 hash
+
+## 3.0.3 - 2012-11-04
+
+* Implementing redirects in PHP rather than cURL
+* Added PECL URI template extension and using as default parser if available
+* Bug: Fixed Content-Length parsing of Response factory
+* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams.
+* Adding ToArrayInterface throughout library
+* Fixing OauthPlugin to create unique nonce values per request
+
+## 3.0.2 - 2012-10-25
+
+* Magic methods are enabled by default on clients
+* Magic methods return the result of a command
+* Service clients no longer require a base_url option in the factory
+* Bug: Fixed an issue with URI templates where null template variables were being expanded
+
+## 3.0.1 - 2012-10-22
+
+* Models can now be used like regular collection objects by calling filter, map, etc.
+* Models no longer require a Parameter structure or initial data in the constructor
+* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
+
+## 3.0.0 - 2012-10-15
+
+* Rewrote service description format to be based on Swagger
+ * Now based on JSON schema
+ * Added nested input structures and nested response models
+ * Support for JSON and XML input and output models
+ * Renamed `commands` to `operations`
+ * Removed dot class notation
+ * Removed custom types
+* Broke the project into smaller top-level namespaces to be more component friendly
+* Removed support for XML configs and descriptions. Use arrays or JSON files.
+* Removed the Validation component and Inspector
+* Moved all cookie code to Guzzle\Plugin\Cookie
+* Magic methods on a Guzzle\Service\Client now return the command un-executed.
+* Calling getResult() or getResponse() on a command will lazily execute the command if needed.
+* Now shipping with cURL's CA certs and using it by default
+* Added previousResponse() method to response objects
+* No longer sending Accept and Accept-Encoding headers on every request
+* Only sending an Expect header by default when a payload is greater than 1MB
+* Added/moved client options:
+ * curl.blacklist to curl.option.blacklist
+ * Added ssl.certificate_authority
+* Added a Guzzle\Iterator component
+* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin
+* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin)
+* Added a more robust caching plugin
+* Added setBody to response objects
+* Updating LogPlugin to use a more flexible MessageFormatter
+* Added a completely revamped build process
+* Cleaning up Collection class and removing default values from the get method
+* Fixed ZF2 cache adapters
+
+## 2.8.8 - 2012-10-15
+
+* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
+
+## 2.8.7 - 2012-09-30
+
+* Bug: Fixed config file aliases for JSON includes
+* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
+* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload
+* Bug: Hardening request and response parsing to account for missing parts
+* Bug: Fixed PEAR packaging
+* Bug: Fixed Request::getInfo
+* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail
+* Adding the ability for the namespace Iterator factory to look in multiple directories
+* Added more getters/setters/removers from service descriptions
+* Added the ability to remove POST fields from OAuth signatures
+* OAuth plugin now supports 2-legged OAuth
+
+## 2.8.6 - 2012-09-05
+
+* Added the ability to modify and build service descriptions
+* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
+* Added a `json` parameter location
+* Now allowing dot notation for classes in the CacheAdapterFactory
+* Using the union of two arrays rather than an array_merge when extending service builder services and service params
+* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references
+ in service builder config files.
+* Services defined in two different config files that include one another will by default replace the previously
+ defined service, but you can now create services that extend themselves and merge their settings over the previous
+* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
+ '_default' with a default JSON configuration file.
+
+## 2.8.5 - 2012-08-29
+
+* Bug: Suppressed empty arrays from URI templates
+* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
+* Added support for HTTP responses that do not contain a reason phrase in the start-line
+* AbstractCommand commands are now invokable
+* Added a way to get the data used when signing an Oauth request before a request is sent
+
+## 2.8.4 - 2012-08-15
+
+* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
+* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
+* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream
+* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream
+* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5())
+* Added additional response status codes
+* Removed SSL information from the default User-Agent header
+* DELETE requests can now send an entity body
+* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries
+* Added the ability of the MockPlugin to consume mocked request bodies
+* LogPlugin now exposes request and response objects in the extras array
+
+## 2.8.3 - 2012-07-30
+
+* Bug: Fixed a case where empty POST requests were sent as GET requests
+* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
+* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
+* Added multiple inheritance to service description commands
+* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()`
+* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
+* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
+
+## 2.8.2 - 2012-07-24
+
+* Bug: Query string values set to 0 are no longer dropped from the query string
+* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()`
+* Bug: `+` is now treated as an encoded space when parsing query strings
+* QueryString and Collection performance improvements
+* Allowing dot notation for class paths in filters attribute of a service descriptions
+
+## 2.8.1 - 2012-07-16
+
+* Loosening Event Dispatcher dependency
+* POST redirects can now be customized using CURLOPT_POSTREDIR
+
+## 2.8.0 - 2012-07-15
+
+* BC: Guzzle\Http\Query
+ * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
+ * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
+ * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
+ * Changed the aggregation functions of QueryString to be static methods
+ * Can now use fromString() with querystrings that have a leading ?
+* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters
+* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
+* Cookies are no longer URL decoded by default
+* Bug: URI template variables set to null are no longer expanded
+
+## 2.7.2 - 2012-07-02
+
+* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
+* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
+* CachePlugin now allows for a custom request parameter function to check if a request can be cached
+* Bug fix: CachePlugin now only caches GET and HEAD requests by default
+* Bug fix: Using header glue when transferring headers over the wire
+* Allowing deeply nested arrays for composite variables in URI templates
+* Batch divisors can now return iterators or arrays
+
+## 2.7.1 - 2012-06-26
+
+* Minor patch to update version number in UA string
+* Updating build process
+
+## 2.7.0 - 2012-06-25
+
+* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
+* BC: Removed magic setX methods from commands
+* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method
+* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable.
+* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity)
+* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace
+* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin
+* Added the ability to set POST fields and files in a service description
+* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method
+* Adding a command.before_prepare event to clients
+* Added BatchClosureTransfer and BatchClosureDivisor
+* BatchTransferException now includes references to the batch divisor and transfer strategies
+* Fixed some tests so that they pass more reliably
+* Added Guzzle\Common\Log\ArrayLogAdapter
+
+## 2.6.6 - 2012-06-10
+
+* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
+* BC: Removing Guzzle\Service\Command\CommandSet
+* Adding generic batching system (replaces the batch queue plugin and command set)
+* Updating ZF cache and log adapters and now using ZF's composer repository
+* Bug: Setting the name of each ApiParam when creating through an ApiCommand
+* Adding result_type, result_doc, deprecated, and doc_url to service descriptions
+* Bug: Changed the default cookie header casing back to 'Cookie'
+
+## 2.6.5 - 2012-06-03
+
+* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
+* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
+* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data
+* BC: Renaming methods in the CookieJarInterface
+* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations
+* Making the default glue for HTTP headers ';' instead of ','
+* Adding a removeValue to Guzzle\Http\Message\Header
+* Adding getCookies() to request interface.
+* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
+
+## 2.6.4 - 2012-05-30
+
+* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
+* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
+* Bug: Fixing magic method command calls on clients
+* Bug: Email constraint only validates strings
+* Bug: Aggregate POST fields when POST files are present in curl handle
+* Bug: Fixing default User-Agent header
+* Bug: Only appending or prepending parameters in commands if they are specified
+* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes
+* Allowing the use of dot notation for class namespaces when using instance_of constraint
+* Added any_match validation constraint
+* Added an AsyncPlugin
+* Passing request object to the calculateWait method of the ExponentialBackoffPlugin
+* Allowing the result of a command object to be changed
+* Parsing location and type sub values when instantiating a service description rather than over and over at runtime
+
+## 2.6.3 - 2012-05-23
+
+* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
+* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
+* You can now use an array of data when creating PUT request bodies in the request factory.
+* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable.
+* [Http] Adding support for Content-Type in multipart POST uploads per upload
+* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1])
+* Adding more POST data operations for easier manipulation of POST data.
+* You can now set empty POST fields.
+* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files.
+* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
+* CS updates
+
+## 2.6.2 - 2012-05-19
+
+* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
+
+## 2.6.1 - 2012-05-19
+
+* [BC] Removing 'path' support in service descriptions. Use 'uri'.
+* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
+* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it.
+* [BC] Removing Guzzle\Common\XmlElement.
+* All commands, both dynamic and concrete, have ApiCommand objects.
+* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits.
+* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
+* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
+
+## 2.6.0 - 2012-05-15
+
+* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
+* [BC] Executing a Command returns the result of the command rather than the command
+* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed.
+* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
+* [BC] Moving ResourceIterator* to Guzzle\Service\Resource
+* [BC] Completely refactored ResourceIterators to iterate over a cloned command object
+* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate
+* [BC] Guzzle\Guzzle is now deprecated
+* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject
+* Adding Guzzle\Version class to give version information about Guzzle
+* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate()
+* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data
+* ServiceDescription and ServiceBuilder are now cacheable using similar configs
+* Changing the format of XML and JSON service builder configs. Backwards compatible.
+* Cleaned up Cookie parsing
+* Trimming the default Guzzle User-Agent header
+* Adding a setOnComplete() method to Commands that is called when a command completes
+* Keeping track of requests that were mocked in the MockPlugin
+* Fixed a caching bug in the CacheAdapterFactory
+* Inspector objects can be injected into a Command object
+* Refactoring a lot of code and tests to be case insensitive when dealing with headers
+* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL
+* Adding the ability to set global option overrides to service builder configs
+* Adding the ability to include other service builder config files from within XML and JSON files
+* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
+
+## 2.5.0 - 2012-05-08
+
+* Major performance improvements
+* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated.
+* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component.
+* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}"
+* Added the ability to passed parameters to all requests created by a client
+* Added callback functionality to the ExponentialBackoffPlugin
+* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies.
+* Rewinding request stream bodies when retrying requests
+* Exception is thrown when JSON response body cannot be decoded
+* Added configurable magic method calls to clients and commands. This is off by default.
+* Fixed a defect that added a hash to every parsed URL part
+* Fixed duplicate none generation for OauthPlugin.
+* Emitting an event each time a client is generated by a ServiceBuilder
+* Using an ApiParams object instead of a Collection for parameters of an ApiCommand
+* cache.* request parameters should be renamed to params.cache.*
+* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle.
+* Added the ability to disable type validation of service descriptions
+* ServiceDescriptions and ServiceBuilders are now Serializable
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/LICENSE b/admin/classes/domain/vendor/guzzlehttp/guzzle/LICENSE
new file mode 100644
index 0000000..71d3b78
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/Makefile b/admin/classes/domain/vendor/guzzlehttp/guzzle/Makefile
new file mode 100644
index 0000000..69bf327
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/Makefile
@@ -0,0 +1,50 @@
+all: clean coverage docs
+
+start-server:
+ cd vendor/guzzlehttp/ringphp && make start-server
+
+stop-server:
+ cd vendor/guzzlehttp/ringphp && make stop-server
+
+test: start-server
+ vendor/bin/phpunit
+ $(MAKE) stop-server
+
+coverage: start-server
+ vendor/bin/phpunit --coverage-html=artifacts/coverage
+ $(MAKE) stop-server
+
+view-coverage:
+ open artifacts/coverage/index.html
+
+clean:
+ rm -rf artifacts/*
+
+docs:
+ cd docs && make html && cd ..
+
+view-docs:
+ open docs/_build/html/index.html
+
+tag:
+ $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1"))
+ @echo Tagging $(TAG)
+ chag update $(TAG)
+ sed -i '' -e "s/VERSION = '.*'/VERSION = '$(TAG)'/" src/ClientInterface.php
+ php -l src/ClientInterface.php
+ git add -A
+ git commit -m '$(TAG) release'
+ chag tag
+
+perf: start-server
+ php tests/perf.php
+ $(MAKE) stop-server
+
+package: burgomaster
+ php build/packager.php
+
+burgomaster:
+ mkdir -p build/artifacts
+ curl -s https://raw.githubusercontent.com/mtdowling/Burgomaster/0.0.2/src/Burgomaster.php > build/artifacts/Burgomaster.php
+
+.PHONY: docs burgomaster
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/README.md b/admin/classes/domain/vendor/guzzlehttp/guzzle/README.md
new file mode 100644
index 0000000..d41e7e7
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/README.md
@@ -0,0 +1,70 @@
+Guzzle, PHP HTTP client and webservice framework
+================================================
+
+[](http://travis-ci.org/guzzle/guzzle)
+
+Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
+trivial to integrate with web services.
+
+- Manages things like persistent connections, represents query strings as
+ collections, simplifies sending streaming POST requests with fields and
+ files, and abstracts away the underlying HTTP transport layer.
+- Can send both synchronous and asynchronous requests using the same interface
+ without requiring a dependency on a specific event loop.
+- Pluggable HTTP adapters allows Guzzle to integrate with any method you choose
+ for sending HTTP requests over the wire (e.g., cURL, sockets, PHP's stream
+ wrapper, non-blocking event loops like ReactPHP.
+- Guzzle makes it so that you no longer need to fool around with cURL options,
+ stream contexts, or sockets.
+
+```php
+$client = new GuzzleHttp\Client();
+$response = $client->get('http://guzzlephp.org');
+$res = $client->get('https://api.github.com/user', ['auth' => ['user', 'pass']]);
+echo $res->getStatusCode();
+// "200"
+echo $res->getHeader('content-type');
+// 'application/json; charset=utf8'
+echo $res->getBody();
+// {"type":"User"...'
+var_export($res->json());
+// Outputs the JSON decoded data
+
+// Send an asynchronous request.
+$req = $client->createRequest('GET', 'http://httpbin.org', ['future' => true]);
+$client->send($req)->then(function ($response) {
+ echo 'I completed! ' . $response;
+});
+```
+
+Get more information and answers with the
+[Documentation](http://guzzlephp.org/),
+[Forums](https://groups.google.com/forum/?hl=en#!forum/guzzle),
+and [Gitter](https://gitter.im/guzzle/guzzle).
+
+### Installing via Composer
+
+The recommended way to install Guzzle is through
+[Composer](http://getcomposer.org).
+
+```bash
+# Install Composer
+curl -sS https://getcomposer.org/installer | php
+```
+
+Next, run the Composer command to install the latest stable version of Guzzle:
+
+```bash
+composer.phar require guzzlehttp/guzzle
+```
+
+After installing, you need to require Composer's autoloader:
+
+```php
+require 'vendor/autoload.php';
+```
+
+### Documentation
+
+More information can be found in the online documentation at
+http://guzzlephp.org/.
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/UPGRADING.md b/admin/classes/domain/vendor/guzzlehttp/guzzle/UPGRADING.md
new file mode 100644
index 0000000..2b3877f
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/UPGRADING.md
@@ -0,0 +1,1050 @@
+Guzzle Upgrade Guide
+====================
+
+4.x to 5.0
+----------
+
+## Rewritten Adapter Layer
+
+Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send
+HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor
+is still supported, but it has now been renamed to `handler`. Instead of
+passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP
+`callable` that follows the RingPHP specification.
+
+## Removed Fluent Interfaces
+
+[Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil)
+from the following classes:
+
+- `GuzzleHttp\Collection`
+- `GuzzleHttp\Url`
+- `GuzzleHttp\Query`
+- `GuzzleHttp\Post\PostBody`
+- `GuzzleHttp\Cookie\SetCookie`
+
+## Removed functions.php
+
+Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following
+functions can be used as replacements.
+
+- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode`
+- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath`
+- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path`
+- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however,
+ deprecated in favor of using `GuzzleHttp\Pool::batch()`.
+
+The "procedural" global client has been removed with no replacement (e.g.,
+`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client`
+object as a replacement.
+
+## `throwImmediately` has been removed
+
+The concept of "throwImmediately" has been removed from exceptions and error
+events. This control mechanism was used to stop a transfer of concurrent
+requests from completing. This can now be handled by throwing the exception or
+by cancelling a pool of requests or each outstanding future request
+individually.
+
+## headers event has been removed
+
+Removed the "headers" event. This event was only useful for changing the
+body a response once the headers of the response were known. You can implement
+a similar behavior in a number of ways. One example might be to use a
+FnStream that has access to the transaction being sent. For example, when the
+first byte is written, you could check if the response headers match your
+expectations, and if so, change the actual stream body that is being
+written to.
+
+## Updates to HTTP Messages
+
+Removed the `asArray` parameter from
+`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
+value as an array, then use the newly added `getHeaderAsArray()` method of
+`MessageInterface`. This change makes the Guzzle interfaces compatible with
+the PSR-7 interfaces.
+
+3.x to 4.0
+----------
+
+## Overarching changes:
+
+- Now requires PHP 5.4 or greater.
+- No longer requires cURL to send requests.
+- Guzzle no longer wraps every exception it throws. Only exceptions that are
+ recoverable are now wrapped by Guzzle.
+- Various namespaces have been removed or renamed.
+- No longer requiring the Symfony EventDispatcher. A custom event dispatcher
+ based on the Symfony EventDispatcher is
+ now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant
+ speed and functionality improvements).
+
+Changes per Guzzle 3.x namespace are described below.
+
+## Batch
+
+The `Guzzle\Batch` namespace has been removed. This is best left to
+third-parties to implement on top of Guzzle's core HTTP library.
+
+## Cache
+
+The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement
+has been implemented yet, but hoping to utilize a PSR cache interface).
+
+## Common
+
+- Removed all of the wrapped exceptions. It's better to use the standard PHP
+ library for unrecoverable exceptions.
+- `FromConfigInterface` has been removed.
+- `Guzzle\Common\Version` has been removed. The VERSION constant can be found
+ at `GuzzleHttp\ClientInterface::VERSION`.
+
+### Collection
+
+- `getAll` has been removed. Use `toArray` to convert a collection to an array.
+- `inject` has been removed.
+- `keySearch` has been removed.
+- `getPath` no longer supports wildcard expressions. Use something better like
+ JMESPath for this.
+- `setPath` now supports appending to an existing array via the `[]` notation.
+
+### Events
+
+Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses
+`GuzzleHttp\Event\Emitter`.
+
+- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by
+ `GuzzleHttp\Event\EmitterInterface`.
+- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by
+ `GuzzleHttp\Event\Emitter`.
+- `Symfony\Component\EventDispatcher\Event` is replaced by
+ `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in
+ `GuzzleHttp\Event\EventInterface`.
+- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and
+ `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the
+ event emitter of a request, client, etc. now uses the `getEmitter` method
+ rather than the `getDispatcher` method.
+
+#### Emitter
+
+- Use the `once()` method to add a listener that automatically removes itself
+ the first time it is invoked.
+- Use the `listeners()` method to retrieve a list of event listeners rather than
+ the `getListeners()` method.
+- Use `emit()` instead of `dispatch()` to emit an event from an emitter.
+- Use `attach()` instead of `addSubscriber()` and `detach()` instead of
+ `removeSubscriber()`.
+
+```php
+$mock = new Mock();
+// 3.x
+$request->getEventDispatcher()->addSubscriber($mock);
+$request->getEventDispatcher()->removeSubscriber($mock);
+// 4.x
+$request->getEmitter()->attach($mock);
+$request->getEmitter()->detach($mock);
+```
+
+Use the `on()` method to add a listener rather than the `addListener()` method.
+
+```php
+// 3.x
+$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } );
+// 4.x
+$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } );
+```
+
+## Http
+
+### General changes
+
+- The cacert.pem certificate has been moved to `src/cacert.pem`.
+- Added the concept of adapters that are used to transfer requests over the
+ wire.
+- Simplified the event system.
+- Sending requests in parallel is still possible, but batching is no longer a
+ concept of the HTTP layer. Instead, you must use the `complete` and `error`
+ events to asynchronously manage parallel request transfers.
+- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`.
+- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`.
+- QueryAggregators have been rewritten so that they are simply callable
+ functions.
+- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in
+ `functions.php` for an easy to use static client instance.
+- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from
+ `GuzzleHttp\Exception\TransferException`.
+
+### Client
+
+Calling methods like `get()`, `post()`, `head()`, etc. no longer create and
+return a request, but rather creates a request, sends the request, and returns
+the response.
+
+```php
+// 3.0
+$request = $client->get('/');
+$response = $request->send();
+
+// 4.0
+$response = $client->get('/');
+
+// or, to mirror the previous behavior
+$request = $client->createRequest('GET', '/');
+$response = $client->send($request);
+```
+
+`GuzzleHttp\ClientInterface` has changed.
+
+- The `send` method no longer accepts more than one request. Use `sendAll` to
+ send multiple requests in parallel.
+- `setUserAgent()` has been removed. Use a default request option instead. You
+ could, for example, do something like:
+ `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`.
+- `setSslVerification()` has been removed. Use default request options instead,
+ like `$client->setConfig('defaults/verify', true)`.
+
+`GuzzleHttp\Client` has changed.
+
+- The constructor now accepts only an associative array. You can include a
+ `base_url` string or array to use a URI template as the base URL of a client.
+ You can also specify a `defaults` key that is an associative array of default
+ request options. You can pass an `adapter` to use a custom adapter,
+ `batch_adapter` to use a custom adapter for sending requests in parallel, or
+ a `message_factory` to change the factory used to create HTTP requests and
+ responses.
+- The client no longer emits a `client.create_request` event.
+- Creating requests with a client no longer automatically utilize a URI
+ template. You must pass an array into a creational method (e.g.,
+ `createRequest`, `get`, `put`, etc.) in order to expand a URI template.
+
+### Messages
+
+Messages no longer have references to their counterparts (i.e., a request no
+longer has a reference to it's response, and a response no loger has a
+reference to its request). This association is now managed through a
+`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to
+these transaction objects using request events that are emitted over the
+lifecycle of a request.
+
+#### Requests with a body
+
+- `GuzzleHttp\Message\EntityEnclosingRequest` and
+ `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The
+ separation between requests that contain a body and requests that do not
+ contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface`
+ handles both use cases.
+- Any method that previously accepts a `GuzzleHttp\Response` object now accept a
+ `GuzzleHttp\Message\ResponseInterface`.
+- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to
+ `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create
+ both requests and responses and is implemented in
+ `GuzzleHttp\Message\MessageFactory`.
+- POST field and file methods have been removed from the request object. You
+ must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface`
+ to control the format of a POST body. Requests that are created using a
+ standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use
+ a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if
+ the method is POST and no body is provided.
+
+```php
+$request = $client->createRequest('POST', '/');
+$request->getBody()->setField('foo', 'bar');
+$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r')));
+```
+
+#### Headers
+
+- `GuzzleHttp\Message\Header` has been removed. Header values are now simply
+ represented by an array of values or as a string. Header values are returned
+ as a string by default when retrieving a header value from a message. You can
+ pass an optional argument of `true` to retrieve a header value as an array
+ of strings instead of a single concatenated string.
+- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to
+ `GuzzleHttp\Post`. This interface has been simplified and now allows the
+ addition of arbitrary headers.
+- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most
+ of the custom headers are now handled separately in specific
+ subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has
+ been updated to properly handle headers that contain parameters (like the
+ `Link` header).
+
+#### Responses
+
+- `GuzzleHttp\Message\Response::getInfo()` and
+ `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event
+ system to retrieve this type of information.
+- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed.
+- `GuzzleHttp\Message\Response::getMessage()` has been removed.
+- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific
+ methods have moved to the CacheSubscriber.
+- Header specific helper functions like `getContentMd5()` have been removed.
+ Just use `getHeader('Content-MD5')` instead.
+- `GuzzleHttp\Message\Response::setRequest()` and
+ `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event
+ system to work with request and response objects as a transaction.
+- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the
+ Redirect subscriber instead.
+- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have
+ been removed. Use `getStatusCode()` instead.
+
+#### Streaming responses
+
+Streaming requests can now be created by a client directly, returning a
+`GuzzleHttp\Message\ResponseInterface` object that contains a body stream
+referencing an open PHP HTTP stream.
+
+```php
+// 3.0
+use Guzzle\Stream\PhpStreamRequestFactory;
+$request = $client->get('/');
+$factory = new PhpStreamRequestFactory();
+$stream = $factory->fromRequest($request);
+$data = $stream->read(1024);
+
+// 4.0
+$response = $client->get('/', ['stream' => true]);
+// Read some data off of the stream in the response body
+$data = $response->getBody()->read(1024);
+```
+
+#### Redirects
+
+The `configureRedirects()` method has been removed in favor of a
+`allow_redirects` request option.
+
+```php
+// Standard redirects with a default of a max of 5 redirects
+$request = $client->createRequest('GET', '/', ['allow_redirects' => true]);
+
+// Strict redirects with a custom number of redirects
+$request = $client->createRequest('GET', '/', [
+ 'allow_redirects' => ['max' => 5, 'strict' => true]
+]);
+```
+
+#### EntityBody
+
+EntityBody interfaces and classes have been removed or moved to
+`GuzzleHttp\Stream`. All classes and interfaces that once required
+`GuzzleHttp\EntityBodyInterface` now require
+`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no
+longer uses `GuzzleHttp\EntityBody::factory` but now uses
+`GuzzleHttp\Stream\Stream::factory` or even better:
+`GuzzleHttp\Stream\create()`.
+
+- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface`
+- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream`
+- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream`
+- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream`
+- `Guzzle\Http\IoEmittyinEntityBody` has been removed.
+
+#### Request lifecycle events
+
+Requests previously submitted a large number of requests. The number of events
+emitted over the lifecycle of a request has been significantly reduced to make
+it easier to understand how to extend the behavior of a request. All events
+emitted during the lifecycle of a request now emit a custom
+`GuzzleHttp\Event\EventInterface` object that contains context providing
+methods and a way in which to modify the transaction at that specific point in
+time (e.g., intercept the request and set a response on the transaction).
+
+- `request.before_send` has been renamed to `before` and now emits a
+ `GuzzleHttp\Event\BeforeEvent`
+- `request.complete` has been renamed to `complete` and now emits a
+ `GuzzleHttp\Event\CompleteEvent`.
+- `request.sent` has been removed. Use `complete`.
+- `request.success` has been removed. Use `complete`.
+- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`.
+- `request.exception` has been removed. Use `error`.
+- `request.receive.status_line` has been removed.
+- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to
+ maintain a status update.
+- `curl.callback.write` has been removed. Use a custom `StreamInterface` to
+ intercept writes.
+- `curl.callback.read` has been removed. Use a custom `StreamInterface` to
+ intercept reads.
+
+`headers` is a new event that is emitted after the response headers of a
+request have been received before the body of the response is downloaded. This
+event emits a `GuzzleHttp\Event\HeadersEvent`.
+
+You can intercept a request and inject a response using the `intercept()` event
+of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and
+`GuzzleHttp\Event\ErrorEvent` event.
+
+See: http://docs.guzzlephp.org/en/latest/events.html
+
+## Inflection
+
+The `Guzzle\Inflection` namespace has been removed. This is not a core concern
+of Guzzle.
+
+## Iterator
+
+The `Guzzle\Iterator` namespace has been removed.
+
+- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and
+ `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of
+ Guzzle itself.
+- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent
+ class is shipped with PHP 5.4.
+- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because
+ it's easier to just wrap an iterator in a generator that maps values.
+
+For a replacement of these iterators, see https://github.com/nikic/iter
+
+## Log
+
+The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The
+`Guzzle\Log` namespace has been removed. Guzzle now relies on
+`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been
+moved to `GuzzleHttp\Subscriber\Log\Formatter`.
+
+## Parser
+
+The `Guzzle\Parser` namespace has been removed. This was previously used to
+make it possible to plug in custom parsers for cookies, messages, URI
+templates, and URLs; however, this level of complexity is not needed in Guzzle
+so it has been removed.
+
+- Cookie: Cookie parsing logic has been moved to
+ `GuzzleHttp\Cookie\SetCookie::fromString`.
+- Message: Message parsing logic for both requests and responses has been moved
+ to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only
+ used in debugging or deserializing messages, so it doesn't make sense for
+ Guzzle as a library to add this level of complexity to parsing messages.
+- UriTemplate: URI template parsing has been moved to
+ `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL
+ URI template library if it is installed.
+- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously
+ it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary,
+ then developers are free to subclass `GuzzleHttp\Url`.
+
+## Plugin
+
+The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`.
+Several plugins are shipping with the core Guzzle library under this namespace.
+
+- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar
+ code has moved to `GuzzleHttp\Cookie`.
+- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin.
+- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is
+ received.
+- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin.
+- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before
+ sending. This subscriber is attached to all requests by default.
+- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin.
+
+The following plugins have been removed (third-parties are free to re-implement
+these if needed):
+
+- `GuzzleHttp\Plugin\Async` has been removed.
+- `GuzzleHttp\Plugin\CurlAuth` has been removed.
+- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This
+ functionality should instead be implemented with event listeners that occur
+ after normal response parsing occurs in the guzzle/command package.
+
+The following plugins are not part of the core Guzzle package, but are provided
+in separate repositories:
+
+- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be muchs simpler
+ to build custom retry policies using simple functions rather than various
+ chained classes. See: https://github.com/guzzle/retry-subscriber
+- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to
+ https://github.com/guzzle/cache-subscriber
+- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to
+ https://github.com/guzzle/log-subscriber
+- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to
+ https://github.com/guzzle/message-integrity-subscriber
+- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to
+ `GuzzleHttp\Subscriber\MockSubscriber`.
+- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to
+ https://github.com/guzzle/oauth-subscriber
+
+## Service
+
+The service description layer of Guzzle has moved into two separate packages:
+
+- http://github.com/guzzle/command Provides a high level abstraction over web
+ services by representing web service operations using commands.
+- http://github.com/guzzle/guzzle-services Provides an implementation of
+ guzzle/command that provides request serialization and response parsing using
+ Guzzle service descriptions.
+
+## Stream
+
+Stream have moved to a separate package available at
+https://github.com/guzzle/streams.
+
+`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take
+on the responsibilities of `Guzzle\Http\EntityBody` and
+`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number
+of methods implemented by the `StreamInterface` has been drastically reduced to
+allow developers to more easily extend and decorate stream behavior.
+
+## Removed methods from StreamInterface
+
+- `getStream` and `setStream` have been removed to better encapsulate streams.
+- `getMetadata` and `setMetadata` have been removed in favor of
+ `GuzzleHttp\Stream\MetadataStreamInterface`.
+- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been
+ removed. This data is accessible when
+ using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`.
+- `rewind` has been removed. Use `seek(0)` for a similar behavior.
+
+## Renamed methods
+
+- `detachStream` has been renamed to `detach`.
+- `feof` has been renamed to `eof`.
+- `ftell` has been renamed to `tell`.
+- `readLine` has moved from an instance method to a static class method of
+ `GuzzleHttp\Stream\Stream`.
+
+## Metadata streams
+
+`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
+that contain additional metadata accessible via `getMetadata()`.
+`GuzzleHttp\Stream\StreamInterface::getMetadata` and
+`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
+
+## StreamRequestFactory
+
+The entire concept of the StreamRequestFactory has been removed. The way this
+was used in Guzzle 3 broke the actual interface of sending streaming requests
+(instead of getting back a Response, you got a StreamInterface). Streeaming
+PHP requests are now implemented throught the `GuzzleHttp\Adapter\StreamAdapter`.
+
+3.6 to 3.7
+----------
+
+### Deprecations
+
+- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.:
+
+```php
+\Guzzle\Common\Version::$emitWarnings = true;
+```
+
+The following APIs and options have been marked as deprecated:
+
+- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead.
+- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
+- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
+- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
+- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
+- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
+- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
+- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
+- Marked `Guzzle\Common\Collection::inject()` as deprecated.
+- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use
+ `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or
+ `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));`
+
+3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational
+request methods. When paired with a client's configuration settings, these options allow you to specify default settings
+for various aspects of a request. Because these options make other previous configuration options redundant, several
+configuration options and methods of a client and AbstractCommand have been deprecated.
+
+- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`.
+- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`.
+- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')`
+- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0
+
+ $command = $client->getCommand('foo', array(
+ 'command.headers' => array('Test' => '123'),
+ 'command.response_body' => '/path/to/file'
+ ));
+
+ // Should be changed to:
+
+ $command = $client->getCommand('foo', array(
+ 'command.request_options' => array(
+ 'headers' => array('Test' => '123'),
+ 'save_as' => '/path/to/file'
+ )
+ ));
+
+### Interface changes
+
+Additions and changes (you will need to update any implementations or subclasses you may have created):
+
+- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
+ createRequest, head, delete, put, patch, post, options, prepareRequest
+- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
+- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
+- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
+ `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
+ resource, string, or EntityBody into the $options parameter to specify the download location of the response.
+- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
+ default `array()`
+- Added `Guzzle\Stream\StreamInterface::isRepeatable`
+- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
+
+The following methods were removed from interfaces. All of these methods are still available in the concrete classes
+that implement them, but you should update your code to use alternative methods:
+
+- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
+ `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
+ `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or
+ `$client->setDefaultOption('headers/{header_name}', 'value')`. or
+ `$client->setDefaultOption('headers', array('header_name' => 'value'))`.
+- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`.
+- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail.
+- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail.
+- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail.
+- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin.
+- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin.
+- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin.
+
+### Cache plugin breaking changes
+
+- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
+ CacheStorageInterface. These two objects and interface will be removed in a future version.
+- Always setting X-cache headers on cached responses
+- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
+- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
+ $request, Response $response);`
+- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
+- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
+- Added `CacheStorageInterface::purge($url)`
+- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
+ $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
+ CanCacheStrategyInterface $canCache = null)`
+- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
+
+3.5 to 3.6
+----------
+
+* Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
+* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
+* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
+ For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader().
+ Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request.
+* Specific header implementations can be created for complex headers. When a message creates a header, it uses a
+ HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
+ CacheControl header implementation.
+* Moved getLinks() from Response to just be used on a Link header object.
+
+If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the
+HeaderInterface (e.g. toArray(), getAll(), etc.).
+
+### Interface changes
+
+* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
+* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
+* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
+ Guzzle\Http\Curl\RequestMediator
+* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
+* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
+* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
+
+### Removed deprecated functions
+
+* Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
+* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
+
+### Deprecations
+
+* The ability to case-insensitively search for header values
+* Guzzle\Http\Message\Header::hasExactHeader
+* Guzzle\Http\Message\Header::raw. Use getAll()
+* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
+ instead.
+
+### Other changes
+
+* All response header helper functions return a string rather than mixing Header objects and strings inconsistently
+* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
+ directly via interfaces
+* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
+ but are a no-op until removed.
+* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
+ `Guzzle\Service\Command\ArrayCommandInterface`.
+* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
+ on a request while the request is still being transferred
+* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
+
+3.3 to 3.4
+----------
+
+Base URLs of a client now follow the rules of http://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs.
+
+3.2 to 3.3
+----------
+
+### Response::getEtag() quote stripping removed
+
+`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header
+
+### Removed `Guzzle\Http\Utils`
+
+The `Guzzle\Http\Utils` class was removed. This class was only used for testing.
+
+### Stream wrapper and type
+
+`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase.
+
+### curl.emit_io became emit_io
+
+Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the
+'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
+
+3.1 to 3.2
+----------
+
+### CurlMulti is no longer reused globally
+
+Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added
+to a single client can pollute requests dispatched from other clients.
+
+If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the
+ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is
+created.
+
+```php
+$multi = new Guzzle\Http\Curl\CurlMulti();
+$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json');
+$builder->addListener('service_builder.create_client', function ($event) use ($multi) {
+ $event['client']->setCurlMulti($multi);
+}
+});
+```
+
+### No default path
+
+URLs no longer have a default path value of '/' if no path was specified.
+
+Before:
+
+```php
+$request = $client->get('http://www.foo.com');
+echo $request->getUrl();
+// >> http://www.foo.com/
+```
+
+After:
+
+```php
+$request = $client->get('http://www.foo.com');
+echo $request->getUrl();
+// >> http://www.foo.com
+```
+
+### Less verbose BadResponseException
+
+The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and
+response information. You can, however, get access to the request and response object by calling `getRequest()` or
+`getResponse()` on the exception object.
+
+### Query parameter aggregation
+
+Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a
+setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is
+responsible for handling the aggregation of multi-valued query string variables into a flattened hash.
+
+2.8 to 3.x
+----------
+
+### Guzzle\Service\Inspector
+
+Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig`
+
+**Before**
+
+```php
+use Guzzle\Service\Inspector;
+
+class YourClient extends \Guzzle\Service\Client
+{
+ public static function factory($config = array())
+ {
+ $default = array();
+ $required = array('base_url', 'username', 'api_key');
+ $config = Inspector::fromConfig($config, $default, $required);
+
+ $client = new self(
+ $config->get('base_url'),
+ $config->get('username'),
+ $config->get('api_key')
+ );
+ $client->setConfig($config);
+
+ $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
+
+ return $client;
+ }
+```
+
+**After**
+
+```php
+use Guzzle\Common\Collection;
+
+class YourClient extends \Guzzle\Service\Client
+{
+ public static function factory($config = array())
+ {
+ $default = array();
+ $required = array('base_url', 'username', 'api_key');
+ $config = Collection::fromConfig($config, $default, $required);
+
+ $client = new self(
+ $config->get('base_url'),
+ $config->get('username'),
+ $config->get('api_key')
+ );
+ $client->setConfig($config);
+
+ $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json'));
+
+ return $client;
+ }
+```
+
+### Convert XML Service Descriptions to JSON
+
+**Before**
+
+```xml
+
+
+
+
+
+ Get a list of groups
+
+
+ Uses a search query to get a list of groups
+
+
+
+ Create a group
+
+
+
+
+ Delete a group by ID
+
+
+
+
+
+
+ Update a group
+
+
+
+
+
+
+```
+
+**After**
+
+```json
+{
+ "name": "Zendesk REST API v2",
+ "apiVersion": "2012-12-31",
+ "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users",
+ "operations": {
+ "list_groups": {
+ "httpMethod":"GET",
+ "uri": "groups.json",
+ "summary": "Get a list of groups"
+ },
+ "search_groups":{
+ "httpMethod":"GET",
+ "uri": "search.json?query=\"{query} type:group\"",
+ "summary": "Uses a search query to get a list of groups",
+ "parameters":{
+ "query":{
+ "location": "uri",
+ "description":"Zendesk Search Query",
+ "type": "string",
+ "required": true
+ }
+ }
+ },
+ "create_group": {
+ "httpMethod":"POST",
+ "uri": "groups.json",
+ "summary": "Create a group",
+ "parameters":{
+ "data": {
+ "type": "array",
+ "location": "body",
+ "description":"Group JSON",
+ "filters": "json_encode",
+ "required": true
+ },
+ "Content-Type":{
+ "type": "string",
+ "location":"header",
+ "static": "application/json"
+ }
+ }
+ },
+ "delete_group": {
+ "httpMethod":"DELETE",
+ "uri": "groups/{id}.json",
+ "summary": "Delete a group",
+ "parameters":{
+ "id":{
+ "location": "uri",
+ "description":"Group to delete by ID",
+ "type": "integer",
+ "required": true
+ }
+ }
+ },
+ "get_group": {
+ "httpMethod":"GET",
+ "uri": "groups/{id}.json",
+ "summary": "Get a ticket",
+ "parameters":{
+ "id":{
+ "location": "uri",
+ "description":"Group to get by ID",
+ "type": "integer",
+ "required": true
+ }
+ }
+ },
+ "update_group": {
+ "httpMethod":"PUT",
+ "uri": "groups/{id}.json",
+ "summary": "Update a group",
+ "parameters":{
+ "id": {
+ "location": "uri",
+ "description":"Group to update by ID",
+ "type": "integer",
+ "required": true
+ },
+ "data": {
+ "type": "array",
+ "location": "body",
+ "description":"Group JSON",
+ "filters": "json_encode",
+ "required": true
+ },
+ "Content-Type":{
+ "type": "string",
+ "location":"header",
+ "static": "application/json"
+ }
+ }
+ }
+}
+```
+
+### Guzzle\Service\Description\ServiceDescription
+
+Commands are now called Operations
+
+**Before**
+
+```php
+use Guzzle\Service\Description\ServiceDescription;
+
+$sd = new ServiceDescription();
+$sd->getCommands(); // @returns ApiCommandInterface[]
+$sd->hasCommand($name);
+$sd->getCommand($name); // @returns ApiCommandInterface|null
+$sd->addCommand($command); // @param ApiCommandInterface $command
+```
+
+**After**
+
+```php
+use Guzzle\Service\Description\ServiceDescription;
+
+$sd = new ServiceDescription();
+$sd->getOperations(); // @returns OperationInterface[]
+$sd->hasOperation($name);
+$sd->getOperation($name); // @returns OperationInterface|null
+$sd->addOperation($operation); // @param OperationInterface $operation
+```
+
+### Guzzle\Common\Inflection\Inflector
+
+Namespace is now `Guzzle\Inflection\Inflector`
+
+### Guzzle\Http\Plugin
+
+Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below.
+
+### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log
+
+Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively.
+
+**Before**
+
+```php
+use Guzzle\Common\Log\ClosureLogAdapter;
+use Guzzle\Http\Plugin\LogPlugin;
+
+/** @var \Guzzle\Http\Client */
+$client;
+
+// $verbosity is an integer indicating desired message verbosity level
+$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE);
+```
+
+**After**
+
+```php
+use Guzzle\Log\ClosureLogAdapter;
+use Guzzle\Log\MessageFormatter;
+use Guzzle\Plugin\Log\LogPlugin;
+
+/** @var \Guzzle\Http\Client */
+$client;
+
+// $format is a string indicating desired message format -- @see MessageFormatter
+$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT);
+```
+
+### Guzzle\Http\Plugin\CurlAuthPlugin
+
+Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`.
+
+### Guzzle\Http\Plugin\ExponentialBackoffPlugin
+
+Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes.
+
+**Before**
+
+```php
+use Guzzle\Http\Plugin\ExponentialBackoffPlugin;
+
+$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge(
+ ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429)
+ ));
+
+$client->addSubscriber($backoffPlugin);
+```
+
+**After**
+
+```php
+use Guzzle\Plugin\Backoff\BackoffPlugin;
+use Guzzle\Plugin\Backoff\HttpBackoffStrategy;
+
+// Use convenient factory method instead -- see implementation for ideas of what
+// you can do with chaining backoff strategies
+$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge(
+ HttpBackoffStrategy::getDefaultFailureCodes(), array(429)
+ ));
+$client->addSubscriber($backoffPlugin);
+```
+
+### Known Issues
+
+#### [BUG] Accept-Encoding header behavior changed unintentionally.
+
+(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e)
+
+In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to
+properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen.
+See issue #217 for a workaround, or use a version containing the fix.
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/build/packager.php b/admin/classes/domain/vendor/guzzlehttp/guzzle/build/packager.php
new file mode 100644
index 0000000..724bf63
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/build/packager.php
@@ -0,0 +1,21 @@
+deepCopy($file, $file);
+}
+
+// Copy each dependency to the staging directory. Copy *.php and *.pem files.
+$packager->recursiveCopy('src', 'GuzzleHttp', ['php']);
+$packager->recursiveCopy('vendor/react/promise/src', 'React/Promise');
+$packager->recursiveCopy('vendor/guzzlehttp/ringphp/src', 'GuzzleHttp/Ring');
+$packager->recursiveCopy('vendor/guzzlehttp/streams/src', 'GuzzleHttp/Stream');
+$packager->createAutoloader(['React/Promise/functions.php']);
+$packager->createPhar(__DIR__ . '/artifacts/guzzle.phar');
+$packager->createZip(__DIR__ . '/artifacts/guzzle.zip');
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/composer.json b/admin/classes/domain/vendor/guzzlehttp/guzzle/composer.json
new file mode 100644
index 0000000..6ec7dad
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/composer.json
@@ -0,0 +1,39 @@
+{
+ "name": "guzzlehttp/guzzle",
+ "type": "library",
+ "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+ "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"],
+ "homepage": "http://guzzlephp.org/",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "require": {
+ "php": ">=5.4.0",
+ "guzzlehttp/ringphp": "^1.1"
+ },
+ "require-dev": {
+ "ext-curl": "*",
+ "psr/log": "^1.0",
+ "phpunit/phpunit": "^4.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "GuzzleHttp\\Tests\\": "tests/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.0-dev"
+ }
+ }
+}
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/Makefile b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/Makefile
new file mode 100644
index 0000000..d92e03f
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/Makefile
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Guzzle.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Guzzle.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/Guzzle"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Guzzle"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_static/guzzle-icon.png b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_static/guzzle-icon.png
new file mode 100644
index 0000000..f1017f7
Binary files /dev/null and b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_static/guzzle-icon.png differ
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_static/logo.png b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_static/logo.png
new file mode 100644
index 0000000..965a4ef
Binary files /dev/null and b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_static/logo.png differ
diff --git a/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_templates/nav_links.html b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_templates/nav_links.html
new file mode 100644
index 0000000..7950a0f
--- /dev/null
+++ b/admin/classes/domain/vendor/guzzlehttp/guzzle/docs/_templates/nav_links.html
@@ -0,0 +1,3 @@
+
The " . count($resToRemove) . " following resources have been removed from package :
");
+ echo _("
");
+ foreach ($resToRemove as $res) {
+ $object = new Resource(new NamedArguments(array('primaryKey' => $res)));
+ echo _("
- " . $object->titleText."
");
+ $object->removeResource();
+ }
+ echo _("
");
+ $customDone = true;
+} else {
+ echo _('
Uncheck titles you want to remove from this package. Unselect all will import package only without any titles.
+ To delete this package and all resources included in Click here
');
+
+ $package = new Resource(new NamedArguments(array('primaryKey' => $resID)));
+ if (count($package) > 1) {
+ echo _("more than 1 resource correspond to this package !! "); //TODO _ DEBUG _
+ } else {
+ ?>
+
" . ImportTool::getNbParentInserted() . " parents have been created. " . ImportTool::getNbParentAttached() . " resources have been attached to an existing parent.
";
+print "
".$displayStat(ImportTool::getNbParentInserted(), "parent", "created. ");
+print $displayStat(ImportTool::getNbParentAttached(), "parent", "attached to an existing parent. ")."
";
+
+//print "
" . ImportTool::getNbOrganizationsInserted() . " organizations have been created";
+print "
".$displayStat(ImportTool::getNbOrganizationsInserted(), "organization", "created ");
+if (count(ImportTool::getArrayOrganizationsCreated()) > 0) {
+ print " (" . implode(',', ImportTool::getArrayOrganizationsCreated()) . "). ";
+}
+//print ". " . ImportTool::getNbOrganizationsAttached() . " resources have been attached to an existing organization.
";
+print $displayStat(ImportTool::getNbOrganizationsAttached(), "resource", "attached to an existing organization. ")."";
+
+
+
+if ($_POST['type'] == 'package') {
+ $res = new Resource();
+ $packID = $res->getResourceByIdentifierAndType($_POST['id'], 'gokb');
+ $nb = count($packID);
+ if(($nb>1) || ($nb == 0) ){
+ echo "None or more than one resource correspond => ERROR"; //DEBUG _ TODO
+ } else {
+ $p_id = $packID[0]->resourceID;
+ }
+
+ print "
"
+ . "Personalize this package content "
+ . "
";
+}
+?>
+
+
+
+
+
diff --git a/ajax_processing/searchResourceFromGokb.php b/ajax_processing/searchResourceFromGokb.php
new file mode 100644
index 0000000..74499d1
--- /dev/null
+++ b/ajax_processing/searchResourceFromGokb.php
@@ -0,0 +1,41 @@
+';
+
+include "../admin/classes/domain/GOKbTools.php";
+echo 'after include ok name = '.$_POST['name'].' ';
+
+$tool = GOKbTools::getInstance();
+
+
+$a = $tool->searchByName($_POST['name'], "package");
+$b = $tool->searchByName($_POST['name'], "title");
+
+
+echo '
Importing and deduping isbnOrISSN on the following columns: " ;
- foreach ($data as $key => $value) {
- if (in_array($value, $deduping_config)) {
- $deduping_columns[] = $key;
- print $value . " ";
- }
- }
- print ".
";
- } else {
- // Deduping
- unset($deduping_values);
- $resource = new Resource();
- $resourceObj = new Resource();
- foreach ($deduping_columns as $value) {
- $deduping_values[] = $data[$value];
- }
- $deduping_count = count($resourceObj->getResourceByIsbnOrISSN($deduping_values));
- if ($deduping_count == 0) {
- // Convert to UTF-8
- $data = array_map(function($row) { return mb_convert_encoding($row, 'UTF-8'); }, $data);
-
- // Let's insert data
- $resource->createLoginID = $loginID;
- $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);
- } catch (Exception $e) {
- print "
Organization $organizationName could not be added.
";
- }
- // If yes, we attach it to our resource
- } elseif ($result['count'] == 1) {
- $query = "SELECT name, organizationID FROM $dbName.Organization WHERE UPPER(name) = '" . str_replace("'", "''", strtoupper($organizationName)) . "'";
- $result = $organization->db->processQuery($query, 'assoc');
- $organizationID = $result['organizationID'];
- $organizationsAttached++;
- } else {
- print "
Error: more than one organization is called $organizationName. Please consider deduping.
";
- }
- if ($organizationID) {
- $dbName = $config->settings->organizationsDatabaseName;
- // Get role
- $query = "SELECT organizationRoleID from OrganizationRole WHERE shortName='" . mysql_escape_string($data[$_POST['role']]) . "'";
- $result = $organization->db->processQuery($query);
- // If role is not found, fallback to the first one.
- $roleID = ($result[0]) ? $result[0] : 1;
- // Does the organizationRole already exists?
- $query = "SELECT count(*) AS count FROM $dbName.OrganizationRoleProfile WHERE organizationID=$organizationID AND organizationRoleID=$roleID";
- $result = $organization->db->processQuery($query, 'assoc');
- // If not, we try to create it
- if ($result['count'] == 0) {
- $query = "INSERT INTO $dbName.OrganizationRoleProfile SET organizationID=$organizationID, organizationRoleID=$roleID";
- try {
- $result = $organization->db->processQuery($query);
- if (!in_array($organizationName, $arrayOrganizationsCreated)) {
- $organizationsInserted++;
- array_push($arrayOrganizationsCreated, $organizationName);
- }
- } catch (Exception $e) {
- print "
Unable to associate organization $organizationName with its role.
Error: more than one organization is called $organizationName. Please consider deduping.
";
- }
- // Find role
- $organizationRoles = $organizationRole->getArray();
- if (($roleID = array_search($data[$_POST['role']], $organizationRoles)) == 0) {
- // If role is not found, fallback to the first one.
- $roleID = '1';
- }
+ $row++;
}
- // Let's link the resource and the organization.
- // (this has to be done whether the module Organization is in use or not)
- if ($organizationID && $roleID) {
- $organizationLink = new ResourceOrganizationLink();
- $organizationLink->organizationRoleID = $roleID;
- $organizationLink->resourceID = $resource->resourceID;
- $organizationLink->organizationID = $organizationID;
- $organizationLink->save();
- }
- }
- } elseif ($deduping_count == 1) {
- $resources = $resourceObj->getResourceByIsbnOrISSN($deduping_values);
- $resource = $resources[0];
- }
- // Do we have a parent resource to create?
- if ($data[$_POST['parentResource']] && ($deduping_count == 0 || $deduping_count == 1) ) {
- // Search if such parent exists
- $numberOfParents = count($resourceObj->getResourceByTitle($data[$_POST['parentResource']]));
- $parentID = null;
- if ($numberOfParents == 0) {
- // If not, create parent
- $parentResource = new Resource();
- $parentResource->createLoginID = $loginID;
- $parentResource->createDate = date( 'Y-m-d' );
- $parentResource->titleText = $data[$_POST['parentResource']];
- $parentResource->statusID = 1;
- $parentResource->save();
- $parentID = $parentResource->resourceID;
- $parentInserted++;
- } elseif ($numberOfParents == 1) {
- // Else, attach the resource to its parent.
- $parentResource = $resourceObj->getResourceByTitle($data[$_POST['parentResource']]);
- $parentID = $parentResource[0]->resourceID;
-
- $parentAttached++;
- }
- if ($numberOfParents == 0 || $numberOfParents == 1) {
- $resourceRelationship = new ResourceRelationship();
- $resourceRelationship->resourceID = $resource->resourceID;
- $resourceRelationship->relatedResourceID = $parentID;
- $resourceRelationship->relationshipTypeID = '1'; //hardcoded because we're only allowing parent relationships
- if (!$resourceRelationship->exists()) {
- $resourceRelationship->save();
- }
- }
- }
- }
- $row++;
- }
+ }
print "
Results
";
- print "
" . ($row - 1) . " rows have been processed. $inserted rows have been inserted.
";
- print "
$parentInserted parents have been created. $parentAttached resources have been attached to an existing parent.
";
- print "
$organizationsInserted organizations have been created";
- if (count($arrayOrganizationsCreated) > 0) print " (" . implode(',', $arrayOrganizationsCreated) . ")";
- print ". $organizationsAttached resources have been attached to an existing organization.
";
- }
+ print "
" . ($row- 1) . " rows have been processed. ".ImportTool::getNbInserted()." rows have been inserted.
";
+ print "
". ImportTool::getNbParentInserted()." parents have been created. ".ImportTool::getNbParentAttached()." resources have been attached to an existing parent.
";
+ print "
".ImportTool::getNbOrganizationsInserted()." organizations have been created";
+ if (count(ImportTool::getArrayOrganizationsCreated()) > 0) print " (" . implode(',', ImportTool::getArrayOrganizationsCreated()) . ")";
+ print ". ".ImportTool::getNbOrganizationsAttached()." resources have been attached to an existing organization.