24 $app = Dataface_Application::getInstance();
25 $query =& $app->getQuery();
27 if ( $query[
'-table'] ==
'xataface__email_newsletters' ){
30 $dummy =
new Dataface_Record(
'dataface__version', array());
31 if ( $dummy->checkPermission(
'email') ){
44 if ( class_exists(
'Dataface_AuthenticationTool') ){
45 $username = Dataface_AuthenticationTool::getInstance()->getLoggedInUserName();
46 if ( $record and $username and $username == $record->val(
'posted_by') ){
47 $perms[
'cancel email job'] = 1;
52 return Dataface_PermissionsTool::NO_ACCESS();
56 $table = Dataface_Table::loadTable($query[
'-table']);
57 $perms = $table->getPermissions();
58 if ( @$perms[
'email'] ){
59 $out = array(
'new'=>1);
60 if ( class_exists(
'Dataface_AuthenticationTool') ){
61 $username = Dataface_AuthenticationTool::getInstance()->getLoggedInUserName();
62 if ( $record and $username and $username == $record->val(
'posted_by') ){
63 $out[
'cancel email job'] = 1;
69 return Dataface_PermissionsTool::NO_ACCESS();
78 if ( $record->checkPermission(
'view') ){
79 return Dataface_PermissionsTool::READ_ONLY();
81 return Dataface_PermissionsTool::NO_ACCESS();
87 $dummy =
new Dataface_Record(
'dataface__version', array());
88 if ( $dummy->checkPermission(
'email') ){
90 'add new related record' => 1,
91 'remove related record' => 1,
92 'delete related record' => 1
108 if( class_exists(
'Dataface_AuthenticationTool') ){
109 $auth = Dataface_AuthenticationTool::getInstance();
111 $record->setValue(
'posted_by', $auth->getLoggedInUserName());
125 Dataface_ModuleTool::getInstance()->loadModule(
'modules_Email')->addPaths();
127 Dataface_JavascriptTool::getInstance()->import(
'xataface/modules/Email/email_form.js');
128 echo
"<div id=\"template-instructions\"></div>";
140 $mod = Dataface_ModuleTool::getInstance()->loadModule(
'modules_Email');
143 $job = df_get_record(
'xataface__email_jobs', array(
'email_id'=>
'='.$record->val(
'id')));
144 if ( !$job )
return null;
146 Dataface_JavascriptTool::getInstance()->import(
'xataface/modules/Email/email_progress.js');
148 'jobId' => $job->val(
'job_id')
150 'xataface/modules/email/email_progress_section.html'
153 $contents = ob_get_contents();
158 'content' => $contents,
159 'label' =>
'Progress',
167 $app = Dataface_Application::getInstance();
168 if ( @$app->_conf[
'modules_Email'] and @$app->_conf[
'modules_Email'][
'attachments'] ){
169 return array(
'view'=>1,
'edit'=>1,
'new'=>1);
171 return Dataface_PermissionsTool::NO_ACCESS();
176 echo
"<h1>Email History</h1>";
177 echo
"<div class=\"portalHelp\">This section allows you to browse the history of emails that have been sent by the system.</div>";
178 echo
'<div>[<a href="'.DATAFACE_SITE_HREF.
'?-action=email_manage">Back to Email Management</a>]</div>';
183 if ( !$record->val(
"start_time") )
return '';
184 else return strftime(
'%c', $record->val(
'start_time'));
188 if ( !$record->val(
'end_time') )
return '';
189 else return strftime(
'%c', $record->val(
'end_time'));