Xataface 2.0
Xataface Application Framework
tables/Profiles/Profiles.php
Go to the documentation of this file.
00001 <?php
00002 // A delegate class for the Profiles table.
00003 // This may contain parsing functions, serializing functions, and formatting functions
00004 // It may also contain permissions functions.
00005 // It may also contain
00006 class tables_Profiles {
00007 /*
00008         //Examples of functions
00009         
00010         // Signatures
00011         // ==========
00012         //
00013         // Field Functions
00014         // ----------------
00015         // function field_name__parse($value);
00016         // function field_name__pushValue($value, &$quickform_element);
00017         // function field_name__pullValue(&$quickform_element);
00018         // function field_name__serialize($value);
00019         // function field_name__toString($value);
00020         // function field_name__permissions($user, &$record);
00021         // function field_name__link($values=null);
00022         //
00023         // Table Functions
00024         // ----------------
00025         // function permissions($user, &$record);
00026         // function init(&$table);
00027         // function beforeSave(&$record);
00028         // function afterSave(&$record);
00029         // function beforeUpdate(&$record);
00030         // function afterUpdate(&$record);
00031         // function beforeDelete(&$record);
00032         // function afterDelete(&$record);
00033 
00034         
00035         // A Parsing function that doesn't do anything.  This is called anytime the
00036         // value of the `created` field's value is set.  It should handle any type
00037         // of input that may be received especially input as would be received from
00038         // the database directly.  It must also be able to handle input in the native
00039         // format.  Ie: if $value is given in the correct format to be stored, it should
00040         // be passed through with no change.  
00041         //
00042         // assertTrue( created__parse( created__parse($value) ) == created__parse($value) )
00043         //              ie: This function is transitive.
00044         function created__parse($value){
00045                 return $value;
00046         }
00047         
00048         // Prepares the value of a quickform_element to be inserted into the table.  
00049         // The output of this function should be acceptable as input for created__parse($value)
00050         function created__prepare($quickform_element){
00051                 
00052                 return $quickform_element->getValue();
00053         
00054         }
00055         
00056         // A function that takes a value in the specific format that is stored in the table
00057         // and formats it in such a way that it can be stored in the database.
00058         //
00059         // assertTrue( created__serialize($value) == created__serialize( created__parse( created__serialize($value) ) )
00060         //              ie: The output of this function should be acceptable to create__parse and vice versa
00061         function created__serialize($value){
00062                 return $value;
00063         }
00064         
00065         // A function that takes a value as stored in the table and formats it as a string.
00066         // The output should be consistent as it is also used to compare fields for equality.
00067         function created__toString($value){
00068                 return $value;
00069         }
00070         
00071         // Returns a permissions array indicating whether this user has view or update permissions
00072         // Presumeably this function
00073         function created__permissions($user, &$record){
00074                 return array(
00075                         'View' => true,
00076                         'Update' => false);
00077                 
00078         }
00079         */
00080         
00081         
00082         function fname__link(&$record){
00083                 if ( !is_a($record, "Dataface_Record") ){
00084                         trigger_error("in tables_Profiles::fname__link() expecting 'Dataface_Record' as first argument but received '".get_class($record)."'.\n<br>".Dataface_Error::printStackTrace(), E_USER_ERROR);
00085                 }
00086                 
00087                 return array(
00088                         "-action"=>"browse",
00089                         "-table"=>"Profiles",
00090                         "fname"=>$record->strval('fname'),
00091                         "lname"=>$record->strval('lname'),
00092                         "description"=>"My name is \$fname");
00093         }
00094         
00095         function lname__link(&$record){
00096                 if ( !is_a($record, "Dataface_Record") ){
00097                         trigger_error("in tables_Profiles::lname__link() expecting 'Dataface_Record' as first argument but received '".get_class($record)."'.\n<br>".Dataface_Error::printStackTrace(), E_USER_ERROR);
00098                 }
00099                 
00100                 
00101                 return "http://www.google.ca?fname=".$record->strval('fname')."&lname=".$record->strval('lname');
00102         }
00103         
00104         function description__link(&$record){
00105                 
00106                 return "http://www.google.ca?fname=\$fname&lname=\$lname";
00107         }
00108 }
00109 
00110 
00111 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations