Forums / Setup & design / Object name pattern from a Object relations datatype

Object name pattern from a Object relations datatype

Author Message

Leandro Alves

Wednesday 07 February 2007 10:20:59 am

Hello

When I create a new class I would like to have the "Object name pattern:" of this class from an attribute of a Objet relations.

For example:

I created a new class "Student" with two attributes:

<b>First Name [Text line]</b>
Name: First Name
Identifier: first_name

<b>Last Name [Text line]</b>
Name: Last Name
Identifier: last_name

And then I created other new class "School Report" with two other attributes:

<b>Student Name [Object relations]</b>
Name: Student Name
Identifier: student_name

<b>Result [Integer]</b>
Name: Result
Identifier: result

I will relate a student object in the "Student Name".

For the "School Report" class I would like to define the "Object name pattern:" with the first attribute of "Student" class. Does it possible?

By default eZ uses <student_name> as "Object name pattern:" in "School Report" class. I would like something like <student.firstname>.

I appreciate any feedback.

Thanks in advance.

Leandro

Bruce Morrison

Wednesday 07 February 2007 3:35:03 pm

Hi Leandro

I'm 99% certian that you cannot do what you want and will be limited to using the student's full name.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Leandro Alves

Wednesday 07 February 2007 6:36:10 pm

Hi Bruce!

Thanks a lot for your reply.

Do you have any suggestion how I could relate these two class in a different way?

Cheers
Leandro

Bruce Morrison

Wednesday 07 February 2007 8:23:43 pm

Hi Leandro

I don't think there is anything wrong with the way you are relating the content.

I don't understand you you can't use the student object name as the object name of the report. Maybe it's so you don't have both the student and report objects with the same name?

You can use static text the the object name of the report. e.g.

Report for <student>

HTH
Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Leandro Alves

Thursday 08 February 2007 3:04:27 am

Hi Bruce

The relation that I tried would work fine for me... The only problem is when I create a new object "School Report" in the content structure, this object is showed without a name in the content tree, it is showed just a icon without a name for a link. It because the "Object name pattern" of the "School Report" class is an object related.

I could create a new attribute in the "School Report" for the student name even I already have the student's name in the Student class. But after I will need to identify if the "School Report" pertains to the current user that is accessing the site. A student can only see his own report, he cannot see the report of others students. I cannot do that with the rule (Self) because this object will not be created by the student.

For true the "Stuent class" will be the default "User class" of eZ publish, so I will have the "user_id" to compare with the current user.

I'm here just thinking a way how to make it easier...

Thanks for you reply!

Cheers,
Leandro