Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
SubscriptionDAO Class Reference
Inheritance diagram for SubscriptionDAO:
DAO IndividualSubscriptionDAO InstitutionalSubscriptionDAO

Public Member Functions

 _generateSearchSQL ($status=null, $searchField=null, $searchMatch=null, $search=null, $dateField=null, $dateFrom=null, $dateTo=null, &$params)
 
 _generateUserNameSearchSQL ($search, $searchMatch, $prefix, &$params)
 
 _insertSubscription (&$subscription)
 
 _renewSubscription (&$subscription)
 
_returnSubscriptionFromRow (&$row)
 
 _updateSubscription (&$subscription)
 
 createObject ()
 
 deleteSubscriptionById ($subscriptionId)
 
 deleteSubscriptionsByJournal ($journalId)
 
 deleteSubscriptionsByTypeId ($subscriptionTypeId)
 
 deleteSubscriptionsByUserId ($userId)
 
 getInsertSubscriptionId ()
 
 getStatusCount ($status)
 
getStatusOptions ()
 
getSubscription ($subscriptionId)
 
 getSubscriptionJournalId ($subscriptionId)
 
getSubscriptions ($rangeInfo=null)
 
getSubscriptionsByDateEnd ($dateEnd, $journalId, $rangeInfo=null)
 
getSubscriptionsByJournalId ($journalId, $status=null, $searchField=null, $searchMatch=null, $search=null, $dateField=null, $dateFrom=null, $dateTo=null, $rangeInfo=null)
 
 insertSubscription (&$subscription)
 
 renewSubscription (&$subscription)
 
 subscriptionExists ($subscriptionId)
 
 subscriptionExistsByUser ($subscriptionId, $userId)
 
 subscriptionExistsByUserForJournal ($userId, $journalId)
 
 updateSubscription (&$subscription)
 
- Public Member Functions inherited from DAO
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 DAO ($dataSource=null, $callHooks=true)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAffectedRows ()
 
 getDataChangedEvent ($elementId=null, $parentElementId=null)
 
getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getInsertId ($table= '', $id= '', $callHooks=true)
 
 getType ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource (&$dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, &$dataObject, $idArray)
 

Additional Inherited Members

- Public Attributes inherited from DAO
 $_dataSource
 

Detailed Description

Abstract class for retrieving and modifying subscriptions.

See Also
Subscription

Definition at line 25 of file SubscriptionDAO.inc.php.

Member Function Documentation

SubscriptionDAO::_generateSearchSQL (   $status = null,
  $searchField = null,
  $searchMatch = null,
  $search = null,
  $dateField = null,
  $dateFrom = null,
  $dateTo = null,
$params 
)

Internal function to generate subscription based search query.

Returns
string

Definition at line 256 of file SubscriptionDAO.inc.php.

References _generateUserNameSearchSQL(), and DAO\datetimeToDB().

Referenced by InstitutionalSubscriptionDAO\getSubscriptionsByJournalId().

SubscriptionDAO::_generateUserNameSearchSQL (   $search,
  $searchMatch,
  $prefix,
$params 
)

Internal function to generate user based search query.

Returns
string

Definition at line 234 of file SubscriptionDAO.inc.php.

References DAO\concat().

Referenced by _generateSearchSQL().

SubscriptionDAO::_insertSubscription ( $subscription)

Internal function to insert a new Subscription.

Parameters
$subscriptionSubscription
Returns
int

Definition at line 365 of file SubscriptionDAO.inc.php.

References DAO\datetimeToDB(), DAO\dateToDB(), getInsertSubscriptionId(), and DAO\update().

Referenced by IndividualSubscriptionDAO\insertSubscription(), and InstitutionalSubscriptionDAO\insertSubscription().

SubscriptionDAO::_renewSubscription ( $subscription)

Internal function to renew a subscription by dateEnd + duration of subscription type if the subscription is expired, renew to current date + duration

Parameters
$subscriptionSubscription
Returns
boolean

Definition at line 430 of file SubscriptionDAO.inc.php.

References DAORegistry\getDAO(), and updateSubscription().

Referenced by IndividualSubscriptionDAO\renewSubscription(), and InstitutionalSubscriptionDAO\renewSubscription().

& SubscriptionDAO::_returnSubscriptionFromRow ( $row)

Internal function to return a Subscription object from a row.

Parameters
$rowarray
Returns
Subscription

Definition at line 342 of file SubscriptionDAO.inc.php.

References HookRegistry\call(), createObject(), and DAO\dateFromDB().

SubscriptionDAO::_updateSubscription ( $subscription)

Internal function to update a Subscription.

Parameters
$subscriptionSubscription
Returns
boolean

Definition at line 394 of file SubscriptionDAO.inc.php.

References DAO\datetimeToDB(), DAO\dateToDB(), and DAO\update().

Referenced by IndividualSubscriptionDAO\updateSubscription(), and InstitutionalSubscriptionDAO\updateSubscription().

SubscriptionDAO::createObject ( )

Generator function to create object.

Returns
Subscription

Definition at line 332 of file SubscriptionDAO.inc.php.

Referenced by _returnSubscriptionFromRow().

SubscriptionDAO::deleteSubscriptionById (   $subscriptionId)

Delete subscription by subscription ID.

Parameters
$subscriptionIdint
Returns
boolean

Definition at line 147 of file SubscriptionDAO.inc.php.

SubscriptionDAO::deleteSubscriptionsByJournal (   $journalId)

Delete subscriptions by journal ID.

Parameters
$journalIdint
Returns
boolean

Definition at line 157 of file SubscriptionDAO.inc.php.

SubscriptionDAO::deleteSubscriptionsByTypeId (   $subscriptionTypeId)

Delete all subscriptions by subscription type ID.

Parameters
$subscriptionTypeIdint
Returns
boolean

Definition at line 177 of file SubscriptionDAO.inc.php.

SubscriptionDAO::deleteSubscriptionsByUserId (   $userId)

Delete subscriptions by user ID.

Parameters
$userIdint
Returns
boolean

Definition at line 167 of file SubscriptionDAO.inc.php.

SubscriptionDAO::getInsertSubscriptionId ( )

Function to get the ID of the last inserted subscription.

Returns
int

Definition at line 128 of file SubscriptionDAO.inc.php.

References DAO\getInsertId().

Referenced by _insertSubscription().

SubscriptionDAO::getStatusCount (   $status)

Return number of subscriptions with given status.

Parameters
statusint
Returns
int

Definition at line 77 of file SubscriptionDAO.inc.php.

& SubscriptionDAO::getStatusOptions ( )

Retrieve subscription status options as associative array.

Returns
array

Definition at line 59 of file SubscriptionDAO.inc.php.

& SubscriptionDAO::getSubscription (   $subscriptionId)

Retrieve subscription by subscription ID.

Parameters
$subscriptionIdint
Returns
Subscription

Definition at line 32 of file SubscriptionDAO.inc.php.

SubscriptionDAO::getSubscriptionJournalId (   $subscriptionId)

Retrieve subscription journal ID by subscription ID.

Parameters
$subscriptionIdint
Returns
int

Definition at line 42 of file SubscriptionDAO.inc.php.

References DAO\retrieve().

& SubscriptionDAO::getSubscriptions (   $rangeInfo = null)

Retrieve all subscriptions.

Returns
object DAOResultFactory containing Subscriptions

Definition at line 186 of file SubscriptionDAO.inc.php.

& SubscriptionDAO::getSubscriptionsByDateEnd (   $dateEnd,
  $journalId,
  $rangeInfo = null 
)

Retrieve subscriptions matching a particular end date and journal ID.

Parameters
$dateEnddate (YYYY-MM-DD)
$journalIdint
Returns
object DAOResultFactory containing matching Subscriptions

Definition at line 214 of file SubscriptionDAO.inc.php.

& SubscriptionDAO::getSubscriptionsByJournalId (   $journalId,
  $status = null,
  $searchField = null,
  $searchMatch = null,
  $search = null,
  $dateField = null,
  $dateFrom = null,
  $dateTo = null,
  $rangeInfo = null 
)

Retrieve subscriptions matching a particular journal ID.

Parameters
$journalIdint
$statusint
$searchFieldint
$searchMatchstring "is" or "contains" or "startsWith"
$searchString to look in $searchField for
$dateFieldint
$dateFromString date to search from
$dateToString date to search to
Returns
object DAOResultFactory containing matching Subscriptions

Definition at line 203 of file SubscriptionDAO.inc.php.

SubscriptionDAO::insertSubscription ( $subscription)

Insert a new subscription.

Parameters
$subscriptionSubscription
Returns
int

Definition at line 119 of file SubscriptionDAO.inc.php.

SubscriptionDAO::renewSubscription ( $subscription)

Function to renew a subscription by dateEnd + duration of subscription type if the subscription is expired, renew to current date + duration

Parameters
$subscriptionSubscription
Returns
boolean

Definition at line 225 of file SubscriptionDAO.inc.php.

SubscriptionDAO::subscriptionExists (   $subscriptionId)

Check if subscription exists for a given subscriptionId.

Parameters
$subscriptionIdint
Returns
boolean

Definition at line 87 of file SubscriptionDAO.inc.php.

SubscriptionDAO::subscriptionExistsByUser (   $subscriptionId,
  $userId 
)

Check if subscription exists given a user.

Parameters
$subscriptionIdint
$userIdint
Returns
boolean

Definition at line 98 of file SubscriptionDAO.inc.php.

SubscriptionDAO::subscriptionExistsByUserForJournal (   $userId,
  $journalId 
)

Check if subscription exists given a user and journal.

Parameters
$subscriptionIdint
$userIdint
Returns
boolean

Definition at line 109 of file SubscriptionDAO.inc.php.

SubscriptionDAO::updateSubscription ( $subscription)

Update existing subscription.

Parameters
$subscriptionSubscription
Returns
boolean

Definition at line 137 of file SubscriptionDAO.inc.php.

Referenced by _renewSubscription().


The documentation for this class was generated from the following file: