[whups] CSV Template

Mike Baptiste mike@msbnetworks.net
Fri Nov 22 01:13:58 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sure.  See the code snippet below from data.php:

foreach ($tickets as $id => $info) {
~    $tickets[$id]['_date'] = strftime('%x', $info['timestamp']);
~    // There has to be a way to do this in a loop by using an existing
field mapping
~    if ($info['_date_assigned']) {
~        $tickets[$id]['_date_assigned'] = strftime('%x',
$info['_date_assigned']);
~    }
~    if ($info['_date_resolved']) {
~        $tickets[$id]['_date_resolved'] = strftime('%x',
$info['_date_resolved']);
~    }
~    $tickets[$id]['_owner_name'] =
Whups::formatUser($info['user_id_owner'], false);
}

I really like the template setup since it is very flexible.  However, I
had to add two if/thens to format DB data for viewing.  Now these may be
the only other ones that were needed, but as fields get added, it seems
kludgy to keep adding strftime's (or whatever other tyep of format
routine is needed, like WHups::formatUser)

So I was thinking that to keep things flexible that there be some type
of mapping between ticket data and how it should be formatted for
reports/display.  Maybe an abstracted method that could be used for both
display and reports since they would most likely be the same.  This way
folks have a consistent and easy to use set of 'values' to include in
their templates and not have to worry about tweaking the code for
formatting.

Mike

Chuck Hagenbuch wrote:

| >You'll note in my data patch I commented about using an existing data
| >mapping to trip a strformat.  Maybe we add a config array that maps the
| >template variable name to a type of string format which would allow for
| >a simple array existance check and contains data check.
|
|
| Could be useful, I think - can you elaborate a bit?
|
| -chuck

- --
Mike Baptiste - mike@thebaptistes.net
Download my GnuPG key at http://thebaptistes.net/mike.gpg
- --
Mike Baptiste - MSB Networks - mike@msbnetworks.net
Download my GnuPG key at http://msbnetworks.net/msbnet.gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE93YTWtbf8BjvL+3ERAstsAJ9jHZOsK4v9YoRFzxh2n7TEmAz42ACgg9xW
BTtQ4wxDvmgzU+aU2JSTF10=
=uwJG
-----END PGP SIGNATURE-----



More information about the whups mailing list