summaryrefslogtreecommitdiff
path: root/tbc_details.inc
blob: 4c265b1e90c463ee9bf20ff8cba999fba1dbe517 (plain)
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
<?php
//  DWSIM TBC display completed Books
function dwsim_tbc_completed_book_proposal_all()
{
	$output = "";
	$query = db_select('textbook_companion_preference', 'pe');
	$query->fields('pe', array('book', 'author', 'publisher', 'year', 'id'));
	$query->leftJoin('textbook_companion_proposal', 'po', 'pe.proposal_id = po.id');
	$query->condition('po.proposal_status', 3);
	$query->condition('pe.approval_status', 1);
	$query->orderBy('pe.year', 'DESC');
	$result = $query->execute();

	if ($result->rowCount() == 0)
	{
		$output .= "Work has been completed on the following books under the Textbook Companion Project. 
					<span style='color:red;'>The list below is not the books as named but only are the solved example for DWSIM</span>";

	} //$result->rowCount() == 0
	else
	{
		/*$output .= "Total number of completed TBC: " . $result->rowCount() . "<br>";*/
		$output .= "Work has been completed on the following books under the Textbook Companion Project. <br>
					<span style='color:red;'>The list below is not the books as named but only are the solved example for DWSIM.</span>";
		$preference_rows = array();
		$i = 1;
		while ($row = $result->fetchObject())
		{
			$year = date("Y", $row->year);
			$preference_rows[] = array(
				$i,
				l($row->book, "textbook-companion/textbook-run/" . $row->id),
				$row->author,
				$row->publisher,
				$row->year
			);
			$i++;
			/*$preference_data->book . " by " . $preference_data->author . ", " . $preference_data->publisher . ", " . $preference_data->year, 'textbook-companion/textbook-run/' . $preference_data->id*/
		} //$row = $result->fetchObject()
		$preference_header = array(
			'No',
			'TBC Project',
			'Contributor Name',
			'University / Institute',
			'Year of Completion'
		);
		$output .= theme('table', array(
			'header' => $preference_header,
			'rows' => $preference_rows
		));
	}
	return $output;
}