OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Printed Schedule

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Printed Schedule

Postby tshore » Wed Mar 24, 2010 9:51 pm

I would like to be able to export the schedule data somehow so that it could be included in the printed conference program. Any suggestions as to how I might go about this on my own? Any plans of including such functionality in a future release of OCS?
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby jmacgreg » Sun Apr 04, 2010 11:21 am

Hi Trudy,

Have you taken a look at the Papers report? It includes building, room and schedule information, along with the more typical paper data. (This may be new to OCS 2.3 -- I can't remember offhand.)

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

Re: Printed Schedule

Postby tshore » Sun Apr 04, 2010 11:52 pm

Thanks James. I'll take a look at it again once I have some schedule data to work with.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby tshore » Fri May 07, 2010 12:28 pm

One of my 2.3 conferences has just started scheduling presentations. Neither the room nor the start/end times are in the report.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby tshore » Mon May 10, 2010 6:50 am

Does anyone have a chance to look at this? My conference organizer needs to get their program to the printer ASAP, but they need to have rooms and times in the papers report.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby jmacgreg » Mon May 10, 2010 10:31 am

Hi Trudy,

The bug report where this functionality was added is here: http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=4774. This was definitely included in OCS 2.3, and it's working in my OCS 2.3.1. Can you double-check that the changes included in the patch are showing up in your files?

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

Re: Printed Schedule

Postby tshore » Mon May 10, 2010 11:05 am

These changes are present, but they are are not all in PaperReportPlugin.inc.php as it says. Instead some are now located in PaperReportDAO.inc.php. The headers are there in .CSV file, but not the data.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby jmacgreg » Mon May 10, 2010 3:58 pm

Hi Trudy,

Hrm. In investigating this, I came across a similar-but different problem in the way these files are represented in Excel. See http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=5422. But I'm guessing that's not your problem.

Otherwise, I'm still not able to replicate this. Can you double-check that the presentations have in fact been scheduled and have been added to the list of presentations, and that you aren't seeing any errors being reported in the server log? Also, you may want to try grabbing a more recent set of files from Github. If none of this turns up anything, I'll bump the thread up to a developer.

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

Re: Printed Schedule

Postby tshore » Mon May 10, 2010 5:51 pm

I've just taken a closer look at the file and the times are there, it's only the buildings and rooms that are missing. I will take a look at the files on Github, but I thought I would add this update, just in case it might help.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby tshore » Mon May 10, 2010 6:43 pm

Checked out the Github files. Didn't really seem to be anything that should make a difference. The only thing is that I've included user_id and session_type in my papers report. I've included the files so you can take a look (couldn't attach them), but I don't see how anything I've done would affect room_id and therefore, building and room.

Code: Select all
<?php

/**
 * @file PaperReportPlugin.inc.php
 *
 * Copyright (c) 2000-2009 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class PaperReportPlugin
 * @ingroup plugins_reports_paper
 * @see PaperReportDAO
 *
 * @brief Paper report plugin
 */

//$Id: PaperReportPlugin.inc.php,v 1.16 2010/01/14 00:13:47 asmecher Exp $

import('classes.plugins.ReportPlugin');

class PaperReportPlugin extends ReportPlugin {
   /**
    * Called as a plugin is registered to the registry
    * @param $category String Name of category plugin was registered to
    * @return boolean True if plugin initialized successfully; if false,
    *    the plugin will not be registered.
    */
   function register($category, $path) {
      $success = parent::register($category, $path);
      if ($success) {
         $this->import('PaperReportDAO');
         $paperReportDAO = new PaperReportDAO();
         DAORegistry::registerDAO('PaperReportDAO', $paperReportDAO);
      }
      $this->addLocaleData();
      return $success;
   }

   /**
    * Get the name of this plugin. The name must be unique within
    * its category.
    * @return String name of plugin
    */
   function getName() {
      return 'PaperReportPlugin';
   }

   function getDisplayName() {
      return Locale::translate('plugins.reports.papers.displayName');
   }

