laurent le cadet
|
Monday 30 October 2006 9:01:54 am
Hi,
I allow creation of one type of object for user which are loggin (curriculum vitae). I want to know if they already published there CV (only one per user) or not but don't know exactly how to do it. I'm thinking about something like that but some piece of code are missing :
{section show=$current_user.is_logged_in}
{set cv=fetch(content, list, hash (parent_node_id, 153,
class_filter_type, include,
class_filter_array, array( 'cv' )......How to fetch curent is owner of a CV ? )) }
{set list_count=fetch_alias( children_count, hash( parent_node_id, 153,
class_filter_type, include,
class_filter_array, array( 'cv' ) ))}
{section show=$list_count|gt(0)}
<a href="/content/view/full/153" />My CV</a>
{section-else}
<form method="post" action={"content/action"|ezurl}>
<input type="hidden" name="ClassIdentifier" value="cv" />
<input type="hidden" name="NodeID" value="153" />
<input class="searchbutton" type="submit" name="NewButton" value="Create CV" />
</form>
{/section}
Any hint ? Regards. Laurent
|
laurent le cadet
|
Thursday 02 November 2006 2:19:24 am
Thanks again Claudia, This code do the trick :
{def $count=fetch( 'content', 'list_count', hash( 'parent_node_id', 153,
'attribute_filter', array(
array( 'owner',
'=',
$current_user.contentobject_id ) ) ) )}
{section show=$count|eq(0)}
<form method="post" action={"content/action"|ezurl}>
<input type="hidden" name="ClassIdentifier" value="cv" />
<input type="hidden" name="NodeID" value="153" />
<input class="searchbutton" type="submit" name="NewButton" value="Create CV" />
</form>
{/section}
{undef $count}
Laurent
|