pages/about/AboutHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 // $Id$
00017 
00018 
00019 import('handler.Handler');
00020 
00021 class AboutHandler extends Handler {
00025    function AboutHandler() {
00026       parent::Handler();
00027    }
00028 
00032    function index() {
00033       $this->validate();
00034       $this->setupTemplate(false);
00035 
00036       $templateMgr =& TemplateManager::getManager();
00037       $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00038       $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00039       $conferencePath = Request::getRequestedConferencePath();
00040 
00041       if ($conferencePath != 'index' && $conferenceDao->conferenceExistsByPath($conferencePath)) {
00042          $schedConf =& Request::getSchedConf();
00043          $conference =& Request::getConference();
00044 
00045          if($schedConf) {
00046             $templateMgr->assign('showAboutSchedConf', true);
00047             $settings = $schedConf->getSettings();
00048          } else {
00049             $templateMgr->assign('showAboutSchedConf', false);
00050             $settings = $conference->getSettings();
00051             $templateMgr->assign_by_ref('currentSchedConfs', $schedConfDao->getCurrentSchedConfs($conference->getId()));
00052          }
00053 
00054          $customAboutItems = $conference->getSetting('customAboutItems');
00055 
00056          foreach (AboutHandler::getPublicStatisticsNames() as $name) {
00057             if (isset($settings[$name])) {
00058                $templateMgr->assign('publicStatisticsEnabled', true);
00059                break;
00060             }
00061          }
00062 
00063          if (isset($customAboutItems[AppLocale::getLocale()])) $templateMgr->assign('customAboutItems', $customAboutItems[AppLocale::getLocale()]);
00064          elseif (isset($customAboutItems[AppLocale::getPrimaryLocale()])) $templateMgr->assign('customAboutItems', $customAboutItems[AppLocale::getPrimaryLocale()]);
00065 
00066          $templateMgr->assign('helpTopicId', 'user.about');
00067          $templateMgr->assign_by_ref('conferenceSettings', $settings);
00068          $templateMgr->display('about/index.tpl');
00069       } else {
00070          $site =& Request::getSite();
00071          $about = $site->getLocalizedAbout();
00072          $templateMgr->assign('about', $about);
00073 
00074          $conferences =& $conferenceDao->getEnabledConferences(); //Enabled Added
00075          $templateMgr->assign_by_ref('conferences', $conferences);
00076          $templateMgr->display('about/site.tpl');
00077       }
00078    }
00079 
00080 
00085    function setupTemplate($subclass = true) {
00086       parent::setupTemplate();
00087 
00088       $conference =& Request::getConference();
00089       $schedConf =& Request::getSchedConf();
00090 
00091       $templateMgr =& TemplateManager::getManager();
00092       $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
00093       AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER, LOCALE_COMPONENT_PKP_MANAGER));
00094 
00095       $pageHierarchy = array();
00096       if ($conference) $pageHierarchy[] = array(Request::url(null, 'index', 'index'), $conference->getConferenceTitle(), true);
00097       if ($schedConf) $pageHierarchy[] = array(Request::url(null, null, 'index'), $schedConf->getSchedConfTitle(), true);
00098       if ($subclass) $pageHierarchy[] = array(Request::url(null, null, 'about'), 'about.aboutTheConference');
00099       $templateMgr->assign('pageHierarchy', $pageHierarchy);
00100    }
00101 
00105    function contact() {
00106       $this->validate(true);
00107       $this->setupTemplate();
00108 
00109       $schedConf =& Request::getSchedConf();
00110       $conference =& Request::getConference();
00111 
00112       $settings = ($schedConf? $schedConf->getSettings():$conference->getSettings());
00113       $templateMgr =& TemplateManager::getManager();
00114 
00115       $templateMgr->assign_by_ref('conferenceSettings', $settings);
00116       $templateMgr->display('about/contact.tpl');
00117    }
00118 
00122    function organizingTeam() {
00123       $this->validate(true);
00124       $this->setupTemplate();
00125 
00126       $conference =& Request::getConference();
00127       $schedConf =& Request::getSchedConf();
00128 
00129       $conferenceId = $conference->getId();
00130       $schedConfId = ($schedConf? $schedConf->getId():-1);
00131 
00132       if($schedConf)
00133          $settings = $schedConf->getSettings();
00134       else
00135          $settings =& $conference->getSettings();
00136 
00137       $templateMgr =& TemplateManager::getManager();
00138 
00139       $countryDao =& DAORegistry::getDAO('CountryDAO');
00140       $countries =& $countryDao->getCountries();
00141       $templateMgr->assign_by_ref('countries', $countries);
00142 
00143       $contributors = array();
00144       $sponsors = array();
00145 
00146       if($conference) {
00147          $contributorNote = $conference->getLocalizedSetting('contributorNote');
00148          $contributors = $conference->getSetting('contributors');
00149          if (!is_array($contributors)) $contributors = array();
00150 
00151          $sponsorNote = $conference->getLocalizedSetting('sponsorNote');
00152          $sponsors = $conference->getSetting('sponsors');
00153          if (!is_array($sponsors)) $sponsors = array();
00154       }
00155 
00156       if($schedConf) {
00157          $contributorNote = $schedConf->getLocalizedSetting('contributorNote');
00158          $eventContributors = $schedConf->getSetting('contributors');
00159          if (is_array($eventContributors)) $contributors = array_merge($contributors, $eventContributors);
00160 
00161          $sponsorNote = $schedConf->getLocalizedSetting('sponsorNote');
00162          $eventSponsors = $schedConf->getSetting('sponsors');
00163          if (is_array($eventSponsors)) $sponsors = array_merge($sponsors, $eventSponsors);
00164       }
00165 
00166       $templateMgr->assign_by_ref('contributorNote', $contributorNote);
00167       $templateMgr->assign_by_ref('contributors', $contributors);
00168       $templateMgr->assign('sponsorNote', $sponsorNote);
00169       $templateMgr->assign_by_ref('sponsors', $sponsors);
00170 
00171       // FIXME: This is pretty inefficient; should probably be cached.
00172 
00173       if (!$schedConf->getSetting('boardEnabled')) {
00174          // Don't use the Organizing Team feature. Generate
00175          // Organizing Team information using Role info.
00176          $roleDao =& DAORegistry::getDAO('RoleDAO');
00177 
00178          $directors =& $roleDao->getUsersByRoleId(ROLE_ID_DIRECTOR, $conference->getId(), $schedConfId);
00179          $directors =& $directors->toArray();
00180 
00181          $trackDirectors =& $roleDao->getUsersByRoleId(ROLE_ID_TRACK_DIRECTOR, $conference->getId(), $schedConfId);
00182          $trackDirectors =& $trackDirectors->toArray();
00183 
00184          $templateMgr->assign_by_ref('directors', $directors);
00185          $templateMgr->assign_by_ref('trackDirectors', $trackDirectors);
00186          $templateMgr->display('about/organizingTeam.tpl');
00187       } else {
00188          // The Organizing Team feature has been enabled.
00189          // Generate information using Group data.
00190          $groupDao =& DAORegistry::getDAO('GroupDAO');
00191          $groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
00192 
00193          $allGroups =& $groupDao->getGroups(ASSOC_TYPE_SCHED_CONF, $schedConf->getId());
00194          $teamInfo = array();
00195          $groups = array();
00196          while ($group =& $allGroups->next()) {
00197             if (!$group->getAboutDisplayed()) continue;
00198             $memberships = array();
00199             $allMemberships =& $groupMembershipDao->getMemberships($group->getId());
00200             while ($membership =& $allMemberships->next()) {
00201                if (!$membership->getAboutDisplayed()) continue;
00202                $memberships[] =& $membership;
00203             }
00204             if (!empty($memberships)) $groups[] =& $group;
00205             $teamInfo[$group->getId()] = $memberships;
00206          }
00207 
00208          $templateMgr->assign_by_ref('groups', $groups);
00209          $templateMgr->assign_by_ref('teamInfo', $teamInfo);
00210          $templateMgr->display('about/organizingTeamBoard.tpl');
00211       }
00212    }
00213 
00217    function organizingTeamBio($args) {
00218       $this->addCheck(new HandlerValidatorConference($this));
00219       $this->validate();
00220       $this->setupTemplate();
00221 
00222       $conference =& Request::getConference();
00223       $schedConf =& Request::getSchedConf();
00224 
00225       $roleDao =& DAORegistry::getDAO('RoleDAO');
00226 
00227       $templateMgr =& TemplateManager::getManager();
00228 
00229       $userId = isset($args[0])?(int)$args[0]:0;
00230 
00231       // Make sure we're fetching a biography for
00232       // a user who should appear on the listing;
00233       // otherwise we'll be exposing user information
00234       // that might not necessarily be public.
00235 
00236       // FIXME: This is pretty inefficient. Should be cached.
00237 
00238       if($schedConf) {
00239          $settings = $schedConf->getSettings();
00240          $schedConfId = $schedConf->getId();
00241       } else {
00242          $settings = $conference->getSettings();
00243          $schedConfId = 0;
00244       }
00245 
00246       $user = null;
00247       if (!isset($settings['boardEnabled']) || $settings['boardEnabled'] != true) {
00248          $directors =& $roleDao->getUsersByRoleId(ROLE_ID_DIRECTOR, $conference->getId());
00249          while ($potentialUser =& $directors->next()) {
00250             if ($potentialUser->getId() == $userId)
00251                $user =& $potentialUser;
00252          }
00253 
00254          $trackDirectors =& $roleDao->getUsersByRoleId(ROLE_ID_TRACK_DIRECTOR, $conference->getId());
00255          while ($potentialUser =& $trackDirectors->next()) {
00256             if ($potentialUser->getId() == $userId)
00257                $user =& $potentialUser;
00258          }
00259 
00260       } else {
00261          $groupDao =& DAORegistry::getDAO('GroupDAO');
00262          $groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
00263 
00264          $allGroups =& $groupDao->getGroups(ASSOC_TYPE_SCHED_CONF, $schedConfId);
00265          while ($group =& $allGroups->next()) {
00266             if (!$group->getAboutDisplayed()) continue;
00267             $allMemberships =& $groupMembershipDao->getMemberships($group->getId());
00268             while ($membership =& $allMemberships->next()) {
00269                if (!$membership->getAboutDisplayed()) continue;
00270                $potentialUser =& $membership->getUser();
00271                if ($potentialUser->getId() == $userId)
00272                   $user = $potentialUser;
00273             }
00274          }
00275       }
00276 
00277       if (!$user) Request::redirect(null, null, null, 'about', 'organizingTeam');
00278 
00279       $countryDao =& DAORegistry::getDAO('CountryDAO');
00280       if ($user && $user->getCountry() != '') {
00281          $country = $countryDao->getCountry($user->getCountry());
00282          $templateMgr->assign('country', $country);
00283       }
00284 
00285       $templateMgr->assign_by_ref('user', $user);
00286       $templateMgr->display('about/organizingTeamBio.tpl');
00287    }
00288 
00292    function editorialPolicies() {
00293       parent::validate(true);
00294       $this->setupTemplate();
00295 
00296       $trackDirectorsDao =& DAORegistry::getDAO('TrackDirectorsDAO');
00297       $schedConf =& Request::getSchedConf();
00298       $conference =& Request::getConference();
00299 
00300       $templateMgr =& TemplateManager::getManager();
00301       $settings = ($schedConf? $schedConf->getSettings(): $conference->getSettings());
00302       $templateMgr->assign('conferenceSettings', $settings);
00303 
00304       $templateMgr->display('about/editorialPolicies.tpl');
00305    }
00306 
00310    function registration() {
00311       parent::validate(true);
00312       $this->setupTemplate();
00313 
00314       $conferenceDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
00315       $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
00316 
00317       $schedConf =& Request::getSchedConf();
00318       $conference =& Request::getConference();
00319 
00320       if (!$schedConf || !$conference) Request::redirect(null, null, 'about');
00321 
00322       $registrationName =& $schedConf->getSetting('registrationName');
00323       $registrationEmail =& $schedConf->getSetting('registrationEmail');
00324       $registrationPhone =& $schedConf->getSetting('registrationPhone');
00325       $registrationFax =& $schedConf->getSetting('registrationFax');
00326       $registrationMailingAddress =& $schedConf->getSetting('registrationMailingAddress');
00327       $registrationAdditionalInformation =& $schedConf->getLocalizedSetting('registrationAdditionalInformation');
00328       $registrationTypes =& $registrationTypeDao->getRegistrationTypesBySchedConfId($schedConf->getId());
00329 
00330       $templateMgr =& TemplateManager::getManager();
00331       $templateMgr->assign('registrationName', $registrationName);
00332       $templateMgr->assign('registrationEmail', $registrationEmail);
00333       $templateMgr->assign('registrationPhone', $registrationPhone);
00334       $templateMgr->assign('registrationFax', $registrationFax);
00335       $templateMgr->assign('registrationMailingAddress', $registrationMailingAddress);
00336       $templateMgr->assign('registrationAdditionalInformation', $registrationAdditionalInformation);
00337       $templateMgr->assign('registrationTypes', $registrationTypes);
00338       $templateMgr->display('about/registration.tpl');
00339    }
00340 
00344    function submissions() {
00345       parent::validate(true);
00346       $this->setupTemplate();
00347 
00348       $conference =& Request::getConference();
00349       $schedConf =& Request::getSchedConf();
00350 
00351       $settings = ($schedConf? $schedConf->getSettings():$conference->getSettings());
00352 
00353       $templateMgr =& TemplateManager::getManager();
00354       $submissionChecklist = $schedConf?$schedConf->getLocalizedSetting('submissionChecklist'):null;
00355       if (!empty($submissionChecklist)) {
00356          ksort($submissionChecklist);
00357          reset($submissionChecklist);
00358       }
00359       $templateMgr->assign('submissionChecklist', $submissionChecklist);
00360       if ($schedConf) {
00361          $templateMgr->assign('authorGuidelines', $schedConf->getLocalizedSetting('authorGuidelines'));
00362       }
00363       $templateMgr->assign('copyrightNotice', $conference->getLocalizedSetting('copyrightNotice'));
00364       $templateMgr->assign('privacyStatement', $conference->getLocalizedSetting('privacyStatement'));
00365 
00366       $templateMgr->assign('helpTopicId','submission.authorGuidelines');
00367       $templateMgr->display('about/submissions.tpl');
00368    }
00369 
00373    function siteMap() {
00374       $this->validate();
00375       $this->setupTemplate();
00376 
00377       $templateMgr =& TemplateManager::getManager();
00378       $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00379       $user =& Request::getUser();
00380       $roleDao =& DAORegistry::getDAO('RoleDAO');
00381 
00382       if ($user) {
00383          $rolesByConference = array();
00384          $conferences =& $conferenceDao->getEnabledConferences();
00385          // Fetch the user's roles for each conference
00386          foreach ($conferences->toArray() as $conference) {
00387             $roles =& $roleDao->getRolesByUserId($user->getId(), $conference->getId());
00388             if (!empty($roles)) {
00389                $rolesByConference[$conference->getId()] =& $roles;
00390             }
00391          }
00392       }
00393 
00394       $conferences =& $conferenceDao->getEnabledConferences();
00395       $templateMgr->assign_by_ref('conferences', $conferences->toArray());
00396       if (isset($rolesByConference)) {
00397          $templateMgr->assign_by_ref('rolesByConference', $rolesByConference);
00398       }
00399       if ($user) {
00400          $templateMgr->assign('isSiteAdmin', $roleDao->getRole(0, 0, $user->getId(), ROLE_ID_SITE_ADMIN));
00401       }
00402 
00403       $templateMgr->display('about/siteMap.tpl');
00404    }
00405 
00409    function aboutThisPublishingSystem() {
00410       $this->validate();
00411       $this->setupTemplate();
00412 
00413       $versionDao =& DAORegistry::getDAO('VersionDAO');
00414       $version =& $versionDao->getCurrentVersion();
00415 
00416       $templateMgr =& TemplateManager::getManager();
00417       $templateMgr->assign('ocsVersion', $version->getVersionString());
00418 
00419       foreach (array(AppLocale::getLocale(), $primaryLocale = AppLocale::getPrimaryLocale(), 'en_US') as $locale) {
00420          $edProcessFile = "locale/$locale/edprocesslarge.png";
00421          if (file_exists($edProcessFile)) break;
00422       }
00423       $templateMgr->assign('edProcessFile', $edProcessFile);
00424 
00425       $templateMgr->display('about/aboutThisPublishingSystem.tpl');
00426    }
00427 
00433    function statistics() {
00434       $this->validate();
00435       $this->setupTemplate();
00436 
00437       $conference =& Request::getConference();
00438       $schedConf =& Request::getSchedConf();
00439       $templateMgr =& TemplateManager::getManager();
00440       $templateMgr->assign('helpTopicId','user.about');
00441 
00442       $trackIds = $schedConf->getSetting('statisticsTrackIds');
00443       if (!is_array($trackIds)) $trackIds = array();
00444       $templateMgr->assign('trackIds', $trackIds);
00445 
00446       foreach (AboutHandler::getPublicStatisticsNames() as $name) {
00447          $templateMgr->assign($name, $schedConf->getSetting($name));
00448       }
00449 
00450       $schedConfStatisticsDao =& DAORegistry::getDAO('SchedConfStatisticsDAO');
00451       $paperStatistics = $schedConfStatisticsDao->getPaperStatistics($schedConf->getId(), null);
00452       $templateMgr->assign('paperStatistics', $paperStatistics);
00453 
00454       $limitedPaperStatistics = $schedConfStatisticsDao->getPaperStatistics($schedConf->getId(), $trackIds);
00455       $templateMgr->assign('limitedPaperStatistics', $limitedPaperStatistics);
00456 
00457       $trackDao =& DAORegistry::getDAO('TrackDAO');
00458       $tracks =& $trackDao->getSchedConfTracks($schedConf->getId());
00459       $templateMgr->assign('tracks', $tracks->toArray());
00460 
00461       $reviewerStatistics = $schedConfStatisticsDao->getReviewerStatistics($schedConf->getId(), $trackIds);
00462       $templateMgr->assign('reviewerStatistics', $reviewerStatistics);
00463 
00464       $userStatistics = $schedConfStatisticsDao->getUserStatistics($schedConf->getId());
00465       $templateMgr->assign('userStatistics', $userStatistics);
00466 
00467       $registrationStatistics = $schedConfStatisticsDao->getRegistrationStatistics($schedConf->getId());
00468       $templateMgr->assign('registrationStatistics', $registrationStatistics);
00469 
00470       $templateMgr->display('about/statistics.tpl');
00471    }
00472 
00473    function getPublicStatisticsNames() {
00474       import ('pages.manager.ManagerHandler');
00475       import ('pages.manager.StatisticsHandler');
00476       return StatisticsHandler::getPublicStatisticsNames();
00477    }
00478 }
00479 
00480 ?>

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