00001 <?php
00002
00017 import('classes.signoff.SignoffDAO');
00018
00019 class MonographFileSignoffDAO extends SignoffDAO {
00023 function MonographFileSignoffDAO() {
00024 parent::SignoffDAO();
00025 }
00026
00027
00028
00029
00030
00034 function &getById($signoffId) {
00035 $returner =& parent::getById($signoffId, ASSOC_TYPE_MONOGRAPH_FILE);
00036 return $returner;
00037 }
00038
00050 function &build($symbolic, $monographFileId, $userId = null,
00051 $userGroupId = null, $fileId = null, $fileRevision = null) {
00052 $returner =& parent::build(
00053 $symbolic,
00054 ASSOC_TYPE_MONOGRAPH_FILE, $monographFileId,
00055 $userId, $userGroupId,
00056 $fileId, $fileRevision
00057 );
00058 return $returner;
00059 }
00060
00069 function signoffExists($symbolic, $monographFileId, $userId = null, $userGroupId = null) {
00070 return parent::signoffExists($symbolic, ASSOC_TYPE_MONOGRAPH_FILE, $userId, $userGroupId);
00071 }
00072
00076 function newDataObject() {
00077 $signoff = parent::newDataObject();
00078 $signoff->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
00079 return $signoff;
00080 }
00081
00094 function &getBySymbolic($symbolic, $monographFileId, $userId = null,
00095 $userGroupId = null, $fileId = null, $fileRevision = null) {
00096 $returner = parent::getBySymbolic(
00097 $symbolic,
00098 ASSOC_TYPE_MONOGRAPH_FILE, $monographFileId,
00099 $userId, $userGroupId,
00100 $fileId, $fileRevision
00101 );
00102 return $returner;
00103 }
00104
00114 function getAllBySymbolic($symbolic, $monographFileId = null, $userId = null, $userGroupId = null) {
00115 return parent::getAllBySymbolic($symbolic, ASSOC_TYPE_MONOGRAPH_FILE, $monographFileId, $userId, $userGroupId);
00116 }
00117
00127 function getAllByMonograph($monographId, $symbolic = null, $userId = null, $userGroupId = null, $notCompletedOnly = false) {
00128 $sql = 'SELECT s.* FROM signoffs s, monograph_files mf WHERE s.assoc_type = ? AND s.assoc_id = mf.file_id AND mf.monograph_id = ?';
00129 $params = array(ASSOC_TYPE_MONOGRAPH_FILE, (int) $monographId);
00130
00131 if ($symbolic) {
00132 $sql .= ' AND s.symbolic = ?';
00133 $params[] = $symbolic;
00134 }
00135 if ($userId) {
00136 $sql .= ' AND user_id = ?';
00137 $params[] = (int) $userId;
00138 }
00139
00140 if ($userGroupId) {
00141 $sql .= ' AND user_group_id = ?';
00142 $params[] = (int) $userGroupId;
00143 }
00144
00145 if ($notCompletedOnly) {
00146 $sql .= ' AND date_completed IS NULL';
00147 }
00148
00149 $result =& $this->retrieve($sql, $params);
00150
00151 $returner = new DAOResultFactory($result, $this, '_fromRow', array('id'));
00152 return $returner;
00153 }
00154 }
00155
00156 ?>