![]() |
Xataface Email Module 0.3
Email/Mailmerge Module for Xataface
|
00001 <?php 00002 class actions_email_progress { 00003 00004 function handle($params){ 00005 00006 $app = Dataface_Application::getInstance(); 00007 $query = $app->getQuery(); 00008 $jobId = @$query['-job-id']; 00009 00010 if ( !@$jobId ) throw new Exception("No job id provided"); 00011 00012 $jobRecord = df_get_record('xataface__email_jobs', array("job_id"=>'='.$jobId)); 00013 if ( !$jobRecord ){ 00014 throw new Exception("The job could not be found."); 00015 } 00016 00017 $emailRecord = df_get_record('xataface__email_newsletters', array('id'=>'='.$jobRecord->val('email_id'))); 00018 if ( !$emailRecord ){ 00019 throw new Exception("The email for this job could not be found."); 00020 } 00021 if ( class_exists('Dataface_AuthenticationTool') ){ 00022 00023 00024 $postedBy = $emailRecord->val('posted_by'); 00025 if ( $postedBy != Dataface_AuthenticationTool::getInstance()->getLoggedInUserName() ){ 00026 return Dataface_Error::permissionDenied("Only the user who sent this email can see its progress."); 00027 00028 } 00029 } 00030 00031 $mod = Dataface_ModuleTool::getInstance()->loadModule('modules_Email'); 00032 $mod->addPaths(); 00033 00034 Dataface_JavascriptTool::getInstance()->import('xataface/modules/Email/email_progress.js'); 00035 df_display(array( 00036 'jobId' => $jobId 00037 ), 00038 'xataface/modules/email/email_progress.html' 00039 ); 00040 00041 00042 00043 } 00044 00045 }