   function getDescription() {
      return Locale::translate('plugins.reports.papers.description');
   }

   function display(&$args) {
      $conference =& Request::getConference();
      $schedConf =& Request::getSchedConf();
      Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_OCS_MANAGER));

      header('content-type: text/comma-separated-values');
      header('content-disposition: attachment; filename=papers-' . date('Ymd') . '.csv');

      $paperReportDao =& DAORegistry::getDAO('PaperReportDAO');
      list($papersIterator, $authorsIterator, $decisionsIteratorsArray) = $paperReportDao->getPaperReport(
         $conference->getId(),
         $schedConf->getId()
      );
      $maxAuthors = $this->getMaxAuthorCount($authorsIterator);
      
      $decisions = array();
      foreach ($decisionsIteratorsArray as $decisionsIterator) {
         while ($row =& $decisionsIterator->next()) {
            $decisions[$row['paper_id']] = $row['decision'];
         }
      }

      Locale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR));
      import('classes.paper.Paper');
      $decisionMessages = array(
         SUBMISSION_DIRECTOR_DECISION_INVITE => Locale::translate('director.paper.decision.invitePresentation'),
         SUBMISSION_DIRECTOR_DECISION_ACCEPT => Locale::translate('director.paper.decision.accept'),
         SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS => Locale::translate('director.paper.decision.pendingRevisions'),
         SUBMISSION_DIRECTOR_DECISION_DECLINE => Locale::translate('director.paper.decision.decline'),
         null => Locale::translate('plugins.reports.papers.nodecision')
      );

      $columns = array(
         'paper_id' => Locale::translate('paper.submissionId'),
         'user_id' => 'user_id',
         'session_type' => Locale::translate('paper.sessionType'),
         'track_title' => Locale::translate('track.title'),
         'title' => Locale::translate('paper.title'),
         'abstract' => Locale::translate('paper.abstract'),
      );
      
      for ($a = 1; $a <= $maxAuthors; $a++) {
         $columns = array_merge($columns, array(
            'fname' . $a => Locale::translate('user.firstName') . " (" . Locale::translate('user.role.author') . " $a)",
            'mname' . $a => Locale::translate('user.middleName') . " (" . Locale::translate('user.role.author') . " $a)",
            'lname' . $a => Locale::translate('user.lastName') . " (" . Locale::translate('user.role.author') . " $a)",
            'country' . $a => Locale::translate('common.country') . " (" . Locale::translate('user.role.author') . " $a)",
            'affiliation' . $a => Locale::translate('user.affiliation') . " (" . Locale::translate('user.role.author') . " $a)",
            'email' . $a => Locale::translate('user.email') . " (" . Locale::translate('user.role.author') . " $a)",
            'url' . $a => Locale::translate('user.url') . " (" . Locale::translate('user.role.author') . " $a)",
            'biography' . $a => Locale::translate('user.biography') . " (" . Locale::translate('user.role.author') . " $a)"
         ));
      }
      
      $columns = array_merge($columns, array(
         'language' => Locale::translate('common.language'),
         'director_decision' => Locale::translate('submission.directorDecision'),
         'start_time' => Locale::translate('manager.scheduler.startTime'),
         'end_time' => Locale::translate('manager.scheduler.endTime'),
         'building' => Locale::translate('manager.scheduler.building'),
         'room' => Locale::translate('manager.scheduler.room'),
         'status' => Locale::translate('common.status')
      ));

      $fp = fopen('php://output', 'wt');
      String::fputcsv($fp, array_values($columns));

      import('paper.Paper'); // Bring in getStatusMap function
      $statusMap =& Paper::getStatusMap();

      $controlledVocabDao =& DAORegistry::getDAO('ControlledVocabDAO');
      $sessionTypes = $controlledVocabDao->enumerateBySymbolic('paperType', ASSOC_TYPE_SCHED_CONF, $schedConf->getSchedConfId());

      // Load building and room data
      $buildingDao =& DAORegistry::getDAO('BuildingDAO');
      $roomDao =& DAORegistry::getDAO('RoomDAO');

      $buildings = $rooms = array();
      $buildingsIterator =& $buildingDao->getBuildingsBySchedConfId($schedConf->getId());
      while ($building =& $buildingsIterator->next()) {
         $buildingId = $building->getId();
         $buildings[$buildingId] =& $building;
         $roomsIterator =& $roomDao->getRoomsByBuildingId($buildingId);
         while ($room =& $roomsIterator->next()) {
            $roomId = $room->getId();
            $rooms[$roomId] =& $room;
            unset($room);
         }
         unset($building);
         unset($roomsIterator);
      }
      unset($buildingsIterator);

      $authorIndex = 0;
      while ($row =& $papersIterator->next()) {
         if (isset($authorsIterator[$row['paper_id']])) {
            $authorIterator =& $authorsIterator[$row['paper_id']];
            $authors = $this->mergeAuthors($authorIterator->toArray());
         } else {
            // No authors for a submission.
            $authors = array();
         }
         unset($authorIterator);
         foreach ($columns as $index => $junk) {
            if ($index == 'director_decision') {
               if (isset($decisions[$row['paper_id']])) {
                  $columns[$index] = $decisionMessages[$decisions[$row['paper_id']]];
               } else {
                  $columns[$index] = $decisionMessages[null];
               }
            } elseif ($index == 'status') {
               $columns[$index] = Locale::translate($statusMap[$row[$index]]);
            } elseif ($index == 'abstract') {
               $columns[$index] = html_entity_decode(strip_tags($row[$index]));
            } elseif ($index == 'start_time' || $index == 'end_time') {
               $columns[$index] = $row[$index];
            } elseif ($index == 'building') {
               $columns['building'] = '';
               $room =& $rooms[$row['room_id']];
               if ($room) {
                  $building =& $buildings[$room->getBuildingId()];
                  if ($building) $columns[$index] = $building->getBuildingName();
               }
               unset($room, $building);
            } elseif ($index == 'room') {
               $columns['room'] = '';
               $room =& $rooms[$row['room_id']];
               if ($room) $columns[$index] = $room->getRoomName();
               unset($room);
            } elseif (strstr($index, 'biography') !== false) {
               // "Convert" HTML to text for export
               $columns[$index] = isset($authors[$index])?html_entity_decode(strip_tags($authors[$index])):'';
            } else {
               if (isset($row[$index])) {
                  $columns[$index] = $row[$index];
               } else if (isset($authors[$index])) {
                  $columns[$index] = $authors[$index];
               } else $columns[$index] = '';
            }
         }
         String::fputcsv($fp, $columns);
         $authorIndex++;
         unset($row);
      }
      
      fclose($fp);
   }
   
   /**
    * Get the highest author count for any paper (to determine how many columns to set)
    * @param $authorsIterator DBRowIterator
    * @return int
    */
   function getMaxAuthorCount(&$authorsIterator) {
      $maxAuthors = 0;
      foreach ($authorsIterator as $authorIterator) {
         $maxAuthors = $authorIterator->getCount() > $maxAuthors ? $authorIterator->getCount() : $maxAuthors;
      }
      return $maxAuthors;
   }
   
   /**
    * Flatten an array of author information into one array and append author sequence to each key
    * @param $authors array
    * @return array
    */
   function mergeAuthors($authors) {
      $returner = array();
      $seq = 0;
      foreach($authors as $author) {
         $seq++;
         
         $returner['fname' . $seq] = isset($author['fname']) ? $author['fname'] : '';
         $returner['mname' . $seq] = isset($author['mname']) ? $author['mname'] : '';
         $returner['lname' . $seq] = isset($author['lname']) ? $author['lname'] : '';
         $returner['email' . $seq] = isset($author['email']) ? $author['email'] : '';
         $returner['affiliation'] = isset($author['affiliation']) ? $author['affiliation'] : '';
         $returner['country' . $seq] = isset($author['country']) ? $author['country'] : '';
         $returner['url' . $seq] = isset($author['url']) ? $author['url'] : '';
         $returner['biography' . $seq] = isset($author['biography']) ? $author['biography'] : '';
      }
      return $returner;
   }
}

