1f9e34a54c222940dd9854c43374d6ba7d86e232
[atutor.git] / mods / gradebook / module_install.php
1 <?php\r
2 /*******\r
3  * the line below safe-guards this file from being accessed directly from\r
4  * a web browser. It will only execute if required from within an ATutor script,\r
5  * in our case the Module::install() method.\r
6  */\r
7 if (!defined('AT_INCLUDE_PATH')) { exit; }\r
8 \r
9 /*******\r
10  * Note: the many options for these variables are used to decrease confusion.\r
11  *       TRUE | FALSE | 1 will be the convention.\r
12  *\r
13  * $_course_privilege\r
14  *     specifies the type of instructor privilege this module uses.\r
15  *     set to empty | FALSE | 0   to disable any privileges.\r
16  *     set to 1 | AT_PRIV_ADMIN   to use the instructor only privilege.\r
17  *     set to TRUE | 'new'        to create a privilege specifically for this module:\r
18  *                                will make this module available as a student privilege.\r
19  *\r
20  * $_admin_privilege\r
21  *    specifies the type of ATutor administrator privilege this module uses.\r
22  *    set to FALSE | AT_ADMIN_PRIV_ADMIN   to use the super administrator only privilege.\r
23  *    set to TRUE | 'new'                  to create a privilege specifically for this module:\r
24  *                                         will make this module available as an administrator privilege.\r
25  *\r
26  *\r
27  * $_cron_interval\r
28  *    if non-zero specifies in minutes how often the module's cron job should be run.\r
29  *    set to 0 or not set to disable.\r
30  */\r
31 $_course_privilege = TRUE; // possible values: FALSE | AT_PRIV_ADMIN | TRUE\r
32 $_admin_privilege  = TRUE; // possible values: FALSE | TRUE\r
33 //$_cron_interval    = 35; // run every 30 minutes\r
34 \r
35 \r
36 /********\r
37  * the following code is used for creating a module-specific directory.\r
38  * it generates appropriate error messages to aid in its creation.\r
39  */\r
40 //$directory = AT_CONTENT_DIR .'gradebook';\r
41 \r
42 // check if the directory is writeable\r
43 //if (!is_dir($directory) && !@mkdir($directory)) {\r
44 //      $msg->addError(array('MODULE_INSTALL', '<li>'.$directory.' does not exist. Please create it.</li>'));\r
45 //} else if (!is_writable($directory) && @chmod($directory, 0666)) {\r
46 //      $msg->addError(array('MODULE_INSTALL', '<li>'.$directory.' is not writeable. On Unix issue the command <kbd>chmod a+rw</kbd>.</li>'));\r
47 //}\r
48 \r
49 \r
50 /******\r
51  * the following code checks if there are any errors (generated previously)\r
52  * then uses the SqlUtility to run any database queries it needs, ie. to create\r
53  * its own tables.\r
54  */\r
55 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {\r
56         // deal with the SQL file:\r
57         require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');\r
58         $sqlUtility =& new SqlUtility();\r
59 \r
60         /*\r
61          * the SQL file could be stored anywhere, and named anything, "module.sql" is simply\r
62          * a convention we're using.\r
63          */\r
64         $sqlUtility->queryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);\r
65 }\r
66 \r
67 ?>