1 |
<?php |
<?php |
2 |
/********************************************************** |
/********************************************************** |
3 |
Function Library: delete.php |
Function Library: delete.php |
4 |
Original Author: Paul Bramscher <brams006@tc.umn.edu> |
Original Author: Paul Bramscher <brams006@umn.edu> |
5 |
Last Modified: 11.04.2003 by Paul Bramscher |
Last Modified: 03.16.2004 by Paul Bramscher |
6 |
*********************************************************** |
*********************************************************** |
7 |
Comments: |
Comments: |
8 |
This library brings together all SQL delete functions |
This library brings together all SQL delete functions |
9 |
and "confirm" type promots for LibData general setup |
and confirm delete prompts for LibData general setup |
10 |
tables. Those pertaining to CLPS and RQS are located in |
tables. Those pertaining to PageScribe and SubjectBuilder |
11 |
scribe_application.php and are located in subject_builder.php |
are located in scribe_application.php and |
12 |
respectively. |
subject_builder.php respectively. |
13 |
*********************************************************** |
*********************************************************** |
14 |
Table of Contents: |
Table of Contents: |
15 |
deleteCampus |
deleteCampus |
33 |
deleteMastersubjectConfirm |
deleteMastersubjectConfirm |
34 |
deleteResFeature |
deleteResFeature |
35 |
deleteResLoc |
deleteResLoc |
36 |
|
deleteResMastersubject |
37 |
deleteResource |
deleteResource |
38 |
deleteResourceConfirm |
deleteResourceConfirm |
39 |
deleteService |
deleteService |
58 |
deleteSubStaff |
deleteSubStaff |
59 |
deleteTerm |
deleteTerm |
60 |
deleteTermConfirm |
deleteTermConfirm |
61 |
|
deleteVendor |
62 |
|
deleteVendorConfirm |
63 |
**********************************************************/ |
**********************************************************/ |
64 |
|
|
65 |
|
|
66 |
/********************************************************** |
/********************************************************** |
67 |
Function: deleteCampus |
Function: deleteCampus |
68 |
Author: Paul Bramscher |
Author: Paul Bramscher |
69 |
Last Modified: 06.04.2003 |
Last Modified: 03.16.2004 |
70 |
*********************************************************** |
*********************************************************** |
71 |
Purpose: |
Purpose: |
72 |
Deletes a supplied campus id, sets affected course |
Deletes a supplied campus id, sets affected course |
73 |
pages to NULL campus. |
pages to NULL campus. |
74 |
**********************************************************/ |
**********************************************************/ |
75 |
function deleteCampus($con, $campus_id){ |
function deleteCampus($campus_id){ |
76 |
|
|
77 |
// Draw form heading |
msgTableOpen(1, "Deleting Campus (ID# " . $campus_id . ")"); |
78 |
printf("<center><h3>Deleting Campus...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
79 |
|
|
80 |
// Cannot delete placeholder #1. |
// Cannot delete placeholder #1. |
81 |
if ($campus_id > 1) { |
if ($campus_id > 1) { |
82 |
|
|
83 |
// First clear out any coursescribe pages |
// First clear out any coursescribe pages |
84 |
$sql = "UPDATE course SET campus_id = NULL WHERE campus_id = " |
$sql = "UPDATE course SET campus_id = NULL WHERE campus_id = " . $campus_id; |
85 |
. $campus_id; |
if (xx_tryquery($sql)) printf("Campus purged from assignments to course pages.<br>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Campus purged from assignments to course pages.<BR>\n"); |
|
|
} |
|
86 |
|
|
87 |
// Delete from the coursesub table |
// Delete from the coursesub table |
88 |
if ($problem == 0) { |
$sql = "UPDATE coursesub SET campus_id = 1 WHERE campus_id =" . $campus_id; |
89 |
$sql = "UPDATE coursesub SET campus_id = 1 WHERE campus_id =" . $campus_id; |
if (xx_tryquery ($sql)) printf("Removed from affected Course Subjects.<br>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed from affected Course Subjects.<BR>\n"); |
|
|
} |
|
|
} |
|
90 |
|
|
91 |
// Delete from the campus table |
// Delete from the campus table |
92 |
if ($problem == 0) { |
$sql = "DELETE FROM campus WHERE campus_id =" . $campus_id; |
93 |
$sql = "DELETE FROM campus WHERE campus_id =" . $campus_id; |
if (xx_tryquery ($sql)) printf("Removed this campus successfully."); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this campus successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
94 |
|
|
95 |
} |
} |
96 |
else printf("Cannot delete <b>Campus ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
else printf("Cannot delete Campus ID# 1, it acts as a system placeholder."); |
97 |
|
|
98 |
printf("</td></tr></table>"); |
printf("<br><br>\n"); |
99 |
printf("</center>"); |
msgTableClose(); |
100 |
} |
} |
101 |
|
|
102 |
|
|
103 |
/********************************************************** |
/********************************************************** |
104 |
Function: deleteCampusConfirm |
Function: deleteCampusConfirm |
105 |
Author: Paul Bramscher |
Author: Paul Bramscher |
106 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
107 |
*********************************************************** |
*********************************************************** |
108 |
Purpose: |
Purpose: |
109 |
Confirm prompt for deleting the selected campus. |
Confirm prompt for deleting the selected campus. |
110 |
**********************************************************/ |
**********************************************************/ |
111 |
function deleteCampusConfirm($con, $key_id){ |
function deleteCampusConfirm($key_id){ |
112 |
|
|
|
// Make sure we have a valid integer type |
|
113 |
$campus_id = (int) $key_id; |
$campus_id = (int) $key_id; |
114 |
|
msgTableOpen(1, "Delete Campus (ID# " . $campus_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Campus ID# %s?</h3>", $campus_id); |
|
115 |
|
|
116 |
// Check to see if its possible |
// Check to see if its possible |
117 |
$exists = existsRow($con, "campus", "campus_id", $campus_id); |
$exists = existsRow("campus", "campus_id", $campus_id); |
118 |
if ($exists > 0){ |
if ($exists > 0){ |
119 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
120 |
// Lookup the descriptive title |
// Lookup the descriptive title |
121 |
$campus = lookupField($con, "campus", "campus_id", $campus_id, "campus"); |
$campus = lookupField("campus", "campus_id", $campus_id, "campus"); |
122 |
printf("<strong>Campus:</strong> %s<br><br>\n ", $campus); |
printf("<b>Campus:</b> %s<br><br>\n ", $campus); |
123 |
|
printf("This will permanently remove this campus and its various assignments from the system. Some CourseScribe pages may lose their campus association.<BR><BR>\n"); |
124 |
|
|
125 |
// Form to draw the delete button |
// Form to draw the delete button |
126 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
127 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteCampus\" >"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteCampus\" >\n"); |
128 |
printf("<input type = \"Hidden\" name = \"campus_id\" value = \"%d\" >", $campus_id); |
printf("<input type = \"Hidden\" name = \"campus_id\" value = \"%d\" >\n", $campus_id); |
129 |
printf("This will <b>permanently</b> remove this campus and its various assignments from the system. Some CourseScribe pages may lose their campus association.<BR><BR>"); |
printf("<center>\n"); |
130 |
printf("<center>"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
131 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("</center>\n"); |
132 |
printf("</center>"); |
printf("</form>\n"); |
|
printf("</form><br>"); |
|
133 |
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
134 |
} |
} |
135 |
|
else if ($exists < 1) printf ("Campus not found. Operation cancelled.<br><br>\n"); |
136 |
|
|
137 |
|
msgTableClose(); |
138 |
|
|
|
// Failed for whatever reason |
|
|
else if ($exists < 1) printf ("Campus not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
139 |
} |
} |
140 |
|
|
141 |
|
|
|
|
|
|
|
|
142 |
/********************************************************** |
/********************************************************** |
143 |
Function: deleteCoursesub |
Function: deleteCoursesub |
144 |
Author: Paul Bramscher |
Author: Paul Bramscher |
145 |
Last Modified: 06.04.2003 |
Last Modified: 03.16.2004 |
146 |
*********************************************************** |
*********************************************************** |
147 |
Purpose: |
Purpose: |
148 |
Deletes a supplied course subject id |
Deletes a supplied course subject id |
149 |
**********************************************************/ |
**********************************************************/ |
150 |
function deleteCoursesub($con, $coursesub_id){ |
function deleteCoursesub($coursesub_id){ |
151 |
|
|
152 |
// Draw form heading |
msgTableOpen(1, "Deleting Course Subject (ID# " . $coursesub_id . ")"); |
153 |
printf("<center><h3>Deleting Course Subject...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
154 |
|
|
155 |
// Cannot delete placeholder #1. |
// Cannot delete placeholder #1. |
156 |
if ($coursesub_id > 1) { |
if ($coursesub_id > 1) { |
157 |
|
|
158 |
// Check to see if there are affected courselib pages |
// Check to see if there are affected courselib pages |
159 |
$exists_courselib = existsRow($con, "course", "coursesub_id", $coursesub_id); |
$exists_courselib = existsRow("course", "coursesub_id", $coursesub_id); |
160 |
|
|
161 |
if ($exists_courselib > 0) { |
if ($exists_courselib > 0) { |
162 |
printf("Cannot delete this Course Subject. There are courses which are currently using it."); |
printf("Cannot delete this Course Subject. There are courses which are currently using it."); |
163 |
} |
} |
164 |
|
|
165 |
// Delete from the campus table |
// Delete |
166 |
else { |
else { |
|
|
|
167 |
// Delete from the sub_coursesub table |
// Delete from the sub_coursesub table |
168 |
$sql = "DELETE FROM sub_coursesub WHERE coursesub_id = " . $coursesub_id; |
$sql = "DELETE FROM sub_coursesub WHERE coursesub_id = " . $coursesub_id; |
169 |
|
if (xx_tryquery ($sql)) printf("Subject-Course Subject assignments removed.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 0; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-Course Subject assignments removed.<BR>\n"); |
|
|
|
|
|
} |
|
170 |
|
|
171 |
// Delete from the coursesub table |
// Delete from the coursesub table |
172 |
if ($problem == 0) { |
$sql = "DELETE FROM coursesub WHERE coursesub_id =" . $coursesub_id; |
173 |
|
if (xx_tryquery ($sql)) printf("Removed this Course Subject successfully."); |
|
$sql = "DELETE FROM coursesub WHERE coursesub_id =" . $coursesub_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this Course Subject successfully.<BR><BR>\n"); |
|
|
} |
|
|
|
|
|
} |
|
174 |
} |
} |
175 |
|
|
176 |
} |
} |
177 |
else printf("Cannot delete <b>Course Subject ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
else printf ("Cannot delete Course Subject ID# 1, it acts as a system placeholder."); |
178 |
|
|
179 |
printf("</td></tr></table>"); |
printf("<br><br>\n"); |
180 |
printf("</center>"); |
msgTableClose(); |
181 |
} |
} |
182 |
|
|
183 |
|
|
|
|
|
184 |
/********************************************************** |
/********************************************************** |
185 |
Function: deleteCoursesubConfirm |
Function: deleteCoursesubConfirm |
186 |
Author: Paul Bramscher |
Author: Paul Bramscher |
187 |
Last Modified: 05.29.2003 |
Last Modified: 03.16.2004 |
188 |
*********************************************************** |
*********************************************************** |
189 |
Purpose: |
Purpose: |
190 |
Confirm prompt for deleting the selected campus. |
Confirm prompt for deleting the selected campus. |
191 |
**********************************************************/ |
**********************************************************/ |
192 |
function deleteCoursesubConfirm($con, $coursesub_id){ |
function deleteCoursesubConfirm($coursesub_id){ |
193 |
|
|
|
// Make sure we have a valid integer type |
|
194 |
$coursesub_id = (int) $coursesub_id; |
$coursesub_id = (int) $coursesub_id; |
195 |
|
msgTableOpen(1, "Delete Course Subject (ID# " . $coursesub_id . ")?"); |
196 |
|
|
197 |
// Check to see if its possible |
// Check to see if its possible |
198 |
$exists = existsRow($con, "coursesub", "coursesub_id", $coursesub_id); |
$exists = existsRow("coursesub", "coursesub_id", $coursesub_id); |
199 |
if ($exists > 0){ |
if ($exists > 0){ |
200 |
|
|
201 |
// Lookup the descriptive title |
// Lookup the descriptive title |
202 |
$coursesub = lookupField($con, "coursesub", "coursesub_id", $coursesub_id, "coursesub"); |
$coursesub = lookupField("coursesub", "coursesub_id", $coursesub_id, "coursesub"); |
|
|
|
|
// Draw page heading |
|
|
printf("<center><h3>Delete Course Subject '%s'?</h3>", $coursesub); |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<b>Messages:</b><br>\n"); |
|
203 |
|
|
204 |
// Check to see if there are affected courselib pages |
// Check to see if there are affected courselib pages |
205 |
$exists_courselib = existsRow($con, "course", "coursesub_id", $coursesub_id); |
$exists_courselib = existsRow("course", "coursesub_id", $coursesub_id); |
206 |
|
|
207 |
if ($exists_courselib > 0) { |
if ($exists_courselib > 0) { |
208 |
|
|
209 |
// Cannot delete, dependencies exist |
// Cannot delete, dependencies exist |
210 |
|
printf("<b>Messages:</b><br>\n"); |
211 |
printf("This course subject is currently used on one or more course pages. "); |
printf("This course subject is currently used on one or more course pages. "); |
212 |
printf("It may not be edited or deleted until all affected courses are moved to "); |
printf("It may not be edited or deleted until all affected courses are moved to "); |
213 |
printf("an alternate course subject. Follow the link below for a list of "); |
printf("an alternate course subject. Follow the link below for a list of "); |
214 |
printf("affected pages.<br><br>"); |
printf("affected pages.<br><br>"); |
215 |
printf("<a href=\"page_results_brief.phtml?coursesub_id=%s\">", $coursesub_id); |
printf("<a href=\"page_results_brief.phtml?coursesub_id=%s\">", $coursesub_id); |
216 |
printf("page_results_brief.phtml?coursesub_id=%s", $coursesub_id); |
printf("page_results_brief.phtml?coursesub_id=%s", $coursesub_id); |
217 |
printf("</a><br><br>"); |
printf("</a><br><br>\n"); |
218 |
|
|
219 |
} |
} |
220 |
|
|
221 |
else { |
else { |
222 |
|
|
223 |
// Form to draw the delete button |
// Form to draw the delete button |
224 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<b>Course Subject:</b> %s<br><br>\n ", $coursesub); |
225 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteCoursesub\" >"); |
printf("This will permanently remove this Course Subject.<BR><BR>\n"); |
226 |
printf("<input type = \"Hidden\" name = \"coursesub_id\" value = \"%d\" >", $coursesub_id); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
227 |
printf("This will <b>permanently</b> remove this Course Subject.<BR><BR>"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteCoursesub\" >\n"); |
228 |
printf("<center>"); |
printf("<input type = \"Hidden\" name = \"coursesub_id\" value = \"%d\" >\n", $coursesub_id); |
229 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("<center>\n"); |
230 |
printf("</center>"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
231 |
printf("</form><br>"); |
printf("</center>\n"); |
232 |
|
printf("</form>\n"); |
233 |
|
|
234 |
} |
} |
235 |
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
|
|
|
236 |
} |
} |
237 |
|
else if ($exists < 1) printf ("Course Subject not found. Operation cancelled.<br><br>\n"); |
238 |
|
|
239 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Course Subject not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
240 |
} |
} |
241 |
|
|
242 |
|
|
243 |
/********************************************************** |
/********************************************************** |
244 |
Function: deleteFaculty |
Function: deleteFaculty |
245 |
Author: Paul Bramscher |
Author: Paul Bramscher |
246 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
247 |
*********************************************************** |
*********************************************************** |
248 |
Purpose: |
Purpose: |
249 |
Deletes the supplied faculty id, and removes any relations |
Deletes the supplied faculty id, and removes any relations |
250 |
to affected courses. |
to affected courses. |
251 |
**********************************************************/ |
**********************************************************/ |
252 |
function deleteFaculty($con, $faculty_id){ |
function deleteFaculty($faculty_id){ |
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Faculty...</h3>"); |
|
253 |
|
|
254 |
// Table |
msgTableOpen(1, "Deleting Faculty (ID# " . $faculty_id . ")"); |
255 |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
printf("<b>Messages:</b><br>\n"); |
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
256 |
|
|
257 |
// Cannot delete placeholder #1. |
// Cannot delete placeholder #1. |
258 |
if ($faculty_id > 1) { |
if ($faculty_id > 1) { |
259 |
|
|
260 |
// First clear out the course_personnel assignments |
// First clear out the course_personnel assignments |
261 |
$sql = "DELETE FROM course_personnel WHERE faculty_id = " |
$sql = "DELETE FROM course_personnel WHERE faculty_id = " . $faculty_id; |
262 |
. $faculty_id; |
if (xx_tryquery ($sql)) printf("Faculty person purged from assignments to course pages.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Faculty person purged from assignments to course pages.<BR>\n"); |
|
|
} |
|
263 |
|
|
264 |
// Delete from the faculty table |
// Delete from the faculty table |
265 |
if ($problem == 0) { |
$sql = "DELETE FROM faculty WHERE faculty_id =" . $faculty_id; |
266 |
$sql = "DELETE FROM faculty WHERE faculty_id =" . $faculty_id; |
if (xx_tryquery ($sql)) printf("Removed this faculty person successfully."); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this faculty person successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
267 |
|
|
268 |
} |
} |
269 |
else printf("Cannot delete <b>Faculty ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
else printf ("Cannot delete Faculty ID# 1, it acts as a system placeholder."); |
270 |
|
|
271 |
printf("</td></tr></table>"); |
printf("<br><br>\n"); |
272 |
printf("</center>"); |
msgTableClose(); |
273 |
} |
} |
274 |
|
|
275 |
|
|
276 |
/********************************************************** |
/********************************************************** |
277 |
Function: deleteFacultyConfirm |
Function: deleteFacultyConfirm |
278 |
Author: Paul Bramscher |
Author: Paul Bramscher |
279 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
280 |
*********************************************************** |
*********************************************************** |
281 |
Purpose: |
Purpose: |
282 |
Confirm prompt for deleting the selected faculty person. |
Confirm prompt for deleting the selected faculty person. |
283 |
**********************************************************/ |
**********************************************************/ |
284 |
function deleteFacultyConfirm($con, $faculty_id){ |
function deleteFacultyConfirm($faculty_id){ |
285 |
|
|
|
// Make sure we have a valid integer type |
|
286 |
$faculty_id = (int) $faculty_id; |
$faculty_id = (int) $faculty_id; |
287 |
|
msgTableOpen(1, "Delete Faculty (ID# " . $faculty_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Faculty ID# %s?</h3>", $faculty_id); |
|
288 |
|
|
289 |
// Check to see if its possible |
// Check to see if its possible |
290 |
$exists = existsRow($con, "faculty", "faculty_id", $faculty_id); |
$exists = existsRow("faculty", "faculty_id", $faculty_id); |
291 |
if ($exists > 0){ |
if ($exists > 0){ |
292 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
293 |
// Lookup the descriptive title |
// Lookup the descriptive title |
294 |
$faculty_name = lookupFaculty($con, $faculty_id); |
$faculty_name = lookupFaculty($faculty_id); |
295 |
printf("<strong>Faculty Person:</strong> %s<br>\n ", $faculty_name); |
printf("<b>Faculty Person:</b> %s<br><br>\n ", $faculty_name); |
296 |
|
printf("This will permanently remove the faculty person and his/her various assignments from the system. Some CourseScribe pages may have no personnel.<BR><BR>\n"); |
297 |
|
|
298 |
// Form to draw the delete button |
// Form to draw the delete button |
299 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
300 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteFaculty\" >"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteFaculty\" >\n"); |
301 |
printf("<input type = \"Hidden\" name = \"faculty_id\" value = \"%d\" >", $faculty_id); |
printf("<input type = \"Hidden\" name = \"faculty_id\" value = \"%d\" >\n", $faculty_id); |
302 |
printf("This will <b>permanently</b> remove the faculty person and his/her various assignments from the system. Some CourseScribe pages may have no personnel.<BR><BR>"); |
printf("<center>\n"); |
303 |
printf("<center>"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
304 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("</center>\n"); |
305 |
printf("</center>"); |
printf("</form>\n"); |
|
printf("</form><br>"); |
|
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
306 |
} |
} |
307 |
|
else if ($exists < 1) printf ("Faculty not found. Operation cancelled.<br><br>\n"); |
308 |
|
|
309 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Faculty not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
310 |
} |
} |
311 |
|
|
312 |
|
|
313 |
/********************************************************** |
/********************************************************** |
314 |
Function: deleteFeature |
Function: deleteFeature |
315 |
Author: Paul Bramscher |
Author: Paul Bramscher |
316 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
317 |
*********************************************************** |
*********************************************************** |
318 |
Purpose: |
Purpose: |
319 |
Deletes the supplied feature id, and removes any relations to |
Deletes the supplied feature id, and removes any relations to |
320 |
affected resources. |
affected resources. |
321 |
**********************************************************/ |
**********************************************************/ |
322 |
function deleteFeature($con, $feature_id){ |
function deleteFeature($feature_id){ |
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Feature...</h3>"); |
|
323 |
|
|
324 |
// Table |
msgTableOpen(1, "Deleting Feature (ID# " . $feature_id . ")"); |
325 |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
printf("<b>Messages:</b><br>\n"); |
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
326 |
|
|
327 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
328 |
if ($feature_id > 1) { |
if ($feature_id > 1) { |
329 |
|
|
330 |
// Delete all resource_feature assignments |
// Delete all resource_feature assignments |
331 |
$sql = "DELETE from res_feature WHERE feature_id =" . $feature_id; |
$sql = "DELETE from res_feature WHERE feature_id =" . $feature_id; |
332 |
|
if (xx_tryquery ($sql)) printf("Removed resource-feature associations.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed resource-feature associations.<BR>\n"); |
|
|
|
|
|
if ($problem == 0) { |
|
333 |
|
|
334 |
// Delete from feature table |
// Delete from feature table |
335 |
$sql = "DELETE FROM feature WHERE feature_id =" . $feature_id; |
$sql = "DELETE FROM feature WHERE feature_id =" . $feature_id; |
336 |
|
if (xx_tryquery ($sql)) printf("Removed feature successfully."); |
337 |
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed feature successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
|
} |
|
338 |
} |
} |
339 |
|
else printf ("Cannot delete Feature ID# 1, it acts as a system placeholder."); |
340 |
|
|
341 |
else printf("Cannot delete <b>Feature ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
printf("<br><br>\n"); |
342 |
|
msgTableClose(); |
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
343 |
} |
} |
344 |
|
|
345 |
|
|
346 |
/********************************************************** |
/********************************************************** |
347 |
Function: deleteFeatureConfirm |
Function: deleteFeatureConfirm |
348 |
Author: Paul Bramscher |
Author: Paul Bramscher |
349 |
Last Modified: 04.21.2003 |
Last Modified: 03.15.2004 |
350 |
*********************************************************** |
*********************************************************** |
351 |
Purpose: |
Purpose: |
352 |
Confirm prompt for deleting the supplied feature id. |
Confirm prompt for deleting the supplied feature id. |
353 |
**********************************************************/ |
**********************************************************/ |
354 |
function deleteFeatureConfirm($con, $key_id){ |
function deleteFeatureConfirm($key_id){ |
355 |
|
|
|
// Make sure we have a valid integer type |
|
356 |
$feature_id = (int) $key_id; |
$feature_id = (int) $key_id; |
357 |
|
msgTableOpen(1, "Delete Feature (ID# " . $feature_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Feature ID# %s?</h3>", $feature_id); |
|
358 |
|
|
359 |
// Check to see if its possible |
// Check to see if its possible |
360 |
$exists = existsRow($con, "feature", "feature_id", $feature_id); |
$exists = existsRow("feature", "feature_id", $feature_id); |
361 |
if ($exists > 0){ |
if ($exists > 0){ |
362 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
363 |
// Lookup the descriptive title |
// Lookup the descriptive title |
364 |
$feature = lookupField($con, "feature", "feature_id", $feature_id, "feature"); |
$feature = lookupField("feature", "feature_id", $feature_id, "feature"); |
365 |
printf("<strong>Feature:</strong> %s<br>\n ", $feature); |
printf("<b>Feature:</b> %s<br><br>\n ", $feature); |
366 |
|
printf("This will permanently remove the feature and its various assignments from the system. Some resources may no longer have icons.<BR><BR>\n"); |
367 |
|
|
368 |
// Form to draw the delete button |
// Form to draw the delete button |
369 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
370 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteFeature\" >"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteFeature\" >\n"); |
371 |
printf("<input type = \"Hidden\" name = \"feature_id\" value = \"%d\" >", $feature_id); |
printf("<input type = \"Hidden\" name = \"feature_id\" value = \"%d\" >\n", $feature_id); |
372 |
printf("This will <b>permanently</b> remove the feature and its various assignments from the system. Some resources may no longer have icons.<BR><BR>"); |
printf("<center>\n"); |
373 |
printf("<center>"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
374 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("</center>\n"); |
375 |
printf("</center>"); |
printf("</form>\n"); |
|
printf("</form><br>"); |
|
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
376 |
} |
} |
377 |
|
else if ($exists < 1) printf ("Feature not found. Operation cancelled.<br><br>\n"); |
378 |
|
|
379 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Feature not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
380 |
} |
} |
381 |
|
|
382 |
|
|
383 |
/********************************************************** |
/********************************************************** |
384 |
Function: deleteInfotype |
Function: deleteInfotype |
385 |
Author: Paul Bramscher |
Author: Paul Bramscher |
386 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
387 |
*********************************************************** |
*********************************************************** |
388 |
Purpose: |
Purpose: |
389 |
Deletes the supplied information type id, and removes |
Deletes the supplied information type id, and removes |
390 |
assocations in the resource and resource-subject-information |
assocations in the resource and resource-subject-information |
391 |
type tables. |
type tables. |
392 |
**********************************************************/ |
**********************************************************/ |
393 |
function deleteInfotype($con, $infotype_id){ |
function deleteInfotype($infotype_id){ |
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Information Type...</h3>"); |
|
394 |
|
|
395 |
// Table |
msgTableOpen(1, "Deleting Information Type (ID# " . $infotype_id . ")"); |
396 |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
printf("<b>Messages:</b><br>\n"); |
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
397 |
|
|
398 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
399 |
if ($infotype_id > 1) { |
if ($infotype_id > 1) { |
400 |
|
|
401 |
// Delete all res_sub_infotype assignments |
// Delete all res_sub_infotype assignments |
402 |
$sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id; |
$sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id; |
403 |
|
if (xx_tryquery ($sql)) printf("Removed resource-subject-infotype associations.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed resource-subject-infotype associations.<BR>\n"); |
|
|
|
|
404 |
|
|
405 |
if ($problem == 0) { |
// Set (N/A) type in resource table |
406 |
|
$sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id; |
407 |
|
if (xx_tryquery ($sql)) printf("Set default information types for affects resources to (N/A).<BR>\n"); |
408 |
|
|
409 |
// Set (N/A) type in resource table |
// Delete from infotype table |
410 |
$sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id; |
$sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id; |
411 |
|
if (xx_tryquery ($sql)) printf("Removed this information type successfully."); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Set default information types for affects resources to (N/A).<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($problem == 0) { |
|
|
|
|
|
// Delete from infotype table |
|
|
$sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this information type successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
412 |
} |
} |
413 |
|
else printf ("Cannot delete Information Type ID# 1, it acts as a system placeholder."); |
414 |
|
|
415 |
else printf("Cannot delete <b>Information Type ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
printf("<br><br>\n"); |
416 |
|
msgTableClose(); |
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
417 |
} |
} |
418 |
|
|
419 |
|
|
420 |
/********************************************************** |
/********************************************************** |
421 |
Function: deleteInfotypeConfirm |
Function: deleteInfotypeConfirm |
422 |
Author: Paul Bramscher |
Author: Paul Bramscher |
423 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
424 |
*********************************************************** |
*********************************************************** |
425 |
Purpose: |
Purpose: |
426 |
Confirm prompt to delete the supplied information type id. |
Confirm prompt to delete the supplied information type id. |
427 |
**********************************************************/ |
**********************************************************/ |
428 |
function deleteInfotypeConfirm($con, $key_id){ |
function deleteInfotypeConfirm($key_id){ |
429 |
|
|
|
// Make sure we have a valid integer type |
|
430 |
$infotype_id = (int) $key_id; |
$infotype_id = (int) $key_id; |
431 |
|
msgTableOpen(1, "Delete Information Type (ID# " . $infotype_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Information Type ID# %s?</h3>", $infotype_id); |
|
432 |
|
|
433 |
// Check to see if its possible |
// Check to see if its possible |
434 |
$exists = existsRow($con, "infotype", "infotype_id", $infotype_id); |
$exists = existsRow("infotype", "infotype_id", $infotype_id); |
435 |
if ($exists > 0){ |
if ($exists > 0){ |
436 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
437 |
// Lookup the descriptive title |
// Lookup the descriptive title |
438 |
$infotype = lookupField($con, "infotype", "infotype_id", $infotype_id, "infotype"); |
$infotype = lookupField("infotype", "infotype_id", $infotype_id, "infotype"); |
439 |
printf("<strong>Information Type:</strong> %s<br><br>\n ", $infotype); |
printf("<b>Information Type:</b> %s<br><br>\n ", $infotype); |
440 |
|
printf("This will permanently remove the Information Type and its various assignments from the system. <b>Affected resource-subject-infotype assignments on RQS pages will be broken, and therefore removed!</b> Be sure to re-assign important resources to another information type before deleting this one.<BR><BR>\n"); |
441 |
|
printf("Check the <b><a href=\"infotype_drill.phtml?infotype_id=%d\">Information Type Detail<a></b> page to display affected RQS pages.", $infotype_id); |
442 |
|
|
443 |
// Form to draw the delete button |
// Form to draw the delete button |
444 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
445 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteInfotype\" >"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteInfotype\" >\n"); |
446 |
printf("<input type = \"Hidden\" name = \"infotype_id\" value = \"%d\" >", $infotype_id); |
printf("<input type = \"Hidden\" name = \"infotype_id\" value = \"%d\" >\n", $infotype_id); |
|
printf("This will <b>permanently</b> remove the Information Type and its various assignments from the system. <b>Affected resource-subject-infotype assignments on RQS pages will be broken, and therefore removed!</b> Be sure to re-assign important resources to another information type before deleting this one.<BR><BR>"); |
|
|
printf("Check the <b><a href=\"infotype_drill.phtml?infotype_id=%d\">Information Type Detail<a></b> page to display affected RQS pages.", $infotype_id); |
|
447 |
printf("<br><br>\n"); |
printf("<br><br>\n"); |
448 |
printf("<center>"); |
printf("<center>\n"); |
449 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
450 |
printf("</center>"); |
printf("</center>\n"); |
451 |
printf("</form><br>"); |
printf("</form>\n"); |
452 |
|
} |
453 |
|
else if ($exists < 1) printf ("Information Type not found. Operation cancelled.<br><br>\n"); |
454 |
|
|
455 |
|
msgTableClose(); |
456 |
|
} |
457 |
|
|
458 |
|
|
459 |
|
/********************************************************** |
460 |
|
Function: deleteLibunit |
461 |
|
Author: Paul Bramscher |
462 |
|
Last Modified: 03.16.2004 |
463 |
|
*********************************************************** |
464 |
|
Purpose: |
465 |
|
Deletes the supplied libunit id, and any staff assignments |
466 |
|
in that library unit. |
467 |
|
**********************************************************/ |
468 |
|
function deleteLibunit($libunit_id){ |
469 |
|
|
470 |
|
msgTableOpen(1, "Deleting Library Unit (ID# " . $libunit_id . ")"); |
471 |
|
printf("<b>Messages:</b><br>\n"); |
472 |
|
|
473 |
|
// First delete from libunit_staff |
474 |
|
if ($libunit_id > 1) { |
475 |
|
$sql = "DELETE FROM libunit_staff WHERE libunit_id = " . $libunit_id; |
476 |
|
if (xx_tryquery ($sql)) printf("Deleted affected Library Unit staff assignments.<BR>\n"); |
477 |
|
|
478 |
|
// Delete from the libunit table |
479 |
|
$sql = "DELETE FROM libunit WHERE libunit_id =" . $libunit_id; |
480 |
|
if (xx_tryquery ($sql)) printf("Removed this Library Unit successfully."); |
481 |
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
482 |
} |
} |
483 |
|
else printf ("Cannot delete Library Unit ID# 1, it acts as a system placeholder."); |
484 |
|
|
485 |
// Failed for whatever reason |
printf("<br><br>\n"); |
486 |
else if ($exists < 1) printf ("Information Type not found. Operation cancelled.<br>\n"); |
msgTableClose(); |
487 |
|
} |
488 |
|
|
489 |
|
|
490 |
|
/********************************************************** |
491 |
|
Function: deleteLibunitConfirm |
492 |
|
Author: Paul Bramscher |
493 |
|
Last Modified: 03.16.2004 |
494 |
|
*********************************************************** |
495 |
|
Purpose: |
496 |
|
Confirm prompt for deleting the supplied libunit id. |
497 |
|
**********************************************************/ |
498 |
|
function deleteLibunitConfirm($key_id){ |
499 |
|
|
500 |
|
$libunit_id = (int) $key_id; |
501 |
|
msgTableOpen(1, "Delete Library Unit (ID# " . $libunit_id . ")?"); |
502 |
|
|
503 |
|
// Check to see if its possible |
504 |
|
$exists = existsRow("libunit", "libunit_id", $libunit_id); |
505 |
|
if ($exists > 0){ |
506 |
|
|
507 |
|
// Lookup the descriptive title |
508 |
|
$libunit = lookupField("libunit", "libunit_id", $libunit_id, "libunit"); |
509 |
|
printf("<b>Libunit:</b> %s<br><br>\n ", $libunit); |
510 |
|
printf("This will permanently remove this Library Unit from the system. This may render some staff without a unit.<BR><BR>"); |
511 |
|
|
512 |
|
// Form to draw the delete button |
513 |
|
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
514 |
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteLibunit\" >\n"); |
515 |
|
printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >\n", $libunit_id); |
516 |
|
printf("<center>\n"); |
517 |
|
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
518 |
|
printf("</center>\n"); |
519 |
|
printf("</form>\n"); |
520 |
|
} |
521 |
|
else if ($exists < 1) printf ("Library Unit not found. Operation cancelled.<br><br>\n"); |
522 |
|
|
523 |
|
msgTableClose(); |
524 |
|
} |
525 |
|
|
526 |
printf("</center>"); |
|
527 |
|
/********************************************************** |
528 |
|
Function: deleteLibunitStaff |
529 |
|
Author: Paul Bramscher |
530 |
|
Last Modified: 03.03.2004 |
531 |
|
*********************************************************** |
532 |
|
Purpose: |
533 |
|
Deletes staffperson assignments (possibly multiple) to the |
534 |
|
supplied libunit id and calls formLibunit back again. |
535 |
|
**********************************************************/ |
536 |
|
function deleteLibunitStaff($key_list_array, $libunit_id){ |
537 |
|
|
538 |
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
539 |
|
$sql = "DELETE FROM libunit_staff WHERE libunit_id = " |
540 |
|
. $libunit_id |
541 |
|
. " AND staff_id = " |
542 |
|
. $key_list_array[$element]; |
543 |
|
xx_tryquery($sql); |
544 |
|
} |
545 |
|
// Call the libunit form back |
546 |
|
formLibunit($libunit_id); |
547 |
} |
} |
548 |
|
|
549 |
|
|
550 |
/********************************************************** |
/********************************************************** |
551 |
Function: deleteLocation |
Function: deleteLocation |
552 |
Author: Paul Bramscher |
Author: Paul Bramscher |
553 |
Last Modified: 05.27.2003 |
Last Modified: 03.15.2004 |
554 |
*********************************************************** |
*********************************************************** |
555 |
Purpose: |
Purpose: |
556 |
Deletes the supplied location id, and removes associations |
Deletes the supplied location id, and removes associations |
560 |
fields (non-relational), as well as all user copy-paste |
fields (non-relational), as well as all user copy-paste |
561 |
buffers. |
buffers. |
562 |
**********************************************************/ |
**********************************************************/ |
563 |
function deleteLocation($con, $delMessage, $location_id){ |
function deleteLocation($delMessage, $location_id){ |
564 |
|
|
565 |
// Draw form heading |
msgTableOpen(1, "Deleting Location (ID# " . $location_id . ")"); |
566 |
printf("<center><h3>Deleting Location...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
567 |
|
|
568 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
569 |
if ($location_id > 1) { |
if ($location_id > 1) { |
570 |
|
|
571 |
// First delete from res_loc |
// First delete from res_loc |
572 |
$sql = "DELETE FROM res_loc WHERE location_id = " . $location_id; |
$sql = "DELETE FROM res_loc WHERE location_id = " . $location_id; |
573 |
|
if (xx_tryquery ($sql)) printf("Affected resource-location assignments removed.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Affected resource-location assignments removed.<BR>\n"); |
|
|
} |
|
574 |
|
|
575 |
// Delete from sub_loc |
// Delete from sub_loc |
576 |
if ($problem == 0) { |
$sql = "DELETE FROM sub_loc WHERE location_id =" . $location_id; |
577 |
$sql = "DELETE FROM sub_loc WHERE location_id =" . $location_id; |
if (xx_tryquery ($sql)) printf("Affected subject-location assignments removed.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Affected subject-location assignments removed.<BR>\n"); |
|
|
} |
|
|
} |
|
578 |
|
|
579 |
// Delete primary subject locations |
// Delete primary subject locations |
580 |
if ($problem == 0) { |
$sql = "UPDATE subject SET sublocation_id = NULL WHERE sublocation_id =" . $location_id; |
581 |
$sql = "UPDATE subject SET sublocation_id = NULL WHERE sublocation_id =" . $location_id; |
if (xx_tryquery ($sql)) printf("Affected primary subject locations set to NULL.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Affected primary subject locations set to NULL.<BR>\n"); |
|
|
} |
|
|
} |
|
582 |
|
|
583 |
// Delete from serv_loc |
// Delete from serv_loc |
584 |
if ($problem == 0) { |
$sql = "DELETE FROM serv_loc WHERE location_id =" . $location_id; |
585 |
$sql = "DELETE FROM serv_loc WHERE location_id =" . $location_id; |
if (xx_tryquery ($sql)) printf("Affected service-location assignments removed.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Affected service-location assignments removed.<BR>\n"); |
|
|
} |
|
|
} |
|
586 |
|
|
587 |
// Update affected PageScribe pages |
/******************************** |
588 |
if ($problem == 0) { |
** Update affected CL/PS pages ** |
589 |
|
********************************/ |
590 |
|
|
591 |
|
// First, get the default location description and title |
592 |
|
$sql = "SELECT location, location_descr FROM location WHERE location_id = " |
593 |
|
. $location_id; |
594 |
|
$rs = xx_tryquery($sql); |
595 |
|
$row = xx_fetch_array ($rs, xx_ASSOC); |
596 |
|
$location = $row["location"]; |
597 |
|
$location_descr = $row["location_descr"]; |
598 |
|
|
599 |
// First, get the default location description and title |
// Clean up strings |
600 |
$sql = "SELECT location, location_descr FROM location WHERE location_id = " |
$location_descr = textInmySQL($location_descr); |
601 |
. $location_id; |
$location = textInmySQL($location); |
602 |
$rs = xx_query($sql, $con); |
$delMessage = textInmySQL($delMessage); |
|
$row = xx_fetch_array ($rs); |
|
|
$location = $row["location"]; |
|
|
$location_descr = $row["location_descr"]; |
|
|
|
|
|
// Clean up strings |
|
|
$location_descr = textInmySQL($location_descr); |
|
|
$location = textInmySQL($location); |
|
|
$delMessage = textInmySQL($delMessage); |
|
|
|
|
|
// Next, append the reason for deletion to the description |
|
|
if (strlen($location_descr) > 0) $location_descr .= "<BR>" . $delMessage; |
|
|
else $location_descr = $delMessage; |
|
|
|
|
|
// Update all of the elements using this resource with a custom description. |
|
|
$sql = "UPDATE element SET label = '" |
|
|
. $location |
|
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), location_id = NULL WHERE location_id =" . $location_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
// Next, update all of the elements using this resource without a custom description. |
|
|
$sql = "UPDATE element SET label = '" |
|
|
. $location |
|
|
. "', element_descr = '" |
|
|
. $location_descr |
|
|
. "', location_id = NULL WHERE location_id =" . $location_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
|
|
} |
|
603 |
|
|
604 |
|
// Next, append the reason for deletion to the description |
605 |
|
if (strlen($location_descr) > 0) $location_descr .= "<BR>" . $delMessage; |
606 |
|
else $location_descr = $delMessage; |
607 |
|
|
608 |
} |
// Update all of the elements using this resource with a custom description. |
609 |
|
$sql = "UPDATE element SET label = '" |
610 |
|
. $location |
611 |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
612 |
|
. $delMessage |
613 |
|
. "'), location_id = NULL WHERE location_id =" . $location_id |
614 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
615 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
616 |
|
|
617 |
// Update affected PageScribe copy buffers |
// Next, update all of the elements using this resource without a custom description. |
618 |
if ($problem == 0) { |
$sql = "UPDATE element SET label = '" |
619 |
|
. $location |
620 |
|
. "', element_descr = '" |
621 |
|
. $location_descr |
622 |
|
. "', location_id = NULL WHERE location_id =" . $location_id |
623 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
624 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
625 |
|
|
626 |
// Update all of the elements using this location with a custom description. |
/********************************** |
627 |
$sql = "UPDATE pastebuffer SET label = '" |
** Update affected CL/PS buffers ** |
628 |
. $location |
**********************************/ |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), location_id = NULL WHERE location_id =" . $location_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
// Next, update all of the elements using this location without a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $location |
|
|
. "', element_descr = '" |
|
|
. $location_descr |
|
|
. "', location_id = NULL WHERE location_id =" . $location_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
629 |
|
|
630 |
|
// Update all of the elements using this location with a custom description. |
631 |
|
$sql = "UPDATE pastebuffer SET label = '" |
632 |
|
. $location |
633 |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
634 |
|
. $delMessage |
635 |
|
. "'), location_id = NULL WHERE location_id =" . $location_id |
636 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
637 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
638 |
|
|
639 |
} |
// Next, update all of the elements using this location without a custom description. |
640 |
|
$sql = "UPDATE pastebuffer SET label = '" |
641 |
|
. $location |
642 |
|
. "', element_descr = '" |
643 |
|
. $location_descr |
644 |
|
. "', location_id = NULL WHERE location_id =" . $location_id |
645 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
646 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
647 |
|
|
648 |
// Delete from location |
// Delete from location |
649 |
if ($problem == 0) { |
$sql = "DELETE FROM location WHERE location_id =" . $location_id; |
650 |
$sql = "DELETE FROM location WHERE location_id =" . $location_id; |
if (xx_tryquery ($sql)) printf("Location successfully removed."); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Location successfully removed.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
651 |
|
|
652 |
} |
} |
653 |
else printf("Cannot delete <b>Location ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
else printf ("Cannot delete Location ID# 1, it acts as a system placeholder."); |
654 |
|
|
655 |
printf("</td></tr></table>\n"); |
printf("<br><br>\n"); |
656 |
printf("</center><BR>\n"); |
msgTableClose(); |
657 |
} |
} |
658 |
|
|
659 |
|
|
660 |
/********************************************************** |
/********************************************************** |
661 |
Function: deleteLocationConfirm |
Function: deleteLocationConfirm |
662 |
Author: Paul Bramscher |
Author: Paul Bramscher |
663 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
664 |
*********************************************************** |
*********************************************************** |
665 |
Purpose: |
Purpose: |
666 |
Confirm prompt to delete the supplied location id. |
Confirm prompt to delete the supplied location id. |
667 |
**********************************************************/ |
**********************************************************/ |
668 |
function deleteLocationConfirm($con, $key_id){ |
function deleteLocationConfirm($key_id){ |
669 |
|
|
|
// Make sure we have a valid integer type |
|
670 |
$location_id = (int) $key_id; |
$location_id = (int) $key_id; |
671 |
|
msgTableOpen(1, "Delete Location (ID# " . $location_id . ")?"); |
|
printf("<center>\n"); |
|
672 |
|
|
673 |
// Check to see if its possible |
// Check to see if its possible |
674 |
$exists = existsRow($con, "location", "location_id", $location_id); |
$exists = existsRow("location", "location_id", $location_id); |
675 |
if ($exists > 0){ |
if ($exists > 0){ |
676 |
|
|
|
// Table |
|
|
printf("<table width=\"60%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Location ID# %s?", $location_id); |
|
|
printf("</td></tr>\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
677 |
// Lookup the name of the location |
// Lookup the name of the location |
678 |
$location = lookupField($con, "location", "location_id", $location_id, "location"); |
$location = lookupField("location", "location_id", $location_id, "location"); |
679 |
printf("<b>Location:</b> %s<br><br>\n ", $location); |
printf("<b>Location:</b> %s<br><br>\n ", $location); |
680 |
|
|
681 |
// Form to draw the delete button |
// Form to draw the delete button |
688 |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Location no longer available]\" size=\"75\"><br><br>\n"); |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Location no longer available]\" size=\"75\"><br><br>\n"); |
689 |
|
|
690 |
// Warning |
// Warning |
691 |
printf("This will <b>permanently</b> remove the location and its various assignments from the system.<BR><BR>\n"); |
printf("This will permanently remove the location and its various assignments from the system.<BR><BR>\n"); |
692 |
|
|
693 |
// Delete button |
// Delete button |
694 |
printf("<center>\n"); |
printf("<center>\n"); |
695 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
696 |
printf("</center>\n"); |
printf("</center>\n"); |
697 |
printf("</form><br>\n"); |
printf("</form>\n"); |
698 |
|
} |
699 |
// Close table |
else if ($exists < 1) printf ("Location not found. Operation cancelled.<br><br>\n"); |
|
printf("</td></tr></table>\n"); |
|
|
printf("<BR>\n"); |
|
|
} |
|
700 |
|
|
701 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Location #%d not found. Operation cancelled.<br><br>\n", $location_id); |
|
|
|
|
|
printf("</center>\n"); |
|
702 |
} |
} |
703 |
|
|
704 |
|
|
705 |
/********************************************************** |
/********************************************************** |
706 |
Function: deleteMasterinfotype |
Function: deleteMasterinfotype |
707 |
Author: Paul Bramscher |
Author: Paul Bramscher |
708 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
709 |
*********************************************************** |
*********************************************************** |
710 |
Purpose: |
Purpose: |
711 |
Delete the supplied master information type id. Note that |
Delete the supplied master information type id. Note that |
715 |
well as their resource-subject-information type assignments. |
well as their resource-subject-information type assignments. |
716 |
This can have potentially large impact. |
This can have potentially large impact. |
717 |
**********************************************************/ |
**********************************************************/ |
718 |
function deleteMasterinfotype($con, $masterinfotype_id){ |
function deleteMasterinfotype($masterinfotype_id){ |
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Master Information Type...</h3>"); |
|
719 |
|
|
720 |
// Table |
msgTableOpen(1, "Deleting Master Information Type (ID# " . $masterinfotype_id . ")"); |
721 |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
printf("<b>Messages:</b><br>\n"); |
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
722 |
|
|
723 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
724 |
if ($masterinfotype_id > 1) { |
if ($masterinfotype_id > 1) { |
728 |
. $masterinfotype_id; |
. $masterinfotype_id; |
729 |
|
|
730 |
// Fetch the values |
// Fetch the values |
731 |
$rs = xx_query($sql, $con); |
$rs = xx_tryquery($sql); |
732 |
while ($row = xx_fetch_array ($rs)) { |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
733 |
$infotype_id = $row["infotype_id"]; |
$infotype_id = $row["infotype_id"]; |
734 |
$infotype = $row["infotype"]; |
$infotype = $row["infotype"]; |
735 |
|
|
738 |
|
|
739 |
// Delete all res_sub_infotype assignments |
// Delete all res_sub_infotype assignments |
740 |
$sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id; |
$sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id; |
741 |
|
if (xx_tryquery ($sql)) printf("Removed resource-subject-infotype associations.<BR>\n"); |
742 |
|
|
743 |
if (!xx_query ($sql, $con)){ |
// Set (N/A) type in resource table |
744 |
$problem = 1; |
$sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id; |
745 |
sql_err($sql); |
if (xx_tryquery ($sql)) printf("Set default information types for affects resources to (N/A).<BR>\n"); |
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed resource-subject-infotype associations.<BR>\n"); |
|
|
|
|
|
|
|
|
if ($problem == 0) { |
|
|
|
|
|
// Set (N/A) type in resource table |
|
|
$sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Set default information types for affects resources to (N/A).<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($problem == 0) { |
|
|
|
|
|
// Delete from infotype table |
|
|
$sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed affected specific information types.<BR>\n"); |
|
|
} |
|
|
} // successful delete of a specific information type |
|
746 |
|
|
747 |
} // end of delete for an affected infotype |
// Delete from infotype table |
748 |
|
$sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id; |
749 |
} // all affected infotypes below this masterinfotype |
if (xx_tryquery ($sql)) printf("Removed affected specific information types.<BR>\n"); |
750 |
|
} |
|
// Delete the masterinfotype itself |
|
751 |
|
|
752 |
if ($problem == 0) { |
// Delete from masterinfotype table |
753 |
|
$sql = "DELETE FROM masterinfotype WHERE masterinfotype_id =" . $masterinfotype_id; |
754 |
// Delete from masterinfotype table |
if (xx_tryquery ($sql)) printf("Removed Master Information Type successfully."); |
|
$sql = "DELETE FROM masterinfotype WHERE masterinfotype_id =" . $masterinfotype_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed Master Information Type successfully.<BR><BR>\n"); |
|
|
} |
|
|
} // delete masterinfotype itself |
|
755 |
|
|
756 |
} // masterinfotype > 1 (cannot delete N/A). |
} |
757 |
|
else printf ("Cannot delete Master Information Type ID# 1, it acts as a system placeholder."); |
758 |
|
|
759 |
else printf("Cannot delete <b>Master Information Type ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
printf("<br><br>\n"); |
760 |
|
msgTableClose(); |
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
761 |
} |
} |
762 |
|
|
763 |
|
|
764 |
/********************************************************** |
/********************************************************** |
765 |
Function: deleteMasterinfotypeConfirm |
Function: deleteMasterinfotypeConfirm |
766 |
Author: Paul Bramscher |
Author: Paul Bramscher |
767 |
Last Modified: 05.21.2003 |
Last Modified: 03.16.2004 |
768 |
*********************************************************** |
*********************************************************** |
769 |
Purpose: |
Purpose: |
770 |
Confirm prompt for deleting the supplied master information |
Confirm prompt for deleting the supplied master information |
771 |
type id. Note the dire warning. |
type id. Note the dire warning. |
772 |
**********************************************************/ |
**********************************************************/ |
773 |
function deleteMasterinfotypeConfirm($con, $key_id){ |
function deleteMasterinfotypeConfirm($key_id){ |
774 |
|
|
|
// Make sure we have a valid integer type |
|
775 |
$masterinfotype_id = (int) $key_id; |
$masterinfotype_id = (int) $key_id; |
776 |
|
msgTableOpen(1, "Delete Master Information Type (ID# " . $masterinfotype_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Master Information Type ID# %s?</h3>", $masterinfotype_id); |
|
777 |
|
|
778 |
// Check to see if its possible |
// Check to see if its possible |
779 |
$exists = existsRow($con, "masterinfotype", "masterinfotype_id", $masterinfotype_id); |
$exists = existsRow("masterinfotype", "masterinfotype_id", $masterinfotype_id); |
780 |
if ($exists > 0){ |
if ($exists > 0){ |
781 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
782 |
// Lookup the descriptive title |
// Lookup the descriptive title |
783 |
$masterinfotype = lookupField($con, "masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype"); |
$masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype"); |
784 |
printf("<strong>Master Information Type:</strong> %s<br><br>\n ", $masterinfotype); |
printf("<b>Master Information Type:</b> %s<br><br>\n ", $masterinfotype); |
785 |
|
printf("This will permanently remove the Master Information Type and its various assignments from the system. "); |
|
// Form to draw the delete button |
|
|
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
|
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteMasterinfotype\" >"); |
|
|
printf("<input type = \"Hidden\" name = \"masterinfotype_id\" value = \"%d\" >", $masterinfotype_id); |
|
|
printf("This will <b>permanently</b> remove the Master Information Type and its various assignments from the system. "); |
|
786 |
printf("A potentially large deletion cascade may result, since deleting a Master Information Type will delete all Information Types below it. "); |
printf("A potentially large deletion cascade may result, since deleting a Master Information Type will delete all Information Types below it. "); |
787 |
printf("<b>All affected resource-subject-infotype assignments on RQS pages will be broken, and therefore removed!</b> "); |
printf("<b>All affected resource-subject-infotype assignments on RQS pages will be broken, and therefore removed!</b> "); |
788 |
printf("Be sure to re-assign important resources to another specific Information Type, and assign it to a safe Master Information Type before deleting this one.<br><br>"); |
printf("Be sure to re-assign important resources to another specific Information Type, and assign it to a safe Master Information Type before deleting this one.<br><br>"); |
789 |
printf("Do not proceed unless you are <b>VERY</b> sure of what you're doing.<br><br>\n"); |
printf("Do not proceed unless you are <b>VERY</b> sure of what you're doing.<br><br>\n"); |
790 |
printf("Check the <b><a href=\"masterinfotype_drill.phtml?masterinfotype_id=%d\">Master Information Type Detail<a></b> page to display affected Information Types and drill down further.", $masterinfotype_id); |
printf("Check the <b><a href=\"masterinfotype_drill.phtml?masterinfotype_id=%d\">Master Information Type Detail<a></b> page to display affected Information Types and drill down further.", $masterinfotype_id); |
791 |
printf("<br><br>\n"); |
printf("<br><br>\n"); |
|
printf("<center>"); |
|
|
printf("<input type =\"Submit\" value=\"Delete!\">"); |
|
|
printf("</center>"); |
|
|
printf("</form><br>"); |
|
792 |
|
|
793 |
// Close table |
// Form to draw the delete button |
794 |
printf("</td></tr></table>"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
795 |
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteMasterinfotype\" >\n"); |
796 |
|
printf("<input type = \"Hidden\" name = \"masterinfotype_id\" value = \"%d\" >\n", $masterinfotype_id); |
797 |
|
printf("<center>\n"); |
798 |
|
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
799 |
|
printf("</center>\n"); |
800 |
|
printf("</form>\n"); |
801 |
} |
} |
802 |
|
else if ($exists < 1) printf ("Master Information Type not found. Operation cancelled.<br><br>\n"); |
803 |
|
|
804 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Master Information Type not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
805 |
} |
} |
806 |
|
|
807 |
|
|
808 |
/********************************************************** |
/********************************************************** |
809 |
Function: deleteMastersubject |
Function: deleteMastersubject |
810 |
Author: Paul Bramscher |
Author: Paul Bramscher |
811 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
812 |
*********************************************************** |
*********************************************************** |
813 |
Purpose: |
Purpose: |
814 |
Delete the supplied master subject id, and removes |
Delete the supplied master subject id, and removes |
819 |
theoretically, the additional cascades here aren't |
theoretically, the additional cascades here aren't |
820 |
necessary. |
necessary. |
821 |
**********************************************************/ |
**********************************************************/ |
822 |
function deleteMastersubject($con, $mastersubject_id){ |
function deleteMastersubject($mastersubject_id){ |
823 |
|
|
824 |
// Draw form heading |
msgTableOpen(1, "Deleting Master Subject (ID# " . $mastersubject_id . ")"); |
825 |
printf("<center><h3>Deleting Master Subject...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
826 |
|
|
827 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
828 |
if ($mastersubject_id > 1) { |
if ($mastersubject_id > 1) { |
829 |
|
|
830 |
// Delete from sub_mastersubject |
// Delete from sub_mastersubject |
831 |
if ($problem == 0) { |
$sql = "DELETE FROM sub_mastersubject WHERE mastersubject_id =" . $mastersubject_id; |
832 |
$sql = "DELETE FROM sub_mastersubject WHERE mastersubject_id =" . $mastersubject_id; |
if (xx_tryquery ($sql)) printf("Affected subject-mastersubject assignments removed.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Affected subject-mastersubject assignments removed.<BR>\n"); |
|
|
} |
|
|
} |
|
833 |
|
|
834 |
// Delete from res_mastersubject |
// Delete from res_mastersubject |
835 |
if ($problem == 0) { |
$sql = "DELETE FROM res_mastersubject WHERE mastersubject_id =" . $mastersubject_id; |
836 |
$sql = "DELETE FROM res_mastersubject WHERE mastersubject_id =" . $mastersubject_id; |
if (xx_tryquery ($sql)) printf("Affected resource-mastersubject assignments removed.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Affected resource-mastersubject assignments removed.<BR>\n"); |
|
|
} |
|
|
} |
|
837 |
|
|
838 |
// Delete from mastersubject table |
// Delete from mastersubject table |
839 |
if ($problem == 0) { |
$sql = "DELETE FROM mastersubject WHERE mastersubject_id =" . $mastersubject_id; |
840 |
$sql = "DELETE FROM mastersubject WHERE mastersubject_id =" . $mastersubject_id; |
if (xx_tryquery ($sql)) printf("Removed Master Subject successfully."); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed Master Subject successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
841 |
|
|
842 |
} // mastersubject > 1 (cannot delete N/A). |
} |
843 |
|
else printf ("Cannot delete Master Subject ID# 1, it acts as a system placeholder."); |
844 |
|
|
845 |
else printf("Cannot delete <b>Master Subject ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
printf("<br><br>\n"); |
846 |
|
msgTableClose(); |
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
847 |
} |
} |
848 |
|
|
849 |
|
|
850 |
/********************************************************** |
/********************************************************** |
851 |
Function: deleteMastersubjectConfirm |
Function: deleteMastersubjectConfirm |
852 |
Author: Paul Bramscher |
Author: Paul Bramscher |
853 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
854 |
*********************************************************** |
*********************************************************** |
855 |
Purpose: |
Purpose: |
856 |
Confirm prompt to delete the supplied mastersubject id. |
Confirm prompt to delete the supplied mastersubject id. |
860 |
link to the drilldown page and may not delete this |
link to the drilldown page and may not delete this |
861 |
mastersubject. |
mastersubject. |
862 |
**********************************************************/ |
**********************************************************/ |
863 |
function deleteMastersubjectConfirm($con, $key_id){ |
function deleteMastersubjectConfirm($key_id){ |
864 |
|
|
|
// Make sure we have a valid integer type |
|
865 |
$mastersubject_id = (int) $key_id; |
$mastersubject_id = (int) $key_id; |
866 |
|
msgTableOpen(1, "Delete Master Subject (ID# " . $mastersubject_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Master Subject ID# %s?</h3>", $mastersubject_id); |
|
867 |
|
|
868 |
// Check to see if its possible |
// Check to see if its possible |
869 |
$exists = existsRow($con, "mastersubject", "mastersubject_id", $mastersubject_id); |
$exists = existsRow("mastersubject", "mastersubject_id", $mastersubject_id); |
870 |
if ($exists > 0 && $mastersubject_id > 2){ |
if ($exists > 0 && $mastersubject_id > 2){ |
871 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
872 |
// Lookup the descriptive title |
// Lookup the descriptive title |
873 |
$mastersubject = lookupField($con, "mastersubject", "mastersubject_id", $mastersubject_id, "mastersubject"); |
$mastersubject = lookupField("mastersubject", "mastersubject_id", $mastersubject_id, "mastersubject"); |
874 |
printf("<strong>Master Subject:</strong> %s<br><br>\n ", $mastersubject); |
printf("<b>Master Subject:</b> %s<br><br>\n ", $mastersubject); |
875 |
|
|
876 |
// Determine whether any subjects or resources are affected |
// Determine whether any subjects or resources are affected |
877 |
$problem = 0; |
$problem = 0; |
879 |
// Check subjects |
// Check subjects |
880 |
$sql = "SELECT COUNT(sm.subject_id) as num_subjects FROM sub_mastersubject sm WHERE sm.mastersubject_id =" |
$sql = "SELECT COUNT(sm.subject_id) as num_subjects FROM sub_mastersubject sm WHERE sm.mastersubject_id =" |
881 |
. $mastersubject_id; |
. $mastersubject_id; |
882 |
$rs = xx_query($sql, $con); |
$rs = xx_tryquery($sql); |
883 |
$row = xx_fetch_array ($rs); |
$row = xx_fetch_array ($rs, xx_ASSOC); |
884 |
$num_subjects = $row["num_subjects"]; |
$num_subjects = $row["num_subjects"]; |
885 |
if ($num_subjects > 0) $problem = 1; |
if ($num_subjects > 0) $problem = 1; |
886 |
|
|
887 |
// Check resources |
// Check resources |
888 |
else { |
$sql = "SELECT COUNT(rm.resource_id) as num_resources FROM res_mastersubject rm WHERE rm.mastersubject_id = " |
889 |
// Check resources |
. $mastersubject_id; |
890 |
$sql = "SELECT COUNT(rm.resource_id) as num_resources FROM res_mastersubject rm WHERE rm.mastersubject_id = " |
$rs = xx_tryquery($sql); |
891 |
. $mastersubject_id; |
$row = xx_fetch_array ($rs, xx_ASSOC); |
892 |
$rs = xx_query($sql, $con); |
$num_resources = $row["num_resources"]; |
893 |
$row = xx_fetch_array ($rs); |
if ($num_resources > 0) $problem = 1; |
|
$num_resources = $row["num_resources"]; |
|
|
|
|
|
if ($num_resources > 1) $problem = 1; |
|
|
} |
|
894 |
|
|
895 |
// Proceed only if no subjects or resources are affected |
// Proceed only if no subjects or resources are affected |
896 |
if ($problem == 0) { |
if ($problem == 0) { |
897 |
// Form to draw the delete button |
// Form to draw the delete button |
898 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
899 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteMastersubject\" >"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteMastersubject\" >\n"); |
900 |
printf("<input type = \"Hidden\" name = \"mastersubject_id\" value = \"%d\" >", $mastersubject_id); |
printf("<input type = \"Hidden\" name = \"mastersubject_id\" value = \"%d\" >\n", $mastersubject_id); |
901 |
printf("This will <b>permanently</b> remove the Master Subject from the system. "); |
printf("This will permanently remove the Master Subject from the system. "); |
902 |
printf("Are you sure you want to proceed?<br><br>\n"); |
printf("Are you sure you want to proceed?<br><br>\n"); |
903 |
printf("<center>"); |
printf("<center>\n"); |
904 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
905 |
printf("</center>"); |
printf("</center>\n"); |
906 |
printf("</form><br>"); |
printf("</form>\n"); |
907 |
} |
} |
908 |
|
|
909 |
// There was a problem of some sort. |
// There was a problem of some sort. |
910 |
else { |
else { |
911 |
printf("Dependencies were found. Master Subjects may not be deleted if there are resources or "); |
printf("Dependencies were found. Master Subjects may not be deleted if there are resources or "); |
912 |
printf("specific subjects assigned to them. "); |
printf("specific subjects assigned to them. "); |
913 |
printf("Examine the <a href=\"admin_mastersubject_detail.phtml?mastersubject_id=%d\">Master Subject Detail</a></b> page.\n", $mastersubject_id); |
printf("Examine the <a href=\"mastersubject_drill.phtml?mastersubject_id=%d\">Master Subject Detail</a></b> page.\n", $mastersubject_id); |
914 |
printf("<br><br>\n"); |
printf("<br><br>\n"); |
915 |
} |
} |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
916 |
|
|
917 |
} |
} |
918 |
|
else if ($exists < 1) printf ("Master Subject not found. Operation cancelled.<br><br>\n"); |
919 |
|
else if ($mastersubject_id < 3) printf("Master Subjects ID's #1 and #2 cannot be deleted.<br><br>\n"); |
920 |
|
|
921 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Master Subject not found. Operation cancelled.<br>\n"); |
|
|
else if ($mastersubject_id < 3) printf("Master Subjects #1 and #2 cannot be deleted.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
922 |
} |
} |
923 |
|
|
924 |
|
|
925 |
/********************************************************** |
/********************************************************** |
926 |
Function: deleteResFeature |
Function: deleteResFeature |
927 |
Author: Paul Bramscher |
Author: Paul Bramscher |
928 |
Last Modified: 04.21.2003 |
Last Modified: 03.02.2004 |
929 |
*********************************************************** |
*********************************************************** |
930 |
Purpose: |
Purpose: |
931 |
Deletes resource-feature associations based on the supplied |
Deletes resource-feature associations based on the supplied |
932 |
feature id (possibly multiple) and calls formResource back |
feature id (possibly multiple) and calls formResource back |
933 |
again. |
again. |
934 |
**********************************************************/ |
**********************************************************/ |
935 |
function deleteResFeature($con, $key_list_array, $resource_id){ |
function deleteResFeature($key_list_array, $resource_id){ |
936 |
|
|
937 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
938 |
|
|
940 |
. $resource_id |
. $resource_id |
941 |
. " AND feature_id = " |
. " AND feature_id = " |
942 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
943 |
|
xx_tryquery ($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
944 |
} |
} |
945 |
// Call the resource form back |
// Call the resource form back |
946 |
formResource($con, $resource_id, 0, 0, ''); |
formResource($resource_id, 0, 0, ''); |
947 |
} |
} |
948 |
|
|
949 |
|
|
950 |
/********************************************************** |
/********************************************************** |
951 |
Function: deleteResLoc |
Function: deleteResLoc |
952 |
Author: Paul Bramscher |
Author: Paul Bramscher |
953 |
Last Modified: 04.21.2003 |
Last Modified: 03.02.2004 |
954 |
*********************************************************** |
*********************************************************** |
955 |
Purpose: |
Purpose: |
956 |
Deletes resource-location associations based on the supplied |
Deletes resource-location associations based on the supplied |
957 |
location id (possibly multiple) and calls formResource back |
location id (possibly multiple) and calls formResource back |
958 |
again. |
again. |
959 |
**********************************************************/ |
**********************************************************/ |
960 |
function deleteResLoc($con, $key_list_array, $resource_id){ |
function deleteResLoc($key_list_array, $resource_id){ |
961 |
|
|
962 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
963 |
$sql = "DELETE FROM res_loc WHERE resource_id = " |
$sql = "DELETE FROM res_loc WHERE resource_id = " |
964 |
. $resource_id |
. $resource_id |
965 |
. " AND location_id = " |
. " AND location_id = " |
966 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
967 |
|
xx_tryquery ($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
968 |
} |
} |
969 |
// Call the resource form back |
// Call the resource form back |
970 |
formResource($con, $resource_id, 0, 0, ''); |
formResource($resource_id, 0, 0, ''); |
971 |
} |
} |
972 |
|
|
973 |
|
|
974 |
/********************************************************** |
/********************************************************** |
975 |
Function: deleteResMastersubject |
Function: deleteResMastersubject |
976 |
Author: Paul Bramscher |
Author: Paul Bramscher |
977 |
Last Modified: 04.21.2003 |
Last Modified: 03.02.2004 |
978 |
*********************************************************** |
*********************************************************** |
979 |
Purpose: |
Purpose: |
980 |
Deletes resource-mastersubject associations based on the |
Deletes resource-mastersubject associations based on the |
981 |
supplied mastersubject id (possibly multiple) and calls |
supplied mastersubject id (possibly multiple) and calls |
982 |
formResource back again. |
formResource back again. |
983 |
**********************************************************/ |
**********************************************************/ |
984 |
function deleteResMastersubject($con, $key_list_array, $resource_id){ |
function deleteResMastersubject($key_list_array, $resource_id){ |
985 |
|
|
986 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
987 |
|
|
988 |
$sql = "DELETE FROM res_mastersubject WHERE resource_id = " |
$sql = "DELETE FROM res_mastersubject WHERE resource_id = " |
989 |
. $resource_id |
. $resource_id |
990 |
. " AND mastersubject_id = " |
. " AND mastersubject_id = " |
991 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
992 |
|
xx_tryquery ($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
993 |
} |
} |
994 |
// Call the resource form back |
// Call the resource form back |
995 |
formResource($con, $resource_id, 0, 0, ''); |
formResource($resource_id, 0, 0, ''); |
996 |
} |
} |
997 |
|
|
998 |
|
|
999 |
/********************************************************** |
/********************************************************** |
1000 |
Function: deleteResource |
Function: deleteResource |
1001 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1002 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
1003 |
*********************************************************** |
*********************************************************** |
1004 |
Purpose: |
Purpose: |
1005 |
Deletes the supplied resource id, and removes associations |
Deletes the supplied resource id, and removes associations |
1009 |
Page/CourseScribe pages to text-type fields (non-relational), |
Page/CourseScribe pages to text-type fields (non-relational), |
1010 |
as well as all user copy-paste buffers. |
as well as all user copy-paste buffers. |
1011 |
**********************************************************/ |
**********************************************************/ |
1012 |
function deleteResource($con, $delMessage, $resource_id){ |
function deleteResource($delMessage, $resource_id){ |
|
|
|
|
// Table |
|
|
printf("<center>\n"); |
|
|
printf("<table width=\"50%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Messages"); |
|
|
printf("</td></tr>\n"); |
|
1013 |
|
|
1014 |
// New row |
msgTableOpen(1, "Deleting Resource (ID# " . $resource_id . ")"); |
1015 |
printf("<tr><td>\n"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Set up a problem flag. |
|
|
$problem = 0; |
|
1016 |
|
|
1017 |
// First delete all related rows in res_sub_infotype |
// First delete all related rows in res_sub_infotype |
1018 |
$sql = "DELETE FROM res_sub_infotype WHERE resource_id = " . $resource_id; |
$sql = "DELETE FROM res_sub_infotype WHERE resource_id = " . $resource_id; |
1019 |
|
if (xx_tryquery ($sql)) printf("Resource removed from all resource-subject-infotype assignments.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Resource removed from all resource-subject-infotype assignments.<BR>\n"); |
|
|
|
|
|
} |
|
1020 |
|
|
1021 |
// Delete from the res_loc table |
// Delete from the res_loc table |
1022 |
if ($problem == 0) { |
$sql = "DELETE FROM res_loc WHERE resource_id =" . $resource_id; |
1023 |
$sql = "DELETE FROM res_loc WHERE resource_id =" . $resource_id; |
if (xx_tryquery ($sql)) printf("Removed from resource-location table.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed from resource-location table.<BR>\n"); |
|
|
} |
|
|
} |
|
1024 |
|
|
1025 |
// Delete from the res_mastersubject table |
// Delete from the res_mastersubject table |
1026 |
if ($problem == 0) { |
$sql = "DELETE FROM res_mastersubject WHERE resource_id =" . $resource_id; |
1027 |
|
if (xx_tryquery ($sql)) printf("Removed from resource-mastersubject table.<BR>\n"); |
|
$sql = "DELETE FROM res_mastersubject WHERE resource_id =" . $resource_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed from resource-mastersubject table.<BR>\n"); |
|
|
} |
|
|
} |
|
1028 |
|
|
1029 |
// Delete from the res_feature table |
// Delete from the res_feature table |
1030 |
if ($problem == 0) { |
$sql = "DELETE FROM res_feature WHERE resource_id =" . $resource_id; |
1031 |
|
if (xx_tryquery ($sql)) printf("Removed from resource-feature table.<BR>\n"); |
|
$sql = "DELETE FROM res_feature WHERE resource_id =" . $resource_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed from resource-feature table.<BR>\n"); |
|
|
} |
|
|
} |
|
1032 |
|
|
1033 |
// Update affected PageScribe pages |
/******************************** |
1034 |
if ($problem == 0) { |
** Update affected CL/PS pages ** |
1035 |
|
********************************/ |
1036 |
// First, get the default resource description and title |
|
1037 |
$sql = "SELECT annotation, title FROM resource WHERE resource_id = " |
// First, get the default resource description and title |
1038 |
. $resource_id; |
$sql = "SELECT annotation, title FROM resource WHERE resource_id = " |
1039 |
$rs = xx_query($sql, $con); |
. $resource_id; |
1040 |
$row = xx_fetch_array ($rs); |
$rs = xx_tryquery($sql); |
1041 |
$annotation = $row["annotation"]; |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1042 |
$title = $row["title"]; |
$annotation = $row["annotation"]; |
1043 |
|
$title = $row["title"]; |
1044 |
// Clean up |
|
1045 |
$title = textInmySQL($title); |
// Clean up |
1046 |
$annotation = textInmySQL($annotation); |
$title = textInmySQL($title); |
1047 |
$delMessage = textInmySQL($delMessage); |
$annotation = textInmySQL($annotation); |
1048 |
|
$delMessage = textInmySQL($delMessage); |
1049 |
// Next, append the reason for deletion to the annotation |
|
1050 |
if (strlen($annotation) > 0) $annotation .= "<BR>" . $delMessage; |
// Next, append the reason for deletion to the annotation |
1051 |
else $annotation = $delMessage; |
if (strlen($annotation) > 0) $annotation .= "<BR>" . $delMessage; |
1052 |
|
else $annotation = $delMessage; |
1053 |
// Update all of the elements using this resource with a custom description. |
|
1054 |
$sql = "UPDATE element SET label = '" |
// Update all of the elements using this resource with a custom description. |
1055 |
. $title |
$sql = "UPDATE element SET label = '" |
1056 |
. "', element_descr = CONCAT(element_descr, '<BR>" |
. $title |
1057 |
. $delMessage |
. "', element_descr = CONCAT(element_descr, '<BR>" |
1058 |
. "'), resource_id = NULL WHERE resource_id =" . $resource_id |
. $delMessage |
1059 |
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
. "'), resource_id = NULL WHERE resource_id =" . $resource_id |
1060 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
1061 |
if (!xx_query ($sql, $con)){ |
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
1062 |
$problem = 1; |
|
1063 |
sql_err($sql); |
// Next, update all of the elements using this resource without a custom description. |
1064 |
xx_query ("UNLOCK TABLES", $con); |
$sql = "UPDATE element SET label = '" |
1065 |
bailout(); |
. $title |
1066 |
} |
. "', element_descr = '" |
1067 |
else { |
. $annotation |
1068 |
xx_query ("UNLOCK TABLES", $con); |
. "', resource_id = NULL WHERE resource_id =" . $resource_id |
1069 |
printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
. " AND (element_descr IS NULL OR element_descr = '')"; |
1070 |
} |
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
1071 |
|
|
1072 |
|
/*************************************** |
1073 |
// Next, update all of the elements using this resource without a custom description. |
** Update affected CL/PS copy buffers ** |
1074 |
$sql = "UPDATE element SET label = '" |
***************************************/ |
1075 |
. $title |
|
1076 |
. "', element_descr = '" |
// Update all of the elements using this resource with a custom description. |
1077 |
. $annotation |
$sql = "UPDATE pastebuffer SET label = '" |
1078 |
. "', resource_id = NULL WHERE resource_id =" . $resource_id |
. $title |
1079 |
. " AND (element_descr IS NULL OR element_descr = '')"; |
. "', element_descr = CONCAT(element_descr, '<BR>" |
1080 |
|
. $delMessage |
1081 |
if (!xx_query ($sql, $con)){ |
. "'), resource_id = NULL WHERE resource_id =" . $resource_id |
1082 |
$problem = 1; |
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
1083 |
sql_err($sql); |
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
1084 |
xx_query ("UNLOCK TABLES", $con); |
|
1085 |
bailout(); |
// Next, update all of the elements using this resource without a custom description. |
1086 |
} |
$sql = "UPDATE pastebuffer SET label = '" |
1087 |
else { |
. $title |
1088 |
xx_query ("UNLOCK TABLES", $con); |
. "', element_descr = '" |
1089 |
printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
. $annotation |
1090 |
} |
. "', resource_id = NULL WHERE resource_id =" . $resource_id |
1091 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
1092 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
1093 |
} |
|
1094 |
|
// Delete from the resource table |
1095 |
|
$sql = "DELETE FROM resource WHERE resource_id =" . $resource_id; |
1096 |
// Update affected PageScribe copy buffers |
if (xx_tryquery ($sql)) printf("Successfully removed from all tables."); |
|
if ($problem == 0) { |
|
|
|
|
|
// Update all of the elements using this resource with a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $title |
|
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), resource_id = NULL WHERE resource_id =" . $resource_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
// Next, update all of the elements using this resource without a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $title |
|
|
. "', element_descr = '" |
|
|
. $annotation |
|
|
. "', resource_id = NULL WHERE resource_id =" . $resource_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
1097 |
|
|
1098 |
|
printf("<br><br>\n"); |
1099 |
// Delete from the resource table |
msgTableClose(); |
|
if ($problem == 0) { |
|
|
|
|
|
$sql = "DELETE FROM resource WHERE resource_id =" . $resource_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
|
|
|
if ($problem == 0) printf("Successfully removed from all tables.<BR><BR>\n"); |
|
|
|
|
|
printf("</td></tr></table>\n"); |
|
|
printf("</center><BR>\n"); |
|
1100 |
} |
} |
1101 |
|
|
1102 |
|
|
1103 |
/********************************************************** |
/********************************************************** |
1104 |
Function: deleteResourceConfirm |
Function: deleteResourceConfirm |
1105 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1106 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
1107 |
*********************************************************** |
*********************************************************** |
1108 |
Purpose: |
Purpose: |
1109 |
Confirm prompt to delete the supplied resource id. |
Confirm prompt to delete the supplied resource id. |
1110 |
**********************************************************/ |
**********************************************************/ |
1111 |
function deleteResourceConfirm($con, $resource_id){ |
function deleteResourceConfirm($resource_id){ |
1112 |
|
|
|
// Make sure we have a valid integer type |
|
1113 |
$resource_id = (int) $resource_id; |
$resource_id = (int) $resource_id; |
1114 |
|
msgTableOpen(1, "Delete Resource (ID# " . $resource_id . ")?"); |
|
printf("<center>\n"); |
|
1115 |
|
|
1116 |
// Check to see if its possible |
// Check to see if its possible |
1117 |
$exists = existsRow($con, "resource", "resource_id", $resource_id); |
$exists = existsRow("resource", "resource_id", $resource_id); |
1118 |
if ($exists > 0){ |
if ($exists > 0){ |
1119 |
|
|
|
// Table |
|
|
printf("<table width=\"60%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Resource ID# %s?", $resource_id); |
|
|
printf("</td></tr>\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
1120 |
// Lookup the title & author |
// Lookup the title & author |
1121 |
$title = lookupField($con, "resource", "resource_id", $resource_id, "title"); |
$title = lookupField("resource", "resource_id", $resource_id, "title"); |
1122 |
$author = lookupField($con, "resource", "resource_id", $resource_id, "author"); |
$author = lookupField("resource", "resource_id", $resource_id, "author"); |
1123 |
printf("<b>Title:</b> %s<br>\n ", $title); |
printf("<b>Title:</b> %s<br>\n ", $title); |
1124 |
printf("<b>Author:</b> %s<br><br>\n ", $author); |
printf("<b>Author:</b> %s<br><br>\n ", $author); |
1125 |
|
|
1136 |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Resource no longer available]\" size=\"75\"><br><br>\n"); |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Resource no longer available]\" size=\"75\"><br><br>\n"); |
1137 |
|
|
1138 |
// Warning |
// Warning |
1139 |
printf("This will <b>permanently</b> remove the resource and its various assignments from the system.<BR><BR>\n"); |
printf("This will permanently remove the resource and its various assignments from the system.<BR><BR>\n"); |
1140 |
|
|
1141 |
// Delete button |
// Delete button |
1142 |
printf("<center>\n"); |
printf("<center>\n"); |
1143 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1144 |
printf("</center>\n"); |
printf("</center>\n"); |
1145 |
printf("</form><br>\n"); |
printf("</form>\n"); |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>\n"); |
|
|
printf("<BR>\n"); |
|
1146 |
} |
} |
1147 |
|
else if ($exists < 1) printf ("Resource not found. Operation cancelled.<br><br>\n"); |
1148 |
|
|
1149 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Resource #%d not found. Operation cancelled.<br><br>\n", $resource_id); |
|
|
|
|
|
printf("</center>\n"); |
|
1150 |
} |
} |
1151 |
|
|
1152 |
|
|
1153 |
/********************************************************** |
/********************************************************** |
1154 |
Function: deleteService |
Function: deleteService |
1155 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1156 |
Last Modified: 05.21.2003 |
Last Modified: 03.16.2004 |
1157 |
*********************************************************** |
*********************************************************** |
1158 |
Purpose: |
Purpose: |
1159 |
Deletes the supplied service id, and removes associations |
Deletes the supplied service id, and removes associations |
1162 |
Page/CourseScribe pages to text-type fields (non-relational), |
Page/CourseScribe pages to text-type fields (non-relational), |
1163 |
as well as all user copy-paste buffers. |
as well as all user copy-paste buffers. |
1164 |
**********************************************************/ |
**********************************************************/ |
1165 |
function deleteService($con, $delMessage, $service_id){ |
function deleteService($delMessage, $service_id){ |
|
|
|
|
// Table |
|
|
printf("<center>\n"); |
|
|
printf("<table width=\"50%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Messages"); |
|
|
printf("</td></tr>\n"); |
|
|
|
|
|
// New row |
|
|
printf("<tr><td>\n"); |
|
1166 |
|
|
1167 |
// Set up a problem flag. |
msgTableOpen(1, "Deleting Service (ID# " . $service_id . ")"); |
1168 |
$problem = 0; |
printf("<b>Messages:</b><br>\n"); |
1169 |
|
|
1170 |
// First delete all related rows in serv_servtype |
// First delete all related rows in serv_servtype |
1171 |
$sql = "DELETE FROM serv_servtype WHERE service_id = " . $service_id; |
$sql = "DELETE FROM serv_servtype WHERE service_id = " . $service_id; |
1172 |
|
if (xx_tryquery ($sql)) printf("Service removed from all service-servicetype assignments.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Service removed from all service-servicetype assignments.<BR>\n"); |
|
|
|
|
|
} |
|
1173 |
|
|
1174 |
// Delete from the serv_loc table |
// Delete from the serv_loc table |
1175 |
if ($problem == 0) { |
$sql = "DELETE FROM serv_loc WHERE service_id =" . $service_id; |
1176 |
$sql = "DELETE FROM serv_loc WHERE service_id =" . $service_id; |
if (xx_tryquery ($sql)) printf("Removed from service-location table.<BR>\n"); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed from service-location table.<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Update affected PageScribe pages |
|
|
if ($problem == 0) { |
|
|
|
|
|
// First, get the default service description and title |
|
|
$sql = "SELECT service, serviceDescr FROM service WHERE service_id = " |
|
|
. $service_id; |
|
|
$rs = xx_query($sql, $con); |
|
|
$row = xx_fetch_array ($rs); |
|
|
$service = $row["service"]; |
|
|
$serviceDescr = $row["serviceDescr"]; |
|
|
|
|
|
// Clean up strings |
|
|
$service = textInmySQL($service); |
|
|
$serviceDescr = textInmySQL($serviceDescr); |
|
|
$delMessage = textInmySQL($delMessage); |
|
|
|
|
|
// Next, append the reason for deletion to the annotation |
|
|
if (strlen($serviceDescr) > 0) $serviceDescr .= "<BR>" . $delMessage; |
|
|
else $serviceDescr = $delMessage; |
|
|
|
|
|
// Update all of the elements using this service with a custom description. |
|
|
$sql = "UPDATE element SET label = '" |
|
|
. $service |
|
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), service_id = NULL WHERE service_id =" . $service_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
|
|
} |
|
1177 |
|
|
1178 |
|
/******************************** |
1179 |
|
** Update affected CL/PS pages ** |
1180 |
|
********************************/ |
1181 |
|
|
1182 |
|
// First, get the default service description and title |
1183 |
|
$sql = "SELECT service, serviceDescr FROM service WHERE service_id = " |
1184 |
|
. $service_id; |
1185 |
|
$rs = xx_tryquery($sql); |
1186 |
|
$row = xx_fetch_array ($rs, xx_ASSOC); |
1187 |
|
$service = $row["service"]; |
1188 |
|
$serviceDescr = $row["serviceDescr"]; |
1189 |
|
|
1190 |
|
// Clean up strings |
1191 |
|
$service = textInmySQL($service); |
1192 |
|
$serviceDescr = textInmySQL($serviceDescr); |
1193 |
|
$delMessage = textInmySQL($delMessage); |
1194 |
|
|
1195 |
|
// Next, append the reason for deletion to the annotation |
1196 |
|
if (strlen($serviceDescr) > 0) $serviceDescr .= "<BR>" . $delMessage; |
1197 |
|
else $serviceDescr = $delMessage; |
1198 |
|
|
1199 |
|
// Update all of the elements using this service with a custom description. |
1200 |
|
$sql = "UPDATE element SET label = '" |
1201 |
|
. $service |
1202 |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
1203 |
|
. $delMessage |
1204 |
|
. "'), service_id = NULL WHERE service_id =" . $service_id |
1205 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
1206 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
1207 |
|
|
1208 |
|
// Next, update all of the elements using this service without a custom description. |
1209 |
|
$sql = "UPDATE element SET label = '" |
1210 |
|
. $service |
1211 |
|
. "', element_descr = '" |
1212 |
|
. $serviceDescr |
1213 |
|
. "', service_id = NULL WHERE service_id =" . $service_id |
1214 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
1215 |
|
|
1216 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
1217 |
|
|
1218 |
|
/*************************************** |
1219 |
|
** Update affected CP/PS copy buffers ** |
1220 |
|
***************************************/ |
1221 |
|
|
1222 |
|
// Update all of the elements using this service with a custom description. |
1223 |
|
$sql = "UPDATE pastebuffer SET label = '" |
1224 |
|
. $service |
1225 |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
1226 |
|
. $delMessage |
1227 |
|
. "'), service_id = NULL WHERE service_id =" . $service_id |
1228 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
1229 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
1230 |
|
|
1231 |
|
// Next, update all of the elements using this service without a custom description. |
1232 |
|
$sql = "UPDATE pastebuffer SET label = '" |
1233 |
|
. $service |
1234 |
|
. "', element_descr = '" |
1235 |
|
. $serviceDescr |
1236 |
|
. "', service_id = NULL WHERE service_id =" . $service_id |
1237 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
1238 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
1239 |
|
|
1240 |
|
// Delete from the service table |
1241 |
|
$sql = "DELETE FROM service WHERE service_id =" . $service_id; |
1242 |
|
if (xx_tryquery ($sql)) printf("Successfully removed from all tables."); |
1243 |
|
|
1244 |
// Next, update all of the elements using this service without a custom description. |
printf("<br><br>\n"); |
1245 |
$sql = "UPDATE element SET label = '" |
msgTableClose(); |
|
. $service |
|
|
. "', element_descr = '" |
|
|
. $serviceDescr |
|
|
. "', service_id = NULL WHERE service_id =" . $service_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Update affected PageScribe copy buffers |
|
|
if ($problem == 0) { |
|
|
|
|
|
// Update all of the elements using this service with a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $service |
|
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), service_id = NULL WHERE service_id =" . $service_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
// Next, update all of the elements using this service without a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $service |
|
|
. "', element_descr = '" |
|
|
. $serviceDescr |
|
|
. "', service_id = NULL WHERE service_id =" . $service_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Delete from the service table |
|
|
if ($problem == 0) { |
|
|
|
|
|
$sql = "DELETE FROM service WHERE service_id =" . $service_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
|
|
|
if ($problem == 0) printf("Successfully removed from all tables.<BR><BR>\n"); |
|
|
|
|
|
printf("</td></tr></table>\n"); |
|
|
printf("</center><BR>\n"); |
|
1246 |
} |
} |
1247 |
|
|
1248 |
|
|
1249 |
/********************************************************** |
/********************************************************** |
1250 |
Function: deleteServiceConfirm |
Function: deleteServiceConfirm |
1251 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1252 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
1253 |
*********************************************************** |
*********************************************************** |
1254 |
Purpose: |
Purpose: |
1255 |
Confirm prompt to delete the supplied service id. |
Confirm prompt to delete the supplied service id. |
1256 |
**********************************************************/ |
**********************************************************/ |
1257 |
function deleteServiceConfirm($con, $key_id){ |
function deleteServiceConfirm($key_id){ |
1258 |
|
|
|
// Make sure we have a valid integer type |
|
1259 |
$service_id = (int) $key_id; |
$service_id = (int) $key_id; |
1260 |
|
msgTableOpen(1, "Delete Service (ID# " . $service_id . ")?"); |
|
printf("<center>\n"); |
|
1261 |
|
|
1262 |
// Check to see if its possible |
// Check to see if its possible |
1263 |
$exists = existsRow($con, "service", "service_id", $service_id); |
$exists = existsRow("service", "service_id", $service_id); |
1264 |
if ($exists > 0){ |
if ($exists > 0){ |
1265 |
|
|
|
// Table |
|
|
printf("<table width=\"60%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Service ID# %s?", $service_id); |
|
|
printf("</td></tr>\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
1266 |
// Lookup the descriptive title |
// Lookup the descriptive title |
1267 |
$service = lookupField($con, "service", "service_id", $service_id, "service"); |
$service = lookupField("service", "service_id", $service_id, "service"); |
1268 |
printf("<b>Service:</b> %s<br><br>\n ", $service); |
printf("<b>Service:</b> %s<br><br>\n ", $service); |
1269 |
|
|
1270 |
// Form to draw the delete button |
// Form to draw the delete button |
1277 |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Service no longer available]\" size=\"75\"><br><br>\n"); |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Service no longer available]\" size=\"75\"><br><br>\n"); |
1278 |
|
|
1279 |
// Warning |
// Warning |
1280 |
printf("This will <b>permanently</b> remove the service and its various assignments from the system.<BR><BR>\n"); |
printf("This will permanently remove the service and its various assignments from the system.<BR><BR>\n"); |
1281 |
|
|
1282 |
// Delete button |
// Delete button |
1283 |
printf("<center>\n"); |
printf("<center>\n"); |
1284 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1285 |
printf("</center>\n"); |
printf("</center>\n"); |
1286 |
printf("</form><br>\n"); |
printf("</form>\n"); |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>\n"); |
|
|
printf("<BR>\n"); |
|
1287 |
} |
} |
1288 |
|
else if ($exists < 1) printf ("Service not found. Operation cancelled.<br><br>\n"); |
1289 |
|
|
1290 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Service #%d not found. Operation cancelled.<br><br>\n", $service_id); |
|
|
|
|
|
printf("</center>\n"); |
|
1291 |
} |
} |
1292 |
|
|
1293 |
|
|
1294 |
/********************************************************** |
/********************************************************** |
1295 |
Function: deleteServicetype |
Function: deleteServicetype |
1296 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1297 |
Last Modified: 04.21.2003 |
Last Modified: 03.15.2004 |
1298 |
*********************************************************** |
*********************************************************** |
1299 |
Purpose: |
Purpose: |
1300 |
Delete the supplied service type id. This will render |
Delete the supplied service type id. This will render |
1301 |
some services without a type, but this does not break |
some services without a type, but this does not break |
1302 |
anything. |
anything. |
1303 |
**********************************************************/ |
**********************************************************/ |
1304 |
function deleteServicetype($con, $servicetype_id){ |
function deleteServicetype($servicetype_id){ |
1305 |
|
|
1306 |
// Draw form heading |
msgTableOpen(1, "Deleting Service Type (ID# " . $servicetype_id . ")"); |
1307 |
printf("<center><h3>Deleting Service Type...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
1308 |
|
|
1309 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
1310 |
if ($servicetype_id > 1) { |
if ($servicetype_id > 1) { |
1311 |
|
|
1312 |
|
// Delete from serv_servtype table |
1313 |
|
$sql = "DELETE FROM serv_servtype WHERE servicetype_id =" . $servicetype_id; |
1314 |
|
if (xx_tryquery ($sql)) printf("Removed Service-Service Type associations.<BR>\n"); |
1315 |
|
|
1316 |
// Delete from servicetype table |
// Delete from servicetype table |
1317 |
$sql = "DELETE FROM servicetype WHERE servicetype_id =" . $servicetype_id; |
$sql = "DELETE FROM servicetype WHERE servicetype_id =" . $servicetype_id; |
1318 |
|
if (xx_tryquery ($sql)) printf("Removed Service Type successfully."); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed Service Type successfully.<BR><BR>\n"); |
|
|
} |
|
1319 |
|
|
1320 |
} |
} |
1321 |
|
else printf ("Cannot delete Service Type ID# 1, it acts as a system placeholder."); |
1322 |
|
|
1323 |
else printf("Cannot delete <b>Service Type ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
printf("<br><br>\n"); |
1324 |
|
msgTableClose(); |
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
1325 |
} |
} |
1326 |
|
|
1327 |
|
|
1328 |
/********************************************************** |
/********************************************************** |
1329 |
Function: deleteServicetypeConfirm |
Function: deleteServicetypeConfirm |
1330 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1331 |
Last Modified: 04.21.2003 |
Last Modified: 03.16.2004 |
1332 |
*********************************************************** |
*********************************************************** |
1333 |
Purpose: |
Purpose: |
1334 |
Confirm prompt to delete the supplied service type id. |
Confirm prompt to delete the supplied service type id. |
1335 |
**********************************************************/ |
**********************************************************/ |
1336 |
function deleteServicetypeConfirm($con, $key_id){ |
function deleteServicetypeConfirm($key_id){ |
1337 |
|
|
|
// Make sure we have a valid integer type |
|
1338 |
$servicetype_id = (int) $key_id; |
$servicetype_id = (int) $key_id; |
1339 |
|
msgTableOpen(1, "Delete Service Type (ID# " . $servicetype_id . ")?"); |
|
printf("<center>\n"); |
|
1340 |
|
|
1341 |
// Check to see if its possible |
// Check to see if its possible |
1342 |
$exists = existsRow($con, "servicetype", "servicetype_id", $servicetype_id); |
$exists = existsRow("servicetype", "servicetype_id", $servicetype_id); |
1343 |
if ($exists > 0){ |
if ($exists > 0){ |
1344 |
|
|
|
// Table |
|
|
printf("<table width=\"60%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Service Type ID# %s?", $servicetype_id); |
|
|
printf("</td></tr>\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
1345 |
// Lookup the descriptive title |
// Lookup the descriptive title |
1346 |
$servicetype = lookupField($con, "servicetype", "servicetype_id", $servicetype_id, "servicetype"); |
$servicetype = lookupField("servicetype", "servicetype_id", $servicetype_id, "servicetype"); |
1347 |
printf("<b>Service Type:</b> %s<br><br>\n ", $servicetype); |
printf("<b>Service Type:</b> %s<br><br>\n ", $servicetype); |
1348 |
|
printf("This will permanently remove this Service Type. Note that Services which rely exclusively on this Service Type will be left without a Service Type.<br><br>\n"); |
1349 |
|
|
1350 |
// Form to draw the delete button |
// Form to draw the delete button |
1351 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
1352 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServicetype\" >\n"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServicetype\" >\n"); |
1353 |
printf("<input type = \"Hidden\" name = \"servicetype_id\" value = \"%d\" >\n", $servicetype_id); |
printf("<input type = \"Hidden\" name = \"servicetype_id\" value = \"%d\" >\n", $servicetype_id); |
1354 |
|
|
|
// Warning |
|
|
printf("This will <b>permanently</b> remove this Service Type. Note that Services which rely exlusively on this Service Type will be left without a Service Type.<br><br>\n"); |
|
|
|
|
1355 |
// Delete button |
// Delete button |
1356 |
printf("<center>\n"); |
printf("<center>\n"); |
1357 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1358 |
printf("</center>\n"); |
printf("</center>\n"); |
1359 |
printf("</form><br>\n"); |
printf("</form>\n"); |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>\n"); |
|
|
printf("<BR>\n"); |
|
1360 |
} |
} |
1361 |
|
else if ($exists < 1) printf ("Service Type not found. Operation cancelled.<br><br>\n"); |
1362 |
|
|
1363 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Service Type #%d not found. Operation cancelled.<br><br>\n", $servicetype_id); |
|
|
|
|
|
printf("</center>\n"); |
|
1364 |
} |
} |
1365 |
|
|
1366 |
|
|
1367 |
/********************************************************** |
/********************************************************** |
1368 |
Function: deleteServLoc |
Function: deleteServLoc |
1369 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1370 |
Last Modified: 04.21.2003 |
Last Modified: 03.02.2004 |
1371 |
*********************************************************** |
*********************************************************** |
1372 |
Purpose: |
Purpose: |
1373 |
Deletes service-location associations based on the supplied |
Deletes service-location associations based on the supplied |
1374 |
location id (possibly multiple) and calls formService back |
location id (possibly multiple) and calls formService back |
1375 |
again. |
again. |
1376 |
**********************************************************/ |
**********************************************************/ |
1377 |
function deleteServLoc($con, $key_list_array, $service_id){ |
function deleteServLoc($key_list_array, $service_id){ |
1378 |
|
|
1379 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
1380 |
|
|
1382 |
. $service_id |
. $service_id |
1383 |
. " AND location_id = " |
. " AND location_id = " |
1384 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
1385 |
|
xx_tryquery ($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1386 |
} |
} |
1387 |
// Call the service form back |
// Call the service form back |
1388 |
formService($con, $service_id, 0, 0); |
formService($service_id, 0, 0); |
1389 |
} |
} |
1390 |
|
|
1391 |
|
|
1392 |
/********************************************************** |
/********************************************************** |
1393 |
Function: deleteServServtype |
Function: deleteServServtype |
1394 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1395 |
Last Modified: 04.21.2003 |
Last Modified: 03.02.2004 |
1396 |
*********************************************************** |
*********************************************************** |
1397 |
Purpose: |
Purpose: |
1398 |
Deletes service-servicetype associations based on the |
Deletes service-servicetype associations based on the |
1399 |
supplied servicetype id (possibly multiple) and calls |
supplied servicetype id (possibly multiple) and calls |
1400 |
formService back again. |
formService back again. |
1401 |
**********************************************************/ |
**********************************************************/ |
1402 |
function deleteServServtype($con, $key_list_array, $service_id){ |
function deleteServServtype($key_list_array, $service_id){ |
1403 |
|
|
1404 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
1405 |
|
|
1407 |
. $service_id |
. $service_id |
1408 |
. " AND servicetype_id = " |
. " AND servicetype_id = " |
1409 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
1410 |
|
xx_tryquery ($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1411 |
} |
} |
1412 |
// Call the service form back |
// Call the service form back |
1413 |
formService($con, $service_id, 0, 0); |
formService($service_id, 0, 0); |
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteSubCoursesub |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 06.04.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes subject-coursesub associations based on the supplied |
|
|
coursesub id (possibly multiple) and calls formSubject back |
|
|
again. |
|
|
**********************************************************/ |
|
|
function deleteSubCoursesub($con, $key_list_array, $subject_id){ |
|
|
|
|
|
// For the given subject, delete every location in the array |
|
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
|
|
|
|
|
$sql = "DELETE FROM sub_coursesub WHERE subject_id = " |
|
|
. $subject_id |
|
|
. " AND coursesub_id = " |
|
|
. $key_list_array[$element]; |
|
|
|
|
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
// Call the subject form back |
|
|
formSubject($con, $subject_id); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteSubject |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 06.17.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes a subject, and removes associations in the |
|
|
resource-subject-informationtype, subject-location, |
|
|
subject-mastersubject, subject-coursesub, and |
|
|
subject-staff tables. |
|
|
**********************************************************/ |
|
|
function deleteSubject($con, $delMessage, $subject_id){ |
|
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Subject...</h3>"); |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
|
|
|
|
// Cannot delete placeholder #1 |
|
|
if ($subject_id > 1) { |
|
|
// First delete all related rows in res_sub_infotype |
|
|
$sql = "DELETE FROM res_sub_infotype WHERE subject_id = " . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Resource-subject-information type associations removed.<BR>\n"); |
|
|
} |
|
|
|
|
|
// Delete from the sub_loc table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM sub_loc WHERE subject_id =" . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-location associations removed.<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
// Delete from the sub_mastersubject table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM sub_mastersubject WHERE subject_id =" . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-mastersubject associations removed.<BR>\n"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// Delete from the sub_staff table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM sub_staff WHERE subject_id =" . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-staff assignments removed.<BR>\n"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// Delete from the sub_coursesub table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM sub_coursesub WHERE subject_id =" . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-Course Subject assignments removed.<BR>\n"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// Delete from the sub_page table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM sub_page WHERE subject_id =" . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-Page assignments removed.<BR>\n"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// Delete from the sub_othersub table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM sub_othersub WHERE othersub_id =" |
|
|
. $subject_id |
|
|
. " OR subject_id = " |
|
|
. $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Subject-Other Subject assignments removed.<BR>\n"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// Update affected PageScribe pages |
|
|
if ($problem == 0) { |
|
|
|
|
|
// First, get the default subject description and title |
|
|
$sql = "SELECT subject, subject_descr FROM subject WHERE subject_id = " |
|
|
. $subject_id; |
|
|
$rs = xx_query($sql, $con); |
|
|
$row = xx_fetch_array ($rs); |
|
|
$subject = $row["subject"]; |
|
|
$subject_descr = $row["subject_descr"]; |
|
|
|
|
|
// Clean up strings |
|
|
$subject_descr = textInmySQL($subject_descr); |
|
|
$subject = textInmySQL($subject); |
|
|
$delMessage = textInmySQL($delMessage); |
|
|
|
|
|
// Next, append the reason for deletion to the description |
|
|
if (strlen($subject_descr) > 0) $subject_descr .= "<BR>" . $delMessage; |
|
|
else $subject_descr = $delMessage; |
|
|
|
|
|
// Update all of the elements using this resource with a custom description. |
|
|
$sql = "UPDATE element SET label = '" |
|
|
. $subject |
|
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), subject_id = NULL WHERE subject_id =" . $subject_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
// Next, update all of the elements using this resource without a custom description. |
|
|
$sql = "UPDATE element SET label = '" |
|
|
. $subject |
|
|
. "', element_descr = '" |
|
|
. $subject_descr |
|
|
. "', subject_id = NULL WHERE subject_id =" . $subject_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Update affected PageScribe copy buffers |
|
|
if ($problem == 0) { |
|
|
|
|
|
// Update all of the elements using this location with a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $subject |
|
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
|
|
. $delMessage |
|
|
. "'), subject_id = NULL WHERE subject_id =" . $subject_id |
|
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
// Next, update all of the elements using this location without a custom description. |
|
|
$sql = "UPDATE pastebuffer SET label = '" |
|
|
. $subject |
|
|
. "', element_descr = '" |
|
|
. $subject_descr |
|
|
. "', subject_id = NULL WHERE subject_id =" . $subject_id |
|
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
// Finally delete from the subject table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM subject WHERE subject_id =" . $subject_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Successfully removed this subject from the system.<BR><BR>\n"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else printf("Cannot delete <b>Subject ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
|
|
|
|
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteSubjectConfirm |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 06.11.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Confirm prompt to delete the supplied subject id. |
|
|
**********************************************************/ |
|
|
function deleteSubjectConfirm($con, $key_id){ |
|
|
|
|
|
// Make sure we have a valid integer type |
|
|
$subject_id = (int) $key_id; |
|
|
|
|
|
// Draw page heading |
|
|
printf("<center><h3>Delete Subject ID# %s?</h3>", $subject_id); |
|
|
|
|
|
// Check to see if its possible |
|
|
$exists = existsRow($con, "subject", "subject_id", $subject_id); |
|
|
if ($exists > 0){ |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
|
// Lookup the descriptive title |
|
|
$subject = lookupField($con, "subject", "subject_id", $subject_id, "subject"); |
|
|
printf("<strong>Subject:</strong> %s<br><br>\n ", $subject); |
|
|
|
|
|
// Form to draw the delete button |
|
|
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
|
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubject\" >"); |
|
|
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id); |
|
|
|
|
|
// Delete message |
|
|
printf("<b>Message to appear on affected PageScribe Pages</b> (75 char max.):<br>\n"); |
|
|
printf("<input type=\"text\" name=\"delMessage\" value=\"[RQS subject no longer available]\" size=\"75\"><br><br>\n"); |
|
|
|
|
|
printf("This will <b>permanently</b> remove the subject and its various subject assignments from the system. |
|
|
This includes assignments to resources, master/general subjects, locations and staff specialists.<BR><BR>"); |
|
|
printf("<center>"); |
|
|
printf("<input type =\"Submit\" value=\"Delete!\">"); |
|
|
printf("</center>"); |
|
|
printf("</form><br>"); |
|
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
|
} |
|
|
|
|
|
// Failed for whatever reason |
|
|
else if ($exists < 1) printf ("Subject not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteSubLoc |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.21.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes subject-location associations based on the supplied |
|
|
location id (possibly multiple) and calls formSubject back |
|
|
again. |
|
|
**********************************************************/ |
|
|
function deleteSubLoc($con, $key_list_array, $subject_id){ |
|
|
|
|
|
// For the given subject, delete every location in the array |
|
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
|
|
|
|
|
$sql = "DELETE FROM sub_loc WHERE subject_id = " |
|
|
. $subject_id |
|
|
. " AND location_id = " |
|
|
. $key_list_array[$element]; |
|
|
|
|
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
// Call the subject form back |
|
|
formSubject($con, $subject_id); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteSubMaster |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.21.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes subject-mastersubject associations based on the |
|
|
supplied mastersubject id (possibly multiple) and calls |
|
|
formSubject back again. |
|
|
**********************************************************/ |
|
|
function deleteSubMaster($con, $key_list_array, $subject_id){ |
|
|
|
|
|
// For every mastersubject in the array, delete it from the bridging table |
|
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
|
|
|
|
|
$sql = "DELETE FROM sub_mastersubject WHERE subject_id = " |
|
|
. $subject_id |
|
|
. " AND mastersubject_id = " |
|
|
. $key_list_array[$element]; |
|
|
|
|
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
// Call the subject form back |
|
|
formSubject($con, $subject_id); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteSubStaff |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.21.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes staff-subject associations for the supplied staff |
|
|
id (possibly multiple) and calls formSubject back again. |
|
|
**********************************************************/ |
|
|
function deleteSubStaff($con, $key_list_array, $subject_id){ |
|
|
|
|
|
// For a given subject, delete all staff in the array |
|
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
|
|
|
|
|
$sql = "DELETE FROM sub_staff WHERE subject_id = " |
|
|
. $subject_id |
|
|
. " AND staff_id = " |
|
|
. $key_list_array[$element]; |
|
|
|
|
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
// Call the subject form back |
|
|
formSubject($con, $subject_id); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteLibunit |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.29.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes the supplied libunit id, and any staff assignments |
|
|
in that library unit. |
|
|
**********************************************************/ |
|
|
function deleteLibunit($con, $libunit_id){ |
|
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Library Unit...</h3>"); |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
|
|
|
|
// First delete from libunit_staff |
|
|
if ($libunit_id > 1) { |
|
|
$sql = "DELETE FROM libunit_staff WHERE libunit_id = " . $libunit_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Deleted all Library Unit staff assignments.<BR>\n"); |
|
|
} |
|
|
|
|
|
// Delete from the libunit table |
|
|
if ($problem == 0) { |
|
|
$sql = "DELETE FROM libunit WHERE libunit_id =" . $libunit_id; |
|
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this Library Unit successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
else printf("Cannot delete <b>Library Unit ID #1. It acts as a system placeholder.</b>.<br><br>\n"); |
|
|
|
|
|
printf("</td></tr></table>\n"); |
|
|
printf("</center>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteLibunitConfirm |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.29.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Confirm prompt for deleting the supplied libunit id. |
|
|
**********************************************************/ |
|
|
function deleteLibunitConfirm($con, $key_id){ |
|
|
|
|
|
// Make sure we have a valid integer type |
|
|
$libunit_id = (int) $key_id; |
|
|
|
|
|
// Draw page heading |
|
|
printf("<center><h3>Delete Libunit ID# %s?</h3>", $libunit_id); |
|
|
|
|
|
// Check to see if its possible |
|
|
$exists = existsRow($con, "libunit", "libunit_id", $libunit_id); |
|
|
if ($exists > 0){ |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
|
// Lookup the descriptive title |
|
|
$libunit = lookupField($con, "libunit", "libunit_id", $libunit_id, "libunit"); |
|
|
printf("<strong>Libunit:</strong> %s<br>\n ", $libunit); |
|
|
|
|
|
// Form to draw the delete button |
|
|
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
|
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteLibunit\" >"); |
|
|
printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >", $libunit_id); |
|
|
printf("This will <b>permanently</b> remove this Library Unit from the system. This may render some staff without a unit.<BR><BR>"); |
|
|
printf("<center>"); |
|
|
printf("<input type =\"Submit\" value=\"Delete!\">"); |
|
|
printf("</center>"); |
|
|
printf("</form><br>"); |
|
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
|
} |
|
|
|
|
|
// Failed for whatever reason |
|
|
else if ($exists < 1) printf ("Unit not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>"); |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: deleteLibunitStaff |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 12.09.2002 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Deletes staffperson assignments (possibly multiple) to the |
|
|
supplied libunit id and calls formLibunit back again. |
|
|
**********************************************************/ |
|
|
function deleteLibunitStaff($con, $key_list_array, $libunit_id){ |
|
|
|
|
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
|
|
$sql = "DELETE FROM libunit_staff WHERE libunit_id = " |
|
|
. $libunit_id |
|
|
. " AND staff_id = " |
|
|
. $key_list_array[$element]; |
|
|
|
|
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
} |
|
|
// Call the libunit form back |
|
|
formLibunit($con, $libunit_id); |
|
1414 |
} |
} |
1415 |
|
|
1416 |
|
|
1417 |
/********************************************************** |
/********************************************************** |
1418 |
Function: deleteStaff |
Function: deleteStaff |
1419 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1420 |
Last Modified: 04.29.2003 |
Last Modified: 03.15.2004 |
1421 |
*********************************************************** |
*********************************************************** |
1422 |
Purpose: |
Purpose: |
1423 |
Deletes the supplied staff id. This function purges the |
Deletes the supplied staff id. This function purges the |
1426 |
intoto text-type fields (non-relational). The same is done |
intoto text-type fields (non-relational). The same is done |
1427 |
across all user copy-paste buffers. |
across all user copy-paste buffers. |
1428 |
**********************************************************/ |
**********************************************************/ |
1429 |
function deleteStaff($con, $delMessage, $staff_id){ |
function deleteStaff($delMessage, $staff_id){ |
1430 |
|
|
1431 |
// Draw form heading |
msgTableOpen(1, "Deleting Staff (ID# " . $staff_id . ")"); |
1432 |
printf("<center><h3>Deleting Staff Person...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
1433 |
|
|
1434 |
// Table |
// Can't delete admin account (#2) or the '(N/A)' staff (#1) |
1435 |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
if ($staff_id > 2) { |
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Success flag for each delete step |
|
|
// Can't delete myself (#2) or the '(N/A)' staff (#1) |
|
|
if ($staff_id < 3) $problem = 2; |
|
|
else $problem = 0; |
|
1436 |
|
|
1437 |
// First delete all related rows in sub_staff |
// First delete all related rows in sub_staff |
|
if ($problem == 0) { |
|
|
|
|
1438 |
$sql = "DELETE FROM sub_staff WHERE staff_id = " . $staff_id; |
$sql = "DELETE FROM sub_staff WHERE staff_id = " . $staff_id; |
1439 |
|
if (xx_tryquery ($sql)) printf("All subject-staff assignments for this staff person removed.<BR>\n"); |
1440 |
|
|
1441 |
if (!xx_query ($sql, $con)){ |
// Delete from the course_personnel table |
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("All subject-staff assignments for this staff person removed.<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
// Delete from the course_personnel table |
|
|
if ($problem == 0) { |
|
1442 |
$sql = "DELETE FROM course_personnel WHERE staff_id =" . $staff_id; |
$sql = "DELETE FROM course_personnel WHERE staff_id =" . $staff_id; |
1443 |
|
if (xx_tryquery ($sql)) printf("Removed this staff person from course personnel tables.<BR>\n"); |
1444 |
|
|
1445 |
if (!xx_query ($sql, $con)){ |
// Delete all related rows in page_staff |
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this staff person from course personnel tables.<BR>\n"); |
|
|
} |
|
|
} // delete from course_personnel table |
|
|
|
|
|
// Delete all related rows in page_staff |
|
|
if ($problem == 0) { |
|
|
|
|
1446 |
$sql = "DELETE FROM page_staff WHERE staff_id = " . $staff_id; |
$sql = "DELETE FROM page_staff WHERE staff_id = " . $staff_id; |
1447 |
|
if (xx_tryquery ($sql)) printf("All page-staff assignments for this staff person removed.<BR>\n"); |
1448 |
|
|
1449 |
if (!xx_query ($sql, $con)){ |
/******************************** |
1450 |
$problem = 1; |
** Update affected CL/PS pages ** |
1451 |
sql_err($sql); |
********************************/ |
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("All page-staff assignments for this staff person removed.<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
// Update affected PageScribe pages |
|
|
if ($problem == 0) { |
|
1452 |
|
|
1453 |
// First, get the staff fields |
// First, get the staff fields |
1454 |
$sql = "SELECT first_name, last_name FROM staff WHERE staff_id = " |
$sql = "SELECT first_name, last_name FROM staff WHERE staff_id = " |
1455 |
. $staff_id; |
. $staff_id; |
1456 |
$rs = xx_query($sql, $con); |
$rs = xx_tryquery($sql); |
1457 |
$row = xx_fetch_array ($rs); |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1458 |
$first_name = $row["first_name"]; |
$first_name = $row["first_name"]; |
1459 |
$last_name = $row["last_name"]; |
$last_name = $row["last_name"]; |
1460 |
|
|
1474 |
. $delMessage |
. $delMessage |
1475 |
. "'), staff_id = NULL WHERE staff_id =" . $staff_id |
. "'), staff_id = NULL WHERE staff_id =" . $staff_id |
1476 |
. " AND element_descr IS NOT NULL AND element_descr <> ''"; |
. " AND element_descr IS NOT NULL AND element_descr <> ''"; |
1477 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
1478 |
|
|
1479 |
if (!xx_query ($sql, $con)){ |
// Handle blank staff description elements |
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
// Handle blank staff description elements |
|
|
if ($problem == 0) { |
|
|
|
|
1480 |
$sql = "UPDATE element SET label = '" |
$sql = "UPDATE element SET label = '" |
1481 |
. $staff_name |
. $staff_name |
1482 |
. "', element_descr = '" |
. "', element_descr = '" |
1483 |
. $delMessage |
. $delMessage |
1484 |
. "', staff_id = NULL WHERE staff_id =" . $staff_id |
. "', staff_id = NULL WHERE staff_id =" . $staff_id |
1485 |
. " AND (element_descr IS NULL OR element_descr = '')"; |
. " AND (element_descr IS NULL OR element_descr = '')"; |
1486 |
|
if (xx_tryquery ($sql)) printf("Added delete message to blank PageScribe descriptions.<BR>\n"); |
1487 |
|
|
1488 |
if (!xx_query ($sql, $con)){ |
/********************************** |
1489 |
$problem = 1; |
** Update affected CL/PS buffers ** |
1490 |
sql_err($sql); |
**********************************/ |
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to blank PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// Update affected PageScribe buffers |
|
|
if ($problem == 0) { |
|
1491 |
|
|
1492 |
// Update all of the elements using this staffperson with a custom description |
// Update all of the elements using this staffperson with a custom description |
1493 |
$sql = "UPDATE pastebuffer SET label = '" |
$sql = "UPDATE pastebuffer SET label = '" |
1496 |
. $delMessage |
. $delMessage |
1497 |
. "'), staff_id = NULL WHERE staff_id =" . $staff_id |
. "'), staff_id = NULL WHERE staff_id =" . $staff_id |
1498 |
. " AND element_descr IS NOT NULL AND element_descr <> ''"; |
. " AND element_descr IS NOT NULL AND element_descr <> ''"; |
1499 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
} |
|
1500 |
|
|
1501 |
// Handle blank staff description pastebuffer elements |
// Handle blank staff description pastebuffer elements |
|
if ($problem == 0) { |
|
|
|
|
1502 |
$sql = "UPDATE pastebuffer SET label = '" |
$sql = "UPDATE pastebuffer SET label = '" |
1503 |
. $staff_name |
. $staff_name |
1504 |
. "', element_descr = '" |
. "', element_descr = '" |
1505 |
. $delMessage |
. $delMessage |
1506 |
. "', staff_id = NULL WHERE staff_id =" . $staff_id |
. "', staff_id = NULL WHERE staff_id =" . $staff_id |
1507 |
. " AND (element_descr IS NULL OR element_descr = '')"; |
. " AND (element_descr IS NULL OR element_descr = '')"; |
1508 |
|
if (xx_tryquery ($sql)) printf("Added delete message to blank PageScribe descriptions.<BR>\n"); |
1509 |
|
|
1510 |
if (!xx_query ($sql, $con)){ |
// Delete from the staff table |
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Added delete message to blank PageScribe descriptions.<BR>\n"); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// Delete from the staff table |
|
|
if ($problem == 0) { |
|
1511 |
$sql = "DELETE FROM staff WHERE staff_id =" . $staff_id; |
$sql = "DELETE FROM staff WHERE staff_id =" . $staff_id; |
1512 |
|
if (xx_tryquery ($sql)) printf("Removed this staff person successfully."); |
1513 |
if (!xx_query ($sql, $con)){ |
} |
1514 |
$problem = 1; |
else printf ("Cannot delete Staff ID's #1-2. Operation cancelled."); |
1515 |
sql_err($sql); |
|
1516 |
xx_query ("UNLOCK TABLES", $con); |
printf("<br><br>\n"); |
1517 |
bailout(); |
msgTableClose(); |
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this staff person successfully.<BR><BR>\n"); |
|
|
} |
|
|
} // delete from staff table |
|
|
|
|
|
if ($problem == 2) printf("Cannot delete <b>Staff ID's #1-2</b>.<br><br>\n"); |
|
|
|
|
|
// Close the table |
|
|
printf("</td></tr></table>\n"); |
|
|
printf("</center><br>\n"); |
|
1518 |
|
|
1519 |
} // end function |
} // end function |
1520 |
|
|
1522 |
/********************************************************** |
/********************************************************** |
1523 |
Function: deleteStaffConfirm |
Function: deleteStaffConfirm |
1524 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1525 |
Last Modified: 04.29.2003 |
Last Modified: 03.16.2004 |
1526 |
*********************************************************** |
*********************************************************** |
1527 |
Purpose: |
Purpose: |
1528 |
Confirm prompt to delete the supplied staff id. This |
Confirm prompt to delete the supplied staff id. This |
1531 |
as the staffperson is converted from a relational to a |
as the staffperson is converted from a relational to a |
1532 |
text-type element. |
text-type element. |
1533 |
**********************************************************/ |
**********************************************************/ |
1534 |
function deleteStaffConfirm($con, $staff_id){ |
function deleteStaffConfirm($staff_id){ |
1535 |
|
|
|
// Make sure we have a valid integer type |
|
1536 |
$staff_id = (int) $staff_id; |
$staff_id = (int) $staff_id; |
1537 |
|
msgTableOpen(1, "Delete Staff (ID# " . $staff_id . ")?"); |
|
printf("<center>\n"); |
|
1538 |
|
|
1539 |
// Check to see if its possible |
// Check to see if its possible |
1540 |
$exists = existsRow($con, "staff", "staff_id", $staff_id); |
$exists = existsRow("staff", "staff_id", $staff_id); |
1541 |
if ($exists > 0){ |
if ($exists > 0){ |
1542 |
|
|
|
// Table |
|
|
printf("<table width=\"60%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
|
|
|
|
|
// Row header |
|
|
printf("<tr><td class=\"cellPlain\">\n"); |
|
|
printf("Delete Staff ID# %s?", $staff_id); |
|
|
printf("</td></tr>\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
1543 |
// Lookup the first and last names |
// Lookup the first and last names |
1544 |
$first_name = lookupField($con, "staff", "staff_id", $staff_id, "first_name"); |
$first_name = lookupField("staff", "staff_id", $staff_id, "first_name"); |
1545 |
$last_name = lookupField($con, "staff", "staff_id", $staff_id, "last_name"); |
$last_name = lookupField("staff", "staff_id", $staff_id, "last_name"); |
1546 |
printf("<b>Staffperson:</b> %s %s<br><br>\n ", $first_name, $last_name); |
printf("<b>Staffperson:</b> %s %s<br><br>\n ", $first_name, $last_name); |
1547 |
|
|
1548 |
// Form to draw the delete button |
// Form to draw the delete button |
1555 |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Staffperson no longer available]\" size=\"75\"><br><br>\n"); |
printf("<input type=\"text\" name=\"delMessage\" value=\"[Staffperson no longer available]\" size=\"75\"><br><br>\n"); |
1556 |
|
|
1557 |
// Warning |
// Warning |
1558 |
printf("This will <b>permanently</b> remove this staffperson and his/her various assignments from the system.<BR><BR>\n"); |
printf("This will permanently remove this staffperson and his/her various assignments from the system.<BR><BR>\n"); |
1559 |
|
|
1560 |
// Delete button |
// Delete button |
1561 |
printf("<center>\n"); |
printf("<center>\n"); |
1562 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1563 |
printf("</center>\n"); |
printf("</center>\n"); |
1564 |
printf("</form><br>\n"); |
printf("</form>\n"); |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>\n"); |
|
|
printf("<BR>\n"); |
|
1565 |
} |
} |
1566 |
|
else if ($exists < 1) printf ("Staffperson not found. Operation cancelled.<br><br>\n"); |
1567 |
|
|
1568 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Staff #%d not found. Operation cancelled.<br><br>\n", $staff_id); |
|
|
|
|
|
printf("</center>\n"); |
|
1569 |
} |
} |
1570 |
|
|
1571 |
|
|
1572 |
/********************************************************** |
/********************************************************** |
1573 |
Function: deleteStaffLibunit |
Function: deleteStaffLibunit |
1574 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1575 |
Last Modified: 12.09.2002 |
Last Modified: 03.03.2004 |
1576 |
*********************************************************** |
*********************************************************** |
1577 |
Purpose: |
Purpose: |
1578 |
Delete the staff-libunit associations (possibly multiple) |
Delete the staff-libunit associations (possibly multiple) |
1580 |
This works the same table as deleteLibunitStaff, but with |
This works the same table as deleteLibunitStaff, but with |
1581 |
emphasis on the other side of the multiple pick list. |
emphasis on the other side of the multiple pick list. |
1582 |
**********************************************************/ |
**********************************************************/ |
1583 |
function deleteStaffLibunit($con, $key_list_array, $staff_id){ |
function deleteStaffLibunit($key_list_array, $staff_id){ |
1584 |
|
|
1585 |
// For every libunit in the array, delete it from the bridging table |
// For every libunit in the array, delete it from the bridging table |
1586 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
1589 |
. $staff_id |
. $staff_id |
1590 |
. " AND libunit_id = " |
. " AND libunit_id = " |
1591 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
1592 |
|
xx_tryquery($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1593 |
} |
} |
1594 |
// Call the staff form back |
// Call the staff form back |
1595 |
formStaff($con, $staff_id); |
formStaff($staff_id); |
1596 |
} |
} |
1597 |
|
|
1598 |
|
|
1599 |
/********************************************************** |
/********************************************************** |
1600 |
Function: deleteStaffSub |
Function: deleteStaffSub |
1601 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1602 |
Last Modified: 04.29.2003 |
Last Modified: 03.03.2004 |
1603 |
*********************************************************** |
*********************************************************** |
1604 |
Purpose: |
Purpose: |
1605 |
Deletes the staff-subject associations (possibly multiple) |
Deletes the staff-subject associations (possibly multiple) |
1608 |
application.php, not this ssl counterpart), but with |
application.php, not this ssl counterpart), but with |
1609 |
emphasis on the other side of the multiple pick list. |
emphasis on the other side of the multiple pick list. |
1610 |
**********************************************************/ |
**********************************************************/ |
1611 |
function deleteStaffSub($con, $key_list_array, $staff_id){ |
function deleteStaffSub($key_list_array, $staff_id){ |
1612 |
|
|
1613 |
// For a given staff person, delete every associated subject in the array |
// For a given staff person, delete every associated subject in the array |
1614 |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
1617 |
. $staff_id |
. $staff_id |
1618 |
. " AND subject_id = " |
. " AND subject_id = " |
1619 |
. $key_list_array[$element]; |
. $key_list_array[$element]; |
1620 |
|
xx_tryquery($sql); |
|
// Failed |
|
|
if (!xx_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1621 |
} |
} |
1622 |
// Call the staff form back |
// Call the staff form back |
1623 |
formStaff($con, $staff_id); |
formStaff($staff_id); |
1624 |
} |
} |
1625 |
|
|
1626 |
|
|
1627 |
/********************************************************** |
/********************************************************** |
1628 |
Function: deleteStafftitle |
Function: deleteStafftitle |
1629 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1630 |
Last Modified: 04.29.2003 |
Last Modified: 03.16.2004 |
1631 |
*********************************************************** |
*********************************************************** |
1632 |
Purpose: |
Purpose: |
1633 |
Deletes the supplied staff job title id. Any staff currently |
Deletes the supplied staff job title id. Any staff currently |
1634 |
using this title are set to the (N/A) placeholder title. |
using this title are set to the (N/A) placeholder title. |
1635 |
**********************************************************/ |
**********************************************************/ |
1636 |
function deleteStafftitle($con, $stafftitle_id){ |
function deleteStafftitle($stafftitle_id){ |
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Job Title...</h3>"); |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
1637 |
|
|
1638 |
// Problem flag for each delete step |
msgTableOpen(1, "Deleting Staff Title (ID# " . $stafftitle_id . ")"); |
1639 |
$problem = 0; |
printf("<b>Messages:</b><br>\n"); |
1640 |
|
|
|
// First update all rows in staff to (N/A) |
|
1641 |
if ($stafftitle_id > 1) { |
if ($stafftitle_id > 1) { |
1642 |
|
// First update all rows in staff to (N/A) |
1643 |
$sql = "UPDATE staff SET stafftitle_id = 1 WHERE stafftitle_id = " . $stafftitle_id; |
$sql = "UPDATE staff SET stafftitle_id = 1 WHERE stafftitle_id = " . $stafftitle_id; |
1644 |
|
if (xx_tryquery ($sql)) printf("Successfully set affected staff titles to (N/A).<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Successfully set affected staff person job titles to (N/A).<BR>\n"); |
|
|
} |
|
1645 |
|
|
1646 |
// Delete from the title table |
// Delete from the title table |
1647 |
if ($problem == 0) { |
$sql = "DELETE FROM stafftitle WHERE stafftitle_id =" . $stafftitle_id; |
1648 |
$sql = "DELETE FROM stafftitle WHERE stafftitle_id =" . $stafftitle_id; |
if (xx_tryquery ($sql)) printf("Removed this staff title successfully."); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this job title successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
1649 |
|
|
1650 |
} |
} |
1651 |
else printf("Cannot delete <b>Job Title ID #1.</b> It acts as a system placeholder.</b>.<br><br>\n"); |
else printf ("Cannot delete Staff Title ID# 1, it acts as a system placeholder."); |
1652 |
|
|
1653 |
printf("</td></tr></table>"); |
printf("<br><br>\n"); |
1654 |
printf("</center>"); |
msgTableClose(); |
1655 |
} |
} |
1656 |
|
|
1657 |
|
|
1658 |
/********************************************************** |
/********************************************************** |
1659 |
Function: deleteStafftitleConfirm |
Function: deleteStafftitleConfirm |
1660 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1661 |
Last Modified: 04.29.2003 |
Last Modified: 03.16.2004 |
1662 |
*********************************************************** |
*********************************************************** |
1663 |
Purpose: |
Purpose: |
1664 |
Confirm prompt for deleting the supplied staff title id. |
Confirm prompt for deleting the supplied staff title id. |
1665 |
**********************************************************/ |
**********************************************************/ |
1666 |
function deleteStafftitleConfirm($con, $key_id){ |
function deleteStafftitleConfirm($key_id){ |
1667 |
|
|
|
// Make sure we have a valid integer type |
|
1668 |
$stafftitle_id = (int) $key_id; |
$stafftitle_id = (int) $key_id; |
1669 |
|
msgTableOpen(1, "Delete Staff Title (ID# " . $stafftitle_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Job Title ID# %s?</h3>\n", $stafftitle_id); |
|
1670 |
|
|
1671 |
// Check to see if its possible |
// Check to see if its possible |
1672 |
$exists = existsRow($con, "stafftitle", "stafftitle_id", $stafftitle_id); |
$exists = existsRow("stafftitle", "stafftitle_id", $stafftitle_id); |
1673 |
if ($exists > 0){ |
if ($exists > 0){ |
1674 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
1675 |
// Lookup the descriptive title |
// Lookup the descriptive title |
1676 |
$stafftitle = lookupField($con, "stafftitle", "stafftitle_id", $stafftitle_id, "stafftitle"); |
$stafftitle = lookupField("stafftitle", "stafftitle_id", $stafftitle_id, "stafftitle"); |
1677 |
printf("<strong>Staff Title:</strong> %s<br>\n ", $stafftitle); |
printf("<b>Staff Title:</b> %s<br><br>\n ", $stafftitle); |
1678 |
|
printf("This will permanently remove this staff title and its various assignments from the system. Some staff will be set to (N/A).<BR><BR>\n"); |
1679 |
|
|
1680 |
// Form to draw the delete button |
// Form to draw the delete button |
1681 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
1682 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStafftitle\" >\n"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStafftitle\" >\n"); |
1683 |
printf("<input type = \"Hidden\" name = \"stafftitle_id\" value = \"%d\" >\n", $stafftitle_id); |
printf("<input type = \"Hidden\" name = \"stafftitle_id\" value = \"%d\" >\n", $stafftitle_id); |
|
printf("<BR>This will <b>permanently</b> remove this job title and its various assignments from the system. Some staff will be set to (N/A).<BR><BR>\n"); |
|
1684 |
printf("<center>\n"); |
printf("<center>\n"); |
1685 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1686 |
printf("</center>\n"); |
printf("</center>\n"); |
1687 |
printf("</form><br>\n"); |
printf("</form>\n"); |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
1688 |
} |
} |
1689 |
|
else if ($exists < 1) printf ("Staff Title not found. Operation cancelled.<br><br>\n"); |
1690 |
|
|
1691 |
// Failed for whatever reason |
msgTableClose(); |
|
else if ($exists < 1) printf ("Job title not found. Operation cancelled.<br>\n"); |
|
|
|
|
|
printf("</center>\n"); |
|
1692 |
} |
} |
1693 |
|
|
1694 |
|
|
1695 |
/********************************************************** |
/********************************************************** |
1696 |
Function: deleteStyle |
Function: deleteStyle |
1697 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1698 |
Last Modified: 05.22.2003 |
Last Modified: 03.16.2004 |
1699 |
*********************************************************** |
*********************************************************** |
1700 |
Purpose: |
Purpose: |
1701 |
Deletes the supplied style id. Any pages currently |
Deletes the supplied style id. Any pages currently |
1703 |
Note that the actual header, footer, and css files are |
Note that the actual header, footer, and css files are |
1704 |
not deleted -- only the references to them. |
not deleted -- only the references to them. |
1705 |
**********************************************************/ |
**********************************************************/ |
1706 |
function deleteStyle($con, $style_id){ |
function deleteStyle($style_id){ |
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Style...</h3>"); |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
1707 |
|
|
1708 |
// Problem flag for each delete step |
msgTableOpen(1, "Deleting Style (ID# " . $style_id . ")"); |
1709 |
$problem = 0; |
printf("<b>Messages:</b><br>\n"); |
1710 |
|
|
|
// First update all affected rows in page to (N/A) |
|
1711 |
if ($style_id > 2) { |
if ($style_id > 2) { |
1712 |
|
// First update all affected rows in page to (N/A) |
1713 |
$sql = "UPDATE page SET style_id = 1 WHERE style_id = " . $style_id; |
$sql = "UPDATE page SET style_id = 1 WHERE style_id = " . $style_id; |
1714 |
|
if (xx_tryquery ($sql)) printf("Successfully set affected page styles to (N/A).<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Successfully set affected page styles to (N/A).<BR>\n"); |
|
|
} |
|
1715 |
|
|
1716 |
// Delete from the style table |
// Delete from the style table |
1717 |
if ($problem == 0) { |
$sql = "DELETE FROM style WHERE style_id =" . $style_id; |
1718 |
$sql = "DELETE FROM style WHERE style_id =" . $style_id; |
if (xx_tryquery ($sql)) printf("Removed this style successfully."); |
|
|
|
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this style successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
1719 |
|
|
1720 |
} |
} |
1721 |
else { |
else { |
1722 |
printf("Cannot delete <b>Style ID #1-2.</b> #1 acts as a system placeholder, #2 "); |
printf("Cannot delete Style ID's #1 and #2. #1 acts as a system placeholder, #2 "); |
1723 |
printf("is the default style for new pages, but may be renamed or redefined as "); |
printf("is the default style for new pages, but may be renamed or redefined as "); |
1724 |
printf("needed </b>.<br><br>\n"); |
printf("needed."); |
1725 |
} |
} |
1726 |
|
|
1727 |
|
printf("<br><br>\n"); |
1728 |
printf("</td></tr></table>"); |
msgTableClose(); |
|
printf("</center>"); |
|
1729 |
} |
} |
1730 |
|
|
1731 |
|
|
1732 |
/********************************************************** |
/********************************************************** |
1733 |
Function: deleteStyleConfirm |
Function: deleteStyleConfirm |
1734 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1735 |
Last Modified: 05.22.2003 |
Last Modified: 03.16.2004 |
1736 |
*********************************************************** |
*********************************************************** |
1737 |
Purpose: |
Purpose: |
1738 |
Confirm prompt for deleting the supplied style id |
Confirm prompt for deleting the supplied style id |
1739 |
**********************************************************/ |
**********************************************************/ |
1740 |
function deleteStyleConfirm($con, $key_id){ |
function deleteStyleConfirm($key_id){ |
1741 |
|
|
|
// Make sure we have a valid integer type |
|
1742 |
$style_id = (int) $key_id; |
$style_id = (int) $key_id; |
1743 |
|
msgTableOpen(1, "Delete Style (ID# " . $style_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Style ID# %s?</h3>\n", $style_id); |
|
1744 |
|
|
1745 |
// Check to see if its possible |
// Check to see if its possible |
1746 |
$exists = existsRow($con, "style", "style_id", $style_id); |
$exists = existsRow("style", "style_id", $style_id); |
1747 |
if ($exists > 0){ |
if ($exists > 0){ |
1748 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">\n"); |
|
|
printf("<tr><td>\n"); |
|
|
|
|
1749 |
// Lookup the descriptive title |
// Lookup the descriptive title |
1750 |
$style_title = lookupField($con, "style", "style_id", $style_id, "style_title"); |
$style_title = lookupField("style", "style_id", $style_id, "style_title"); |
1751 |
printf("<strong>Style Title:</strong> %s<br>\n ", $style_title); |
printf("<b>Style Title:</b> %s<br><br>\n ", $style_title); |
1752 |
|
printf("This will permanently remove this style and "); |
1753 |
|
printf("assign affected pages to the (N/A) style. Note that this function does "); |
1754 |
|
printf("not actually delete any header, footer or css files -- only the references "); |
1755 |
|
printf("to them. If a default page style is not properly configured, pages without "); |
1756 |
|
printf("a style may fail to display properly, and should be assigned a new style.<BR><BR>\n"); |
1757 |
|
|
1758 |
// Form to draw the delete button |
// Form to draw the delete button |
1759 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
1760 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStyle\" >\n"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStyle\" >\n"); |
1761 |
printf("<input type = \"Hidden\" name = \"style_id\" value = \"%d\" >\n", $style_id); |
printf("<input type = \"Hidden\" name = \"style_id\" value = \"%d\" >\n", $style_id); |
|
printf("<BR>This will <b>permanently</b> remove this style and "); |
|
|
printf("assign affected pages to the (N/A) style. Note that this function does "); |
|
|
printf("not actually delete any header, footer or css files -- only the references "); |
|
|
printf("to them. If a default page style is not properly configured, pages without "); |
|
|
printf("a style may fail to display properly, and should be assigned a new style.<BR><BR>\n"); |
|
1762 |
printf("<center>\n"); |
printf("<center>\n"); |
1763 |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1764 |
printf("</center>\n"); |
printf("</center>\n"); |
1765 |
printf("</form><br>\n"); |
printf("</form>\n"); |
1766 |
|
} |
1767 |
|
else if ($exists < 1) printf ("Style not found. Operation cancelled.<br><br>\n"); |
1768 |
|
|
1769 |
|
msgTableClose(); |
1770 |
|
} |
1771 |
|
|
1772 |
|
|
1773 |
|
/********************************************************** |
1774 |
|
Function: deleteSubCoursesub |
1775 |
|
Author: Paul Bramscher |
1776 |
|
Last Modified: 03.02.2004 |
1777 |
|
*********************************************************** |
1778 |
|
Purpose: |
1779 |
|
Deletes subject-coursesub associations based on the supplied |
1780 |
|
coursesub id (possibly multiple) and calls formSubject back |
1781 |
|
again. |
1782 |
|
**********************************************************/ |
1783 |
|
function deleteSubCoursesub($key_list_array, $subject_id){ |
1784 |
|
|
1785 |
|
// For the given subject, delete every location in the array |
1786 |
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
1787 |
|
|
1788 |
// Close table |
$sql = "DELETE FROM sub_coursesub WHERE subject_id = " |
1789 |
printf("</td></tr></table>\n"); |
. $subject_id |
1790 |
|
. " AND coursesub_id = " |
1791 |
|
. $key_list_array[$element]; |
1792 |
|
xx_tryquery ($sql); |
1793 |
} |
} |
1794 |
|
// Call the subject form back |
1795 |
|
formSubject($subject_id); |
1796 |
|
} |
1797 |
|
|
1798 |
|
|
1799 |
|
/********************************************************** |
1800 |
|
Function: deleteSubject |
1801 |
|
Author: Paul Bramscher |
1802 |
|
Last Modified: 03.16.2004 |
1803 |
|
*********************************************************** |
1804 |
|
Purpose: |
1805 |
|
Deletes a subject, and removes associations in the |
1806 |
|
resource-subject-informationtype, subject-location, |
1807 |
|
subject-mastersubject, subject-coursesub, and |
1808 |
|
subject-staff tables. |
1809 |
|
**********************************************************/ |
1810 |
|
function deleteSubject($delMessage, $subject_id){ |
1811 |
|
|
1812 |
|
msgTableOpen(1, "Deleting Subject (ID# " . $subject_id .")"); |
1813 |
|
printf("<b>Messages:</b><br>\n"); |
1814 |
|
|
1815 |
|
// Cannot delete placeholder #1 |
1816 |
|
if ($subject_id > 1) { |
1817 |
|
|
1818 |
// Failed for whatever reason |
// First delete all related rows in res_sub_infotype |
1819 |
else if ($exists < 1) printf ("Job title not found. Operation cancelled.<br>\n"); |
$sql = "DELETE FROM res_sub_infotype WHERE subject_id = " . $subject_id; |
1820 |
|
if (xx_tryquery ($sql)) printf("Resource-subject-information type associations removed.<BR>\n"); |
1821 |
|
|
1822 |
|
// Delete from the sub_loc table |
1823 |
|
$sql = "DELETE FROM sub_loc WHERE subject_id =" . $subject_id; |
1824 |
|
if (xx_tryquery ($sql)) printf("Subject-location associations removed.<BR>\n"); |
1825 |
|
|
1826 |
|
// Delete from the sub_mastersubject table |
1827 |
|
$sql = "DELETE FROM sub_mastersubject WHERE subject_id =" . $subject_id; |
1828 |
|
if (xx_tryquery ($sql)) printf("Subject-mastersubject associations removed.<BR>\n"); |
1829 |
|
|
1830 |
|
// Delete from the sub_staff table |
1831 |
|
$sql = "DELETE FROM sub_staff WHERE subject_id =" . $subject_id; |
1832 |
|
if (xx_tryquery ($sql)) printf("Subject-staff assignments removed.<BR>\n"); |
1833 |
|
|
1834 |
|
// Delete from the sub_coursesub table |
1835 |
|
$sql = "DELETE FROM sub_coursesub WHERE subject_id =" . $subject_id; |
1836 |
|
if (xx_tryquery ($sql)) printf("Subject-Course Subject assignments removed.<BR>\n"); |
1837 |
|
|
1838 |
|
// Delete from the sub_page table |
1839 |
|
$sql = "DELETE FROM sub_page WHERE subject_id =" . $subject_id; |
1840 |
|
if (xx_tryquery ($sql)) printf("Subject-Page assignments removed.<BR>\n"); |
1841 |
|
|
1842 |
|
// Delete from the sub_othersub table |
1843 |
|
$sql = "DELETE FROM sub_othersub WHERE othersub_id =" |
1844 |
|
. $subject_id |
1845 |
|
. " OR subject_id = " |
1846 |
|
. $subject_id; |
1847 |
|
if (xx_tryquery ($sql)) printf("Subject-Other Subject assignments removed.<BR>\n"); |
1848 |
|
|
1849 |
|
/******************************** |
1850 |
|
** Update affected CL/PS pages ** |
1851 |
|
********************************/ |
1852 |
|
|
1853 |
|
// First, get the default subject description and title |
1854 |
|
$sql = "SELECT subject, subject_descr FROM subject WHERE subject_id = " |
1855 |
|
. $subject_id; |
1856 |
|
$rs = xx_tryquery($sql); |
1857 |
|
$row = xx_fetch_array ($rs, xx_ASSOC); |
1858 |
|
$subject = $row["subject"]; |
1859 |
|
$subject_descr = $row["subject_descr"]; |
1860 |
|
|
1861 |
|
// Clean up strings |
1862 |
|
$subject_descr = textInmySQL($subject_descr); |
1863 |
|
$subject = textInmySQL($subject); |
1864 |
|
$delMessage = textInmySQL($delMessage); |
1865 |
|
|
1866 |
|
// Next, append the reason for deletion to the description |
1867 |
|
if (strlen($subject_descr) > 0) $subject_descr .= "<BR>" . $delMessage; |
1868 |
|
else $subject_descr = $delMessage; |
1869 |
|
|
1870 |
|
// Update all of the elements using this resource with a custom description. |
1871 |
|
$sql = "UPDATE element SET label = '" |
1872 |
|
. $subject |
1873 |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
1874 |
|
. $delMessage |
1875 |
|
. "'), subject_id = NULL WHERE subject_id =" . $subject_id |
1876 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
1877 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n"); |
1878 |
|
|
1879 |
|
// Next, update all of the elements using this resource without a custom description. |
1880 |
|
$sql = "UPDATE element SET label = '" |
1881 |
|
. $subject |
1882 |
|
. "', element_descr = '" |
1883 |
|
. $subject_descr |
1884 |
|
. "', subject_id = NULL WHERE subject_id =" . $subject_id |
1885 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
1886 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n"); |
1887 |
|
|
1888 |
|
/*************************************** |
1889 |
|
** Update affected CL/PS copy buffers ** |
1890 |
|
***************************************/ |
1891 |
|
|
1892 |
|
// Update all of the elements using this location with a custom description. |
1893 |
|
$sql = "UPDATE pastebuffer SET label = '" |
1894 |
|
. $subject |
1895 |
|
. "', element_descr = CONCAT(element_descr, '<BR>" |
1896 |
|
. $delMessage |
1897 |
|
. "'), subject_id = NULL WHERE subject_id =" . $subject_id |
1898 |
|
. " AND (element_descr IS NOT NULL OR element_descr != '')"; |
1899 |
|
if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n"); |
1900 |
|
|
1901 |
printf("</center>\n"); |
// Next, update all of the elements using this location without a custom description. |
1902 |
|
$sql = "UPDATE pastebuffer SET label = '" |
1903 |
|
. $subject |
1904 |
|
. "', element_descr = '" |
1905 |
|
. $subject_descr |
1906 |
|
. "', subject_id = NULL WHERE subject_id =" . $subject_id |
1907 |
|
. " AND (element_descr IS NULL OR element_descr = '')"; |
1908 |
|
if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n"); |
1909 |
|
|
1910 |
|
// Finally delete from the subject table |
1911 |
|
$sql = "DELETE FROM subject WHERE subject_id =" . $subject_id; |
1912 |
|
if (xx_tryquery ($sql)) printf("Successfully removed this subject from the system."); |
1913 |
|
} |
1914 |
|
else printf ("Cannot delete Subject ID# 1, it acts as a system placeholder."); |
1915 |
|
|
1916 |
|
printf("<br><br>\n"); |
1917 |
|
msgTableClose(); |
1918 |
|
} |
1919 |
|
|
1920 |
|
|
1921 |
|
/********************************************************** |
1922 |
|
Function: deleteSubjectConfirm |
1923 |
|
Author: Paul Bramscher |
1924 |
|
Last Modified: 03.16.2004 |
1925 |
|
*********************************************************** |
1926 |
|
Purpose: |
1927 |
|
Confirm prompt to delete the supplied subject id. |
1928 |
|
**********************************************************/ |
1929 |
|
function deleteSubjectConfirm($key_id){ |
1930 |
|
|
1931 |
|
$subject_id = (int) $key_id; |
1932 |
|
msgTableOpen(1, "Delete Subject (ID# " . $subject_id . ")?"); |
1933 |
|
|
1934 |
|
// Check to see if its possible |
1935 |
|
$exists = existsRow("subject", "subject_id", $subject_id); |
1936 |
|
if ($exists > 0){ |
1937 |
|
|
1938 |
|
// Lookup the descriptive title |
1939 |
|
$subject = lookupField("subject", "subject_id", $subject_id, "subject"); |
1940 |
|
printf("<b>Subject:</b> %s<br><br>\n ", $subject); |
1941 |
|
|
1942 |
|
// Form to draw the delete button |
1943 |
|
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
1944 |
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubject\" >\n"); |
1945 |
|
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
1946 |
|
|
1947 |
|
// Delete message |
1948 |
|
printf("<b>Message to appear on affected PageScribe Pages</b> (75 char max.):<br>\n"); |
1949 |
|
printf("<input type=\"text\" name=\"delMessage\" value=\"[RQS subject no longer available]\" size=\"75\"><br><br>\n"); |
1950 |
|
|
1951 |
|
printf("This will permanently remove the subject and its various subject assignments from the system. |
1952 |
|
This includes assignments to resources, master/general subjects, locations and staff specialists.<BR><BR>"); |
1953 |
|
printf("<center>\n"); |
1954 |
|
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
1955 |
|
printf("</center>\n"); |
1956 |
|
printf("</form>\n"); |
1957 |
|
} |
1958 |
|
else if ($exists < 1) printf ("Subject not found. Operation cancelled.<br><br>\n"); |
1959 |
|
|
1960 |
|
msgTableClose(); |
1961 |
|
} |
1962 |
|
|
1963 |
|
|
1964 |
|
/********************************************************** |
1965 |
|
Function: deleteSubLoc |
1966 |
|
Author: Paul Bramscher |
1967 |
|
Last Modified: 03.03.2004 |
1968 |
|
*********************************************************** |
1969 |
|
Purpose: |
1970 |
|
Deletes subject-location associations based on the supplied |
1971 |
|
location id (possibly multiple) and calls formSubject back |
1972 |
|
again. |
1973 |
|
**********************************************************/ |
1974 |
|
function deleteSubLoc($key_list_array, $subject_id){ |
1975 |
|
|
1976 |
|
// For the given subject, delete every location in the array |
1977 |
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
1978 |
|
|
1979 |
|
$sql = "DELETE FROM sub_loc WHERE subject_id = " |
1980 |
|
. $subject_id |
1981 |
|
. " AND location_id = " |
1982 |
|
. $key_list_array[$element]; |
1983 |
|
xx_tryquery($sql); |
1984 |
|
} |
1985 |
|
// Call the subject form back |
1986 |
|
formSubject($subject_id); |
1987 |
|
} |
1988 |
|
|
1989 |
|
|
1990 |
|
/********************************************************** |
1991 |
|
Function: deleteSubMaster |
1992 |
|
Author: Paul Bramscher |
1993 |
|
Last Modified: 03.03.2004 |
1994 |
|
*********************************************************** |
1995 |
|
Purpose: |
1996 |
|
Deletes subject-mastersubject associations based on the |
1997 |
|
supplied mastersubject id (possibly multiple) and calls |
1998 |
|
formSubject back again. |
1999 |
|
**********************************************************/ |
2000 |
|
function deleteSubMaster($key_list_array, $subject_id){ |
2001 |
|
|
2002 |
|
// For every mastersubject in the array, delete it from the bridging table |
2003 |
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
2004 |
|
|
2005 |
|
$sql = "DELETE FROM sub_mastersubject WHERE subject_id = " |
2006 |
|
. $subject_id |
2007 |
|
. " AND mastersubject_id = " |
2008 |
|
. $key_list_array[$element]; |
2009 |
|
xx_tryquery($sql); |
2010 |
|
} |
2011 |
|
// Call the subject form back |
2012 |
|
formSubject($subject_id); |
2013 |
|
} |
2014 |
|
|
2015 |
|
|
2016 |
|
/********************************************************** |
2017 |
|
Function: deleteSubStaff |
2018 |
|
Author: Paul Bramscher |
2019 |
|
Last Modified: 03.03.2004 |
2020 |
|
*********************************************************** |
2021 |
|
Purpose: |
2022 |
|
Deletes staff-subject associations for the supplied staff |
2023 |
|
id (possibly multiple) and calls formSubject back again. |
2024 |
|
**********************************************************/ |
2025 |
|
function deleteSubStaff($key_list_array, $subject_id){ |
2026 |
|
|
2027 |
|
// For a given subject, delete all staff in the array |
2028 |
|
for ($element = 0; $element < sizeof($key_list_array); $element++) { |
2029 |
|
|
2030 |
|
$sql = "DELETE FROM sub_staff WHERE subject_id = " |
2031 |
|
. $subject_id |
2032 |
|
. " AND staff_id = " |
2033 |
|
. $key_list_array[$element]; |
2034 |
|
xx_tryquery($sql); |
2035 |
|
} |
2036 |
|
// Call the subject form back |
2037 |
|
formSubject($subject_id); |
2038 |
} |
} |
2039 |
|
|
2040 |
|
|
2041 |
/********************************************************** |
/********************************************************** |
2042 |
Function: deleteTerm |
Function: deleteTerm |
2043 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2044 |
Last Modified: 05.07.2003 |
Last Modified: 03.16.2004 |
2045 |
*********************************************************** |
*********************************************************** |
2046 |
Purpose: |
Purpose: |
2047 |
Deletes the supplied term id, and removes references in |
Deletes the supplied term id, and removes references in |
2048 |
the course table. |
the course table. |
2049 |
**********************************************************/ |
**********************************************************/ |
2050 |
function deleteTerm($con, $term_id){ |
function deleteTerm($term_id){ |
2051 |
|
|
2052 |
// Draw form heading |
msgTableOpen(1, "Deleting Term (ID# " . $term_id . ")"); |
2053 |
printf("<center><h3>Deleting Academic Term...</h3>"); |
printf("<b>Messages:</b><br>\n"); |
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td><br>"); |
|
|
printf("<strong>Messages:</strong><br>"); |
|
|
|
|
|
// Problem flag for each delete step |
|
|
$problem = 0; |
|
2054 |
|
|
2055 |
// Cannot delete placeholder #1 |
// Cannot delete placeholder #1 |
2056 |
if ($term_id > 1) { |
if ($term_id > 1) { |
2057 |
|
|
2058 |
// Delete all course term assignments |
// Delete all course term assignments |
2059 |
$sql = "UPDATE course SET term_id = NULL WHERE term_id =" . $term_id; |
$sql = "UPDATE course SET term_id = NULL WHERE term_id =" . $term_id; |
2060 |
|
if (xx_tryquery ($sql)) printf("Removed this term from affected course pages.<BR>\n"); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this term from affected course pages.<BR>\n"); |
|
|
} |
|
|
|
|
|
|
|
|
if ($problem == 0) { |
|
2061 |
|
|
2062 |
// Delete from term table |
// Delete from term table |
2063 |
$sql = "DELETE FROM term WHERE term_id =" . $term_id; |
$sql = "DELETE FROM term WHERE term_id =" . $term_id; |
2064 |
|
if (xx_tryquery ($sql)) printf("Removed term successfully."); |
|
if (!xx_query ($sql, $con)){ |
|
|
$problem = 1; |
|
|
sql_err($sql); |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
xx_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed term successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
2065 |
} |
} |
2066 |
|
else printf ("Cannot delete Term ID# 1, it acts as a system placeholder."); |
2067 |
|
|
2068 |
else printf("Cannot delete <b>Term ID#1</b>, it acts as a system placeholder.<br><br>\n"); |
printf("<br><br>\n"); |
2069 |
|
msgTableClose(); |
|
printf("</td></tr></table>"); |
|
|
printf("</center>"); |
|
2070 |
} |
} |
2071 |
|
|
2072 |
|
|
2073 |
/********************************************************** |
/********************************************************** |
2074 |
Function: deleteTermConfirm |
Function: deleteTermConfirm |
2075 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2076 |
Last Modified: 05.07.2003 |
Last Modified: 03.16.2004 |
2077 |
*********************************************************** |
*********************************************************** |
2078 |
Purpose: |
Purpose: |
2079 |
Confirm prompt for deleting the supplied term id. |
Confirm prompt for deleting the supplied term id. |
2080 |
**********************************************************/ |
**********************************************************/ |
2081 |
function deleteTermConfirm($con, $key_id){ |
function deleteTermConfirm($key_id){ |
2082 |
|
|
|
// Make sure we have a valid integer type |
|
2083 |
$term_id = (int) $key_id; |
$term_id = (int) $key_id; |
2084 |
|
msgTableOpen(1, "Delete Term (ID# " . $term_id . ")?"); |
|
// Draw page heading |
|
|
printf("<center><h3>Delete Term ID# %s?</h3>", $term_id); |
|
2085 |
|
|
2086 |
// Check to see if its possible |
// Check to see if its possible |
2087 |
$exists = existsRow($con, "term", "term_id", $term_id); |
$exists = existsRow("term", "term_id", $term_id); |
2088 |
if ($exists > 0){ |
if ($exists > 0){ |
2089 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
2090 |
// Lookup the descriptive title |
// Lookup the descriptive title |
2091 |
$term = lookupField($con, "term", "term_id", $term_id, "term"); |
$term = lookupField("term", "term_id", $term_id, "term"); |
2092 |
printf("<strong>Term:</strong> %s<br>\n ", $term); |
printf("<b>Term:</b> %s<br><br>\n ", $term); |
2093 |
|
printf("This will permanently remove this academic term. Some courses may no longer have terms.<BR><BR>\n"); |
2094 |
|
|
2095 |
// Form to draw the delete button |
// Form to draw the delete button |
2096 |
printf("<form method = \"POST\" action = \"delete.phtml\" >"); |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
2097 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteTerm\" >"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteTerm\" >\n"); |
2098 |
printf("<input type = \"Hidden\" name = \"term_id\" value = \"%d\" >", $term_id); |
printf("<input type = \"Hidden\" name = \"term_id\" value = \"%d\" >\n", $term_id); |
2099 |
printf("This will <b>permanently</b> remove this academic term. Some courses may no longer have terms.<BR><BR>"); |
printf("<center>\n"); |
2100 |
printf("<center>"); |
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
2101 |
printf("<input type =\"Submit\" value=\"Delete!\">"); |
printf("</center>\n"); |
2102 |
printf("</center>"); |
printf("</form>\n"); |
2103 |
printf("</form><br>"); |
} |
2104 |
|
else if ($exists < 1) printf ("Term not found. Operation cancelled.<br><br>\n"); |
2105 |
|
|
2106 |
|
msgTableClose(); |
2107 |
|
} |
2108 |
|
|
2109 |
|
|
2110 |
|
/********************************************************** |
2111 |
|
Function: deleteVendor |
2112 |
|
Author: Paul Bramscher |
2113 |
|
Last Modified: 03.15.2004 |
2114 |
|
*********************************************************** |
2115 |
|
Purpose: |
2116 |
|
Deletes a supplied vendor id, sets affected resources |
2117 |
|
to (N/A) vendor. |
2118 |
|
**********************************************************/ |
2119 |
|
function deleteVendor($vendor_id){ |
2120 |
|
|
2121 |
|
msgTableOpen(1, "Deleting Vendor (ID# " . $vendor_id . ")"); |
2122 |
|
printf("<b>Messages:</b><br>\n"); |
2123 |
|
|
2124 |
|
// Cannot delete placeholder #1. |
2125 |
|
if ($vendor_id > 1) { |
2126 |
|
|
2127 |
|
// First update affected resources |
2128 |
|
$sql = "UPDATE resource SET vendor_id = NULL WHERE vendor_id = " |
2129 |
|
. $vendor_id; |
2130 |
|
if (xx_tryquery ($sql)) printf("Vendor purged from assignments to resources.<BR>\n"); |
2131 |
|
|
2132 |
|
// Delete from the vendor table |
2133 |
|
$sql = "DELETE FROM vendor WHERE vendor_id =" . $vendor_id; |
2134 |
|
if (xx_tryquery ($sql)) printf("Removed this vendor successfully."); |
2135 |
|
|
|
// Close table |
|
|
printf("</td></tr></table>"); |
|
2136 |
} |
} |
2137 |
|
else printf ("Cannot delete Vendor ID# 1, it acts as a system placeholder."); |
2138 |
|
|
2139 |
// Failed for whatever reason |
printf("<br><br>\n"); |
2140 |
else if ($exists < 1) printf ("Term not found. Operation cancelled.<br>\n"); |
msgTableClose(); |
2141 |
|
} |
2142 |
|
|
2143 |
printf("</center>"); |
|
2144 |
|
/********************************************************** |
2145 |
|
Function: deleteVendorConfirm |
2146 |
|
Author: Paul Bramscher |
2147 |
|
Last Modified: 03.16.2004 |
2148 |
|
*********************************************************** |
2149 |
|
Purpose: |
2150 |
|
Confirm prompt for deleting the selected vendor. |
2151 |
|
**********************************************************/ |
2152 |
|
function deleteVendorConfirm($key_id){ |
2153 |
|
|
2154 |
|
$vendor_id = (int) $key_id; |
2155 |
|
msgTableOpen(1, "Delete Vendor (ID# " . $vendor_id . ")?"); |
2156 |
|
|
2157 |
|
// Check to see if its possible |
2158 |
|
$exists = existsRow("vendor", "vendor_id", $vendor_id); |
2159 |
|
if ($exists > 0){ |
2160 |
|
|
2161 |
|
// Lookup the descriptive title |
2162 |
|
$vendor = lookupField("vendor", "vendor_id", $vendor_id, "vendor"); |
2163 |
|
printf("<b>Vendor:</b> %s<br><br>\n ", $vendor); |
2164 |
|
printf("This will permanently remove this vendor and its various assignments from the system. Some resources may lose their vendor association.<BR><BR>"); |
2165 |
|
|
2166 |
|
// Form to draw the delete button |
2167 |
|
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
2168 |
|
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteVendor\" >\n"); |
2169 |
|
printf("<input type = \"Hidden\" name = \"vendor_id\" value = \"%d\" >\n", $vendor_id); |
2170 |
|
printf("<center>\n"); |
2171 |
|
printf("<input type =\"Submit\" value=\"Delete!\">\n"); |
2172 |
|
printf("</center>\n"); |
2173 |
|
printf("</form>\n"); |
2174 |
|
} |
2175 |
|
else if ($exists < 1) printf ("Vendor not found. Operation cancelled.<br><br>\n"); |
2176 |
|
|
2177 |
|
msgTableClose(); |
2178 |
} |
} |
2179 |
?> |
?> |