?>

Code: Select all
<?php

/**
 * @file PaperReportDAO.inc.php
 *
 * Copyright (c) 2000-2009 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class PaperReportDAO
 * @ingroup plugins_reports_paper
 * @see PaperReportPlugin
 *
 * @brief Paper report DAO
 *
 */

// $Id: PaperReportDAO.inc.php,v 1.15 2009/12/30 00:14:24 asmecher Exp $


import('submission.common.Action');
import('db.DBRowIterator');

class PaperReportDAO extends DAO {
   /**
    * Get the paper report data.
    * @param $conferenceId int
    * @param $schedConfId int
    * @return array
    */
   function getPaperReport($conferenceId, $schedConfId) {
      $primaryLocale = Locale::getPrimaryLocale();
      $locale = Locale::getLocale();

               $result =& $this->retrieve(
         'SELECT   p.status AS status,
            p.start_time AS start_time,
            p.end_time AS end_time,
            pp.room_id AS room_id,
            p.paper_id AS paper_id,
            p.user_id AS user_id,
            COALESCE(psl1.setting_value, pspl1.setting_value) AS title,
            COALESCE(psl2.setting_value, pspl2.setting_value) AS abstract,
            COALESCE(psl3.setting_value, pspl3.setting_value) AS session_type,
            COALESCE(tl.setting_value, tpl.setting_value) AS track_title,
            p.language AS language
         FROM   papers p
            LEFT JOIN published_papers pp ON (p.paper_id = pp.paper_id)
            LEFT JOIN paper_settings pspl1 ON (pspl1.paper_id=p.paper_id AND pspl1.setting_name = ? AND pspl1.locale = ?)
            LEFT JOIN paper_settings psl1 ON (psl1.paper_id=p.paper_id AND psl1.setting_name = ? AND psl1.locale = ?)
            LEFT JOIN paper_settings pspl2 ON (pspl2.paper_id=p.paper_id AND pspl2.setting_name = ? AND pspl2.locale = ?)
            LEFT JOIN paper_settings psl2 ON (psl2.paper_id=p.paper_id AND psl2.setting_name = ? AND psl2.locale = ?)
            LEFT JOIN paper_settings pspl3 ON (pspl3.paper_id=p.paper_id AND pspl3.setting_name = ?)
            LEFT JOIN paper_settings psl3 ON (psl3.paper_id=p.paper_id AND psl3.setting_name = ?)
            LEFT JOIN track_settings tpl ON (tpl.track_id=p.track_id AND tpl.setting_name = ? AND tpl.locale = ?)
            LEFT JOIN track_settings tl ON (tl.track_id=p.track_id AND tl.setting_name = ? AND tl.locale = ?)
         WHERE   p.sched_conf_id = ?
            AND submission_progress != 3
         ORDER BY title',
         array(
            'title',
            $primaryLocale,
            'title',
            $locale,
            'abstract',
            $primaryLocale,
            'abstract',
            $locale,
            'sessionType',
            'sessionType',
            'title',
            $primaryLocale,
            'title',
            $locale,
            $schedConfId
         )
      );
      $papersReturner = new DBRowIterator($result);
      unset($result);

      $result =& $this->retrieve(
         'SELECT   MAX(ed.date_decided) AS date,
            ed.paper_id AS paper_id
         FROM   edit_decisions ed,
            papers p
         WHERE   p.sched_conf_id = ? AND
            p.paper_id = ed.paper_id
         GROUP BY p.paper_id, ed.paper_id',
         array($schedConfId)
      );
      $decisionDatesIterator = new DBRowIterator($result);
      unset($result);

      $decisionsReturner = array();
      while ($row =& $decisionDatesIterator->next()) {
         $result =& $this->retrieve(
            'SELECT   decision AS decision,
               paper_id AS paper_id
            FROM   edit_decisions
            WHERE   date_decided = ? AND
               paper_id = ?',
            array(
               $row['date'],
               $row['paper_id']
            )
         );
         $decisionsReturner[] = new DBRowIterator($result);
         unset($result);
      }

      $paperDao =& DAORegistry::getDAO('PaperDAO');
      $papers =& $paperDao->getPapersBySchedConfId($schedConfId);
      $authorsReturner = array();
      $index = 1;
      while ($paper =& $papers->next()) {
         $result =& $this->retrieve(
            'SELECT   pa.first_name AS fname,
               pa.middle_name AS mname,
               pa.last_name AS lname,
               pa.email AS email,
               pa.affiliation AS affiliation,
               pa.country AS country,
               pa.url AS url,
               COALESCE(pasl.setting_value, pas.setting_value) AS biography
            FROM   paper_authors pa
               LEFT JOIN papers p ON pa.paper_id=p.paper_id
               LEFT JOIN paper_author_settings pas ON (pa.author_id=pas.author_id AND pas.setting_name = ? AND pas.locale = ?)
               LEFT JOIN paper_author_settings pasl ON (pa.author_id=pasl.author_id AND pasl.setting_name = ? AND pasl.locale = ?)
            WHERE   p.sched_conf_id = ? AND
               p.paper_id = ?',
            array(
               'biography',
               $primaryLocale,
               'biography',
               $locale,
               $schedConfId,
               $paper->getPaperId()
            )
         );
         $authorIterator = new DBRowIterator($result);
         unset($result);
         $authorsReturner[$paper->getPaperId()] = $authorIterator;
         unset($authorIterator);
         $index++;
         unset($paper);
      }

      return array($papersReturner, $authorsReturner, $decisionsReturner);
   }
}

