More complex relationship between table

Archived from the Xataface Users forum.

fantomasdm — Wed Sep 02, 2009 9:23 am

Is possible to create something like this:http://www.evolutility.org/demo/demo_winecellar.aspx

with xataface? With some field from primary table, and all of secondary table?


shannah — Wed Sep 02, 2009 12:48 pm

They have a very nice interface. This application looks very similar to what you would get out of a xataface application.

In fact, that particular application with Xataface could probably be written in an hour or two.


fantomasdm — Thu Sep 03, 2009 7:54 am

Is possible to see more than title of primary record ?

At this moment i have add

Code: Select all
function getTitle(&$record)    {       return $record->val('nome').' '.$record->val('cognome');    }

to class of primary table to see 2 fields (nome[name] and cognome[family name]) when view recods in browse mode (in current record) , how can I change

layout for this?

Sorry for my ItalianEnglish……


shannah — Thu Sep 03, 2009 8:44 am

You might try to fill the before_record_tabs slot with the content that you want.

e.g.

Code: Select all
function block__before_record_tabs(){     $record =& Dataface_Application::getInstance()->getRecord();         echo "Name: ".$record->htmlValue('name');  // etc.... }

This will appear just before the record tabs (e.g. View, Edit, etc..)

-Steve


fantomasdm — Fri Sep 04, 2009 12:41 am

hi! I have add this code, now if in fields.ini add attribute viewInPrimary=true

I can see it!! Thanks!!

Code: Select all
function block__before_record_tabs()         {             $record =& Dataface_Application::getInstance()->getRecord();             $table = & Dataface_Table::loadTable("anagrafica");             $fields =& $table->fields(false,true);             $fieldnames = array_keys($fields );             foreach ($fieldnames as $field)             {                 if(  @$fields[$field]['viewInPrimary'])                     echo @$fields[$field]['widget']['label'].":".$record->htmlValue(   $field )."<br>\n";             }         }