Open Journal Systems  2.4.4
 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)
 
 flagReminded ($subscriptionId, $reminderType)
 
 getInsertSubscriptionId ()
 
 getStatusCount ($status)
 
getStatusOptions ()
 
getSubscription ($subscriptionId)
 
 getSubscriptionJournalId ($subscriptionId)
 
getSubscriptions ($rangeInfo=null)
 
getSubscriptionsByJournalId ($journalId, $status=null, $searchField=null, $searchMatch=null, $search=null, $dateField=null, $dateFrom=null, $dateTo=null, $rangeInfo=null)
 
getSubscriptionsToRemind ($dateEnd, $journalId, $reminderType, $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 28 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 276 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 254 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 387 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 460 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 362 of file SubscriptionDAO.inc.php.

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

SubscriptionDAO::_updateSubscription ( $subscription)

Internal function to update a Subscription.

Parameters
$subscriptionSubscription
Returns
boolean

Definition at line 419 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 352 of file SubscriptionDAO.inc.php.

Referenced by _returnSubscriptionFromRow().

SubscriptionDAO::deleteSubscriptionById (   $subscriptionId)

Delete subscription by subscription ID.

Parameters
$subscriptionIdint
Returns
boolean

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

SubscriptionDAO::deleteSubscriptionsByJournal (   $journalId)

Delete subscriptions by journal ID.

Parameters
$journalIdint
Returns
boolean

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

SubscriptionDAO::deleteSubscriptionsByTypeId (   $subscriptionTypeId)

Delete all subscriptions by subscription type ID.

Parameters
$subscriptionTypeIdint
Returns
boolean

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

SubscriptionDAO::deleteSubscriptionsByUserId (   $userId)

Delete subscriptions by user ID.

Parameters
$userIdint
Returns
boolean

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

SubscriptionDAO::flagReminded (   $subscriptionId,
  $reminderType 
)

Flag a subscription reminder as having been sent.

Parameters
$subscriptionIdint
$reminderTypeint SUBSCRIPTION_REMINDER_FIELD_..._EXPIRY

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

References DAO\datetimeToDB(), Core\getCurrentDate(), and DAO\update().

SubscriptionDAO::getInsertSubscriptionId ( )

Function to get the ID of the last inserted subscription.

Returns
int

Definition at line 147 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 96 of file SubscriptionDAO.inc.php.

& SubscriptionDAO::getStatusOptions ( )

Retrieve subscription status options as associative array.

Returns
array

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

& SubscriptionDAO::getSubscription (   $subscriptionId)

Retrieve subscription by subscription ID.

Parameters
$subscriptionIdint
Returns
Subscription

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

SubscriptionDAO::getSubscriptionJournalId (   $subscriptionId)

Retrieve subscription journal ID by subscription ID.

Parameters
$subscriptionIdint
Returns
int

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

References DAO\retrieve().

& SubscriptionDAO::getSubscriptions (   $rangeInfo = null)

Retrieve all subscriptions.

Returns
object DAOResultFactory containing Subscriptions

Definition at line 205 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 222 of file SubscriptionDAO.inc.php.

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

Retrieve subscriptions matching a particular end date and journal ID.

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

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

SubscriptionDAO::insertSubscription ( $subscription)

Insert a new subscription.

Parameters
$subscriptionSubscription
Returns
int

Definition at line 138 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 245 of file SubscriptionDAO.inc.php.

SubscriptionDAO::subscriptionExists (   $subscriptionId)

Check if subscription exists for a given subscriptionId.

Parameters
$subscriptionIdint
Returns
boolean

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

SubscriptionDAO::subscriptionExistsByUser (   $subscriptionId,
  $userId 
)

Check if subscription exists given a user.

Parameters
$subscriptionIdint
$userIdint
Returns
boolean

Definition at line 117 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 128 of file SubscriptionDAO.inc.php.

SubscriptionDAO::updateSubscription ( $subscription)

Update existing subscription.

Parameters
$subscriptionSubscription
Returns
boolean

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

Referenced by _renewSubscription().


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