| Main Page |
| General |
|---|
|
Basic Use Custom Formats Extra Info Credits |
| Modules |
|
Address Book Datebook DOC List Memo Pad MobileDB SmallBASIC Todo |
| Examples |
|
Bookmark Test Spade Twister |
| SourceForge |
|
Download Project Page Mailing Lists Bug Reporting |
The todo module is mostly straightforward, and should be fairly easy to use.
If you install a database created with this class onto your handheld, it will overwrite the one that already exists on your handheld. This is because a new database will have the same name as the current database on your handheld and you can't change the name of the database otherwise the application won't work. This is obviously irritating -- please keep this in mind. An ideal use for this PHP class would be for talking to a conduit, where the conduit would upload the current data, the server would parse it and add/modify/delete entries with this class, the server would send the modified file back to the conduit, and the conduit would replace the device's database with the modified one.
| include 'php-pdb.inc'; include 'modules/todo.inc'; |
Since a todo list has a specified type, creator, and name, the class takes care of knowing what they are. Creation of a new database is a snap.
| $DB = new PalmTodoList(); |
This is the same as the base class. See Basic Use for more information.
This is the same as the base class. See Basic Use for more information.
This supports categories and attributes. See Basic Use for more information.
The data for the GetRecordRaw and the data returned from SetRecordRaw is a specially formatted array, as detailed below. Optional values can be set to '' or not defined. If an optional value is anything else (including zero), it is considered to be set.
| Key | Example | Description |
|---|---|---|
| Description | This is my todo | Short description of thing to do |
| Note | Extended information | [Optional] A note attached to the record |
| DueDate | 2001-01-23 | [Optional] Year, month, and day of when the item should be done |
| Priority | 1 | [Optional]Priority of the event ([1-5]) |
| Completed | false | [Optional] True/false indicating whether the action was completed or not. |
If description is not specified, then the string 'No description' will be used instead.
| // Write Example $todo = new PalmTodoList(); $categories = array(1 => 'Visita', 'Fax', 'Correo'); $todo->SetCategoryList($categories); $record = array('Description' => 'Enviar Fax', 'Note' => "25\nProbar palm", 'Priority' => 2); $todo->SetRecordRaw($record); $todo->SetRecordAttrib(2); // Category 2 $todo->GoToRecord('+1'); $record = array('Description' => 'Llamar a juan', 'Note' => '35', 'Completed' => true, 'DueDate' => '2002-5-31'); $todo->SetRecordRaw($record); $todo->SetRecordAttrib(PDB_RECORD_ATTRIB_DIRTY | PDB_RECORD_ATTRIB_PRIVATE | 0); // Category 0, dirty, private $fp = fopen('./pdbs/todo.pdb','wb'); $todo->WriteToFile($fp); fclose($fp); |
| // Read Example $pdb = new PalmTodoList(); $fp = fopen('./tdread.pdb', 'r'); $pdb->ReadFile($fp); fclose($fp); echo "Name: $pdb->Name<BR>\n"; echo "Type ID: $pdb->TypeID<br>\n"; echo "Creator: $pdb->CreatorID<br>\n"; echo "Attributes: $pdb->Attributes<br>\n"; echo "Version: $pdb->Version<br>\n"; echo "ModNum: $pdb->ModNumber<br>\n"; echo "CreationTime: $pdb->CreationTime<br>\n"; echo "ModTime: $pdb->ModificationTime<br>\n"; echo "BackTime: $pdb->BackupTime<br>\n"; echo 'NumRec: '.$pdb->GetRecordCount()."<br>\n"; $recids = $pdb->GetRecordIDs(); $record1 = $pdb->GetRecordRaw($recids[0]); $attrib = $pdb->GetRecordAttrib($recids[0]); echo "record1 = $record1<br>\n"; echo "Desc: " . $record1['Description'] . "<br>\n"; echo "Note: " . $record1['Note'] . "<br>\n"; echo 'Due Date: ' . $record1['DueDate'] . "<br>\n"; echo 'Cat: ' . $record1['Category'] . "<br>\n"; $categories = $pdb->GetCategoryList(); echo "NumCat = " . count($categories) . "<br>\n"; foreach ($categories as $k => $v) { echo "categories[$k] = $v<br>\n"; foreach ($categories[$k] as $key => $val) { echo " categories[$k][$key] = $val<br>"; } } |