Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
AboutContextHandler.inc.php
1 <?php
2 
16 import('classes.handler.Handler');
17 import('lib.pkp.classes.pages.about.IAboutContextInfoProvider');
18 
23  function AboutContextHandler() {
24  parent::Handler();
25  AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
26  }
27 
31  function authorize($request, &$args, $roleAssignments) {
32  $context = $request->getContext();
33  if (!$context || !$context->getSetting('restrictSiteAccess')) {
34  $templateMgr = TemplateManager::getManager($request);
35  $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
36  }
37 
38  import('lib.pkp.classes.security.authorization.ContextRequiredPolicy');
39  $this->addPolicy(new ContextRequiredPolicy($request));
40  return parent::authorize($request, $args, $roleAssignments);
41  }
42 
48  function contact($args, $request) {
49  $settingsDao = DAORegistry::getDAO('PressSettingsDAO');
50  $context = $request->getContext();
51  $templateMgr = TemplateManager::getManager($request);
52  $templateMgr->assign('contactInfo', AboutContextHandler::getContactInfo($context));
53  $templateMgr->display('about/contact.tpl');
54  }
55 
61  function description($args, $request) {
62  $context = $request->getContext();
63 
64  $templateMgr = TemplateManager::getManager($request);
65  $templateMgr->assign('descriptionInfo', AboutContextHandler::getDescriptionInfo($context));
66  $templateMgr->display('about/description.tpl');
67  }
68 
74  function sponsorship($args, $request) {
75  $context = $request->getContext();
76  $templateMgr = TemplateManager::getManager($request);
77  $templateMgr->assign('sponsorshipInfo', AboutContextHandler::getSponsorshipInfo($context));
78  $templateMgr->display('about/sponsorship.tpl');
79  }
80 
86  function editorialTeam($args, $request) {
87  $context = $request->getContext();
88  $templateMgr = TemplateManager::getManager($request);
89  $templateMgr->assign('editorialTeamInfo', AboutContextHandler::getEditorialTeamInfo($context));
90  $templateMgr->display('about/editorialTeam.tpl');
91  }
92 
98  function editorialPolicies($args, $request) {
99  $context = $request->getContext();
100  $templateMgr = TemplateManager::getManager($request);
101  $templateMgr->assign('editorialPoliciesInfo', AboutContextHandler::getEditorialPoliciesInfo($context));
102  $templateMgr->display('about/editorialPolicies.tpl');
103  }
104 
110  function submissions($args, $request) {
111  $settingsDao = DAORegistry::getDAO('PressSettingsDAO');
112  $context = $request->getContext();
113  $templateMgr = TemplateManager::getManager($request);
114  $templateMgr->assign('submissionInfo', AboutContextHandler::getSubmissionsInfo($context));
115  $templateMgr->display('about/submissions.tpl');
116  }
117 
118 
119  //
120  // Static protected methods.
121  //
127  static protected function getContactInfo($context) {
128  $pressSettings = $context->getSettings();
129  $contactSettingNames = array('mailingAddress', 'contactPhone',
130  'contactFax', 'contactEmail', 'contactName', 'supportName',
131  'supportPhone', 'supportEmail');
132  $contactSettings = array_intersect_key($pressSettings, array_fill_keys($contactSettingNames, null));
133 
134  // Remove empty elements.
135  $contactSettings = array_filter($contactSettings);
136 
137  $contactLocalizedSettingNames = array('contactTitle', 'contactAffiliation', 'contactMailingAddress',
138  'contactTitle', 'contactAffiliation', 'contactMailingAddress');
139 
140  foreach ($contactLocalizedSettingNames as $settingName) {
141  $settingValue = $context->getLocalizedSetting($settingName);
142  if ($settingValue) {
143  $contactSettings[$settingName] = $settingValue;
144  }
145  }
146 
147  return $contactSettings;
148  }
149 
155  static protected function getDescriptionInfo($context) {
156  $descriptionSettings = array(
157  'description' => $context->getLocalizedSetting('description')
158  );
159 
160  // Remove empty elements.
161  $descriptionSettings = array_filter($descriptionSettings);
162  return $descriptionSettings;
163  }
164 
170  static protected function getSponsorshipInfo($context) {
171  $sponsorshipSettings = array(
172  'contributorNote' => $context->getLocalizedSetting('contributorNote'),
173  'contributors' => $context->getSetting('contributors'),
174  'sponsorNote' => $context->getLocalizedSetting('sponsorNote'),
175  'sponsors' => $context->getSetting('sponsors')
176  );
177 
178  // Remove empty elements.
179  $sponsorshipSettings = array_filter($sponsorshipSettings);
180  return $sponsorshipSettings;
181  }
182 
188  static protected function getEditorialTeamInfo($context) {
189  $editorialTeamInfo = array(
190  'masthead' => $context->getLocalizedSetting('masthead')
191  );
192 
193  // Remove empty elements.
194  $editorialTeamInfo = array_filter($editorialTeamInfo);
195  return $editorialTeamInfo;
196  }
197 
204  static protected function getEditorialPoliciesInfo($context) {
205  $editorialPoliciesSettingNames = array('focusScopeDesc', 'reviewPolicy',
206  'openAccessPolicy', 'customAboutItems');
207 
208  $editorialPoliciesInfo = array();
209 
210  foreach ($editorialPoliciesSettingNames as $settingName) {
211  $settingValue = $context->getLocalizedSetting($settingName);
212  if ($settingValue) {
213  $editorialPoliciesInfo[$settingName] = $settingValue;
214  }
215  }
216 
217  return $editorialPoliciesInfo;
218  }
219 
224  static protected function getSubmissionsInfo($context) {
225  $submissionSettingNames = array('authorGuidelines', 'copyrightNotice', 'privacyStatement');
226 
227  $submissionInfo = array();
228 
229  foreach ($submissionSettingNames as $settingName) {
230  $settingValue = $context->getLocalizedSetting($settingName);
231  if ($settingValue) {
232  $editorialPoliciesInfo[$settingName] = $settingValue;
233  }
234  }
235 
236  $submissionChecklist = $context->getLocalizedSetting('submissionChecklist');
237  if (!empty($submissionChecklist)) {
238  ksort($submissionChecklist);
239  reset($submissionChecklist);
240  $submissionInfo['checklist'] = $submissionChecklist;
241  }
242 
243  return $submissionInfo;
244  }
245 
246 
247  //
248  // Static public methods.
249  //
253  static function getAboutInfo($context) {
254  return array(
255  'contact' => AboutContextHandler::getContactInfo($context),
256  'description' => AboutContextHandler::getDescriptionInfo($context),
257  'sponsorship' => AboutContextHandler::getSponsorshipInfo($context),
258  'editorialTeam' => AboutContextHandler::getEditorialTeamInfo($context),
259  'editorialPolicies' => AboutContextHandler::getEditorialPoliciesInfo($context),
260  'submissions' => AboutContextHandler::getSubmissionsInfo($context)
261  );
262  }
263 }
264 
265 ?>
static & getDAO($name, $dbconn=null)
addPolicy($authorizationPolicy, $addToTop=false)
editorialTeam($args, $request)
Policy to deny access if a context cannot be found in the request.
static requireComponents()
editorialPolicies($args, $request)
Interface to retrieve about context information.
Handle requests for context-level about functions.
static getEditorialPoliciesInfo($context)
static getSubmissionsInfo($context)
Base request handler application class.
Definition: Handler.inc.php:20
static getSponsorshipInfo($context)
authorize($request, &$args, $roleAssignments)
static getDescriptionInfo($context)
static getEditorialTeamInfo($context)