Location: PHPKode > scripts > phpMyAccess > phpmyaccess-1.5.3/phpmyaccess/demos/hours/hourtotals.php
<?php

function MyHeader($header) {
echo("<?xml version=\"1.0\"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
  <title>$header </title>
</head>
<body bgcolor=\"#ffeb10\">
  <div class=\"main\">
  <h3>$header</h3>
");
}

//   MySQL host name, user name, password, database, and table to edit
include "dbaccess.php";
$tb='hourslist';
$header = "All Hours";

//  Name of field which is the unique key
$key='ID_hours';
//  Type of key field (int/real/string/date etc)
$key_type='int';
//   Number of records to display on the screen
$inc = 15;
//   Options you wish to give the users - A(dd) C(hange) D(elete) F(ilter)
$options = 'ACDFZXPJ';
//   Should authentication be used, "0" if no, anything else is minimum
//   user level needed to be allowed access
$auth = '100';
//   Debugging on/off (0=off, 1=on)
$debug = '0';
//

function Pre_run () {
   $GLOBALS['account_id'] = $GLOBALS['chk']['acc_id'];
}

$presel     = true;
$preselfld  = "hourslist.name";
$preselval  = $account_id;
$presel1     = true;
$sort_asc = false;
//
//
$fdd['ID_hours']['name'] = 'ID Hours';
$fdd['ID_hours']['sort'] = true;
$fdd['ID_hours']['select'] = 'T';
$fdd['ID_hours']['required'] = true;
$fdd['ID_hours']['auto'] = true;
// $fdd['ID_hours']['listview'] = false;
$fdd['name']['name'] = 'Name';
$fdd['name']['sort'] = true;
$fdd['name']['select'] = 'T';
$fdd['name']['required'] = true;
$fdd['name']['values']['table'] = 'useraccounts';
$fdd['name']['values']['column'] = 'useracc_ID';
$fdd['name']['values']['description'] = 'user_name';
//$fdd['name']['listview'] = false;
$fdd['project']['name'] = 'Project';
$fdd['project']['sort'] = true;
$fdd['project']['select'] = 'T';
$fdd['project']['required'] = true;
$fdd['project']['values']['table'] = 'activities';
$fdd['project']['values']['column'] = 'ID_act';
$fdd['project']['values']['description'] = 'activity';
//$fdd['project']['listview'] = false;
$fdd['bu']['name'] = 'BU';
$fdd['bu']['sort'] = true;
$fdd['bu']['select'] = 'T';
$fdd['bu']['required'] = true;
$fdd['bu']['values']['table'] = 'bu_list';
$fdd['bu']['values']['column'] = 'ID_bu';
$fdd['bu']['values']['description'] = 'bu';
//$fdd['bu']['listview'] = false;
$fdd['hours']['name'] = 'Hours';
$fdd['hours']['sort'] = true;
$fdd['hours']['select'] = 'T';
$fdd['hours']['required'] = true;
$fdd['hours']['values'] = array(0.25,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0);

//$fdd['hours']['listview'] = false;
$fdd['date']['name'] = 'Date';
$fdd['date']['sort'] = true;
$fdd['date']['select'] = 'T';
$fdd['date']['required'] = true;
$fdd['date']['date'] = true;
$fdd['date']['yearstart'] = 2000;
$fdd['date']['yearend'] = 2010;

//$fdd['date']['listview'] = false;
$fdd['comment']['name'] = 'Comment';
$fdd['comment']['sort'] = true;
$fdd['comment']['select'] = 'T';
$fdd['comment']['textarea']['rows'] = 5;
$fdd['comment']['textarea']['cols'] = 50;
$fdd['comment']['listview'] = false;
//  and now the all-important call to PHPMyEdit
//  warning - beware of case-sensitive operating systems!
include 'PHPMyEdit.php';

function Post_run() {
echo "  </div>
  <p></p>
  <hr  width=\"30%\" >
  <table>
   <tr>
     <td><a href=\"index.php\" name=\"link\">Main Page</a></td>
     <td> &nbsp;&nbsp;&nbsp; </td>
     <td><a href=\"index.php?page=menus\" name=\"link\">Menus Maintenance Page</a></td>
   </tr>
  </table>
  <br><b> User : ".$GLOBALS['auth_user']." </b><br>
";
}

function footer () {
   echo "  </body>\n</html>\n";
}
?>
Return current item: phpMyAccess