plugins/reports/papers/PaperReportDAO.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00017 // $Id$
00018 
00019 
00020 import('submission.common.Action');
00021 import('db.DBRowIterator');
00022 
00023 class PaperReportDAO extends DAO {
00030    function getPaperReport($conferenceId, $schedConfId) {
00031       $primaryLocale = AppLocale::getPrimaryLocale();
00032       $locale = AppLocale::getLocale();
00033 
00034       $result =& $this->retrieve(
00035          'SELECT  p.status AS status,
00036             p.start_time AS start_time,
00037             p.end_time AS end_time,
00038             pp.room_id AS room_id,
00039             p.paper_id AS paper_id,
00040             COALESCE(psl1.setting_value, pspl1.setting_value) AS title,
00041             COALESCE(psl2.setting_value, pspl2.setting_value) AS abstract,
00042             COALESCE(tl.setting_value, tpl.setting_value) AS track_title,
00043             p.language AS language
00044          FROM  papers p
00045             LEFT JOIN published_papers pp ON (p.paper_id = pp.paper_id)
00046             LEFT JOIN paper_settings pspl1 ON (pspl1.paper_id=p.paper_id AND pspl1.setting_name = ? AND pspl1.locale = ?)
00047             LEFT JOIN paper_settings psl1 ON (psl1.paper_id=p.paper_id AND psl1.setting_name = ? AND psl1.locale = ?)
00048             LEFT JOIN paper_settings pspl2 ON (pspl2.paper_id=p.paper_id AND pspl2.setting_name = ? AND pspl2.locale = ?)
00049             LEFT JOIN paper_settings psl2 ON (psl2.paper_id=p.paper_id AND psl2.setting_name = ? AND psl2.locale = ?)
00050             LEFT JOIN track_settings tpl ON (tpl.track_id=p.track_id AND tpl.setting_name = ? AND tpl.locale = ?)
00051             LEFT JOIN track_settings tl ON (tl.track_id=p.track_id AND tl.setting_name = ? AND tl.locale = ?)
00052          WHERE p.sched_conf_id = ?
00053          ORDER BY p.paper_id',
00054          array(
00055             'title',
00056             $primaryLocale,
00057             'title',
00058             $locale,
00059             'abstract',
00060             $primaryLocale,
00061             'abstract',
00062             $locale,
00063             'title',
00064             $primaryLocale,
00065             'title',
00066             $locale,
00067             $schedConfId
00068          )
00069       );
00070       $papersReturner = new DBRowIterator($result);
00071       unset($result);
00072 
00073       $result =& $this->retrieve(
00074          'SELECT  MAX(ed.date_decided) AS date,
00075             ed.paper_id AS paper_id
00076          FROM  edit_decisions ed,
00077             papers p
00078          WHERE p.sched_conf_id = ? AND
00079             p.paper_id = ed.paper_id
00080          GROUP BY p.paper_id, ed.paper_id',
00081          array($schedConfId)
00082       );
00083       $decisionDatesIterator = new DBRowIterator($result);
00084       unset($result);
00085 
00086       $decisionsReturner = array();
00087       while ($row =& $decisionDatesIterator->next()) {
00088          $result =& $this->retrieve(
00089             'SELECT  decision AS decision,
00090                paper_id AS paper_id
00091             FROM  edit_decisions
00092             WHERE date_decided = ? AND
00093                paper_id = ?',
00094             array(
00095                $row['date'],
00096                $row['paper_id']
00097             )
00098          );
00099          $decisionsReturner[] = new DBRowIterator($result);
00100          unset($result);
00101       }
00102 
00103       $paperDao =& DAORegistry::getDAO('PaperDAO');
00104       $papers =& $paperDao->getPapersBySchedConfId($schedConfId);
00105       $authorsReturner = array();
00106       $index = 1;
00107       while ($paper =& $papers->next()) {
00108          $result =& $this->retrieve(
00109             'SELECT  pa.first_name AS fname,
00110                pa.middle_name AS mname,
00111                pa.last_name AS lname,
00112                pa.email AS email,
00113                pa.affiliation AS affiliation,
00114                pa.country AS country,
00115                pa.url AS url,
00116                COALESCE(pasl.setting_value, pas.setting_value) AS biography
00117             FROM  paper_authors pa
00118                LEFT JOIN papers p ON pa.paper_id=p.paper_id
00119                LEFT JOIN paper_author_settings pas ON (pa.author_id=pas.author_id AND pas.setting_name = ? AND pas.locale = ?)
00120                LEFT JOIN paper_author_settings pasl ON (pa.author_id=pasl.author_id AND pasl.setting_name = ? AND pasl.locale = ?)
00121             WHERE p.sched_conf_id = ? AND
00122                p.paper_id = ?',
00123             array(
00124                'biography',
00125                $primaryLocale,
00126                'biography',
00127                $locale,
00128                $schedConfId,
00129                $paper->getId()
00130             )
00131          );
00132          $authorIterator = new DBRowIterator($result);
00133          unset($result);
00134          $authorsReturner[$paper->getId()] = $authorIterator;
00135          unset($authorIterator);
00136          $index++;
00137          unset($paper);
00138       }
00139 
00140       return array($papersReturner, $authorsReturner, $decisionsReturner);
00141    }
00142 }
00143 
00144 ?>

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