File: ArtifactHtml.class

package info (click to toggle)
gforge 4.5.14-22etch13
  • links: PTS
  • area: main
  • in suites: etch
  • size: 13,004 kB
  • ctags: 11,918
  • sloc: php: 36,047; sql: 29,050; sh: 10,538; perl: 6,496; xml: 3,810; makefile: 341; python: 263; ansic: 256
file content (136 lines) | stat: -rw-r--r-- 3,735 bytes parent folder | download | duplicates (2)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/**
  *
  * SourceForge Generic Tracker facility
  *
  * SourceForge: Breaking Down the Barriers to Open Source Development
  * Copyright 1999-2001 (c) VA Linux Systems
  * http://sourceforge.net
  *
  * @version   $Id: ArtifactHtml.class 4192 2005-03-26 04:46:16Z tperdue $
  *
  */


require_once('common/tracker/Artifact.class');

class ArtifactHtml extends Artifact {

	/**
	 *  ArtifactHtml() - constructor
	 *
	 *  Use this constructor if you are modifying an existing artifact
	 *
	 *  @param $ArtifactType object
	 *  @param $artifact_id integer (primary key from database)
	 *  @return true/false
	 */
	function ArtifactHtml(&$ArtifactType,$artifact_id=false) {
		return $this->Artifact($ArtifactType,$artifact_id);
	}

	/**
	 * show details preformatted (like followups)
	 */
	function showDetails() {
		global $Language;
		$result = $this->getDetails();

		$title_arr = array();
		$title_arr[] = $Language->getText('tracker','detailed_description');
		echo $GLOBALS['HTML']->listTableTop ($title_arr);

		echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td><pre>'. util_line_wrap ( $result, 120,"\n"). '</pre></td></tr>';

		echo $GLOBALS['HTML']->listTableBottom();
	}


	function showMessages() {
		global $sys_datefmt;
		global $Language;
		$result= $this->getMessages();
		$rows=db_numrows($result);

		if ($rows > 0) {
			$title_arr=array();
			$title_arr[]=$Language->getText('tracker_artifacthtml','message');

			echo $GLOBALS['HTML']->listTableTop ($title_arr);

			for ($i=0; $i < $rows; $i++) {
				echo '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td><pre>
'.$Language->getText('tracker_artifacthtml','date').': '. date($sys_datefmt,db_result($result, $i, 'adddate')) .'
'.$Language->getText('tracker_artifacthtml','sender').': ';
				if(db_result($result,$i,'user_id') == 100) {
					echo db_result($result,$i,'realname');
				} else {
					echo '<a href="/users/'.db_result($result,$i,'user_name').'/">'.db_result($result,$i,'realname').'</a>';
				}
				echo "\n\n". util_line_wrap ( db_result($result, $i, 'body'),65,"\n"). '</pre></td></tr>';
			}

			echo $GLOBALS['HTML']->listTableBottom();

		} else {
			echo '
				<h3>'.$Language->getText('tracker_artifacthtml','no_followups').'</h3>';
		}
	}

	function showHistory() {
		global $sys_datefmt,$artifact_cat_arr,$artifact_grp_arr,$artifact_res_arr, $Language;
		$result=$this->getHistory();
		$rows= db_numrows($result);

		if ($rows > 0) {

			$title_arr=array();
			$title_arr[]=$Language->getText('tracker_artifacthtml','field');
			$title_arr[]=$Language->getText('tracker_artifacthtml','old_value');
			$title_arr[]=$Language->getText('tracker_artifacthtml','date');
			$title_arr[]=$Language->getText('tracker_artifacthtml','by');

			echo $GLOBALS['HTML']->listTableTop ($title_arr);

			$artifactType =& $this->getArtifactType();

			for ($i=0; $i < $rows; $i++) {
				$field=db_result($result, $i, 'field_name');
				echo '
				<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';

				if ($field == 'status_id') {

					echo $artifactType->getStatusName(db_result($result, $i, 'old_value'));

				} else if ($field == 'assigned_to') {

					echo user_getname(db_result($result, $i, 'old_value'));

				} else if ($field == 'close_date') {

					echo date($sys_datefmt,db_result($result, $i, 'old_value'));

				} else {

					echo db_result($result, $i, 'old_value');

				}
				echo '</td>'.
					'<td>'. date($sys_datefmt,db_result($result, $i, 'entrydate')) .'</td>'.
					'<td>'. db_result($result, $i, 'user_name'). '</td></tr>';
			}

			echo $GLOBALS['HTML']->listTableBottom();

		} else {
			echo '
			<h3>'.$Language->getText('tracker_artifacthtml','no_changes').'</h3>';
		}

	}

}

?>