/** * Internal function to return a scheduled conference object from a row. * @param $row array * @return SchedConf */ function &_returnSchedConfFromRow(&$row) { $schedConf = new SchedConf(); $schedConf->setSchedConfId($row['sched_conf_id']); $schedConf->setPath($row['path']); $schedConf->setSequence($row['seq']); $schedConf->setConferenceId($row['conference_id']); $schedConf->setStartDate($this->datetimeFromDB($row['start_date'])); $schedConf->setEndDate($this->datetimeFromDB($row['end_date'])); HookRegistry::call('SchedConfDAO::_returnSchedConfFromRow', array(&$schedConf, &$row)); return $schedConf; }
/** * Import scheduled conference and related settings. * @param $id int */ function importSchedConf($id) { $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); if ($this->hasOption('verbose')) { printf("Importing OCS 1.x conference ID {$id}\n"); } $dbtable = $this->dbtable; // Load sched conf config $result =& $this->importDao->retrieve("SELECT * FROM {$dbtable['conference']} WHERE id = ?", array($id)); $this->conferenceInfo[$id] =& $result->fields; $result->Close(); $conferenceInfo =& $this->conferenceInfo[$id]; // Create/fetch scheduled conference if (!($schedConf =& $schedConfDao->getSchedConfByPath($id, $this->conferenceId))) { unset($schedConf); $schedConf = new SchedConf(); $schedConf->setConferenceId($this->conferenceId); $schedConf->setPath($id); $schedConfDao->insertSchedConf($schedConf); $schedConfDao->resequenceSchedConfs($this->conferenceId); $schedConf->updateSetting('title', array(Locale::getLocale() => $conferenceInfo['name']), null, true); } else { $schedConf->updateSetting('title', array(Locale::getLocale() => $conferenceInfo['name']), null, true); } $this->schedConfMap[$id] =& $schedConf; $schedConfSettings = array('contactEmail' => array('string', Core::cleanVar($this->conferenceInfo[$id]['contact_email'])), 'contactName' => array('string', Core::cleanVar($this->conferenceInfo[$id]['contact_name']))); foreach ($schedConfSettings as $settingName => $settingInfo) { list($settingType, $settingValue) = $settingInfo; $schedConf->updateSetting($settingName, $settingValue, $settingType); } }
/** * Save scheduled conference settings. */ function execute() { $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $conference =& $conferenceDao->getConference($this->getData('conferenceId')); if (isset($this->schedConfId)) { $schedConf =& $schedConfDao->getSchedConf($this->schedConfId); } if (!isset($schedConf)) { $schedConf = new SchedConf(); } $schedConf->setConferenceId($this->getData('conferenceId')); $schedConf->setPath($this->getData('schedConfPath')); if ($schedConf->getId() != null) { $schedConfDao->updateSchedConf($schedConf); $track = null; // avoid warning } else { $schedConfId = $schedConfDao->insertSchedConf($schedConf); $schedConfDao->resequenceSchedConfs($this->getData('conferenceId')); // Make the file directories for the scheduled conference import('lib.pkp.classes.file.FileManager'); $conferenceId = $schedConf->getConferenceId(); $privateBasePath = Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId . '/schedConfs/' . $schedConfId; $publicBasePath = Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId . '/schedConfs/' . $schedConfId; FileManager::mkdirtree($privateBasePath); FileManager::mkdirtree($privateBasePath . '/papers'); FileManager::mkdirtree($privateBasePath . '/tracks'); FileManager::mkdirtree($publicBasePath); // Install default scheduled conference settings $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO'); $title = $this->getData('title'); $title = $title[$this->getFormLocale()]; Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_OCS_DEFAULT)); $schedConfSettingsDao->installSettings($schedConfId, Config::getVar('general', 'registry_dir') . '/schedConfSettings.xml', array('authorGuidelinesUrl' => Request::url($conference->getPath(), $this->getData('schedConfPath'), 'about', 'submissions', null, null, 'authorGuidelines'), 'indexUrl' => Request::getIndexUrl(), 'conferencePath' => $conference->getPath(), 'conferenceName' => $conference->getConferenceTitle(), 'schedConfPath' => $this->getData('schedConfPath'), 'schedConfUrl' => Request::url($conference->getPath(), $this->getData('schedConfPath'), 'index'), 'schedConfName' => $title)); // Create a default "Papers" track $trackDao =& DAORegistry::getDAO('TrackDAO'); $track = new Track(); $track->setSchedConfId($schedConfId); $track->setMetaReviewed(true); $track->setTitle(Locale::translate('track.default.title'), $conference->getPrimaryLocale()); $track->setAbbrev(Locale::translate('track.default.abbrev'), $conference->getPrimaryLocale()); $track->setPolicy(Locale::translate('track.default.policy'), $conference->getPrimaryLocale()); $track->setDirectorRestricted(false); $trackDao->insertTrack($track); } $schedConf->updateSetting('title', $this->getData('title'), 'string', true); $schedConf->updateSetting('acronym', $this->getData('acronym'), 'string', true); HookRegistry::call('SchedConfSettingsForm::execute', array(&$this, &$conference, &$schedConf, &$track)); }