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.

eZ debug

Timing: Jan 31 2025 01:29:22
Script start
Timing: Jan 31 2025 01:29:22
Module start 'layout'
Timing: Jan 31 2025 01:29:22
Module start 'content'
Timing: Jan 31 2025 01:29:22
Module end 'content'
Timing: Jan 31 2025 01:29:22
Script end

Main resources:

Total runtime0.0273 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.1250151.2109
Module start 'layout' 0.00530.0055 739.3359220.6719
Module start 'content' 0.01080.0148 960.0078997.6328
Module end 'content' 0.02560.0017 1,957.640633.9922
Script end 0.0273  1,991.6328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003011.0145140.0002
Check MTime0.00124.4618140.0001
Mysql Total
Database connection0.00093.295110.0009
Mysqli_queries0.003312.061730.0011
Looping result0.00000.084610.0000
Template Total0.00114.010.0011
Template load0.00083.010010.0008
Template processing0.00030.994910.0003
Override
Cache load0.00062.151110.0006
General
dbfile0.00031.042080.0000
String conversion0.00000.036640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs