home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / projects / fee.php < prev    next >
PHP Script  |  2004-03-08  |  4KB  |  128 lines

  1. <?php
  2. /*
  3. Copyright Intermesh 2003
  4. Author: Merijn Schering <mschering@intermesh.nl>
  5. Version: 1.0 Release date: 08 July 2003
  6.  
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.
  11. */
  12.  
  13. require("../../Group-Office.php");
  14.  
  15.  
  16. $GO_SECURITY->authenticate();
  17. $GO_MODULES->authenticate('projects');
  18. require($GO_LANGUAGE->get_language_file('projects'));
  19.  
  20. $page_title=$menu_projects;
  21. require($GO_CONFIG->class_path."projects.class.inc");
  22. $projects = new projects();
  23.  
  24. $fee_id = isset($_REQUEST['fee_id']) ? $_REQUEST['fee_id'] : 0;
  25.  
  26. if ($_SERVER['REQUEST_METHOD'] == 'POST')
  27. {
  28.     if($GO_MODULES->write_permissions)
  29.     {
  30.         $name = trim($_POST['name']);
  31.         $value = trim(str_replace(',','.',$_POST['value']));
  32.  
  33.         if ($name == '' || $value == '')
  34.         {
  35.             $feedback = '<p class="Error">'.$error_missing_field.'</p>';
  36.         }else
  37.         {
  38.             if (isset($_POST['fee_id']))
  39.             {
  40.                 if ($projects->update_fee($_POST['fee_id'], $name, $value, $_POST['time']))
  41.                 {
  42.                     header('Location: '.$GO_MODULES->url.'index.php?post_action=fees');
  43.                     exit();
  44.                 }else
  45.                 {
  46.                     $feedback = '<p class="Error">'.$strSaveError.'</p>';
  47.                 }
  48.             }else
  49.             {
  50.                 if($projects->add_fee($name, $value, $_POST['time']))
  51.                 {
  52.                     header('Location: '.$GO_MODULES->url.'index.php?post_action=fees');
  53.                     exit();
  54.                 }else
  55.                 {
  56.                     $feedback = '<p class="Error">'.$strSaveError.'</p>';
  57.                 }
  58.             }
  59.         }            
  60.     }else
  61.     {
  62.         $title = $strAccessDenied;
  63.         $require = $GO_CONFIG->root_path.'error_docs/403.inc';
  64.     }
  65. }
  66. $page_title = $lang_modules['projects'];
  67. require($GO_THEME->theme_path."header.inc");
  68. echo '<table border="0" cellpadding="10" cellspacing="0"><tr><td>';
  69. $tabtable = new tabtable('fee_tab', $pm_fees, '600', '400', '100', '', true);
  70. $tabtable->print_head();
  71. ?>
  72. <form method="post" name="add_fee" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  73. <input type="hidden" name="post_action" value="<?php echo $task; ?>" />
  74. <?php
  75. if ($fee_id > 0)
  76. {
  77.     echo '<input type="hidden" name="fee_id" value="'.$fee_id.'" />';
  78.     $fee = $projects->get_fee($fee_id);
  79.     $name = $fee["name"];
  80.     $value = $fee["value"];
  81.     $time = $fee["time"];
  82. }else
  83. {
  84.     $name = isset($_POST['name']) ? $_POST['name'] : '';
  85.     $time = isset($_POST['time']) ? $_POST['time'] : '60';
  86.     $value = isset($_POST['value']) ? $_POST['value'] : '';
  87. }
  88.  
  89. if (isset($feedback)) echo $feedback;
  90. ?>
  91. <table border="0" cellpadding="0" cellspacing="3">
  92.  
  93. <tr>
  94.     <td><?php echo $strName; ?>:</td>
  95.     <td><input type="text" name="name" value="<?php echo $name; ?>" maxlength="50" size="40" class="textbox" /></td>
  96. </tr>
  97. <tr>
  98.     <td valign="top"><?php echo $pm_value; ?>:</td>
  99.     <td><?php echo htmlentities($_SESSION['GO_SESSION']['currency']); ?> <input type="text" name="value" value="<?php echo $value; ?>" maxlength="10" size="6" class="textbox" />
  100.      / 
  101.     <?php
  102.     $dropbox = new dropbox();
  103.     for ($i=1;$i<=60;$i++)
  104.     {
  105.         $dropbox->add_value($i,$i);
  106.     }
  107.     $dropbox->print_dropbox('time', $time);
  108.     echo ' '.$pm_mins;
  109.     ?>
  110.     </td>
  111. </tr>
  112. <tr>
  113.     <td colspan="2"><br />
  114.     <?php
  115.     $button = new button($cmdOk, "javascript:document.forms[0].submit()");
  116.     echo '  ';
  117.     $button = new button($cmdCancel, "javascript:document.location='index.php?post_action=fees';");
  118.     ?>
  119.     </td>
  120. </tr>
  121.  
  122. </table>
  123. </form>
  124. <?php
  125. echo '</td></tr></table>';
  126. $tabtable->print_foot();
  127. require($GO_THEME->theme_path."footer.inc");
  128. ?>