?>
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby tshore » Tue May 11, 2010 11:11 am

I found the @#$%&*! problem. The fact that it has taken up a good chunk of my day is more than a bit frustrating. It would sure have been nice to have been making money instead. I guess that this is part of the cost of using the latest version of OCS (ie. 2.3) rather than the latest stable version. There are two lines in PaperReportPlugin.inc.php that needed to be corrected:
Code: Select all
$buildingId = $building->getId();

Code: Select all
$roomId = $room->getId();

need to be replaced with:
Code: Select all
$buildingId = $building->getBuildingId();

Code: Select all
$roomId = $room->getRoomId();

I'm not sure what direction OCS is going in, but I think that they are trying to get rid of things like $room->getRoomId() (which is redundant, I guess) and replace them with $room->getId(). And, I assume that the build of OCS that I downloaded was in the middle of switching over.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby asmecher » Tue May 11, 2010 11:52 am

Hi Trudy,

You can avoid this kind of thing by upgrading fully to OCS 2.3.1 rather than applying OCS 2.3.1 code to your OCS 2.3.0 install. When mixing code from different versions, you can expect to run into similar problems; it's the nature of the beast.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8470
Joined: Wed Aug 10, 2005 12:56 pm

Re: Printed Schedule

Postby tshore » Tue May 11, 2010 12:04 pm

I didn't mix this code, I'm pretty sure this is how it came to me when I downloaded it...

Plus, I can't upgrade live conferences to 2.3.1 because of the modifications that I've had to make to the code.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Printed Schedule

Postby asmecher » Tue May 11, 2010 5:12 pm

Hi Trudy,

It's entirely possible that this is a 2.3.0 bug -- I can't reproduce it in 2.3.1, though the changes between 2.3.0 and 2.3.1 that corrected this are likely in classes/scheduler rather than plugins/reports/papers. Upgrading a modified copy can be tricky (in our experience liberal use of the standard diff/patch tools helps), but time you invest there will mean less time spent chasing down bugs that have already been fixed in newer releases.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8470
Joined: Wed Aug 10, 2005 12:56 pm


Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest