system.install

  1. 7.x modules/system/system.install
  2. 6.x modules/system/system.install
  3. 4.x modules/system/system.install
  4. 5.x modules/system/system.install

The install file for the System module

This file is responsible for installing all of the required tables for FlightPath.

File

modules/system/system.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * The install file for the System module
  5. *
  6. * This file is responsible for installing all of the required tables
  7. * for FlightPath.
  8. */
  9. /**
  10. * Implementation of hook_enable.
  11. *
  12. * This is meant to be called during initial installation. We will make all of the
  13. * database changes we need to make in order to have FlightPath up and running.
  14. */
  15. function system_enable() {
  16. // Set up our default roles
  17. db_query("INSERT INTO roles (rid, name)
  18. VALUES (1, 'anonymous user'),
  19. (2, 'authenticated user')");
  20. // Add in the anonymous user into the users table (uid = 0)
  21. db_query("INSERT INTO users (user_id, cwid, user_name) VALUES (0, 0, 'anonymous')");
  22. // Let's figure out what the current schema value is for this system module...
  23. $info_contents = file_get_contents("modules/system/system.info");
  24. // From the info_contents variable, split up and place into an array.
  25. $info_details_array = array();
  26. $lines = explode("\n", $info_contents);
  27. foreach ($lines as $line) {
  28. if (trim($line) == "") continue;
  29. $temp = explode("=", trim($line));
  30. $info_details_array[trim($temp[0])] = trim(substr($line, strlen($temp[0]) + 1));
  31. }
  32. // Set up the modules table-- add the system module first.
  33. db_query("INSERT INTO modules (path, name, version, enabled, weight, type, `schema`)
  34. VALUES ('modules/system', 'system', 'core', 1, '-999', 'module', '?') ", $info_details_array["schema"]);
  35. // Let's perform installations on the other modules we want enabled by default.
  36. $modules = array("admin", "advise", "blocks", "comments", "student_search", "update_status", "content", "announcements", "tinymce", "course_search", "blank_degrees", "user", "batch");
  37. foreach ($modules as $module) {
  38. system_enable_module(array("module" => $module, "path" => "modules/$module", "version" => "core"));
  39. }
  40. // Set up some blocks for the system module by default.
  41. db_query("INSERT INTO blocks (section, region, module, delta, weight)
  42. VALUES ('system_main', 'right_col', 'system', 'tools', 1),
  43. ('system_main', 'right_col', 'system', 'admin_tools', 2),
  44. ('system_main', 'left_col', 'announcements', 'primary', 0),
  45. ('system_login', 'left_col', 'blocks', 'block_1', 0),
  46. ('system_login', 'right_col', 'system', 'login_form', 0),
  47. ('system_login', 'top', 'blocks', 'block_2', 0)
  48. ");
  49. // Set up some basic permissions for authenticated user.
  50. db_query("INSERT INTO role_permissions (rid, perm)
  51. VALUES
  52. (2, 'access_logged_in_content'),
  53. (2, 'view_comments') ");
  54. // Add some default variable values, to make things a little easier on first-run.
  55. variable_set("earliest_catalog_year", date("Y"));
  56. variable_set("current_catalog_year", date("Y"));
  57. variable_set("current_draft_catalog_year", date("Y"));
  58. // Do we have "clean URLs" enabled?
  59. $test = system_check_clean_urls();
  60. variable_set("clean_urls", $test);
  61. }
  62. function system_update($old_schema, $new_schema) {
  63. if ($old_schema <= 1) {
  64. // Add column to the faculty table
  65. db_query("ALTER TABLE faculty
  66. ADD COLUMN department_code varchar(10) AFTER college,
  67. ADD INDEX (department_code)");
  68. }
  69. if ($old_schema < 3) {
  70. // Add an index to the advising_comments table for access_type
  71. db_query("ALTER TABLE advising_comments
  72. ADD INDEX (access_type) ");
  73. }
  74. if ($old_schema < 4) {
  75. // Add college-related tables
  76. db_query("CREATE TABLE `colleges` (
  77. `college_code` varchar(10) ,
  78. `title` varchar(255) ,
  79. PRIMARY KEY (`college_code`)
  80. ) ");
  81. db_query("CREATE TABLE `degree_college` (
  82. `major_code` varchar(100) ,
  83. `college_code` varchar(10) ,
  84. PRIMARY KEY (`major_code`),
  85. KEY `college_code` (`college_code`)
  86. ) ");
  87. fp_add_message(t("Added college-related tables to database."));
  88. }
  89. if ($old_schema < 5) {
  90. // Update hour fields to be decimal type.
  91. db_query("ALTER TABLE `advised_courses` MODIFY `var_hours` DECIMAL(8,4) ");
  92. db_query("ALTER TABLE `student_courses` MODIFY `hours_awarded` DECIMAL(8,4) ");
  93. db_query("ALTER TABLE `student_substitutions` MODIFY `sub_hours` DECIMAL(8,4) ");
  94. db_query("ALTER TABLE `courses` MODIFY `min_hours` DECIMAL(8,4) ");
  95. db_query("ALTER TABLE `courses` MODIFY `max_hours` DECIMAL(8,4) ");
  96. db_query("ALTER TABLE `courses` MODIFY `repeat_hours` DECIMAL(8,4) ");
  97. db_query("ALTER TABLE `draft_courses` MODIFY `min_hours` DECIMAL(8,4) ");
  98. db_query("ALTER TABLE `draft_courses` MODIFY `max_hours` DECIMAL(8,4) ");
  99. db_query("ALTER TABLE `draft_courses` MODIFY `repeat_hours` DECIMAL(8,4) ");
  100. db_query("ALTER TABLE `degree_requirements` MODIFY `group_hours_required` DECIMAL(8,4) ");
  101. db_query("ALTER TABLE `draft_degree_requirements` MODIFY `group_hours_required` DECIMAL(8,4) ");
  102. db_query("ALTER TABLE `student_transfer_courses` MODIFY `hours_awarded` DECIMAL(8,4) ");
  103. db_query("ALTER TABLE `transfer_courses` MODIFY `min_hours` DECIMAL(8,4) ");
  104. db_query("ALTER TABLE `transfer_courses` MODIFY `max_hours` DECIMAL(8,4) ");
  105. // Also, expand the varchar fields for students table...
  106. db_query("ALTER TABLE `students` MODIFY `cumulative_hours` varchar(10) ");
  107. db_query("ALTER TABLE `students` MODIFY `gpa` varchar(10) ");
  108. fp_add_message(t("Updated database fields to allow for decimal hours."));
  109. }
  110. if ($old_schema < 6) {
  111. // Add level_code field to relavant tables.
  112. db_query("alter table `student_courses` add column `level_code` VARCHAR(10) ");
  113. db_query("alter table `student_transfer_courses` add column `level_code` VARCHAR(10) ");
  114. // Also add indexes for these fields.
  115. db_query("alter table `student_courses` add index `level_code` (level_code)");
  116. db_query("alter table `student_transfer_courses` add index `level_code` (level_code)");
  117. fp_add_message(t("Updated database fields to allow for level codes per course."));
  118. }
  119. if ($old_schema < 8) {
  120. // We want to add an "extra_data" field to the student_degrees table. This is an optional field, meant to be
  121. // used by module developers. It can be empty, and will not affect the core functioning of FlightPath.
  122. db_query("alter table `student_degrees` add column `extra_data` VARCHAR(255) ");
  123. // Add an index as well...
  124. db_query("alter table `student_degrees` add index `extra_data` (extra_data)");
  125. }
  126. }
  127. /**
  128. * Implementation of hook_install.
  129. *
  130. * This will create all of our tables.
  131. */
  132. function system_install() {
  133. // Since this will ONLY be called during initial install, we do not
  134. // need to first check for existing tables; it is assumed that the database
  135. // is empty.
  136. // Therefore, let's place all of our create table statements in one query, for
  137. // simplicity.
  138. $q = "
  139. CREATE TABLE `advised_courses` (
  140. `id` int(11) NOT NULL AUTO_INCREMENT,
  141. `advising_session_id` int(11) DEFAULT '0',
  142. `course_id` int(11) DEFAULT '0',
  143. `entry_value` varchar(20) DEFAULT '',
  144. `semester_num` int(11) DEFAULT '0',
  145. `group_id` varchar(50) DEFAULT '',
  146. `var_hours` decimal(8,4) DEFAULT '0.0000',
  147. `term_id` varchar(20) DEFAULT '',
  148. `degree_id` int(11) DEFAULT '0',
  149. PRIMARY KEY (`id`),
  150. KEY `advid` (`advising_session_id`),
  151. KEY `course_id` (`course_id`),
  152. KEY `ev` (`entry_value`),
  153. KEY `degree_id` (`degree_id`),
  154. KEY `term_id` (`term_id`),
  155. KEY `semester_num` (`semester_num`)
  156. ); ";
  157. db_query($q);
  158. $q = "
  159. CREATE TABLE `advising_comments` (
  160. `id` int(11) AUTO_INCREMENT,
  161. `student_id` varchar(30) DEFAULT '0',
  162. `faculty_id` varchar(30) DEFAULT '0',
  163. `term_id` varchar(20) DEFAULT '',
  164. `comment` text,
  165. `posted` int(10) unsigned DEFAULT '0',
  166. `access_type` varchar(20) DEFAULT '',
  167. `delete_flag` tinyint(4) DEFAULT '0',
  168. PRIMARY KEY (`id`),
  169. KEY `student_id` (`student_id`),
  170. KEY `delete_flag` (`delete_flag`),
  171. KEY `access_type` (`access_type`)
  172. );
  173. ";
  174. db_query($q);
  175. $q = "
  176. CREATE TABLE `advising_sessions` (
  177. `advising_session_id` int(11) AUTO_INCREMENT,
  178. `student_id` varchar(30) DEFAULT '0',
  179. `faculty_id` varchar(30) DEFAULT '0',
  180. `term_id` varchar(20) DEFAULT '',
  181. `degree_id` int(11) DEFAULT '0',
  182. `major_code_csv` varchar(255) DEFAULT '',
  183. `catalog_year` int(11) DEFAULT '0',
  184. `posted` int(10) unsigned DEFAULT '0',
  185. `is_whatif` tinyint(4) DEFAULT '0',
  186. `is_draft` tinyint(4) DEFAULT '0',
  187. `is_empty` tinyint(4) DEFAULT '0',
  188. PRIMARY KEY (`advising_session_id`),
  189. KEY `sid` (`student_id`),
  190. KEY `termid` (`term_id`)
  191. ); ";
  192. db_query($q);
  193. $q = "
  194. CREATE TABLE `advisor_student` (
  195. `faculty_id` varchar(30) DEFAULT '0',
  196. `student_id` varchar(30) DEFAULT '0',
  197. PRIMARY KEY (`faculty_id`,`student_id`)
  198. ); ";
  199. db_query($q);
  200. $q = "
  201. CREATE TABLE `blocks` (
  202. `bid` int(10) unsigned AUTO_INCREMENT,
  203. `section` varchar(255) DEFAULT '',
  204. `region` varchar(255) DEFAULT '',
  205. `module` varchar(255) DEFAULT '',
  206. `delta` varchar(255) DEFAULT '',
  207. `weight` int(11) DEFAULT '0',
  208. PRIMARY KEY (`bid`)
  209. ); ";
  210. db_query($q);
  211. $q = "
  212. CREATE TABLE `courses` (
  213. `id` int(11) AUTO_INCREMENT,
  214. `course_id` int(11) DEFAULT '0',
  215. `subject_id` varchar(10) DEFAULT '',
  216. `course_num` varchar(10) DEFAULT '',
  217. `catalog_year` int(11) DEFAULT '0',
  218. `title` text,
  219. `description` text,
  220. `min_hours` decimal(8,4) DEFAULT '0.0000',
  221. `max_hours` decimal(8,4) DEFAULT '0.0000',
  222. `repeat_hours` decimal(8,4) DEFAULT '0.0000',
  223. `exclude` tinyint(4) DEFAULT '0',
  224. `data_entry_comment` text,
  225. `delete_flag` tinyint(4) DEFAULT '0',
  226. PRIMARY KEY (`id`),
  227. KEY `course_id` (`course_id`),
  228. KEY `subject_id` (`subject_id`),
  229. KEY `course_num` (`course_num`),
  230. KEY `catalog_year` (`catalog_year`)
  231. ); ";
  232. db_query($q);
  233. db_query("CREATE TABLE `colleges` (
  234. `college_code` varchar(10) ,
  235. `title` varchar(255) DEFAULT '',
  236. PRIMARY KEY (`college_code`)
  237. ) ");
  238. db_query("CREATE TABLE `degree_college` (
  239. `major_code` varchar(100) DEFAULT '',
  240. `college_code` varchar(10) DEFAULT '',
  241. PRIMARY KEY (`major_code`),
  242. KEY `college_code` (`college_code`)
  243. ) ");
  244. $q = "
  245. CREATE TABLE `degree_requirements` (
  246. `id` int(11) AUTO_INCREMENT,
  247. `degree_id` int(11) DEFAULT '0',
  248. `semester_num` int(11) DEFAULT '0',
  249. `group_id` int(11) DEFAULT '0',
  250. `group_requirement_type` varchar(10) DEFAULT '',
  251. `group_min_hours_allowed` decimal(8,4) DEFAULT '0.0000',
  252. `group_hours_required` decimal(8,4) DEFAULT '0.0000',
  253. `group_min_grade` varchar(10) DEFAULT '',
  254. `course_id` int(11) DEFAULT '0',
  255. `course_min_grade` varchar(10) DEFAULT '',
  256. `course_requirement_type` varchar(10) DEFAULT '',
  257. `data_entry_value` varchar(50) DEFAULT '',
  258. PRIMARY KEY (`id`),
  259. KEY `degree_id` (`degree_id`),
  260. KEY `group_id` (`group_id`),
  261. KEY `dev` (`data_entry_value`)
  262. ); ";
  263. db_query($q);
  264. $q = "
  265. CREATE TABLE `degree_tracks` (
  266. `track_id` int(11) AUTO_INCREMENT,
  267. `catalog_year` int(11) DEFAULT '2006',
  268. `major_code` varchar(100) DEFAULT '',
  269. `track_code` varchar(20) DEFAULT '',
  270. `track_title` varchar(100) DEFAULT '',
  271. `track_short_title` varchar(50) DEFAULT '',
  272. `track_description` text,
  273. PRIMARY KEY (`track_id`)
  274. ); ";
  275. db_query($q);
  276. $q = "
  277. CREATE TABLE `degrees` (
  278. `id` int(11) AUTO_INCREMENT,
  279. `degree_id` int(11) DEFAULT '0',
  280. `major_code` varchar(100) DEFAULT '',
  281. `degree_type` varchar(20) DEFAULT '',
  282. `degree_level` varchar(5) DEFAULT '',
  283. `degree_class` varchar(40) DEFAULT '',
  284. `title` varchar(200) DEFAULT '',
  285. `public_note` text,
  286. `semester_titles_csv` text,
  287. `catalog_year` int(11) DEFAULT '2006',
  288. `exclude` int(11) DEFAULT '0',
  289. `allow_dynamic` int(11) DEFAULT '0',
  290. `advising_weight` int(11) DEFAULT '0',
  291. `override_degree_hours` varchar(20) DEFAULT '',
  292. `min_tracks` int(11) DEFAULT '0',
  293. `max_tracks` int(11) DEFAULT '0',
  294. `default_tracks` varchar(255) DEFAULT '',
  295. `track_selection_config` text,
  296. PRIMARY KEY (`id`),
  297. KEY `degree_id` (`degree_id`),
  298. KEY `major_code` (`major_code`),
  299. KEY `degree_level` (`degree_level`),
  300. KEY `degree_class` (`degree_class`),
  301. KEY `allow_dynamic` (`allow_dynamic`),
  302. KEY `advising_weight` (`advising_weight`),
  303. KEY `catalog_year` (`catalog_year`)
  304. ); ";
  305. db_query($q);
  306. $q = "
  307. CREATE TABLE `draft_courses` (
  308. `id` int(11) AUTO_INCREMENT,
  309. `course_id` int(11) DEFAULT '0',
  310. `subject_id` varchar(10) DEFAULT '',
  311. `course_num` varchar(10) DEFAULT '',
  312. `catalog_year` int(11) DEFAULT '2006',
  313. `title` text,
  314. `description` text,
  315. `min_hours` decimal(8,4) DEFAULT '0.0000',
  316. `max_hours` decimal(8,4) DEFAULT '0.0000',
  317. `repeat_hours` decimal(8,4) DEFAULT '0.0000',
  318. `exclude` tinyint(4) DEFAULT '0',
  319. `data_entry_comment` text,
  320. `delete_flag` tinyint(4) DEFAULT '0',
  321. PRIMARY KEY (`id`),
  322. KEY `course_id` (`course_id`),
  323. KEY `subject_id` (`subject_id`),
  324. KEY `course_num` (`course_num`),
  325. KEY `catalog_year` (`catalog_year`)
  326. ); ";
  327. db_query($q);
  328. $q = "
  329. CREATE TABLE `draft_degree_requirements` (
  330. `id` int(11) AUTO_INCREMENT,
  331. `degree_id` int(11) DEFAULT '0',
  332. `semester_num` int(11) DEFAULT '0',
  333. `group_id` int(11) DEFAULT '0',
  334. `group_requirement_type` varchar(10) DEFAULT '',
  335. `group_min_hours_allowed` decimal(8,4) DEFAULT '0.0000',
  336. `group_hours_required` decimal(8,4) DEFAULT '0.0000',
  337. `group_min_grade` varchar(10) DEFAULT '',
  338. `course_id` int(11) DEFAULT '0',
  339. `course_min_grade` varchar(10) DEFAULT '',
  340. `course_requirement_type` varchar(10) DEFAULT '',
  341. `data_entry_value` varchar(50) DEFAULT '',
  342. PRIMARY KEY (`id`),
  343. KEY `degree_id` (`degree_id`),
  344. KEY `group_id` (`group_id`),
  345. KEY `dev` (`data_entry_value`)
  346. );";
  347. db_query($q);
  348. $q = "
  349. CREATE TABLE `draft_degree_tracks` (
  350. `track_id` int(11) AUTO_INCREMENT,
  351. `catalog_year` int(11) DEFAULT '2006',
  352. `major_code` varchar(100) DEFAULT '',
  353. `track_code` varchar(20) DEFAULT '',
  354. `track_title` varchar(100) DEFAULT '',
  355. `track_short_title` varchar(50) DEFAULT '',
  356. `track_description` text,
  357. PRIMARY KEY (`track_id`)
  358. ); ";
  359. db_query($q);
  360. $q = "
  361. CREATE TABLE `draft_degrees` (
  362. `id` int(11) AUTO_INCREMENT,
  363. `degree_id` int(11) DEFAULT '0',
  364. `major_code` varchar(100) DEFAULT '',
  365. `degree_type` varchar(20) DEFAULT '',
  366. `degree_level` varchar(5) DEFAULT '',
  367. `degree_class` varchar(40) DEFAULT '',
  368. `title` varchar(200) DEFAULT '',
  369. `public_note` text,
  370. `semester_titles_csv` text,
  371. `catalog_year` int(11) DEFAULT '2006',
  372. `exclude` int(11) DEFAULT '0',
  373. `allow_dynamic` int(11) DEFAULT '0',
  374. `advising_weight` int(11) DEFAULT '0',
  375. `override_degree_hours` varchar(20) DEFAULT '',
  376. `min_tracks` int(11) DEFAULT '0',
  377. `max_tracks` int(11) DEFAULT '0',
  378. `default_tracks` varchar(255) DEFAULT '',
  379. `track_selection_config` text,
  380. PRIMARY KEY (`id`),
  381. KEY `degree_id` (`degree_id`),
  382. KEY `major_code` (`major_code`),
  383. KEY `exclude` (`exclude`),
  384. KEY `allow_dynamic` (`allow_dynamic`),
  385. KEY `advising_weight` (`advising_weight`),
  386. KEY `degree_level` (`degree_level`),
  387. KEY `degree_class` (`degree_class`),
  388. KEY `catalog_year` (`catalog_year`)
  389. );";
  390. db_query($q);
  391. $q = "
  392. CREATE TABLE `draft_group_requirements` (
  393. `id` int(11) AUTO_INCREMENT,
  394. `group_id` int(11) DEFAULT '0',
  395. `course_id` int(11) DEFAULT '0',
  396. `course_min_grade` varchar(10) DEFAULT '',
  397. `course_repeats` int(11) DEFAULT '0',
  398. `child_group_id` int(11) DEFAULT '0',
  399. `data_entry_value` varchar(50) DEFAULT '',
  400. PRIMARY KEY (`id`),
  401. KEY `group_id` (`group_id`),
  402. KEY `dev` (`data_entry_value`)
  403. ); ";
  404. db_query($q);
  405. $q = "
  406. CREATE TABLE `draft_groups` (
  407. `id` int(11) NOT NULL AUTO_INCREMENT,
  408. `group_id` int(11) DEFAULT '0',
  409. `group_name` varchar(200) DEFAULT '',
  410. `title` varchar(255) DEFAULT '',
  411. `definition` text,
  412. `icon_filename` text,
  413. `catalog_year` int(11) DEFAULT '2006',
  414. `priority` int(11) DEFAULT '50',
  415. `delete_flag` tinyint(4) DEFAULT '0',
  416. `data_entry_comment` text,
  417. `catalog_repeat` tinyint(4) DEFAULT '0',
  418. PRIMARY KEY (`id`),
  419. KEY `group_id` (`group_id`),
  420. KEY `group_name` (`group_name`),
  421. KEY `catalog_year` (`catalog_year`),
  422. KEY `title` (`title`),
  423. KEY `delete_flag` (`delete_flag`),
  424. KEY `catalog_repeat` (`catalog_repeat`),
  425. KEY `priority` (`priority`)
  426. ); ";
  427. db_query($q);
  428. $q = "
  429. CREATE TABLE `draft_instructions` (
  430. `id` int(11) AUTO_INCREMENT,
  431. `instruction` text,
  432. PRIMARY KEY (`id`)
  433. );";
  434. db_query($q);
  435. $q = "
  436. CREATE TABLE `faculty` (
  437. `cwid` varchar(30) ,
  438. `college` varchar(100) DEFAULT '',
  439. `department_code` varchar(10) DEFAULT '',
  440. `department` varchar(100) DEFAULT '',
  441. `major_code_csv` varchar(255) DEFAULT '',
  442. PRIMARY KEY (`cwid`),
  443. KEY `major_code_csv` (`major_code_csv`),
  444. KEY `dept` (`department`),
  445. KEY `department_code` (`department_code`),
  446. KEY `college` (`college`)
  447. ); ";
  448. db_query($q);
  449. $q = "
  450. CREATE TABLE `group_requirements` (
  451. `id` int(11) AUTO_INCREMENT,
  452. `group_id` int(11) DEFAULT '0',
  453. `course_id` int(11) DEFAULT '0',
  454. `course_min_grade` varchar(10) DEFAULT '',
  455. `course_repeats` int(11) DEFAULT '0',
  456. `child_group_id` int(11) DEFAULT '0',
  457. `data_entry_value` varchar(50) DEFAULT '',
  458. PRIMARY KEY (`id`),
  459. KEY `group_id` (`group_id`),
  460. KEY `dev` (`data_entry_value`)
  461. ); ";
  462. db_query($q);
  463. $q = "
  464. CREATE TABLE `groups` (
  465. `id` int(11) NOT NULL AUTO_INCREMENT,
  466. `group_id` int(11) DEFAULT '0',
  467. `group_name` varchar(200) DEFAULT '',
  468. `title` varchar(255) DEFAULT '',
  469. `definition` text,
  470. `icon_filename` text,
  471. `catalog_year` int(11) DEFAULT '2006',
  472. `priority` int(11) DEFAULT '50',
  473. `delete_flag` tinyint(4) DEFAULT '0',
  474. `data_entry_comment` text,
  475. `catalog_repeat` tinyint(4) DEFAULT '0',
  476. PRIMARY KEY (`id`),
  477. KEY `group_id` (`group_id`),
  478. KEY `group_name` (`group_name`),
  479. KEY `catalog_year` (`catalog_year`),
  480. KEY `title` (`title`),
  481. KEY `delete_flag` (`delete_flag`),
  482. KEY `catalog_repeat` (`catalog_repeat`),
  483. KEY `priority` (`priority`)
  484. ); ";
  485. db_query($q);
  486. $q = "
  487. CREATE TABLE `menu_router` (
  488. `path` varchar(255) ,
  489. `access_callback` varchar(255) DEFAULT '',
  490. `access_arguments` text,
  491. `page_callback` varchar(255) DEFAULT '',
  492. `page_arguments` text,
  493. `title` varchar(255) DEFAULT '',
  494. `description` text,
  495. `type` tinyint(3) unsigned DEFAULT '0',
  496. `tab_family` varchar(255) DEFAULT '',
  497. `tab_parent` varchar(255) DEFAULT '',
  498. `weight` int(11) DEFAULT '0',
  499. `icon` varchar(255) DEFAULT '',
  500. `page_settings` text,
  501. `file` varchar(255) DEFAULT '',
  502. PRIMARY KEY (`path`),
  503. KEY `type` (`type`),
  504. KEY `tab_family` (`tab_family`)
  505. ); ";
  506. db_query($q);
  507. $q = "
  508. CREATE TABLE `modules` (
  509. `path` varchar(255) ,
  510. `name` varchar(100) DEFAULT '',
  511. `version` varchar(20) DEFAULT '',
  512. `requires` text,
  513. `enabled` int(11) DEFAULT '0',
  514. `weight` int(11) DEFAULT '0',
  515. `type` varchar(20) DEFAULT '',
  516. `schema` int(11) DEFAULT '0',
  517. `info` text,
  518. PRIMARY KEY (`path`)
  519. ); ";
  520. db_query($q);
  521. $q = "
  522. CREATE TABLE `role_permissions` (
  523. `pid` int(10) unsigned AUTO_INCREMENT,
  524. `rid` int(10) unsigned DEFAULT '0',
  525. `perm` varchar(255) DEFAULT '',
  526. PRIMARY KEY (`pid`),
  527. KEY `perm` (`perm`),
  528. KEY `rid` (`rid`)
  529. ); ";
  530. db_query($q);
  531. $q = "
  532. CREATE TABLE `roles` (
  533. `rid` int(11) AUTO_INCREMENT,
  534. `name` varchar(255) DEFAULT '',
  535. PRIMARY KEY (`rid`)
  536. ); ";
  537. db_query($q);
  538. $q = "
  539. CREATE TABLE `standardized_tests` (
  540. `id` int(11) AUTO_INCREMENT,
  541. `test_id` varchar(20) DEFAULT '',
  542. `category_id` varchar(20) DEFAULT '',
  543. `position` int(11) DEFAULT '0',
  544. `test_description` varchar(200) DEFAULT '',
  545. `category_description` varchar(200) DEFAULT '',
  546. PRIMARY KEY (`id`)
  547. ); ";
  548. db_query($q);
  549. $q = "
  550. CREATE TABLE `student_courses` (
  551. `id` int(11) AUTO_INCREMENT,
  552. `student_id` varchar(30) DEFAULT '',
  553. `subject_id` varchar(10) DEFAULT '',
  554. `course_num` varchar(10) DEFAULT '',
  555. `hours_awarded` decimal(8,4) DEFAULT '0.0000',
  556. `grade` varchar(5) DEFAULT '',
  557. `term_id` varchar(20) DEFAULT '',
  558. `level_code` varchar(10) DEFAULT '',
  559. PRIMARY KEY (`id`),
  560. KEY `student_id` (`student_id`),
  561. KEY `level_code` (`level_code`)
  562. ); ";
  563. db_query($q);
  564. $q = "
  565. CREATE TABLE `student_degrees` (
  566. `student_id` varchar(30) DEFAULT '',
  567. `major_code` varchar(100) DEFAULT '',
  568. `is_editable` tinyint(4) DEFAULT '0',
  569. `delete_flag` tinyint(4) DEFAULT '0',
  570. PRIMARY KEY (`student_id`,`major_code`)
  571. ); ";
  572. db_query($q);
  573. $q = "
  574. CREATE TABLE `student_developmentals` (
  575. `student_id` varchar(30) ,
  576. `requirement` varchar(15) DEFAULT '',
  577. PRIMARY KEY (`student_id`,`requirement`),
  578. KEY (`requirement`)
  579. ); ";
  580. db_query($q);
  581. $q = "
  582. CREATE TABLE `student_settings` (
  583. `student_id` varchar(30) ,
  584. `settings` text,
  585. `posted` int(10) unsigned DEFAULT '0',
  586. PRIMARY KEY (`student_id`)
  587. ); ";
  588. db_query($q);
  589. $q = "
  590. CREATE TABLE `student_substitutions` (
  591. `id` int(11) AUTO_INCREMENT,
  592. `student_id` varchar(30) DEFAULT '',
  593. `faculty_id` varchar(30) DEFAULT '',
  594. `required_course_id` int(11) DEFAULT '0',
  595. `required_entry_value` varchar(20) DEFAULT '',
  596. `required_group_id` varchar(50) DEFAULT '',
  597. `required_degree_id` int(11) unsigned DEFAULT '0',
  598. `required_semester_num` int(11) DEFAULT '0',
  599. `sub_course_id` int(11) DEFAULT '0',
  600. `sub_entry_value` varchar(20) DEFAULT '',
  601. `sub_term_id` varchar(20) DEFAULT '',
  602. `sub_transfer_flag` tinyint(4) DEFAULT '0',
  603. `sub_hours` decimal(8,4) DEFAULT '0.0000',
  604. `sub_remarks` text,
  605. `posted` int(10) unsigned DEFAULT '0',
  606. `delete_flag` tinyint(4) DEFAULT '0',
  607. PRIMARY KEY (`id`),
  608. KEY `student_id` (`student_id`),
  609. KEY `rev` (`required_entry_value`),
  610. KEY `sev` (`sub_entry_value`)
  611. ); ";
  612. db_query($q);
  613. $q = "
  614. CREATE TABLE `student_tests` (
  615. `id` int(11) AUTO_INCREMENT,
  616. `student_id` varchar(30) DEFAULT '',
  617. `test_id` varchar(20) DEFAULT '',
  618. `category_id` varchar(20) DEFAULT '',
  619. `score` varchar(10) DEFAULT '',
  620. `date_taken` datetime DEFAULT '1970-01-01 00:00:01',
  621. PRIMARY KEY (`id`),
  622. KEY `student_id` (`student_id`)
  623. ); ";
  624. db_query($q);
  625. $q = "
  626. CREATE TABLE `student_transfer_courses` (
  627. `id` int(10) unsigned AUTO_INCREMENT,
  628. `student_id` varchar(30) DEFAULT '',
  629. `transfer_course_id` int(11) DEFAULT '0',
  630. `student_specific_course_title` varchar(255) DEFAULT '',
  631. `term_id` varchar(20) DEFAULT '',
  632. `grade` varchar(5) DEFAULT '',
  633. `hours_awarded` decimal(8,4) DEFAULT '0.0000',
  634. `level_code` VARCHAR(10) DEFAULT '',
  635. PRIMARY KEY (`id`),
  636. KEY `student_id` (`student_id`),
  637. KEY `transfer_id` (`transfer_course_id`),
  638. KEY `term_id` (`term_id`),
  639. KEY `grade` (`grade`),
  640. KEY `level_code` (`level_code`),
  641. KEY `hrs` (`hours_awarded`)
  642. ) ; ";
  643. db_query($q);
  644. $q = "
  645. CREATE TABLE `student_unassign_group` (
  646. `id` int(11) AUTO_INCREMENT,
  647. `student_id` varchar(30) DEFAULT '',
  648. `faculty_id` varchar(30) DEFAULT '',
  649. `course_id` int(11) DEFAULT '0',
  650. `term_id` varchar(20) DEFAULT '',
  651. `transfer_flag` tinyint(4) DEFAULT '0',
  652. `group_id` varchar(50) DEFAULT '',
  653. `degree_id` int(11) DEFAULT '0',
  654. `delete_flag` tinyint(4) DEFAULT '0',
  655. `posted` int(10) unsigned DEFAULT '0',
  656. PRIMARY KEY (`id`),
  657. KEY (`student_id`),
  658. KEY (`faculty_id`),
  659. KEY (`delete_flag`)
  660. ); ";
  661. db_query($q);
  662. $q = "
  663. CREATE TABLE `student_unassign_transfer_eqv` (
  664. `id` int(11) AUTO_INCREMENT,
  665. `student_id` varchar(30) DEFAULT '',
  666. `faculty_id` varchar(30) DEFAULT '',
  667. `transfer_course_id` int(11) DEFAULT '0',
  668. `delete_flag` tinyint(4) DEFAULT '0',
  669. `posted` int(10) unsigned DEFAULT '0',
  670. PRIMARY KEY (`id`),
  671. KEY (`student_id`),
  672. KEY (`faculty_id`),
  673. KEY (`transfer_course_id`),
  674. KEY (`delete_flag`)
  675. ); ";
  676. db_query($q);
  677. $q = "
  678. CREATE TABLE `students` (
  679. `cwid` varchar(30) ,
  680. `cumulative_hours` varchar(20) DEFAULT '',
  681. `gpa` varchar(20) DEFAULT '',
  682. `rank_code` varchar(20) DEFAULT '',
  683. `catalog_year` int(11) DEFAULT '2006',
  684. `is_active` tinyint(11) DEFAULT '0',
  685. PRIMARY KEY (`cwid`),
  686. KEY `rank_code` (`rank_code`),
  687. KEY `is_active` (`is_active`)
  688. ); ";
  689. db_query($q);
  690. $q = "
  691. CREATE TABLE `subjects` (
  692. `subject_id` varchar(10) ,
  693. `college` varchar(10) DEFAULT '',
  694. `title` varchar(255) DEFAULT '',
  695. PRIMARY KEY (`subject_id`)
  696. ); ";
  697. db_query($q);
  698. $q = "
  699. CREATE TABLE `transfer_courses` (
  700. `transfer_course_id` int(11) AUTO_INCREMENT,
  701. `institution_id` varchar(10) DEFAULT '',
  702. `subject_id` varchar(10) DEFAULT '',
  703. `course_num` varchar(10) DEFAULT '',
  704. `title` varchar(100) DEFAULT '',
  705. `description` text,
  706. `min_hours` decimal(8,4) DEFAULT '0.0000',
  707. `max_hours` decimal(8,4) DEFAULT '0.0000',
  708. PRIMARY KEY (`transfer_course_id`),
  709. KEY `ic` (`institution_id`),
  710. KEY `si` (`subject_id`),
  711. KEY `cn` (`course_num`)
  712. ); ";
  713. db_query($q);
  714. $q = "
  715. CREATE TABLE `transfer_eqv_per_student` (
  716. `id` int(11) AUTO_INCREMENT,
  717. `student_id` varchar(30) DEFAULT '',
  718. `transfer_course_id` int(11) DEFAULT '0',
  719. `local_course_id` int(11) DEFAULT '0',
  720. `valid_term_id` varchar(20) DEFAULT '',
  721. `broken_id` int(11) DEFAULT '0',
  722. PRIMARY KEY (`id`),
  723. KEY `student_id` (`student_id`),
  724. KEY `transfer_course_id` (`transfer_course_id`),
  725. KEY `local_course_id` (`local_course_id`),
  726. KEY `broken_id` (`broken_id`)
  727. ); ";
  728. db_query($q);
  729. $q = "
  730. CREATE TABLE `transfer_institutions` (
  731. `institution_id` varchar(10) ,
  732. `name` varchar(200) DEFAULT '',
  733. `state` varchar(10) DEFAULT '',
  734. PRIMARY KEY (`institution_id`),
  735. KEY `state` (`state`)
  736. ); ";
  737. db_query($q);
  738. $q = "
  739. CREATE TABLE `user_roles` (
  740. `user_id` int(11) ,
  741. `rid` int(11) DEFAULT '0',
  742. PRIMARY KEY (`user_id`,`rid`),
  743. KEY (`rid`)
  744. ); ";
  745. db_query($q);
  746. $q = "
  747. CREATE TABLE `user_settings` (
  748. `user_id` int(11) ,
  749. `settings` text,
  750. `posted` int(10) unsigned DEFAULT '0',
  751. PRIMARY KEY (`user_id`)
  752. ); ";
  753. db_query($q);
  754. $q = "
  755. CREATE TABLE `users` (
  756. `user_id` int(11) AUTO_INCREMENT,
  757. `user_name` varchar(50) DEFAULT '',
  758. `password` varchar(255) DEFAULT '',
  759. `is_student` tinyint(4) DEFAULT '0',
  760. `is_faculty` tinyint(4) DEFAULT '0',
  761. `email` varchar(255) DEFAULT '',
  762. `cwid` varchar(30) DEFAULT '',
  763. `f_name` varchar(100) DEFAULT '',
  764. `l_name` varchar(100) DEFAULT '',
  765. `is_disabled` tinyint(4) DEFAULT '0',
  766. PRIMARY KEY (`user_id`),
  767. KEY `cwid` (`cwid`),
  768. KEY `user_name` (`user_name`),
  769. KEY (`is_disabled`),
  770. KEY (`is_faculty`),
  771. KEY (`is_student`)
  772. ); ";
  773. db_query($q);
  774. $q = "
  775. CREATE TABLE `variables` (
  776. `name` varchar(255) ,
  777. `value` text,
  778. PRIMARY KEY (`name`)
  779. ); ";
  780. db_query($q);
  781. $q = "
  782. CREATE TABLE `watchdog` (
  783. `wid` int(11) unsigned AUTO_INCREMENT,
  784. `user_id` int(11) unsigned DEFAULT '0',
  785. `user_name` varchar(50) DEFAULT '',
  786. `cwid` varchar(30) DEFAULT '',
  787. `type` varchar(100) DEFAULT '',
  788. `message` text,
  789. `variables` text,
  790. `severity` tinyint(3) unsigned DEFAULT '0',
  791. `extra_data` varchar(255) DEFAULT '',
  792. `location` text,
  793. `referer` text,
  794. `ip` varchar(64) DEFAULT '',
  795. `is_mobile` tinyint(4) DEFAULT '0',
  796. `is_student` tinyint(4) DEFAULT '0',
  797. `is_faculty` tinyint(4) DEFAULT '0',
  798. `timestamp` int(11) unsigned DEFAULT '0',
  799. PRIMARY KEY (`wid`),
  800. KEY `type` (`type`),
  801. KEY `uid` (`user_id`),
  802. KEY `uname` (`user_name`),
  803. KEY `severity` (`severity`),
  804. KEY `cwid` (`cwid`)
  805. ); ";
  806. db_query($q);
  807. }

Functions

Namesort descending Description
system_enable Implementation of hook_enable.
system_install Implementation of hook_install.
system_update