Xataface Email Module  0.3.2
Email/Mailmerge Module for Xataface
 All Data Structures Files Functions Variables Pages
email_progress.php
Go to the documentation of this file.
1 <?php
3 
4  function handle($params){
5 
6  $app = Dataface_Application::getInstance();
7  $query = $app->getQuery();
8  $jobId = @$query['-job-id'];
9 
10  if ( !@$jobId ) throw new Exception("No job id provided");
11 
12  $jobRecord = df_get_record('xataface__email_jobs', array("job_id"=>'='.$jobId));
13  if ( !$jobRecord ){
14  throw new Exception("The job could not be found.");
15  }
16 
17  $emailRecord = df_get_record('xataface__email_newsletters', array('id'=>'='.$jobRecord->val('email_id')));
18  if ( !$emailRecord ){
19  throw new Exception("The email for this job could not be found.");
20  }
21  if ( class_exists('Dataface_AuthenticationTool') ){
22 
23 
24  $postedBy = $emailRecord->val('posted_by');
25  if ( $postedBy != Dataface_AuthenticationTool::getInstance()->getLoggedInUserName() ){
26  return Dataface_Error::permissionDenied("Only the user who sent this email can see its progress.");
27 
28  }
29  }
30 
31  $mod = Dataface_ModuleTool::getInstance()->loadModule('modules_Email');
32  $mod->addPaths();
33 
34  Dataface_JavascriptTool::getInstance()->import('xataface/modules/Email/email_progress.js');
35  df_display(array(
36  'jobId' => $jobId
37  ),
38  'xataface/modules/email/email_progress.html'
39  );
40 
41 
42 
43  }
44 
45 }