std.list3 problem [message #360] |
Mon, 06 November 2006 03:28 |
johandewit
Messages: 25 Registered: May 2006 Location: Belgium
|
Junior Member |
|
|
Hi,
Using the list3 pattern, the parent part is not displayed.
The xml file seems ok, all data is there for the three tables.
Tables involved :
user
input, both for child and parent.
Parent - displays user related data
Child - displays week related data
Grandchild - diplays lines relevant for the selected week.
The std.list3 pattern is used without a prvious form, so I don't have a $selection criteria. The user data I want to display is that of the user logged in the system.
I think i solved this by generating a $where string in the _cm_initialize() function of my user class.
function _cm_initialise($where)
{
if ( $GLOBALS['task_id'] == 'ts_in_input(list3)' )
{
if (empty($where))
{
if (!empty($_SESSION['logon_user_id'])) {
$where = 'log = "' . strtolower($_SESSION['logon_user_id']) . '"';
if ($this->getCount($where) == 1 )
{
// create a new object, to keep this ine clean.
$tmp_object=new $this->tablename;
$fieldarray = $tmp_object->getData_raw($where);
$where_array= $tmp_object->getPkeyArray($fieldarray);
$where = array2where($where_array);
} else {
$where= NULL; // not a regular user
}
}
}
}
return $where;
}
The child part is an extended class of the input class, which contains all inputted data. It calculates some week related fields.
The grandchild then displays the data entered by the user for the selected week, but is empty at the moment.
I suspect I have to set some properties in the user class, but just don't know which one.
Meanly that's why i used another user object, to keep the current one clean, and I only creates the where string, just to avoid to set everything by hand for the user instance.
I included the generetated xml file.
Is there a way in radicore to test an xmkl file, so one can change this file by hand to discover which setting causes the touble ?
greetings
|
|
|
|
Re: std.list3 problem [message #362 is a reply to message #361] |
Mon, 06 November 2006 08:30 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The XSL stylesheet is looking for elements in the XML document with the identity of "aasa_user.user" which do not exist. They have the name "user" instead. I cannot understand why this is happening.
If you look in file include.xml.php4.inc you will see in function addData2XMLdoc() a call to $dbobject->getClassName() which provides the element identity for writing data from that object out to the XL document. The getClassName() function exists within file std.table.class.inc.
Can you step through with your debugger and see what is happening at that point?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
[Updated on: Mon, 06 November 2006 08:30] Report message to a moderator
|
|
|
Re: std.list3 problem [message #363 is a reply to message #362] |
Mon, 06 November 2006 09:31 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The problem looks to be in your screen structure file which (I'm guessing here) contains the line:
$structure['tables']['outer'] = 'aasa_user.user';
instead of
$structure['tables']['outer'] = 'user';
It must contain ONLY the table name, not the table name prefixed with the database name. That is why there is a mismatch in the XML document between the data entry and the structure entry. The two names must match EXACTLY, in case as well as spelling.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: std.list3 problem [message #365 is a reply to message #364] |
Mon, 06 November 2006 11:16 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Glad you got it fixed.
For your information the only place where you need to specify any database names (apart from the database table classes) is where you want to access tables in different databases in the same SQL query. In all other cases the database name is assumed to be the "current" database name, as declared in the database table class.
In patterns such as LIST3 where you supply several different table names you do not need to specify database names as each table is accessed in a separate SQL query. The only requirement is that the table names for each zone is unique, so if you want to access the same table more than once you can provide an alias name by using a subclass.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|