| |
509 |
509 |
|
| |
510 |
510 |
if { [string equal $sim_template(casting_type) "open"] || [string equal $sim_template(casting_type) "group"] } { |
| |
511 |
511 |
# Notify users that they are enrolled and can do their casting |
| |
512 |
512 |
|
| |
513 |
513 |
set subject "You have been enrolled in simulation $sim_template(pretty_name)" |
| |
514 |
514 |
set package_id [ad_conn package_id] |
| |
515 |
515 |
set casting_page_url \ |
| |
516 |
516 |
[export_vars -base "[ad_url][apm_package_url_from_id $package_id]simplay/cast" { workflow_id }] |
| |
517 |
517 |
set body "Dear $user_name, |
| |
518 |
518 |
This is to notify you that you have been enrolled in simulation $sim_template(pretty_name). You may visit the |
| |
519 |
519 |
casting page at ${casting_page_url} to choose case or role. |
| |
520 |
520 |
" |
| |
521 |
521 |
|
| |
522 |
522 |
acs_mail_lite::send \ |
| |
523 |
523 |
-to_addr $email \ |
| |
524 |
524 |
-from_addr [ad_system_owner] \ |
| |
525 |
525 |
-subject $subject\ |
| |
526 |
526 |
-body $body |
| |
527 |
527 |
} |
| |
528 |
528 |
|
| |
529 |
|
# Sign the user up for immediate email notification for received messages in the simulation |
| |
|
529 |
# Sign the user up for email notification of received messages |
| |
530 |
530 |
notification::request::new \ |
| |
531 |
531 |
-type_id [notification::type::get_type_id -short_name [simulation::notification::message::type_short_name]] \ |
| |
532 |
532 |
-user_id $user_id \ |
| |
533 |
533 |
-object_id [ad_conn package_id] \ |
| |
534 |
534 |
-interval_id [notification::get_interval_id -name "instant"] \ |
| |
535 |
535 |
-delivery_method_id [notification::get_delivery_method_id -name "email"] |
| |
|
536 |
|
| |
|
537 |
# Sign up the user for email notification of assigned tasks |
| |
|
538 |
notification::request::new \ |
| |
|
539 |
-type_id [notification::type::get_type_id -short_name "workflow_assignee"] \ |
| |
|
540 |
-user_id $user_id \ |
| |
|
541 |
-object_id [ad_conn package_id] \ |
| |
|
542 |
-interval_id [notification::get_interval_id -name "instant"] \ |
| |
|
543 |
-delivery_method_id [notification::get_delivery_method_id -name "email"] |
| |
536 |
544 |
} |
| |
537 |
545 |
|
| |
538 |
546 |
ad_proc -public simulation::template::enroll_and_invite_users { |
| |
539 |
547 |
{-workflow_id:required} |
| |
540 |
548 |
} { |
| |
541 |
549 |
Enroll users in a simulation and notify them by email if casting |
| |
542 |
550 |
type is open or group. |
| |
543 |
551 |
|
| |
544 |
552 |
@author Peter Marklund |
| |
545 |
553 |
} { |
| |
546 |
554 |
simulation::template::get -workflow_id $workflow_id -array sim_template |
| |
547 |
555 |
|
| |
548 |
556 |
set enroll_user_list [list] |
| |
549 |
557 |
set invite_email_list [list] |
| |
550 |
558 |
db_foreach select_enrolled_and_invited_users { |
| |
551 |
559 |
select distinct pamm.member_id as user_id, |
| |
552 |
560 |
cu.email, |
| |
553 |
561 |
cu.first_names || ' ' || cu.last_name as user_name, |
| |
554 |
562 |
spsm.type |
| |
555 |
563 |
from sim_party_sim_map spsm, |