Commit a710322f authored by ipf's avatar ipf Committed by GitHub
Browse files

Merge pull request #3 from subugoe/upgradeToTypo3-8

Upgrade the extension to work with Typo3 Version 8
parents bebe54f0 4fbd87d8
......@@ -54,6 +54,92 @@ class Query extends AbstractEntity {
protected $queryStringKeyword = Null;
protected $queryStringDate = Null;
/**
* Array containing the sort conditions to use. Each of its elements
* is an array with the fields:
* 'fieldName' - a string containing the name of the pazpar2 field to sort by
* 'direction' - the string 'ascending' or 'descending'
*
* @var array
*/
protected $sortOrder = [];
/**
* Absolute path of the pazpar2 service on the host.
*
* @var string
*/
protected $pazpar2Path = '/pazpar2/search.pz2';
/**
* Service name to run the query on.
*
* @var string|Null
*/
protected $serviceName = Null;
/**
* False by default, True when the Query finished running.
*
* @var Boolean
*/
protected $didRun = False;
/**
* Indicates whether all targets in the service are active (as determined
* by the pazpar2-access.php proxy service).
*
* @var Boolean|Null
*/
protected $allTargetsActive;
/**
* Name of the institution proving database access (as determined by
* the pazpar2-access.php proxy service).
*
* @var string|Null $institutionName
*/
protected $institutionName = Null;
/**
* URL of the pazpar2 service used.
*
* @var string|Null
*/
protected $pazpar2BaseURL;
/**
* Array holding the search results after they are downloaded.
* The array's element can be displayed by the View Helper class
* Tx_Pazpar2_ViewHelpers_ResultViewHelper.
*
* @var array
*/
private $results = [];
/**
* The total number of results (including the ones that could not be fetched.
*
* @var integer
*/
private $totalResultCount;
/**
* VARIABLES FOR INTERNAL USE
*/
/**
* Stores state of query.
* @var Boolean
*/
protected $queryIsRunning;
/**
* Stores time the current query was started.
* @var int
*/
protected $queryStartTime;
/**
* @return string|Null
*/
......@@ -85,7 +171,6 @@ class Query extends AbstractEntity {
return $this->queryStringDate;
}
/**
* Setter for the main query string.
*
......@@ -95,26 +180,21 @@ class Query extends AbstractEntity {
$this->queryString = $newQueryString;
}
/**
* Array containing the sort conditions to use. Each of its elements
* is an array with the fields:
* 'fieldName' - a string containing the name of the pazpar2 field to sort by
* 'direction' - the string 'ascending' or 'descending'
*
* @var Array
* @return array
*/
protected $sortOrder = Array();
public function getSortOrder() {
return $this->sortOrder;
}
/**
* @param string $newSortOrder
* @return void
*/
public function setSortOrder($newSortOrder) {
$this->sortOrder = $newSortOrder;
}
/**
* Set search query elements from the request’s arguments array.
*
......@@ -130,14 +210,6 @@ class Query extends AbstractEntity {
$this->queryStringDate = trim($newArguments['queryStringDate']);
}
/**
* Absolute path of the pazpar2 service on the host.
*
* @var string
*/
protected $pazpar2Path = '/pazpar2/search.pz2';
/**
* @return string
*/
......@@ -153,14 +225,6 @@ class Query extends AbstractEntity {
$this->pazpar2Path = $newPazpar2Path;
}
/**
* Service name to run the query on.
*
* @var string|Null
*/
protected $serviceName = Null;
/**
* @return string
*/
......@@ -176,60 +240,36 @@ class Query extends AbstractEntity {
$this->serviceName = $newServiceName;
}
/**
* Name of the institution proving database access (as determined by
* the pazpar2-access.php proxy service).
*
* @var string|Null $institutionName
*/
protected $institutionName = Null;
/**
* @return string|Null
*/
protected function getInstitutionName() {
public function getInstitutionName() {
return $this->institutionName;
}
/**
* @param string $newInstitutionName
* @return void
*/
protected function setInstitutionName($newInstitutionName) {
$this->institutionName = $newInstitutionName;
}
/**
* False by default, True when the Query finished running.
*
* @var Boolean
*/
protected $didRun = False;
/**
* @return Boolean
*/
protected function getDidRun() {
public function getDidRun() {
return $this->didRun;
}
/**
* @param Boolean $newDidRun
* @return void
*/
protected function setDidRun($newDidRun) {
$this->didRun = $newDidRun;
}
/**
* Indicates whether all targets in the service are active (as determined
* by the pazpar2-access.php proxy service).
*
* @var Boolean|Null
*/
protected $allTargetsActive;
/**
* @return Boolean|Null
*/
......@@ -239,19 +279,12 @@ class Query extends AbstractEntity {
/**
* @param Boolean $newAllTargetsActive
* @return void
*/
protected function setAllTargetsActive($newAllTargetsActive) {
$this->allTargetsActive = $newAllTargetsActive;
}
/**
* URL of the pazpar2 service used.
*
* @var string|Null
*/
protected $pazpar2BaseURL;
/**
* Return URL of pazpar2 service.
* If it is not set, return default URL on localhost.
......@@ -276,16 +309,6 @@ class Query extends AbstractEntity {
$this->pazpar2BaseURL = $newPazpar2BaseURL;
}
/**
* Array holding the search results after they are downloaded.
* The array's element can be displayed by the View Helper class
* Tx_Pazpar2_ViewHelpers_ResultViewHelper.
*
* @var array
*/
private $results = array();
/**
* @return array
*/
......@@ -293,14 +316,6 @@ class Query extends AbstractEntity {
return $this->results;
}
/**
* The total number of results (including the ones that could not be fetched.
*
* @var integer
*/
private $totalResultCount;
/**
* @return integer
*/
......@@ -315,25 +330,6 @@ class Query extends AbstractEntity {
$this->totalResultCount = $newTotalResultCount;
}
/**
* VARIABLES FOR INTERNAL USE
*/
/**
* Stores state of query.
* @var Boolean
*/
protected $queryIsRunning;
/**
* Stores time the current query was started.
* @var int
*/
protected $queryStartTime;
/**
* Creates pazpar2 search string for the given index name and query term.
* Adds an 'indexName=' after and/not/or to allow logical operations in
......@@ -352,7 +348,6 @@ class Query extends AbstractEntity {
return $search;
}
/**
* Returns the full query string to send to pazpar2.
*
......@@ -396,7 +391,6 @@ class Query extends AbstractEntity {
return $query;
}
/**
* Returns URL to initialise pazpar2.
* If $serviceName has been set up, that service is used.
......@@ -412,7 +406,6 @@ class Query extends AbstractEntity {
return $URL;
}
/**
* Returns URL for pazpar2 search command.
*
......@@ -425,7 +418,6 @@ class Query extends AbstractEntity {
return $URL;
}
/**
* Returns URL for pazpar2 status command.
*
......@@ -435,7 +427,6 @@ class Query extends AbstractEntity {
return $this->getPazpar2BaseURL() . '?command=stat';
}
/**
* Returns URL for downloading pazpar2 results.
* The parameters can be used to give the the start record
......@@ -457,7 +448,6 @@ class Query extends AbstractEntity {
return $URL;
}
/**
* Returns a string encoding the sort order formatted for use by pazpar2.
*
......@@ -474,7 +464,6 @@ class Query extends AbstractEntity {
return $sortOrderString;
}
/**
* Returns the content loaded from the given URL.
*
......@@ -485,7 +474,6 @@ class Query extends AbstractEntity {
return GeneralUtility::getURL($URL);
}
/**
* Initialise pazpar2/Service Proxy.
* To be implemented in subclasses.
......@@ -496,7 +484,6 @@ class Query extends AbstractEntity {
return FALSE;
}
/**
* Start a pazpar2 Query.
* Requires $pazpar2SessionID to be set.
......@@ -520,7 +507,6 @@ class Query extends AbstractEntity {
}
}
/**
* Checks whether the query is done.
* Requires a session to be established.
......@@ -552,13 +538,12 @@ class Query extends AbstractEntity {
return $result;
}
/**
* Attempts to extract dates from $record and returns an array
* containing numbers from the 'date' fields as integers.
*
* @param Array $record location or full pazpar2 record
* @return Array of integers
* @param array $record location or full pazpar2 record
* @return array of integers
*/
protected function extractNewestDates($record) {
$result = Array();
......@@ -577,14 +562,13 @@ class Query extends AbstractEntity {
return $result;
}
/**
* Auxiliary sort function for sorting records and locations based
* on their 'date' field with the newest item being first and undefined
* dates last.
*
* @param Array $a location or full pazpar2 record
* @param Array $b location or full pazpar2 record
* @param array $a location or full pazpar2 record
* @param array $b location or full pazpar2 record
* @return integer
*/
protected function yearSort($a, $b) {
......@@ -602,7 +586,6 @@ class Query extends AbstractEntity {
}
}
/**
* Fetches results from pazpar2.
* Requires an established session.
......@@ -668,7 +651,6 @@ class Query extends AbstractEntity {
}
}
/**
* Public function to run the pazpar2 query.
* If the query string is empty, don’t do anything.
......
......@@ -21,7 +21,7 @@ $EM_CONF[$_EXTKEY] = array(
'author_company' => 'Göttingen State and University Library, Germany http://www.sub.uni-goettingen.de',
'constraints' => array(
'depends' => array(
'typo3' => '6.2.0-7.99.99',
'typo3' => '6.2.0-8.4.1',
),
'conflicts' => array(
),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment