Subversion Repositories oidplus

Rev

Rev 279 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * OIDplus 2.0
  5.  * Copyright 2019 Daniel Marschall, ViaThinkSoft
  6.  *
  7.  * Licensed under the Apache License, Version 2.0 (the "License");
  8.  * you may not use this file except in compliance with the License.
  9.  * You may obtain a copy of the License at
  10.  *
  11.  *     http://www.apache.org/licenses/LICENSE-2.0
  12.  *
  13.  * Unless required by applicable law or agreed to in writing, software
  14.  * distributed under the License is distributed on an "AS IS" BASIS,
  15.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16.  * See the License for the specific language governing permissions and
  17.  * limitations under the License.
  18.  */
  19.  
  20. class OIDplusPagePublicContactEMail extends OIDplusPagePluginPublic {
  21.  
  22.         public function action(&$handled) {
  23.                 // Nothing
  24.         }
  25.  
  26.         public function init($html=true) {
  27.                 // Nothing
  28.         }
  29.  
  30.         public function gui($id, &$out, &$handled) {
  31.                 if ($id === 'oidplus:contact') {
  32.                         $handled = true;
  33.                         $out['title'] = 'Contact administrator';
  34.                         $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
  35.  
  36.                         if (empty(OIDplus::config()->getValue('admin_email'))) {
  37.                                 $out['text'] = '<p>The administrator of this OIDplus system has not entered a contact email address.';
  38.                         } else {
  39.                                 $out['text'] = '<p>You can contact the administrator of this OIDplus system at this email address:</p><p><a href="mailto:'.htmlentities(OIDplus::config()->getValue('admin_email')).'">'.htmlentities(OIDplus::config()->getValue('admin_email')).'</a></p>';
  40.                         }
  41.                 }
  42.         }
  43.  
  44.         public function publicSitemap(&$out) {
  45.                 $out[] = OIDplus::getSystemUrl().'?goto=oidplus:contact';
  46.         }
  47.  
  48.         public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
  49.                 if (file_exists(__DIR__.'/treeicon.png')) {
  50.                         $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png';
  51.                 } else {
  52.                         $tree_icon = null; // default icon (folder)
  53.                 }
  54.  
  55.                 $json[] = array(
  56.                         'id' => 'oidplus:contact',
  57.                         'icon' => $tree_icon,
  58.                         'text' => 'Contact administrator'
  59.                 );
  60.  
  61.                 return true;
  62.         }
  63.  
  64.         public function tree_search($request) {
  65.                 return false;
  66.         }
  67. }
  68.