Location: PHPKode > scripts > phpMyAccess > phpmyaccess-1.5.3/phpmyaccess/demos/hours/hourslist.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';

//  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';
//
//
$header = "Hours daily entry";

//
$presel     = true;
$preselfld  = "hourslist.name";
$preselval  = $chk['acc_id'];
$presel1     = true;
$preselfld1  = "hourslist.date";
$today       =  date("Y-m-d");
$preselval1  = $today;
$sort_asc = true;
//
//
$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'] = 'D';
$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'] = 'D';
$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'] = 'D';
$fdd['bu']['required'] = true;
$fdd['bu']['values']['table'] = 'bu_list';
$fdd['bu']['values']['column'] = 'ID_bu';
$fdd['bu']['values']['description'] = 'bu';
$fdd['bu']['default'] = 1;
//$fdd['bu']['listview'] = false;
$fdd['hours']['name'] = 'Hours';
$fdd['hours']['sort'] = true;
$fdd['hours']['select'] = 'T';
$fdd['hours']['required'] = true;
$fdd['hours']['default'] = 0.5;
$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']['default'] = date("Y-m-d");
//$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!

function Pre_Run() {
   pma_debug ('Pre_Run');
   $GLOBALS['fdd']['bu']['default'] = $GLOBALS['chk']['bu'];
   $GLOBALS['fdd']['name']['default'] = $GLOBALS['chk']['acc_id'];
}

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