File: PHPReportLink.php

package info (click to toggle)
phpreports 0.3.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 620 kB
  • ctags: 1,149
  • sloc: php: 2,668; xml: 157; makefile: 29; python: 10; sh: 2
file content (101 lines) | stat: -rwxr-xr-x 2,256 bytes parent folder | download
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
	/**
		Column link object
	*/	
	class PHPReportLink {
		var $_sType;
		var $_sExpr;
		var $_sTitle;
		var $_sTarget;

		/**
			Constructor
		*/
		function PHPReportLink($sType_="STATIC",$sExpr_="",$sTitle_="",$sTarget_="") {
			$this->_sType	=$sType_;
			$this->_sExpr	=$sExpr_;
			$this->_sTitle	=$sTitle_;
			$this->_sTarget=$sTarget_;
		}

		/**
			Set the type
			It can be of three types:
			1) DYNAMIC    - get the link value from the field value specified on the LINK element text
			2)	STATIC     - get the link value from the LINK element text
			3) EXPRESSION - get the link value from the evaluated LINK element text
		*/
		function setType($sType_="STATIC") {
			$this->_sType=strtoupper($sType_);
		}

		/**
			Get the type
		*/		
		function getType() {
			return $this->_sType;
		}

		/**
			Set the expression that will be evaluated on the link
		*/		
		function setExpr($sExpr_="") {
			$this->_sExpr=$sExpr_;
		}
		
		/**
			Get the expression
		*/
		function getExpr() {
			return $this->_sExpr;
		}

		/**
			Set the title (it's the tooltip the browser shows)
		*/		
		function setTitle($sTitle_="") {
			$this->_sTitle=$sTitle_;
		}

		/**
			Return the title
		*/		
		function getTitle() {
			return $this->_sTitle;
		}

		/**
			Set the target frame
			Same funcionality as the HTML target
		*/
		function setTarget($sTarget_="") {
			$this->_sTarget=$sTarget_;
		}

		/**
			Returns the target frame
		*/	
		function getTarget() {
			return $this->_sTarget;
		}

		/**
			Returns this link value based on it's expression and type
		*/
		function getLinkValue($oCol_) {
			$sVal="";
			if($this->_sType=="STATIC")
				$sVal=$this->_sExpr;
			else if($this->_sType=="DYNAMIC") {
				if(!isset($oCol_))
					new PHPReportsError("Specified a dynamic link but no COLUMN element found","contactdeveloper.php?msg=Specified a dynamic link but no COLUMN element found.");
				$sVal=$oCol_->getValue($this->_sExpr);
			}else if($this->_sType=="EXPRESSION") {						
				if(!isset($oCol_))
					new PHPReportsError("Specified an expression link but no COLUMN element found","contactdeveloper.php?msg=Specified an expression link but no COLUMN element found.");
				$sVal = $oCol_->availExpr($this->_sExpr);
			}
			return $sVal;
		}
	}
?>