function "write to guru"

Author Message

Vytautas Germanavičius

Monday 19 September 2005 10:46:35 am

I need function, i call it "write to guru":
Every user has assigned "guru" (another user). I need something like feedback form, but sender information must be taken from cuurent user, and destination email, must be taken from urrent user's "guru".

{set-block scope=root variable=cache_ttl}0{/set-block}

Łukasz Serwatka

Monday 19 September 2005 11:17:14 am

Hi vytis,

You can make custom extension, xhtml form, send post data to one of module view. Modify code below and fetch assigned Guru`s e-mail (you did now write, how is assigned), and send e-mail.

Example code can look:

<?php 

include_once( 'lib/ezutils/classes/ezmail.php' );
include_once( 'lib/ezutils/classes/ezmailtransport.php' );
include_once( 'lib/ezutils/classes/ezhttptool.php' );

$http =& eZHTTPTool::instance();

//Current user data
$user =& eZUser::currentuser();
$object =& $user->attribute( 'contentobject' );

//Receiver
$receiver = $object->attribute( 'assigned_guru_email' );

//E-mail sender
$emailSender = $user->atribute( 'email' );

//Message
$body = $http->postVariable( 'text' );

$mail = new eZMail
$mail->setReceiver( $receiver );
$mail->setSender( $emailSender );
$mail->setBody( $body );

$mailResult = eZMailTransport::send( $mail );

?>

This code needs some modifications but, should give you right point.

Good luck.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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 19 2025 09:59:44
Script start
Timing: Jan 19 2025 09:59:44
Module start 'layout'
Timing: Jan 19 2025 09:59:44
Module start 'content'
Timing: Jan 19 2025 09:59:44
Module end 'content'
Timing: Jan 19 2025 09:59:44
Script end

Main resources:

Total runtime0.8358 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 589.1484152.6250
Module start 'layout' 0.00460.0029 741.773439.4297
Module start 'content' 0.00740.8271 781.2031534.2266
Module end 'content' 0.83450.0013 1,315.42978.1797
Script end 0.8358  1,323.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4200160.0002
Check MTime0.00130.1506160.0001
Mysql Total
Database connection0.00070.077910.0007
Mysqli_queries0.787994.2676540.0146
Looping result0.00050.0650520.0000
Template Total0.802496.020.4012
Template load0.00230.278920.0012
Template processing0.800195.723520.4000
Template load and register function0.00010.015310.0001
states
state_id_array0.00110.133210.0011
state_identifier_array0.00110.132220.0006
Override
Cache load0.00190.2257140.0001
Sytem overhead
Fetch class attribute can translate value0.00060.070420.0003
Fetch class attribute name0.00170.199740.0004
XML
Image XML parsing0.00380.452220.0019
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00550.6564240.0002
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 11
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs