00001 <?php
00002
00015
00016
00017 import('db.DBDataXMLParser');
00018 import('form.Form');
00019
00020 class SchedConfSettingsForm extends Form {
00021
00023 var $schedConfId;
00024 var $conferenceId;
00025
00030 function SchedConfSettingsForm($args = array()) {
00031 parent::Form('manager/schedConfSettings.tpl');
00032
00033 $this->conferenceId = $args[0];
00034 $this->schedConfId = $args[1];
00035
00036
00037 $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'manager.schedConfs.form.titleRequired'));
00038 $this->addCheck(new FormValidatorLocale($this, 'acronym', 'required', 'manager.schedConfs.form.acronymRequired'));
00039 $this->addCheck(new FormValidator($this, 'schedConfPath', 'required', 'manager.schedConfs.form.pathRequired'));
00040 $this->addCheck(new FormValidatorAlphaNum($this, 'schedConfPath', 'required', 'manager.schedConfs.form.pathAlphaNumeric'));
00041 $this->addCheck(new FormValidatorCustom($this, 'schedConfPath', 'required', 'manager.schedConfs.form.pathExists', create_function('$path,$form,$schedConfDao', 'return !$schedConfDao->schedConfExistsByPath($path) || ($form->getData(\'oldPath\') != null && $form->getData(\'oldPath\') == $path);'), array(&$this, DAORegistry::getDAO('SchedConfDAO'))));
00042 $this->addCheck(new FormValidatorPost($this));
00043 }
00044
00048 function display() {
00049 $templateMgr =& TemplateManager::getManager();
00050 $templateMgr->assign('schedConfId', $this->schedConfId);
00051 $templateMgr->assign('conferenceId', $this->conferenceId);
00052 $templateMgr->assign('helpTopicId', 'conference.generalManagement.scheduledConferences');
00053 parent::display();
00054 }
00055
00059 function initData() {
00060 if(isset($this->schedConfId)) {
00061 $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00062 $schedConf =& $schedConfDao->getSchedConf($this->schedConfId);
00063
00064 if($schedConf != null) {
00065 $this->_data = array(
00066 'conferenceId' => $schedConf->getConferenceId(),
00067 'title' => $schedConf->getTitle(null),
00068 'schedConfPath' => $schedConf->getPath(),
00069 'acronym' => $schedConf->getAcronym(null)
00070 );
00071 } else {
00072 $this->schedConfId = null;
00073 }
00074 }
00075
00076 $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00077 $conference =& $conferenceDao->getConference($this->conferenceId);
00078 if ($conference == null) {
00079
00080 $this->conferenceId = null;
00081 }
00082
00083 if (!isset($this->schedConfId)) {
00084 $this->_data = array(
00085 'conferenceId' => $this->conferenceId
00086 );
00087 }
00088 }
00089
00093 function readInputData() {
00094 $this->readUserVars(array('conferenceId', 'acronym', 'title', 'schedConfPath'));
00095
00096 if (isset($this->schedConfId)) {
00097 $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00098 $schedConf =& $schedConfDao->getSchedConf($this->schedConfId);
00099 $this->setData('oldPath', $schedConf->getPath());
00100 }
00101 }
00102
00107 function getLocaleFieldNames() {
00108 return array('title', 'acronym');
00109 }
00110
00114 function execute() {
00115 $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00116 $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00117
00118 $conference =& $conferenceDao->getConference($this->getData('conferenceId'));
00119
00120 if (isset($this->schedConfId)) {
00121 $schedConf =& $schedConfDao->getSchedConf($this->schedConfId);
00122 }
00123
00124 if (!isset($schedConf)) {
00125 $schedConf = new SchedConf();
00126 }
00127
00128 $schedConf->setConferenceId($this->getData('conferenceId'));
00129 $schedConf->setPath($this->getData('schedConfPath'));
00130
00131 if ($schedConf->getId() != null) {
00132 $schedConfDao->updateSchedConf($schedConf);
00133 $track = null;
00134 } else {
00135 $schedConfId = $schedConfDao->insertSchedConf($schedConf);
00136 $schedConfDao->resequenceSchedConfs($this->getData('conferenceId'));
00137
00138
00139 import('file.FileManager');
00140 $conferenceId = $schedConf->getConferenceId();
00141 $privateBasePath = Config::getVar('files','files_dir') . '/conferences/' . $conferenceId . '/schedConfs/' . $schedConfId;
00142 $publicBasePath = Config::getVar('files','public_files_dir') . '/conferences/' . $conferenceId . '/schedConfs/' . $schedConfId;
00143 FileManager::mkdirtree($privateBasePath);
00144 FileManager::mkdirtree($privateBasePath . '/papers');
00145 FileManager::mkdirtree($privateBasePath . '/tracks');
00146 FileManager::mkdirtree($publicBasePath);
00147
00148
00149 $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO');
00150
00151 $title = $this->getData('title');
00152 $title = $title[$this->getFormLocale()];
00153
00154 AppLocale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_OCS_DEFAULT));
00155 $schedConfSettingsDao->installSettings($schedConfId, Config::getVar('general', 'registry_dir') . '/schedConfSettings.xml', array(
00156 'authorGuidelinesUrl' => Request::url($conference->getPath(), $this->getData('schedConfPath'), 'about', 'submissions', null, null, 'authorGuidelines'),
00157 'indexUrl' => Request::getIndexUrl(),
00158 'conferencePath' => $conference->getPath(),
00159 'conferenceName' => $conference->getConferenceTitle(),
00160 'schedConfPath' => $this->getData('schedConfPath'),
00161 'schedConfUrl' => Request::url($conference->getPath(), $this->getData('schedConfPath'), 'index'),
00162 'schedConfName' => $title
00163 ));
00164
00165
00166 $trackDao =& DAORegistry::getDAO('TrackDAO');
00167 $track = new Track();
00168 $track->setSchedConfId($schedConfId);
00169 $track->setMetaReviewed(true);
00170 $track->setTitle(__('track.default.title'), $conference->getPrimaryLocale());
00171 $track->setAbbrev(__('track.default.abbrev'), $conference->getPrimaryLocale());
00172 $track->setPolicy(__('track.default.policy'), $conference->getPrimaryLocale());
00173 $track->setDirectorRestricted(false);
00174 $trackDao->insertTrack($track);
00175 }
00176
00177 $schedConf->updateSetting('title', $this->getData('title'), 'string', true);
00178 $schedConf->updateSetting('acronym', $this->getData('acronym'), 'string', true);
00179
00180 HookRegistry::call('SchedConfSettingsForm::execute', array(&$this, &$conference, &$schedConf, &$track));
00181 }
00182 }
00183
00184 ?>