forked from AppStateESS/InternshipInventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAffiliationContract.php
86 lines (74 loc) · 1.88 KB
/
AffiliationContract.php
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace Intern;
/**
* Represents an Affiliation Contract
*
* @author Chris Detsch
* @package Intern
*/
class AffiliationContract
{
public $agreement_id;
public $document_id;
/**
* @Override Model::getDb
*/
public static function getDb(){
return new PHPWS_DB('intern_agreement_contract');
}
/**
* Getters
*/
public function getAgreementId()
{
return $this->agreement_id;
}
public function getDocumentId()
{
return $this->document_id;
}
/**
* Setters
*/
public function setAgreementId($agreementId)
{
$this->agreement_id = $agreementId;
}
public function setDocumentId($documentId)
{
$this->document_id = $documentId;
}
/**
* Get the link to download this document.
*/
public function getDownloadLink()
{
\PHPWS_Core::initModClass('filecabinet', 'Document.php');
$doc = new \PHPWS_Document($this->document_id);
return \PHPWS_Text::moduleLink($doc->title, 'filecabinet', array('id' => $doc->id));
}
/**
* Get the link to delete this document.
*/
public function getDeleteLink()
{
$vars = array();
$vars['doc_id'] = $this->document_id;
$vars['action'] = 'delete_affiliation_contract';
$link = new \PHPWS_Link(null, 'intern', $vars);
$jsVars = array();
$jsVars['QUESTION'] = 'Are you sure you want to delete this document?';
$jsVars['ADDRESS'] = $link->getAddress();
$jsVars['LINK'] = '<i class="fa fa-trash-o close"></i>';
return javascript('confirm', $jsVars);
}
/**
* Get the folder ID storing documents.
*/
public static function getFolderId()
{
$db = new \PHPWS_DB('folders');
$db->addWhere('module_created', 'intern');
return $db->select('one');
}
}