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