Open Monograph Press  3.3.0
PressDAO.inc.php
1 <?php
16 import('classes.press.Press');
17 import('lib.pkp.classes.context.ContextDAO');
18 
19 class PressDAO extends ContextDAO {
21  var $schemaName = 'context';
22 
24  var $tableName = 'presses';
25 
27  var $settingsTableName = 'press_settings';
28 
30  var $primaryKeyColumn = 'press_id';
31 
33  var $primaryTableColumns = [
34  'id' => 'press_id',
35  'urlPath' => 'path',
36  'enabled' => 'enabled',
37  'seq' => 'seq',
38  'primaryLocale' => 'primary_locale',
39  ];
40 
45  function newDataObject() {
46  return new Press();
47  }
48 
56  function deleteAllPubIds($pressId, $pubIdType) {
57  $pubObjectDaos = array('PublicationDAO', 'ChapterDAO', 'PublicationFormatDAO');
58  foreach($pubObjectDaos as $daoName) {
59  $dao = DAORegistry::getDAO($daoName);
60  $dao->deleteAllPubIds($pressId, $pubIdType);
61  }
62  import('lib.pkp.classes.submission.SubmissionFileDAODelegate');
63  $submissionFileDaoDelegate = new SubmissionFileDAODelegate();
64  $submissionFileDaoDelegate->deleteAllPubIds($pressId, $pubIdType);
65  }
66 
67 
82  function anyPubIdExists($pressId, $pubIdType, $pubId,
83  $assocType = ASSOC_TYPE_ANY, $assocId = 0, $forSameType = false) {
84  $pubObjectDaos = array(
85  ASSOC_TYPE_SUBMISSION => DAORegistry::getDAO('SubmissionDAO'),
86  ASSOC_TYPE_CHAPTER => DAORegistry::getDAO('ChapterDAO'),
87  ASSOC_TYPE_REPRESENTATION => Application::getRepresentationDAO(),
88  ASSOC_TYPE_SUBMISSION_FILE => DAORegistry::getDAO('SubmissionFileDAO')
89  );
90  if ($forSameType) {
91  $dao = $pubObjectDaos[$assocType];
92  $excludedId = $assocId;
93  if ($dao->pubIdExists($pubIdType, $pubId, $excludedId, $pressId)) return true;
94  return false;
95  }
96  foreach($pubObjectDaos as $daoAssocType => $dao) {
97  if ($assocType == $daoAssocType) {
98  $excludedId = $assocId;
99  } else {
100  $excludedId = 0;
101  }
102  if ($dao->pubIdExists($pubIdType, $pubId, $excludedId, $pressId)) return true;
103  }
104  return false;
105  }
106 }
PressDAO\newDataObject
newDataObject()
Definition: PressDAO.inc.php:48
Application\getRepresentationDAO
static getRepresentationDAO()
Definition: Application.inc.php:160
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
PressDAO\$primaryTableColumns
$primaryTableColumns
Definition: PressDAO.inc.php:36
PressDAO\$schemaName
$schemaName
Definition: PressDAO.inc.php:21
PressDAO\$tableName
$tableName
Definition: PressDAO.inc.php:24
PressDAO
Operations for retrieving and modifying Press objects.
Definition: PressDAO.inc.php:19
PressDAO\anyPubIdExists
anyPubIdExists($pressId, $pubIdType, $pubId, $assocType=ASSOC_TYPE_ANY, $assocId=0, $forSameType=false)
Definition: PressDAO.inc.php:85
SubmissionFileDAODelegate
Abstract class to support DAO delegates that provide operations to retrieve and modify SubmissionFile...
Definition: SubmissionFileDAODelegate.inc.php:21
PressDAO\deleteAllPubIds
deleteAllPubIds($pressId, $pubIdType)
Definition: PressDAO.inc.php:59
ContextDAO
Operations for retrieving and modifying context objects.
Definition: ContextDAO.inc.php:18
PressDAO\$settingsTableName
$settingsTableName
Definition: PressDAO.inc.php:27
PressDAO\$primaryKeyColumn
$primaryKeyColumn
Definition: PressDAO.inc.php:30
Press
Basic class describing a press.
Definition: Press.inc.php:23