ea-Geiercode
[ class tree: ea-Geier ] [ index: ea-Geier ] [ all elements ]

Source for file index.html.php

Documentation is available at index.html.php

  1. <?php
  2. /**
  3.  * HTML engine for main file
  4.  *
  5.  * LICENSE:
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 2 of the License, or
  9.  * (at your option) any later version.
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
  13.  * GNU General Public License for more details.
  14.  * You should have received a copy of the GNU General Public License along
  15.  * with this program; if not, write to the Free Software Foundation, Inc.,
  16.  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17.  *
  18.  * @package       ea-Geier
  19.  * @subpackage code
  20.  * @author       m2mtech <tech@m2m.at>
  21.  * @copyright  2007 m2m server software gmbh
  22.  * @license       http://www.gnu.org/licenses/gpl.html GNU General Public License Version 2
  23.  * @version       $Id: index.html.php 150 2007-09-09 10:22:44Z m2mtech $
  24.  * @link       http://www.ea-geier.at/
  25.  */
  26.  
  27. /**
  28.  * template engine wrapper
  29.  */
  30. require_once('code/base/smarty.class.php');
  31.  
  32. /**
  33.  * main HTML engine
  34.  *
  35.  * @param    eaState status & output data
  36.  */
  37. function eaHTMLOutput(&$out) {
  38.     if (isset($out->language)) $lang = $out->language;
  39.     else $lang = false;
  40.     $smarty = new eaSmarty($lang);
  41.     eaHTMLConfiguration($smarty);
  42.     eaHTMLNavigation($smarty, $out->get['state'], $out);
  43.     switch ($out->get['state']) {
  44.         // main screen
  45.         case 'main':        eaHTMLMain($smarty, $out); break;        
  46.  
  47.         // cashbook
  48.         case 'cashbook':        eaHTMLCashBook($smarty, $out); break;        
  49.         case 'cashbookprint':    eaPrintCashBook($smarty, $out); $print = true; break;        
  50.         case 'cashbookcsv':        eaCSVCashBook($smarty, $out); exit;        
  51.         case 'cashbookitem':    eaHTMLCashBookItem($smarty, $out); break;        
  52.         case 'cashbookitemprint':    eaPrintCashBookItem($smarty, $out); $print = true; break;        
  53.         case 'cashbookitemcsv': eaCSVCashBookItem($smarty, $out); exit;        
  54.  
  55.         // assets book
  56.         case 'assets':        eaHTMLAssets($smarty, $out); break;        
  57.         case 'assetsprint': eaPrintAssets($smarty, $out); $print = true; break;        
  58.         case 'assetscsv':    eaCSVAssets($smarty, $out); exit;
  59.         case 'assetsitem':    eaHTMLAssetsItem($smarty, $out); break;        
  60.         case 'assetsitemprint': eaPrintAssetsItem($smarty, $out); $print = true; break;        
  61.         case 'assetsitemcsv':    eaCSVAssetsItem($smarty, $out); exit;
  62.  
  63.         // purchase book
  64.         case 'purchasebook':        eaHTMLPurchaseBook($smarty, $out); break;        
  65.         case 'purchasebookprint':    eaPrintPurchaseBook($smarty, $out); $print = true; break;        
  66.         case 'purchasebookcsv':        eaCSVPurchaseBook($smarty, $out); exit;
  67.         case 'purchasebookitem':    eaHTMLPurchaseBookItem($smarty, $out); break;        
  68.         case 'purchasebookitemprint': eaPrintPurchaseBookItem($smarty, $out); $print = true; break;        
  69.         case 'purchasebookitemcsv': eaCSVPurchaseBookItem($smarty, $out); exit;
  70.  
  71.         // travelling expenses
  72.         case 'travel':        eaHTMLTravel($smarty, $out); break;        
  73.         case 'travelprint': eaPrintTravel($smarty, $out); $print = true; break;        
  74.         case 'travelcsv':    eaCSVTravel($smarty, $out); exit;
  75.         case 'travelitem':    eaHTMLTravelItem($smarty, $out); break;        
  76.         case 'travelitemprint': eaPrintTravelItem($smarty, $out); $print = true; break;        
  77.         case 'travelitemcsv': eaCSVTravelItem($smarty, $out); exit;
  78.  
  79.         // balance
  80.         case 'balance':        eaHTMLBalance($smarty, $out); break;        
  81.         case 'balanceprint':    eaPrintBalance($smarty, $out); $print = true; break;        
  82.         case 'balancecsv':    eaCSVBalance($smarty, $out); exit;        
  83.  
  84.         // base system
  85.         
  86.         // install
  87.         case 'install':        eaHTMLInstall($smarty, $out); break;
  88.         // new user
  89.         case 'newuser':        eaHTMLNewUser($smarty, $out); break;
  90.         case 'usercreated': eaHTMLUserCreated($smarty, $out); break;
  91.         // send password
  92.         case 'sendpw':        eaHTMLSendPW($smarty, $out); break;
  93.         case 'pwsent':        eaHTMLPWSent($smarty, $out); break;        
  94.         // configuration
  95.         case 'config':        eaHTMLConfig($smarty, $out); break;
  96.         // login
  97.         case 'login': default:
  98.             eaHTMLLogin($smarty, $out);
  99.     }
  100.     if (isset($print) && $print) {
  101.         $smarty->display('print.tpl');
  102.         exit;
  103.     }    
  104.     $smarty->assign('prototype', eaPROTOTYPE);
  105.     $smarty->display('index.tpl');
  106.     exit;
  107. }
  108.  
  109. /**
  110.  * login field
  111.  *
  112.  * @param  eaSmarty        Smarty object
  113.  * @return boolean        status
  114.  */
  115. function eaHTMLLogin(&$smarty, &$out) {
  116.     $smarty->assign_by_ref('data', $out->post);
  117.     $smarty->assign_by_ref('error', $out->error);
  118.     $smarty->assign('content', $smarty->fetch('login.tpl'));
  119.     return true;
  120. }
  121.  
  122. /**
  123.  * navigation menu
  124.  *
  125.  * @param    eaSmarty    Smarty object
  126.  * @param    string        state of state machine
  127.  * @param    eaInput        output data
  128.  * @return    boolean        status
  129.  */
  130. function eaHTMLNavigation(&$smarty, $state, &$out) {
  131.     switch ($state) {
  132.         case 'login': case 'logout':
  133.         case 'newuser': case 'usercreated':
  134.         case 'sendpw': case 'pwsent':
  135.             $link['login'] = true;
  136.             break;
  137.         case 'install':
  138.             $link['install'] = true;
  139.             break;
  140.         default:
  141.             $link['config'] = true;
  142.             $link['logout'] = true;
  143.     }
  144.     $smarty->assign_by_ref('link', $link);
  145.     $smarty->assign_by_ref('opt', $out->options);
  146.     $smarty->assign('navigation', $smarty->fetch('navigation.tpl'));
  147.     if ($state == 'config') $state = 'configuration'; // to prevent directory browsing
  148.     $smarty->assign('state', $state);
  149.     $smarty->assign('navlang', $smarty->fetch('navlang.tpl'));
  150.     return true;
  151. }
  152.  
  153. /**
  154.  * assign configuration variables
  155.  *
  156.  * @param  eaSmarty        Smarty object
  157.  * @return boolean        status
  158.  */
  159. function eaHTMLConfiguration(&$smarty) {
  160.     // assign global variables
  161.     $array['self'] = $_SERVER['PHP_SELF'];
  162.     // assign configuration variables
  163.     $vars = array('local' => 'localInstallation');
  164.     foreach ($vars as $key => $val) $array[$key] = $GLOBALS['conf'][$val];
  165.     $smarty->assign_by_ref('conf', $array);
  166.     return true;
  167. }
  168.  
  169. ?>

Documentation generated on Sun, 09 Sep 2007 17:08:49 +0200 by phpDocumentor 1.3.1