Page 1 of 1

More complex relationship between table

PostPosted: Wed Sep 02, 2009 9:23 am
by fantomasdm
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?

PostPosted: Wed Sep 02, 2009 12:48 pm
by shannah
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.

PostPosted: Thu Sep 03, 2009 7:54 am
by fantomasdm
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......

PostPosted: Thu Sep 03, 2009 8:44 am
by shannah
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

PostPosted: Fri Sep 04, 2009 12:41 am
by fantomasdm
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";
            }
        }