Object relation list

Object relation list

Friday 05 March 2004 2:49:35 am - 1 reply

Author Message

Trond Åge Kvalø

Friday 05 March 2004 8:23:39 am

Ok here's the results so far.
We've managed to get the current user's contentobject_id by issuing a
fetch('user', 'current_user').

We have also managed to get a list of licenses from the licenses folder (node id 107)

Then we managed to do a section show that only showed the course_id from the licenses that matched our user.

The puzzling part is that when we use:

{$mylicenses:item.object.data_map.kurs.content.relation_list.0.contentobject_id|wash}

to show the course id we get the two course_id's that we expect displaying nicely on the screen.

But if we use:

{let mylicense=$mylicenses:item.object.data_map.kurs.content.relation_list.0.contentobject_id)
  {$mylicense|wash}
{/let}

We don't see anything on screen.

Anyway the next step then, is to issue a fetch based on the course_id's that we have got like this:

{let coursename=fetch( 'content', 'node', hash( 'node_id', $mylicenses:item.object.data_map.kurs.content.relation_list.0.contentobject_id) ) }
  {$coursename.name}
{/let}

But this doesn't work either. Maybe because the course_id is a string and the node_id in the fetch shall be an integer? If this is the case, how do we convert a string to an integer?

Anyway, if someone could please take a look at the code below and enlighten us as to what is wrong, we'd be very happy.

{let myuser=fetch('user','current_user')}
The current user's user_id is: {$myuser.contentobject_id}<br />

{*node_id 107 is the licenses folder*}
{let licenses=fetch( 'content', 'list', hash( 'parent_node_id', 107 ) )}
  {section name=mylicenses loop=$licenses}
    {section name=thisuser show=$mylicenses:item.object.data_map.bruker.content.relation_list.0.contentobject_id|eq($myuser.contentobject_id)}

    {*this next line displays 115 and 113, the course contentobject_id's*}     
	  {$mylicenses:item.object.data_map.kurs.content.relation_list.0.contentobject_id|wash}

	  {*These ones doesn't work*}
	  {let mylicense=$mylicenses:item.object.data_map.kurs.content.relation_list.0.contentobject_id)
	    {$mylicense|wash}
	  {/let}
    {/section}
   <br />
  {/section}
{/let}
{/let}

trondåge

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.