forked from plribeiro3000/dotproject-audit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_auditors.php
More file actions
64 lines (58 loc) · 2.53 KB
/
add_auditors.php
File metadata and controls
64 lines (58 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$project_id = dPgetParam($_GET, 'project_id', 0);
$auditors = dPgetParam($_POST, 'auditors', 0);
require_once($AppUI->getModuleClass('audit'));
require_once($AppUI->getModuleClass('contacts'));
require_once($AppUI->getModuleClass('projects'));
require_once($AppUI->getSystemClass('libmail'));
if($auditors){
$project = new CProject();
$project->load($project_id);
foreach($auditors as $auditor){
$a = new Auditor();
$a->bind(array('project_id' => $project_id, 'contact_id' => $auditor));
if($a->store() == NULL){
$a->setMail();
$a->mail->Subject("[DotProject] Auditor");
$a->mail->Body("You have been chosen as auditor on project ". $project->project_name);
$a->mail->Send();
}
}
$AppUI->redirect('m=projects&a=view&project_id='.$project_id.'&tab='.$AppUI->getState('ProjVwTab'));
}
//setup the title block
$titleBlock = new CTitleBlock('Add Auditors');
$titleBlock->show();
$p = new CProjectAudit();
$c = new CContact();
$list = $c->loadAll();
?>
<form name="add_auditors" action="?m=audit&a=add_auditors&project_id=<?php echo $project_id; ?>" method="post">
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<thead>
<tr>
<th valign="top"><strong><?php echo $AppUI->_('Add'); ?></strong></th>
<th valign="top"><strong><?php echo $AppUI->_('Last Name'); ?></strong></th>
<th valign="top"><strong><?php echo $AppUI->_('First Name'); ?></strong></th>
<th valign="top"><strong><?php echo $AppUI->_('Email'); ?></strong></th>
</tr>
</thead>
<tbody>
<?php foreach($list as $item){ ?>
<?php if(!$p->isAuditor($project_id, $item['contact_id'])){ ?>
<tr>
<td><input type="checkbox" name="auditors[]" value="<?php echo $item['contact_id'];?>" /></td>
<td><?php echo $item['contact_last_name']; ?></td>
<td><?php echo $item['contact_first_name']; ?></td>
<td><?php echo $item['contact_email']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<input type="button" value="<?php echo $AppUI->_('back');?>" onclick="history.go(-1)" class="button" />
<input type="submit" value="<?php echo $AppUI->_('submit') ?>" class="button" />
</form>