Suscribing to a course #2

Author Message

Thomas Schamm

Saturday 11 October 2003 2:45:56 pm

I'm still confronted with one problem:
I want a user, who is logged in, to suscribe to a course. For doing that, Eirik Johansen told me, i should use the "placements of object" feature. I think he means, that i should create a node of the user under the course object. Doing this manually in the admin interface works, but i still don't know, how to do this with only one click.

I am searching for a code (in my template), i think this should be a form, where i can provide a button for the user, and if he clicks, his node should be placed under the courseobject where he is in. What i already know is the $current_user.contentobject.id and the $node.node_id, where the copy of the user should be copied to.

What i don't know, is the code for the form, and if it is possible to create a new node without getting through the 'create a new draft' ...

Thank you very much, Thomas

ps: the first topic where eirik helped me you find http://ez.no/developer/ez_publish_3/forum/developer/suscribing_to_a_course . I don't publish my question there, because i think it's not a developer question anymore.

Thomas Schamm

Tuesday 14 October 2003 1:39:23 pm

I'm afraid i will jump out of the window the next moment ... I don't get this thing working :-(
What i found out in
http://www.ez.no/developer/ez_publish_3/forum/developer/pass_additional_information_to_cart
is the possibility to bring back my $setCourseID variable in the template, but i don't get it working with the user/edit module.

If i am thinking correct, the /user/edit.php calls the /content/edit.php, and i want to take my variable from the <input type="hidden" name="setCourseID" ...> in my template file through the user/edit.php to content/edit.php and then use {$setCourseID} in my content/edit.tpl file to show my variable there.

Can someone help me here??
Kind Regards, Thomas

Thomas Schamm

Wednesday 15 October 2003 4:16:16 pm

Another try doesn't work:
My course.tpl File has a form and should transfer the $node.node_id to the /content/edit.tpl. I try it this way:

<input type="hidden" name="setCourseID" value="{$node.node_id}" />

I stored my setCourseID in my user/edit.php in a session variable:

if ( $Module->isCurrentAction( "Edit" ) )
{
if ( $http->hasPostVariable( 'setCourseID' ) )
{
$setCourseID = $http->postVariable( 'setCourseID' );
$http->setSessionVariable( 'setCourseID', $setCourseID );
$Module->redirectTo( '/content/edit/' . $UserID );
return;
}
else
{
$Module->redirectTo( '/content/edit/' . $UserID );
return;
}
}

Then, i added these Lines to user/attribute_edit.php:

if ( $http->hasSessionVariable( 'setCourseID' ) )
{
$setCourseID = $http->sessionVariable( 'setCourseID' );
$tpl->setVariable( 'setCourseID', $setCourseID );
}

But i still don't get any attribute in /content/edit.tpl with {$setCourseID}

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