classes/paper/PublishedPaperDAO.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 //$Id$
00017 
00018 import('paper.PublishedPaper');
00019 
00020 define('PAPER_SORT_ORDER_NATURAL', 0);
00021 define('PAPER_SORT_ORDER_TIME', 1);
00022 
00023 class PublishedPaperDAO extends DAO {
00024    var $paperDao;
00025    var $authorDao;
00026    var $galleyDao;
00027    var $suppFileDao;
00028 
00032    function PublishedPaperDAO() {
00033       parent::DAO();
00034       $this->paperDao =& DAORegistry::getDAO('PaperDAO');
00035       $this->authorDao =& DAORegistry::getDAO('AuthorDAO');
00036       $this->galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
00037       $this->suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
00038    }
00039 
00046    function &getPublishedPapers($schedConfId, $sortOrder = PAPER_SORT_ORDER_NATURAL) {
00047       $primaryLocale = AppLocale::getPrimaryLocale();
00048       $locale = AppLocale::getLocale();
00049 
00050       $params = array(
00051          'title',
00052          $primaryLocale,
00053          'title',
00054          $locale,
00055          'abbrev',
00056          $primaryLocale,
00057          'abbrev',
00058          $locale,
00059          $schedConfId
00060       );
00061 
00062       $publishedPapers = array();
00063 
00064       $sql = 'SELECT pp.*,
00065             p.*,
00066             COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
00067             COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev,
00068             t.seq AS track_seq, pp.seq
00069          FROM  published_papers pp,
00070             papers p
00071             LEFT JOIN tracks t ON t.track_id = p.track_id
00072             LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
00073             LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
00074             LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
00075             LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
00076          WHERE pp.paper_id = p.paper_id
00077             AND pp.sched_conf_id = ?
00078             AND p.status = ' . STATUS_PUBLISHED;
00079 
00080       switch ($sortOrder) {
00081          case PAPER_SORT_ORDER_TIME:
00082             $sql .= ' ORDER BY p.start_time ASC, p.end_time ASC';
00083             break;
00084          case PAPER_SORT_ORDER_NATURAL:
00085          default:
00086             $sql .= ' ORDER BY track_seq ASC, pp.seq ASC';
00087             break;
00088       }
00089 
00090       $result =& $this->retrieve($sql, $params);
00091       $returner = new DAOResultFactory($result, $this, '_returnPublishedPaperFromRow');
00092       return $returner;
00093    }
00094 
00098    function getPublishedPaperCountBySchedConfId($schedConfId) {
00099       $result =& $this->retrieve(
00100          'SELECT count(*) FROM published_papers pa, papers a WHERE pa.paper_id = a.paper_id AND a.sched_conf_id = ? AND a.status = ' . STATUS_PUBLISHED,
00101          $schedConfId
00102       );
00103       list($count) = $result->fields;
00104       $result->Close();
00105       return $count;
00106    }
00107 
00113    function &getPublishedPapersBySchedConfId($schedConfId, $rangeInfo = null) {
00114       $primaryLocale = AppLocale::getPrimaryLocale();
00115       $locale = AppLocale::getLocale();
00116 
00117       $result =& $this->retrieveRange(
00118          'SELECT pp.*,
00119             p.*,
00120             COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
00121             COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev
00122          FROM published_papers pp,
00123             papers p
00124             LEFT JOIN tracks t ON t.track_id = p.track_id
00125             LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
00126             LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
00127             LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
00128             LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
00129          WHERE pp.paper_id = p.paper_id
00130             AND p.sched_conf_id = ?
00131             AND p.status = ' . STATUS_PUBLISHED,
00132          array(
00133             'title',
00134             $primaryLocale,
00135             'title',
00136             $locale,
00137             'abbrev',
00138             $primaryLocale,
00139             'abbrev',
00140             $locale,
00141             $schedConfId
00142          ),
00143          $rangeInfo
00144       );
00145 
00146       $returner = new DAOResultFactory($result, $this, '_returnPublishedPaperFromRow');
00147       return $returner;
00148    }
00149 
00160    function &getPublishedPapersInTracks($schedConfId, $trackId = null, $searchField = null, $searchMatch = null, $search = null, $previewAbstracts = false) {
00161       $primaryLocale = AppLocale::getPrimaryLocale();
00162       $locale = AppLocale::getLocale();
00163 
00164       $publishedPapers = array();
00165 
00166       $params = array(
00167          'title', // Paper title
00168          $primaryLocale,
00169          'title', // Paper title
00170          $locale,
00171          'title', // Track title
00172          $primaryLocale,
00173          'title', // Track title
00174          $locale,
00175          'abbrev',
00176          $primaryLocale,
00177          'abbrev',
00178          $locale,
00179          $schedConfId
00180       );
00181 
00182       if ($trackId) $params[] = $trackId;
00183       $searchSql = '';
00184       if (!empty($search)) switch ($searchField) {
00185          case SUBMISSION_FIELD_TITLE:
00186             if ($searchMatch === 'is') {
00187                $searchSql = ' AND LOWER(COALESCE(ptl.setting_value, ptpl.setting_value)) = LOWER(?)';
00188             } else {
00189                $searchSql = ' AND LOWER(COALESCE(ptl.setting_value, ptpl.setting_value)) LIKE LOWER(?)';
00190                $search = '%' . $search . '%';
00191             }
00192             $params[] = $search;
00193             break;
00194          case SUBMISSION_FIELD_AUTHOR:
00195             $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
00196             $searchSql = $directorSubmissionDao->_generateUserNameSearchSQL($search, $searchMatch, 'pp.', $params);
00197             break;
00198       }
00199 
00200       $result =& $this->retrieve(
00201          'SELECT DISTINCT
00202             pa.*,
00203             p.*,
00204             COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
00205             COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev,
00206             t.seq AS track_seq,
00207             pa.seq
00208          FROM  paper_authors pp,
00209             papers p
00210             LEFT JOIN published_papers pa ON (p.paper_id = pa.paper_id)
00211             LEFT JOIN paper_settings ptl ON (p.paper_id = ptl.paper_id AND ptl.setting_name = ? AND ptl.locale = ?)
00212             LEFT JOIN paper_settings ptpl ON (p.paper_id = ptpl.paper_id AND ptpl.setting_name = ? AND ptpl.locale = ?)
00213             LEFT JOIN tracks t ON t.track_id = p.track_id
00214             LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
00215             LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
00216             LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
00217             LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
00218          WHERE p.sched_conf_id = ?
00219             AND (
00220                (p.status = ' . STATUS_PUBLISHED . ' AND pa.paper_id IS NOT NULL)' .
00221                ($previewAbstracts ? 'OR (p.review_mode <> ' . REVIEW_MODE_BOTH_SIMULTANEOUS . ' AND p.status = ' . STATUS_QUEUED . ' AND p.current_stage = ' . REVIEW_STAGE_PRESENTATION . ')':'') . '
00222             )
00223             AND pp.paper_id = p.paper_id
00224             ' . ($trackId?'AND p.track_id = ?' : ''). '
00225             ' . $searchSql . '
00226          ORDER BY track_seq ASC, pa.seq ASC', $params
00227       );
00228 
00229       $currTrackId = 0;
00230       while (!$result->EOF) {
00231          $row =& $result->GetRowAssoc(false);
00232          $publishedPaper =& $this->_returnPublishedPaperFromRow($row);
00233          if ($publishedPaper->getTrackId() != $currTrackId) {
00234             $currTrackId = $publishedPaper->getTrackId();
00235             $publishedPapers[$currTrackId] = array(
00236                'papers'=> array(),
00237                'title' => ''
00238             );
00239             $publishedPapers[$currTrackId]['title'] = $publishedPaper->getTrackTitle();
00240          }
00241          $publishedPapers[$currTrackId]['papers'][] = $publishedPaper;
00242          $result->moveNext();
00243       }
00244 
00245       $result->Close();
00246       unset($result);
00247 
00248       return $publishedPapers;
00249    }
00250 
00256    function &getPublishedPapersByTrackId($trackId, $schedConfId) {
00257       $primaryLocale = AppLocale::getPrimaryLocale();
00258       $locale = AppLocale::getLocale();
00259 
00260       $publishedPapers = array();
00261 
00262       $result =& $this->retrieve(
00263          'SELECT pa.*,
00264             a.*,
00265             COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
00266             COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev
00267          FROM published_papers pa,
00268             papers a,
00269             tracks t
00270             LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
00271             LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
00272             LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
00273             LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
00274          WHERE a.track_id = t.track_id
00275             AND pa.paper_id = a.paper_id
00276             AND a.track_id = ?
00277             AND pa.sched_conf_id = ?
00278             AND a.status = ' . STATUS_PUBLISHED . '
00279          ORDER BY pa.seq ASC', array(
00280             'title',
00281             $primaryLocale,
00282             'title',
00283             $locale,
00284             'abbrev',
00285             $primaryLocale,
00286             'abbrev',
00287             $locale,
00288             $trackId,
00289             $schedConfId
00290          )
00291       );
00292 
00293       $currTrackId = 0;
00294       while (!$result->EOF) {
00295          $publishedPaper =& $this->_returnPublishedPaperFromRow($result->GetRowAssoc(false));
00296          $publishedPapers[] = $publishedPaper;
00297          $result->moveNext();
00298       }
00299 
00300       $result->Close();
00301       unset($result);
00302 
00303       return $publishedPapers;
00304    }
00305 
00311    function &getPublishedPaperById($pubId) {
00312       $result =& $this->retrieve(
00313          'SELECT * FROM published_papers WHERE pub_id = ?', $pubId
00314       );
00315       $row = $result->GetRowAssoc(false);
00316 
00317       $publishedPaper = new PublishedPaper();
00318       $publishedPaper->setPubId($row['pub_id']);
00319       $publishedPaper->setId($row['paper_id']);
00320       $publishedPaper->setSchedConfId($row['sched_conf_id']);
00321       $publishedPaper->setDatePublished($this->datetimeFromDB($row['date_published']));
00322       $publishedPaper->setSeq($row['seq']);
00323       $publishedPaper->setViews($row['views']);
00324       $publishedPaper->setRoomId($row['room_id']);
00325 
00326       $publishedPaper->setSuppFiles($this->suppFileDao->getSuppFilesByPaper($row['paper_id']));
00327 
00328       $result->Close();
00329       unset($result);
00330 
00331       return $publishedPaper;
00332    }
00333 
00341    function &getPublishedPaperByPaperId($paperId, $schedConfId = null, $previewAbstracts = null) {
00342       $primaryLocale = AppLocale::getPrimaryLocale();
00343       $locale = AppLocale::getLocale();
00344       $params = array(
00345          'title',
00346          $primaryLocale,
00347          'title',
00348          $locale,
00349          'abbrev',
00350          $primaryLocale,
00351          'abbrev',
00352          $locale,
00353          $paperId
00354       );
00355       if ($schedConfId) $params[] = $schedConfId;
00356 
00357       $result =& $this->retrieve(
00358          'SELECT pa.*,
00359             a.*,
00360             COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
00361             COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev
00362          FROM  papers a
00363             LEFT JOIN published_papers pa ON (pa.paper_id = a.paper_id)
00364             LEFT JOIN tracks t ON t.track_id = a.track_id
00365             LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
00366             LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
00367             LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
00368             LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
00369          WHERE a.paper_id = ?' .
00370             (isset($schedConfId)?' AND a.sched_conf_id = ?':'') .
00371             ($previewAbstracts!==true?' AND pa.paper_id IS NOT NULL':'') .
00372             ($previewAbstracts===true?' AND (a.status = ' . STATUS_PUBLISHED . ' OR (a.review_mode <> ' . REVIEW_MODE_BOTH_SIMULTANEOUS . ' AND a.status = ' . STATUS_QUEUED . ' AND a.current_stage = ' . REVIEW_STAGE_PRESENTATION . '))':'') .
00373             ($previewAbstracts===false?' AND a.status = ' . STATUS_PUBLISHED:''),
00374          $params
00375       );
00376 
00377       $publishedPaper = null;
00378       if ($result->RecordCount() != 0) {
00379          $publishedPaper =& $this->_returnPublishedPaperFromRow($result->GetRowAssoc(false));
00380       }
00381 
00382       $result->Close();
00383       unset($result);
00384 
00385       return $publishedPaper;
00386    }
00387 
00394    function &getPublishedPaperByPublicPaperId($schedConfId, $publicPaperId) {
00395       $primaryLocale = AppLocale::getPrimaryLocale();
00396       $locale = AppLocale::getLocale();
00397 
00398       $result =& $this->retrieve(
00399          'SELECT  pa.*,
00400             a.*,
00401             COALESCE(ttl.setting_value, ttpl.setting_value) AS track_title,
00402             COALESCE(tal.setting_value, tapl.setting_value) AS track_abbrev
00403          FROM  published_papers pa,
00404             papers a
00405             LEFT JOIN tracks t ON t.track_id = a.track_id
00406             LEFT JOIN track_settings ttpl ON (t.track_id = ttpl.track_id AND ttpl.setting_name = ? AND ttpl.locale = ?)
00407             LEFT JOIN track_settings ttl ON (t.track_id = ttl.track_id AND ttl.setting_name = ? AND ttl.locale = ?)
00408             LEFT JOIN track_settings tapl ON (t.track_id = tapl.track_id AND tapl.setting_name = ? AND tapl.locale = ?)
00409             LEFT JOIN track_settings tal ON (t.track_id = tal.track_id AND tal.setting_name = ? AND tal.locale = ?)
00410          WHERE pa.paper_id = a.paper_id
00411             AND pa.public_paper_id = ?
00412             AND a.sched_conf_id = ?',
00413          array(
00414             'title',
00415             $primaryLocale,
00416             'title',
00417             $locale,
00418             'abbrev',
00419             $primaryLocale,
00420             'abbrev',
00421             $locale,
00422             $publicPaperId,
00423             $schedConfId
00424          )
00425       );
00426 
00427       $publishedPaper = null;
00428       if ($result->RecordCount() != 0) {
00429          $publishedPaper =& $this->_returnPublishedPaperFromRow($result->GetRowAssoc(false));
00430       }
00431 
00432       $result->Close();
00433       unset($result);
00434 
00435       return $publishedPaper;
00436    }
00437 
00446    function &getPublishedPaperByBestPaperId($schedConfId, $paperId, $previewAbstracts = null) {
00447       $paper =& $this->getPublishedPaperByPublicPaperId($schedConfId, $paperId);
00448       if (!isset($paper)) $paper =& $this->getPublishedPaperByPaperId((int) $paperId, $schedConfId, $previewAbstracts);
00449       return $paper;
00450    }
00451 
00460    function &getPublishedPaperIdsAlphabetizedByTitle($conferenceId = null, $schedConfId = null, $rangeInfo = null) {
00461       $params = array(
00462          'cleanTitle',
00463          AppLocale::getLocale(),
00464          'cleanTitle',
00465          AppLocale::getPrimaryLocale()
00466       );
00467       if ($conferenceId) $params[] = $conferenceId;
00468       if ($schedConfId) $params[] = $schedConfId;
00469 
00470       $paperIds = array();
00471 
00472       $result =& $this->retrieveCached(
00473          'SELECT  p.paper_id,
00474             COALESCE(ptl.setting_value, ptpl.setting_value) AS paper_title
00475          FROM  published_papers pp,
00476             papers p
00477             ' . ($conferenceId?'LEFT JOIN sched_confs sc ON sc.sched_conf_id = p.sched_conf_id':'') . '
00478             LEFT JOIN paper_settings ptl ON (ptl.setting_name = ? AND ptl.paper_id = p.paper_id AND ptl.locale = ?)
00479             LEFT JOIN paper_settings ptpl ON (ptpl.setting_name = ? AND ptpl.paper_id = p.paper_id AND ptpl.locale = ?)
00480          WHERE pp.paper_id = p.paper_id AND
00481             p.status = ' . STATUS_PUBLISHED . '
00482             ' . ($schedConfId?'AND p.sched_conf_id = ?':'') . '
00483             ' . ($conferenceId?'AND sc.conference_id = ?':'') . '
00484          ORDER BY paper_title',
00485          $params
00486       );
00487 
00488       while (!$result->EOF) {
00489          $row = $result->getRowAssoc(false);
00490          $paperIds[] = $row['paper_id'];
00491          $result->MoveNext();
00492       }
00493 
00494       $result->Close();
00495       unset($result);
00496 
00497       return $paperIds;
00498    }
00499 
00508    function &getPublishedPaperIdsAlphabetizedBySchedConf($conferenceId = null, $schedConfId = null, $rangeInfo = null) {
00509       $params = array();
00510       if ($conferenceId) $params[] = $conferenceId;
00511       if ($schedConfId) $params[] = $schedConfId;
00512 
00513       $paperIds = array();
00514 
00515       $result =& $this->retrieveCached(
00516          'SELECT  p.paper_id AS pub_id
00517          FROM  published_papers pa,
00518             papers p
00519             ' . ($conferenceId?'LEFT JOIN sched_confs e ON e.sched_conf_id = p.sched_conf_id':'') . '
00520          WHERE pa.paper_id = p.paper_id
00521             AND p.status = ' . STATUS_PUBLISHED .
00522             ($conferenceId?' AND e.conference_id = ?':'') .
00523             ($schedConfId?' AND p.sched_conf_id = ?':'') .
00524          ' ORDER BY p.sched_conf_id',
00525          $params
00526       );
00527 
00528       while (!$result->EOF) {
00529          $row = $result->getRowAssoc(false);
00530          $paperIds[] = $row['pub_id'];
00531          $result->moveNext();
00532       }
00533 
00534       $result->Close();
00535       unset($result);
00536 
00537       return $paperIds;
00538    }
00539 
00545    function &_returnPublishedPaperFromRow($row) {
00546       $publishedPaper = new PublishedPaper();
00547       $publishedPaper->setPubId($row['pub_id']);
00548       $publishedPaper->setSchedConfId($row['sched_conf_id']);
00549       $publishedPaper->setDatePublished($this->datetimeFromDB($row['date_published']));
00550       $publishedPaper->setSeq($row['seq']);
00551       $publishedPaper->setViews($row['views']);
00552       $publishedPaper->setPublicPaperId($row['public_paper_id']);
00553       $publishedPaper->setRoomId($row['room_id']);
00554 
00555       // Paper attributes
00556       $this->paperDao->_paperFromRow($publishedPaper, $row);
00557 
00558       $publishedPaper->setGalleys($this->galleyDao->getGalleysByPaper($row['paper_id']));
00559 
00560       $publishedPaper->setSuppFiles($this->suppFileDao->getSuppFilesByPaper($row['paper_id']));
00561 
00562       HookRegistry::call('PublishedPaperDAO::_returnPublishedPaperFromRow', array(&$publishedPaper, &$row));
00563 
00564       return $publishedPaper;
00565    }
00566 
00573    function insertPublishedPaper(&$publishedPaper) {
00574       $this->update(
00575          sprintf('INSERT INTO published_papers
00576             (paper_id, sched_conf_id, date_published, seq, public_paper_id, room_id)
00577             VALUES
00578             (?, ?, %s, ?, ?, ?)',
00579             $this->datetimeToDB($publishedPaper->getDatePublished())),
00580          array(
00581             $publishedPaper->getId(),
00582             $publishedPaper->getSchedConfId(),
00583             $publishedPaper->getSeq(),
00584             $publishedPaper->getPublicPaperId(),
00585             $publishedPaper->getRoomId()
00586          )
00587       );
00588 
00589       $publishedPaper->setPubId($this->getInsertPublishedPaperId());
00590       return $publishedPaper->getPubId();
00591    }
00592 
00597    function getInsertPublishedPaperId() {
00598       return $this->getInsertId('published_papers', 'pub_id');
00599    }
00600 
00605    function deletePublishedPaperById($pubId) {
00606       $this->update(
00607          'DELETE FROM published_papers WHERE pub_id = ?', $pubId
00608       );
00609    }
00610 
00616    function deletePublishedPaperByPaperId($paperId) {
00617       return $this->update(
00618          'DELETE FROM published_papers WHERE paper_id = ?', $paperId
00619       );
00620    }
00621 
00626    function deletePublishedPapersByTrackId($trackId) {
00627       $result =& $this->retrieve(
00628          'SELECT pa.paper_id AS paper_id FROM published_papers pa, papers a WHERE pa.paper_id = a.paper_id AND a.track_id = ?', $trackId
00629       );
00630 
00631       while (!$result->EOF) {
00632          $row = $result->GetRowAssoc(false);
00633          $this->update(
00634             'DELETE FROM published_papers WHERE paper_id = ?', $row['paper_id']
00635          );
00636       }
00637 
00638       $result->Close();
00639       unset($result);
00640    }
00641 
00646    function deletePublishedPapersBySchedConfId($schedConfId) {
00647       return $this->update(
00648          'DELETE FROM published_papers WHERE sched_conf_id = ?', $schedConfId
00649       );
00650    }
00651 
00656    function updatePublishedPaper($publishedPaper) {
00657       $this->update(
00658          sprintf('UPDATE published_papers
00659             SET
00660                paper_id = ?,
00661                sched_conf_id = ?,
00662                date_published = %s,
00663                seq = ?,
00664                public_paper_id = ?,
00665                room_id = ?
00666             WHERE pub_id = ?',
00667             $this->datetimeToDB($publishedPaper->getDatePublished())),
00668          array(
00669             $publishedPaper->getId(),
00670             $publishedPaper->getSchedConfId(),
00671             $publishedPaper->getSeq(),
00672             $publishedPaper->getPublicPaperId(),
00673             $publishedPaper->getRoomId(),
00674             $publishedPaper->getPubId()
00675          )
00676       );
00677    }
00678 
00685    function updatePublishedPaperField($pubId, $field, $value) {
00686       $this->update(
00687          "UPDATE published_papers SET $field = ? WHERE pub_id = ?", array($value, $pubId)
00688       );
00689    }
00690 
00694    function resequencePublishedPapers($trackId, $schedConfId) {
00695       $result =& $this->retrieve(
00696          'SELECT pa.pub_id FROM published_papers pa, papers a WHERE a.track_id = ? AND a.paper_id = pa.paper_id AND pa.sched_conf_id = ? ORDER BY pa.seq',
00697          array($trackId, $schedConfId)
00698       );
00699 
00700       for ($i=1; !$result->EOF; $i++) {
00701          list($pubId) = $result->fields;
00702          $this->update(
00703             'UPDATE published_papers SET seq = ? WHERE pub_id = ?',
00704             array($i, $pubId)
00705          );
00706 
00707          $result->moveNext();
00708       }
00709 
00710       $result->close();
00711       unset($result);
00712    }
00713 
00719    function getPublishedPaperAuthors($schedConfId) {
00720       $authors = array();
00721       $result =& $this->retrieve(
00722          'SELECT aa.* FROM paper_authors aa, published_papers pa WHERE aa.paper_id = pa.paper_id AND pa.sched_conf_id = ? ORDER BY pa.sched_conf_id', $schedConfId
00723       );
00724 
00725       while (!$result->EOF) {
00726          $row = $result->GetRowAssoc(false);
00727          $author = new Author();
00728          $author->setId($row['author_id']);
00729          $author->setPaperId($row['paper_id']);
00730          $author->setFirstName($row['first_name']);
00731          $author->setMiddleName($row['middle_name']);
00732          $author->setLastName($row['last_name']);
00733          $author->setAffiliation($row['affiliation']);
00734          $author->setEmail($row['email']);
00735          $author->setBiography($row['biography']);
00736          $author->setPrimaryContact($row['primary_contact']);
00737          $author->setSequence($row['seq']);
00738          $authors[] = $author;
00739          $result->moveNext();
00740       }
00741 
00742       $result->Close();
00743       unset($result);
00744 
00745       return $authors;
00746    }
00747 
00752    function incrementViewsByPaperId($paperId) {
00753       return $this->update(
00754          'UPDATE published_papers SET views = views + 1 WHERE paper_id = ?',
00755          $paperId
00756       );
00757    }
00758 
00766    function publicPaperIdExists($publicPaperId, $paperId, $schedConfId) {
00767       $result =& $this->retrieve(
00768          'SELECT COUNT(*) FROM published_papers pa, papers a WHERE pa.paper_id = a.paper_id AND a.sched_conf_id = ? AND pa.public_paper_id = ? AND pa.paper_id <> ?',
00769          array($schedConfId, $publicPaperId, $paperId)
00770       );
00771       $returner = $result->fields[0] ? true : false;
00772 
00773       $result->Close();
00774       unset($result);
00775 
00776       return $returner;
00777    }
00778    
00784    function getPaperYearRange($conferenceId = null) {
00785       $result =& $this->retrieve(
00786          'SELECT MAX(pp.date_published), MIN(pp.date_published) FROM published_papers pp, papers p, sched_confs sc WHERE pp.paper_id = p.paper_id AND pp.sched_conf_id = sc.sched_conf_id ' . (isset($conferenceId)?' AND sc.conference_id = ?':''),
00787          isset($conferenceId)?$conferenceId:false
00788       );
00789       $returner = array($result->fields[0], $result->fields[1]);
00790 
00791       $result->Close();
00792       unset($result);
00793 
00794       return $returner;
00795    }
00796 }
00797 
00798 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7