home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / projects / project.php < prev    next >
PHP Script  |  2004-03-08  |  21KB  |  566 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=$lang_modules['projects'];
  21. require($GO_CONFIG->class_path."projects.class.inc");
  22. $projects = new projects();
  23.  
  24. $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
  25. $project_id = isset($_REQUEST['project_id']) ? $_REQUEST['project_id'] : 0;
  26.  
  27. $link_back = (isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '') ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];
  28. $return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
  29.  
  30. //remember sorting in cookie
  31.  
  32. if (isset($_REQUEST['new_sort_field']) && $_REQUEST['new_sort_field'] != '')
  33. {
  34.     SetCookie("no_sort_field",$_REQUEST['new_sort_field'],time()+3600*24*365,"/","",0);
  35.     $_COOKIE['no_sort_field'] = $_REQUEST['new_sort_field'];
  36. }
  37. if (isset($_REQUEST['new_sort_direction']) && $_REQUEST['new_sort_direction'] != '')
  38. {
  39.     SetCookie("no_sort_direction",$_REQUEST['new_sort_direction'],time()+3600*24*365,"/","",0);
  40.     $_COOKIE['no_sort_direction'] = $_REQUEST['new_sort_direction'];
  41. }
  42.  
  43. if (isset($_REQUEST['show']))
  44. {
  45.     SetCookie("no_show",$_REQUEST['show'],time()+3600*24*365,"/","",0);
  46. }
  47.  
  48. switch ($task)
  49. {
  50.     case 'save_hours':
  51.         $_COOKIE['unit_value_cookie'] = isset($_COOKIE['unit_value_cookie']) ? $_COOKIE['unit_value_cookie'] : '';
  52.         $unit_value = isset($_GET['unit_value']) ? $_GET['unit_value'] : $_COOKIE['unit_value_cookie'];
  53.  
  54.         SetCookie("registration_method_cookie",$_GET['registration_method'],time()+3600*24*365,"/","",0);
  55.         SetCookie("unit_value_cookie",$unit_value,time()+3600*24*365,"/","",0);
  56.  
  57.         //translate the given date stamp to unix time
  58.         $start_date_array = explode('-',$_GET['start_date']);
  59.         $start_year = $start_date_array[2];
  60.  
  61.         if ($_SESSION['GO_SESSION']['date_format'] == "m-j-Y")
  62.         {
  63.             $start_month = $start_date_array[0];
  64.             $start_day = $start_date_array[1];
  65.         }else
  66.         {
  67.             $start_month = $start_date_array[1];
  68.             $start_day = $start_date_array[0];
  69.         }
  70.  
  71.         $start_time = mktime($_GET['start_hour'], $_GET['start_min'], 0, $start_month, $start_day, $start_year)-($_SESSION['GO_SESSION']['timezone']*3600);
  72.  
  73.         //if user gave a number of units calulate ending time
  74.         if ($_GET['registration_method'] == 'units')
  75.         {
  76.             $end_time = $start_time + $unit_value*60*$_GET['units'];
  77.             $break_time=0;
  78.         }else
  79.         {
  80.             //translate the given date stamp to unix time
  81.             $end_date_array = explode('-',$_GET['end_date']);
  82.             $end_year = $end_date_array[2];
  83.             if ($_SESSION['GO_SESSION']['date_format'] == "m-j-Y")
  84.             {
  85.                 $end_month = $end_date_array[0];
  86.                 $end_day = $end_date_array[1];
  87.             }else
  88.             {
  89.                 $end_month = $end_date_array[1];
  90.                 $end_day = $end_date_array[0];
  91.             }
  92.             $break_time = ($_GET['break_hours']*3600)+($_GET['break_mins']*60);
  93.             $end_time = mktime($_GET['end_hour'], $_GET['end_min'], 0, $end_month, $end_day, $end_year)-($_SESSION['GO_SESSION']['timezone']*3600);;
  94.             $unit_value=0;
  95.         }
  96.  
  97.         if ($end_time < $start_time)
  98.         {
  99.             $feedback = '<p class="Error">'.$pm_invalid_period.'</p>';
  100.  
  101.         }elseif(!$projects->check_hours($_GET['pm_user_id'], $start_time, $end_time))
  102.         {
  103.             $feedback = '<p class="Error">'.$pm_already_booked.'</p>';
  104.         }else
  105.         {
  106.             if (!$projects->add_hours($_GET['project_id'], $_GET['pm_user_id'], $start_time, $end_time, $break_time, $unit_value, $_GET['comments']))
  107.             {
  108.                 $feedback = '<p class="Error">'.$strSaveError.'</p>';
  109.             }else
  110.             {
  111.                 $feedback = '<p class="Success">'.$pm_add_hours_success.'</p>';
  112.                 if ($_GET['close'] == 'true')
  113.                 {
  114.                     header('Location: '.$return_to);
  115.                     exit();
  116.                 }
  117.             }
  118.         }
  119.     break;
  120.  
  121.     case 'save_project':
  122.         //translate the given date stamp to unix time
  123.         $start_date = date_to_unixtime($_GET['start_date']);
  124.         $end_date = date_to_unixtime($_GET['end_date']);
  125.  
  126.         if ($project_id > 0)
  127.         {
  128.             $name = trim($_GET['name']);
  129.             if ($name == '')
  130.             {
  131.                 $feedback = '<p class="Error">'.$error_missing_field.'</p>';
  132.             }else
  133.             {
  134.                 $existing_project = $projects->get_project_by_name($name);
  135.  
  136.                 if($existing_project && $existing_project['id'] != $project_id)
  137.                 {
  138.                     $feedback = '<p class="Error">'.$pm_project_exists.'</p>';
  139.                 }elseif(!$projects->update_project($_GET['project_id'], $name, $_GET['description'], $_GET['contact_id'], $_GET['comments'], $start_date, $end_date, $_GET['status'], $_GET['responsible_user_id'], $_GET['probability'], $_GET['fee_id'], $_GET['budget']))
  140.                 {
  141.                     $feedback = '<p class="Error">'.$strSaveError.'</p>';
  142.                 }else
  143.                 {
  144.                     if ($_GET['close'] == 'true')
  145.                     {
  146.                         header('Location: '.$return_to);
  147.                         exit();
  148.                     }
  149.                 }
  150.             }
  151.         }else
  152.         {
  153.             $name = trim($_GET['name']);
  154.             if ($name == '')
  155.             {
  156.                 $feedback = '<p class="Error">'.$error_missing_field.'</p>';
  157.             }elseif($projects->get_project_by_name($name))
  158.             {
  159.                 $feedback = '<p class="Error">'.$pm_project_exists.'</p>';
  160.             }else
  161.             {
  162.                 $acl_read = $GO_SECURITY->get_new_acl('Project read: '.$name);
  163.                 $acl_write = $GO_SECURITY->get_new_acl('Project write: '.$name);
  164.                 if ($acl_read > 0 && $acl_write > 0)
  165.                 {
  166.                     if ($GO_SECURITY->add_user_to_acl($GO_SECURITY->user_id, $acl_write))
  167.                     {
  168.                         if (!$project_id = $projects->add_project($GO_SECURITY->user_id, $name, $_GET['description'], $_GET['contact_id'], $_GET['comments'], $start_date, $end_date, $_GET['status'], $_GET['responsible_user_id'], $_GET['probability'], $_GET['fee_id'], $_GET['budget'], $acl_read, $acl_write))
  169.                         {
  170.                             $GO_SECURITY->delete_acl($acl_read);
  171.                             $GO_SECURITY->delete_acl($acl_write);
  172.                             $feedback = '<p class="Error">'.$strSaveError.'</p>';
  173.                         }else
  174.                         {
  175.                             if ($_GET['close'] == 'true')
  176.                             {
  177.                                 header('Location: '.$return_to);
  178.                                 exit();
  179.                             }
  180.                         }
  181.                     }else
  182.                     {
  183.                         $GO_SECURITY->delete_acl($acl_read);
  184.                         $GO_SECURITY->delete_acl($acl_write);
  185.                         $feedback = '<p class="Error">'.$strSaveError.'</p>';
  186.                     }
  187.                 }else
  188.                 {
  189.                     $feedback ='<p class="Error">'.$strAclError.'</p>';
  190.                 }
  191.             }
  192.         }
  193.     break;
  194.  
  195.     case 'stop_timer':
  196.         $timer = $projects->get_timer($GO_SECURITY->user_id);
  197.         $timer_start_time = $timer['start_time']+($_SESSION['GO_SESSION']['timezone']*3600);
  198.         $timer_end_time = get_time();
  199.  
  200.         $projects->stop_timer($GO_SECURITY->user_id);
  201.  
  202.         $_COOKIE['registration_method_cookie'] = 'endtime';
  203.         SetCookie("registration_method_cookie",'endtime',time()+3600*24*365,"/","",0);
  204.  
  205.         $active_tab = 1;
  206.     break;
  207.  
  208.     case 'book':
  209.         $active_tab = 1;
  210.     break;
  211. }
  212.  
  213. if ($project_id > 0)
  214. {
  215.     $project = $projects->get_project($project_id);
  216.     $project_name = ($project['description'] == '') ? $project['name'] : $project['name'].' ('.$project['description'].')';
  217.  
  218.     $tabtable = new tabtable('project_tab', $project_name, '700', '400', '120', '', true);
  219.     $tabtable->add_tab('properties', $strProperties);
  220.  
  221.     $write_permissions = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $project['acl_write']);
  222.     $read_permissions = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $project['acl_read']);
  223.  
  224.     if (!$write_permissions && !$read_permissions)
  225.     {
  226.         header('Location: '.$GO_CONFIG->host.'error_docs/403.php');
  227.         exit();
  228.     }
  229.  
  230.     if ($write_permissions)
  231.     {
  232.         $tabtable->add_tab('book', $pm_enter_data);
  233.     }
  234.  
  235.     $tabtable->add_tab('load', $pm_load);
  236.  
  237.     if ($notes_module = $GO_MODULES->get_module('notes'))
  238.     {
  239.         if ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $notes_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $notes_module['acl_write']))
  240.         {
  241.             $tabtable->add_tab('notes', $lang_modules['notes']);
  242.         }
  243.     }
  244.  
  245.     $tabtable->add_tab('read_permissions', $strReadRights);
  246.     $tabtable->add_tab('write_permissions', $strWriteRights);
  247.  
  248.     $is_owner = ($project['user_id'] == $GO_SECURITY->user_id) ? true : false;
  249. }else
  250. {
  251.     $tabtable = new tabtable('project_tab', $pm_new_project, '600', '400', '120', '', true);
  252.     $project = false;
  253. }
  254.  
  255.  
  256. if ($project && $task != 'save_project')
  257. {
  258.     $name = $project['name'];
  259.     $contact_id = $project['contact_id'];
  260.     $comments = $project['comments'];
  261.  
  262.     $start_date = date($_SESSION['GO_SESSION']['date_format'], $project['start_date']);
  263.     $end_date = date($_SESSION['GO_SESSION']['date_format'], $project['end_date']);
  264.     $status = $project['status'];
  265.     $responsible_user_id = $project['res_user_id'];
  266.     $probability = $project['probability'];
  267.     $fee_id = $project['fee_id'];
  268.     $budget = $project['budget'];
  269.     $description = $project['description'];
  270.  
  271.     if (isset($active_tab))
  272.     {
  273.         $tabtable->set_active_tab($active_tab);
  274.     }
  275. }else
  276. {
  277.     $name = isset($_GET['name']) ? smartstrip($_GET['name']) : '';
  278.     $contact_id = isset($_GET['contact_id']) ? $_GET['contact_id'] : '0';
  279.     $comments = isset($_GET['comments']) ? smartstrip($_GET['comments']) : '';
  280.     $start_date = isset($_GET['start_date']) ? $_GET['start_date'] : date($_SESSION['GO_SESSION']['date_format'], get_time());
  281.     $end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date($_SESSION['GO_SESSION']['date_format'], get_time());
  282.     $status = isset($_GET['status']) ? $_GET['status'] : '-3';
  283.     $responsible_user_id = isset($_GET['responsible_user_id']) ? $_GET['responsible_user_id'] : 0;
  284.     $fee_id = isset($_GET['fee_id']) ? $_GET['fee_id'] : 0;
  285.     $probability = isset($_GET['probability']) ? $_GET['probability'] : 0;
  286.     $budget = isset($_GET['budget']) ? $_GET['budget'] : 0;
  287.     $description = isset($_GET['description']) ? smartstrip($_GET['description']) : '';
  288. }
  289.  
  290. $datepicker = new date_picker();
  291. $GO_HEADER['head'] = $datepicker->get_header();
  292.  
  293. $page_title = $lang_modules['projects'];
  294. require($GO_THEME->theme_path."header.inc");
  295. echo '<form method="get" action="'.$_SERVER['PHP_SELF'].'" name="projects_form">';
  296. echo '<input type="hidden" name="close" value="false" />';
  297. echo '<input type="hidden" name="project_id" value="'.$project_id.'" />';
  298. echo '<input type="hidden" name="task" value="" />';
  299. echo '<input type="hidden" name="return_to" value="'.$return_to.'" />';
  300.  
  301. $tabtable->print_head();
  302. switch($tabtable->get_active_tab_id())
  303. {
  304.     case 'read_permissions':
  305.         print_acl($project['acl_read']);
  306.         echo '<br />';
  307.         $button = new button($cmdClose, "javascript:document.location='".$return_to."';");
  308.     break;
  309.  
  310.     case 'write_permissions':
  311.         print_acl($project['acl_write']);
  312.         echo '<br />';
  313.         $button = new button($cmdClose, "javascript:document.location='".$return_to."';");
  314.     break;
  315.  
  316.     case 'book':
  317.         require('book.inc');
  318.     break;
  319.  
  320.     case 'load':
  321.         $fixed_project_id = $project_id;
  322.         require('load.inc');
  323.     break;
  324.  
  325.     case 'notes':
  326.         $contact_id=0;
  327.         echo '<input type="hidden" name="sort_cookie_prefix" value="no_" />';
  328.         require($GO_LANGUAGE->get_language_file('notes'));
  329.         require_once($GO_CONFIG->class_path.'notes.class.inc');
  330.         $notes = new notes();
  331.         $notes_module_url = $notes_module['url'];
  332.         $link_back .= '&active_tab=4';
  333.         require($GO_CONFIG->root_path.$notes_module['path'].'notes.inc');
  334.         echo '<br />';
  335.         $button = new button($cmdClose, "javascript:document.location='".$return_to."'");
  336.     break;
  337.  
  338.     default:
  339.     if (isset($feedback)) echo $feedback;
  340.     ?>
  341.  
  342.         <table border="0" cellspacing="0" cellpadding="4">
  343.         <tr>
  344.             <td><?php echo $strName; ?>:</td>
  345.             <td>
  346.             <?php
  347.             if ($project_id < 1 || $is_owner)
  348.             {
  349.                 echo '<input type="text" class="textbox" style="width: 250px;" name="name" value="'.$name.'" maxlength="50" />';
  350.             }else
  351.             {
  352.                 echo $project['name'];
  353.             }
  354.             ?>
  355.             </td>
  356.         <tr>
  357.         <tr>
  358.             <td><?php echo $pm_description; ?>:</td>
  359.             <td>
  360.             <?php
  361.             if ($project_id < 1 || $is_owner)
  362.             {
  363.                 echo '<input type="text" class="textbox" style="width: 250px;" name="description" value="'.$description.'" maxlength="50" />';
  364.             }else
  365.             {
  366.                 echo $project['description'];
  367.             }
  368.             ?>
  369.             </td>
  370.         <tr>
  371.         <?php
  372.         require_once($GO_CONFIG->class_path.'addressbook.class.inc');
  373.         $ab = new addressbook();
  374.  
  375.         if ($project_id < 1 || $project['user_id'] == $GO_SECURITY->user_id)
  376.         {
  377.             $contacts_module = $GO_MODULES->get_module('addressbook');
  378.             if($has_contacts_module = ($contacts_module && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $contacts_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $contacts_module['acl_write']))))
  379.             {
  380.                 if ($contact_id > 0 && $contact = $ab->get_contact($contact_id))
  381.                 {
  382.                     $middle_name = $contact['middle_name'] == '' ? '' : $contact['middle_name'].' ';
  383.                     $contact_name = $contact['first_name'].' '.$middle_name.$contact['last_name'];
  384.                 }else
  385.                 {
  386.                     $contact_name = isset($_GET['contact_name']) ? $_GET['contact_name'] : '';
  387.                 }
  388.                 echo '<tr><td><table border="0" cellpadding="0" cellspacing="0"><tr><td><a class="normal" href="javascript:popup(\''.$contacts_module['url'].'select.php?multiselect=false&GO_HANDLER='.$GO_MODULES->url.'add_client.php&pass_value=id&show_contacts=true\',\'550\',\'400\')"><img src="'.$GO_THEME->images['addressbook_small'].'" width="16" height="16" border="0" /></a> </td><td><a class="normal" href="javascript:popup(\''.$contacts_module['url'].'select.php?multiselect=false&GO_HANDLER='.$GO_MODULES->url.'add_client.php&pass_value=id&show_contacts=true\',\'550\',\'400\')">'.$pm_client.'</a>: </td></tr></table></td>';
  389.                 echo '<td><input type="hidden" value="'.$contact_id.'" name="contact_id" /><input type="hidden" value="'.$contact_name.'" name="contact_name" /><input type="text" name="contact_name_text" class="textbox" style="width: 250px;" value="'.$contact_name.'" disabled>';
  390.                 echo " <a href='javascript:remove_client()' title=\"".$strDeleteItem."\"><img src=\"".$GO_THEME->images['delete']."\" border=\"0\"></a></td></tr>";
  391.             }else
  392.             {
  393.                 echo '<input type="hidden" value="0" name="contact_id" />';
  394.                 echo $pm_no_contact;
  395.             }
  396.             require_once($GO_CONFIG->class_path.'users.class.inc');
  397.             $users = new users();
  398.  
  399.             $ab_module = $GO_MODULES->get_module('addressbook');
  400.  
  401.             if ($responsible_user_id > 0 && $user = $users->get_user($responsible_user_id))
  402.             {
  403.                 $middle_name = $user['middle_name'] == '' ? '' : $user['middle_name'].' ';
  404.                 $user_name = $user['first_name'].' '.$middle_name.$user['last_name'];
  405.             }else
  406.             {
  407.                 $user_name = isset($_REQUEST['user_name']) ? $_REQUEST['user_name'] : '';
  408.             }
  409.             echo '<tr><td><table border="0" cellpadding="0" cellspacing="0"><tr><td><a class="normal" href="javascript:popup(\''.$ab_module['url'].'select.php?show_users=true&multiselect=false&GO_HANDLER='.$GO_MODULES->url.'select_responsible_user.php&pass_value=id\',\'550\',\'400\')"><img src="'.$GO_THEME->images['addressbook_small'].'" width="16" height="16" border="0" /></a> </td><td><a class="normal" href="javascript:popup(\''.$ab_module['url'].'select.php?show_users=true&multiselect=false&GO_HANDLER='.$GO_MODULES->url.'select_responsible_user.php&pass_value=id\',\'550\',\'400\')">'.$pm_responsible.'</a>: </td></tr></table></td>';
  410.             echo '<td><input type="hidden" value="'.$responsible_user_id.'" name="responsible_user_id" /><input type="hidden" value="'.$user_name.'" name="user_name" /><input type="text" name="user_name_text" class="textbox" style="width: 250px;" value="'.$user_name.'" disabled>';
  411.             echo " <a href='javascript:remove_user()' title=\"".$strDeleteItem."\"><img src=\"".$GO_THEME->images['delete']."\" border=\"0\"></a></td></tr>";
  412.             echo '</td></tr>';
  413.  
  414.             echo '<tr><td>'.$pm_start_date.':</td><td>';
  415.             $datepicker->print_date_picker('start_date', $_SESSION['GO_SESSION']['date_format'], $start_date);
  416.             echo '</td></tr>';
  417.             echo '<tr><td>'.$pm_end_date.':</td><td>';
  418.             $datepicker->print_date_picker('end_date', $_SESSION['GO_SESSION']['date_format'], $end_date);
  419.             echo '</td></tr>';
  420.             echo '<tr><td>'.$pm_status.'</td><td>';
  421.  
  422.             $dropbox= new dropbox();
  423.             $dropbox->add_value(STATUS_OFFER, $pm_status_values[STATUS_OFFER]);
  424.             $dropbox->add_value(STATUS_ONGOING, $pm_status_values[STATUS_ONGOING]);
  425.             $dropbox->add_value(STATUS_WAITING, $pm_status_values[STATUS_WAITING]);
  426.             $dropbox->add_value(STATUS_DONE, $pm_status_values[STATUS_DONE]);
  427.             $dropbox->add_value(STATUS_BILLED, $pm_status_values[STATUS_BILLED]);
  428.             $dropbox->print_dropbox('status', $status);
  429.  
  430.             echo '</td></tr>';
  431.             echo '<tr><td>'.$pm_probability.'</td><td>';
  432.  
  433.             $dropbox= new dropbox();
  434.             for ($i=0;$i<=100;$i=$i+10)
  435.             {
  436.                 $dropbox->add_value($i, $i.'%');
  437.             }
  438.             $dropbox->print_dropbox('probability', $probability);
  439.  
  440.             echo '</td></tr>';
  441.             echo '<tr><td colspan="2"> </td></tr>';
  442.  
  443.             echo '<tr><td>'.$pm_budget.'</td><td><input type="text" class="textbox" size="10" name="budget" value="'.$budget.'" maxlength="50" /> '.$_SESSION['GO_SESSION']['currency'].'</td></tr>';
  444.         }else
  445.         {
  446.             echo '<tr><td>'.$pm_client.':</td><td>';
  447.             if($contact_id > 0)
  448.             {
  449.                 echo show_contact($contact_id);
  450.             }else
  451.             {
  452.                 echo $pm_no_contact;
  453.             }
  454.             echo '</td></tr>';
  455.  
  456.             echo '<tr><td>'.$pm_start_date.':</td><td>';
  457.             echo $start_date;
  458.             echo '</td></tr>';
  459.             echo '<tr><td>'.$pm_end_date.':</td><td>';
  460.             echo $end_date;
  461.             echo '</td></tr>';
  462.             echo '<tr><td>'.$pm_status.'</td><td>';
  463.  
  464.             $status = ($projects->f('status') > 0 && $projects->f('status') < 101) ? $projects->f('status').'%' : $pm_status_values[(int) $projects->f('status')];
  465.             echo $status.'</td></tr>';
  466.             echo '<tr><td>'.$pm_probability.'</td><td>'.$probability.'%</td></tr>';
  467.             echo '<tr><td colspan="2"> </td></tr>';
  468.             echo '<tr><td>'.$pm_budget.'</td><td>'.$budget.' '.$_SESSION['GO_SESSION']['currency'].'</td></tr>';
  469.         }
  470.  
  471.  
  472.  
  473.         $fee_count = $projects->get_fees();
  474.         if ($fee_count > 0)
  475.         {
  476.             echo '<tr><td>'.$pm_fee.'</td><td>';
  477.  
  478.             $fee_id = isset($_POST['fee_id']) ? $_POST['fee_id'] : 0;
  479.             $dropbox=new dropbox();
  480.  
  481.             while ($projects->next_record())
  482.             {
  483.                 $dropbox->add_value($projects->f('id'),$projects->f('name').' ('.htmlentities($_SESSION['GO_SESSION']['currency']).' '.number_format($projects->f('value'), 2, $_SESSION['GO_SESSION']['decimal_seperator'],$_SESSION['GO_SESSION']['thousands_seperator']).' / '.$projects->f('time').' '.$pm_mins.')');
  484.             }
  485.             $disabled = ($project_id < 1 || $project['user_id'] == $GO_SECURITY->user_id) ? '' : 'disabled';
  486.             $dropbox->print_dropbox('fee_id', $fee_id, $disabled);
  487.             echo '</td><td colspan="2"> </td></tr>';
  488.         }else
  489.         {
  490.             echo '<input type="hidden" name="fee_id" value="0" />';
  491.         }
  492.  
  493.  
  494.  
  495.         echo '<tr><td colspan="2"> </td></tr>';
  496.         if ($project_id > 0)
  497.         {
  498.  
  499.             echo '<tr><td>'.$strOwner.':</td><td>'.show_profile($project['user_id']).'</td></tr>';
  500.             echo '<tr><td>'.$strCreatedAt.':</td><td>'.date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], $project['ctime']+($_SESSION['GO_SESSION']['timezone']*3600)).'</td><tr>';
  501.             echo '<tr><td>'.$strModifiedAt.':</td><td>'.date($_SESSION['GO_SESSION']['date_format'].' '.$_SESSION['GO_SESSION']['time_format'], $project['mtime']+($_SESSION['GO_SESSION']['timezone']*3600)).'</td><tr>';
  502.             echo '<tr><td colspan="2"> </td></tr>';
  503.         }
  504.         ?>
  505.         <tr>
  506.             <td valign="top"><?php echo $strComments; ?>:</td>
  507.             <td>
  508.             <?php
  509.             if ($project_id < 1 || $project['user_id'] == $GO_SECURITY->user_id)
  510.             {
  511.                 echo '<textarea name="comments" cols="50" rows="4" class="textbox">'.$comments.'</textarea>';
  512.             }else
  513.             {
  514.                 echo text_to_html($comments);
  515.             }
  516.             ?>
  517.             </td>
  518.         </tr>
  519.         <tr>
  520.             <td colspan="2">
  521.             <?php
  522.             if ($project_id < 1 || $is_owner)
  523.             {
  524.                 $button = new button($cmdOk, "javascript:_save('save_project', 'true');");
  525.                 echo '  ';
  526.                 $button = new button($cmdApply, "javascript:_save('save_project', 'false')");
  527.                 echo '  ';
  528.             }
  529.             $button = new button($cmdClose, "javascript:document.location='".$return_to."';");
  530.             ?>
  531.             </td>
  532.         </tr>
  533.         </table>
  534.  
  535.     <?php
  536.     break;
  537. }
  538. $tabtable->print_foot();
  539. echo '</form>';
  540. ?>
  541. <script type="text/javascript">
  542.  
  543. function _save(task, close)
  544. {
  545.     document.projects_form.task.value = task;
  546.     document.projects_form.close.value = close;
  547.     document.projects_form.submit();
  548. }
  549. function remove_client()
  550. {
  551.     document.projects_form.contact_id.value = 0;
  552.     document.projects_form.contact_name.value = '';
  553.     document.projects_form.contact_name_text.value = '';
  554. }
  555.  
  556. function remove_user()
  557. {
  558.     document.projects_form.responsible_user_id.value = 0;
  559.     document.projects_form.user_name.value = '';
  560.     document.projects_form.user_name_text.value = '';
  561. }
  562.  
  563. </script>
  564. <?php
  565. require($GO_THEME->theme_path."footer.inc");
  566. ?>