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
|
<?php
/* function _list_all_certificates()
{
global $user;
$uid1 = $user->uid;
$query2 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE proposal_status=3 AND uid=".$user->uid);
$data2 = db_fetch_object($query2);
if($data2->id)
/*while($data2 = db_fetch_object($query2))
{*/
/* if($data2->id)
{
$search_rows = array();
global $output;
$output = '';
$query3 = db_query("SELECT * FROM textbook_companion_preference WHERE approval_status=1 AND proposal_id=".$data2->id);
while ($search_data3 = db_fetch_object($query3))
{
$search_rows[] = array($search_data3->isbn,$search_data3->book,$search_data3->author,l('Download Certificate', 'certificate/generate_pdf/'.$search_data3->id));
}
if ($search_rows)
{
$search_header = array('ISBN', 'Book Name', 'Author', 'Download Certificates');
$output = theme_table($search_header, $search_rows);
return $output;
}
else
{
echo("Error");
return '';
}
}
else
{
$query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE uid=".$user->uid);
$data3 = db_fetch_object($query3);
if($data3)
{
drupal_set_message('<strong>Your book is still under Review!</strong>', 'status');
return '';
}
else
{
drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
return '';
}
}
//}
} */
function _list_all_certificates()
{
global $user;
$query_id =db_query("SELECT id FROM textbook_companion_proposal WHERE proposal_status=3 AND uid=".$user->uid);
$exist_id = db_fetch_object($query_id);
if($exist_id->id)
{
if($exist_id->id<3)
{
drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
return '';
}
else
{
$search_rows = array();
global $output;
$output = '';
$query3 = db_query("SELECT prop.id,pref.isbn,pref.book,pref.author FROM textbook_companion_proposal as prop,textbook_companion_preference as pref WHERE prop.proposal_status=3 AND pref.approval_status=1 AND pref.proposal_id=prop.id AND prop.uid=".$user->uid);
while ($search_data3 = db_fetch_object($query3))
{
if($search_data3->id)
{
$search_rows[] = array($search_data3->isbn,$search_data3->book,$search_data3->author,l('Download Certificate', 'certificate/generate_pdf/'.$search_data3->id));
}
}
if($search_rows)
{
$search_header = array('ISBN', 'Book Name', 'Author', 'Download Certificates');
$output = theme_table($search_header, $search_rows);
return $output;
}
else
{
echo("Error");
return '';
}
}
}
else
{
drupal_set_message('<strong>You need to propose a book <a href="/proposal">Book Proposal</a></strong>', 'status');
return '';
}
}
?>
|