-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_table.php
104 lines (94 loc) · 3.71 KB
/
index_table.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
// this is another example showing how the dPFramework is working
// additionally we will have an easy database connection here
// as we are now within the tab box, we have to state (call) the needed information saved in the variables of the parent function
GLOBAL $AppUI, $canRead, $canEdit, $project_id;
if (!$canRead) { // lock out users that do not have at least readPermission on this module
$AppUI->redirect( "m=public&a=access_denied" );
}
//prepare an html table with a head section
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
<th nowrap="nowrap"> </th>
<th nowrap="nowrap"> </th>
<th nowrap="nowrap"><?php echo $AppUI->_( 'Name' ); // use the method _($param) of the UIclass $AppUI to translate $param automatically
?></th>
<th nowrap="nowrap"><?php echo $AppUI->_( 'Description' ); // use the method _($param) of the UIclass $AppUI to translate $param automatically
?></th>
<th nowrap="nowrap"><?php echo $AppUI->_( 'Result' ); // use the method _($param) of the UIclass $AppUI to translate $param automatically
?></th>
<th nowrap="nowrap"><?php echo $AppUI->_( 'Task' ); // use the method _($param) of the UIclass $AppUI to translate $param automatically
?></th>
</tr>
<?php
// retrieving some dynamic content using an easy database query
$tab = $AppUI->getState( 'TestingIdxTab' ) !== NULL ? $AppUI->getState( 'TestingIdxTab' ) : "";
$sql = "SELECT unittest_id,unittest_name,unittest_passed,unittest_description,unittest_lasttested ,task_name
FROM unittest
LEFT OUTER JOIN tasks ON unittest_task_id = task_id"; // prepare the sqlQuery command to get all quotes from the einstein table
$sql.=" WHERE 1=1";
if($tab=="0")
$sql.= " AND unittest_passed IS NULL";
if($tab=="1")
$sql.= " AND unittest_passed = 0";
if($tab=="2")
$sql.= " AND unittest_passed = 1";
if($project_id > 0)
$sql.= " AND unittest_project_id = ".$project_id;
// pass the query to the database, please consider always using the (still poor) database abstraction layer
$quotes = db_loadList( $sql ); // retrieve a list (in form of an indexed array) of einstein quotes via an abstract db method
// add/show now gradually the einstein quotes
foreach ($quotes as $row) { //parse the array of einstein quotes
?>
<tr>
<td nowrap="nowrap" width="20">
<?php if ($canEdit) { // in case of writePermission on the module show an icon providing edit functionality for the given quote item
// call the edit site with the unique id of the quote item
echo "\n".'<a href="./index.php?m=testing&a=addedit&unittest_id=' . $row["unittest_id"] . '">';
// use the dPFrameWork to show the image
// always use this way via the framework instead of hard code for the advantage
// of central improvement of code in case of bugs etc. and for other reasons
echo dPshowImage( './images/icons/stock_edit-16.png', '16', '16' );
echo "\n</a>";
}
?>
</td>
<td nowrap="nowrap" width="20">
<?php
if ($canEdit) { // in case of writePermission on the module show an icon providing edit functionality for the given quote item
// call the edit site with the unique id of the quote item
echo "\n".'<a href="./index.php?m=testing&a=runtest&unittest_id=' . $row["unittest_id"] . '">';
// use the dPFrameWork to show the image
// always use this way via the framework instead of hard code for the advantage
// of central improvement of code in case of bugs etc. and for other reasons
echo dPshowImage( './images/icons/stock_ok-16.png', '16', '16' );
echo "\n</a>";
}
?>
</td>
<td >
<?php
echo $row["unittest_name"];
?>
</td>
<td >
<?php
echo $row["unittest_description"];
?>
</td>
<td >
<?php
echo $row["unittest_result"];
?>
</td>
<td >
<?php
echo $row["task_name"];
?>
</td>
</tr>
<?php
}
?>
</table>