/[libdata]/trunk/admin/infotype_drill.phtml
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/admin/infotype_drill.phtml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Fri Dec 5 18:34:18 2003 UTC (20 years, 4 months ago) by dpavlin
File size: 4994 byte(s)
Initial revision

1 dpavlin 1 <?php
2     // Load globals
3     require_once ("global_vars.php");
4    
5     // Includes
6     require_once ($GLOBAL_ADMIN_INC."sessionClass.php");
7     require_once ($GLOBAL_ADMIN_INC."accessClass.php");
8     require_once ($GLOBAL_ADMIN_INC."db_connect.php");
9     require_once ($GLOBAL_ADMIN_INC."app_controls.php");
10    
11    
12     // HTML header
13     printf("<HTML>\n");
14     printf("<HEAD>\n");
15     printf("<title>Information Type Drilldown</title>\n");
16     printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS);
17     printf("</HEAD>\n");
18    
19    
20     // Page header
21     require_once ($GLOBAL_ADMIN_HEADER);
22    
23    
24     // Collect access information
25     if(isset($libsession)) {
26    
27     // Fetch session information
28     $sessionClass = new sessionClass("", $libsession, "", "");
29     $accessClass = new accessClass($sessionClass);
30    
31     // Load user session variables
32     $sess_time_human = $sessionClass->time_human;
33     $sess_staff_account = $sessionClass->staff_account;
34     $sess_access_level = $accessClass->access_level;
35     $sess_access = $accessClass->access;
36     $sess_last_name = $accessClass->last_name;
37     $sess_first_name = $accessClass->first_name;
38    
39     }
40    
41     // If the cookie is set and access level is appropriate
42     if(isset($libsession) && $sess_access_level >= 20) {
43    
44    
45     // Fetch the information type descr. field
46     $infotype = lookupField($con, "infotype", "infotype_id", $infotype_id, "infotype");
47    
48     printf("<center>\n");
49     printf("<h3>Information Type '%s' (#%d) used on the following RQS Pages:</h3>", $infotype, $infotype_id);
50    
51     /*************************
52     ** RQS Usage Drilldowns **
53     *************************/
54    
55     printf("<table width = \"75%%\" border=\"1\"><tr>\n");
56     printf("<td width=\"40%%\" class=\"cellPlain\">RQS Subject Page(s)</td>\n");
57     printf("<td width=\"20%%\" class=\"cellPlain\">Resource</td>\n");
58     printf("<td width=\"20%%\" class=\"cellPlain\">Edit</td>\n");
59     printf("</tr>\n");
60    
61     // Build the query
62     $sql = "SELECT DISTINCT
63     i.infotype,
64     s.subject,
65     s.subject_id,
66     r.title
67    
68     FROM
69     infotype i
70     LEFT JOIN res_sub_infotype rsi using (infotype_id)
71     LEFT JOIN subject s on rsi.subject_id = s.subject_id
72     LEFT JOIN resource r on rsi.resource_id = r.resource_id
73    
74     WHERE s.subject_id > 0 AND i.infotype_id = "
75     . $infotype_id
76     . " ORDER BY s.subject";
77    
78     // Initialize counter
79     $rowcount = 0;
80    
81     $rs = mysql_query($sql, $con);
82    
83     // Cycle through the result set
84     while ( $row = mysql_fetch_array ( $rs ) ) {
85     $subject = Trim($row["subject"]);
86     $subject_id = Trim($row["subject_id"]);
87     $title = Trim($row["title"]);
88    
89     // Make every other row colored
90     if ($rowcount % 2 == 0) $color = " class=\"backLight\" ";
91     else $color = "";
92    
93     // New row
94     printf("<tr>\n");
95     printf("<td %s>%s</td>\n", $color, $subject);
96     printf("<td %s>%s</td>\n", $color, $title);
97     printf("<td %s><a href=\"subject_builder.phtml?subject_id=%d\">Edit</a></td>\n", $color, $subject_id);
98     printf("</tr>\n");
99    
100     // Increment counter
101     $rowcount++;
102     }
103    
104     /*****************************
105     ** Summary of Resource uses **
106     *****************************/
107    
108     printf("<tr><td colspan=\"2\" align=\"right\" class=\"backLight\">Total RQS Uses:</td>\n");
109     if (mysql_num_rows($rs) == 0) printf("<td class=\"backLight\">(None)</td>\n");
110     else printf("<td class=\"backLight\">%d</td>\n", mysql_num_rows($rs));
111     printf("</tr>\n");
112    
113     // Close table
114     printf("</table><br><br>\n");
115    
116     // Resources with this base infotype
117     printf("<h3>Information Type '%s' (#%d) is associated with the following Resources:</h3>", $infotype, $infotype_id);
118     printf("<table width = \"75%%\" border=\"1\"><tr>\n");
119     printf("<td width=\"80%%\" class=\"cellPlain\">Resource</td>\n");
120     printf("<td width=\"20%%\" class=\"cellPlain\">Edit</td>\n");
121     printf("</tr>\n");
122    
123     // Build the query
124     $sql = "SELECT
125     r.resource_id,
126     r.title
127    
128     FROM
129     resource r
130    
131     WHERE r.infotype_id = "
132     . $infotype_id
133     . " ORDER BY r.title";
134    
135     // Initialize counter
136     $rowcount = 0;
137    
138     $rs = mysql_query($sql, $con);
139    
140     // Cycle through the result set
141     while ( $row = mysql_fetch_array ( $rs ) ) {
142     $resource_id = Trim($row["resource_id"]);
143     $title = Trim($row["title"]);
144    
145     // Make every other row colored
146     if ($rowcount % 2 == 0) $color = " class=\"backLight\" ";
147     else $color = "";
148    
149     // New row
150     printf("<tr>\n");
151     printF("<td %s>%s</td>\n", $color, $title);
152     printf("<td %s><a href=\"operation.phtml?operation=Edit&table=resource&key_id=%d\">Edit</a></td>\n", $color, $resource_id);
153     printf("</tr>\n");
154    
155     // Increment counter
156     $rowcount++;
157     }
158    
159     // Summary of occurences in resources
160     printf("<tr><td align=\"right\" class=\"backLight\">Total associated Resources:</td>\n");
161     if (mysql_num_rows($rs) == 0) printf("<td class=\"backLight\">(None)</td>\n");
162     else printf("<td class=\"backLight\">%d</td>\n", mysql_num_rows($rs));
163     printf("</tr>\n");
164    
165     // Close table
166     printf("</table><br><br>\n");
167    
168     // Link to return to admin console
169     adminReturn($sess_access_level);
170    
171     } // logged in
172    
173     // No access page
174     else require_once ($GLOBAL_NO_ACCESS);
175    
176    
177     // Page footer
178     require_once ($GLOBAL_ADMIN_FOOTER);
179     ?>
180    
181     </body>
182     </html>
183    

  ViewVC Help
Powered by ViewVC 1.1.26