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

Functions

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