-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
Locate the PHP source files in the src directory of this repository and extract them to a web server. The LTI class library dependency can be installed using Composer: use a command-line interface in the directory where you extracted the PHP source files and run the following command:
composer install
The application uses the following database tables:
- item - a record for each item to be rated
- rating - a record for each rating made by a student
The table names may also have a prefix (see DB_TABLENAME_PREFIX setting above). The InnoDB database engine is recommended for the tables to ensure support for the integrity constraints.
CREATE TABLE item (
item_pk int(11) NOT NULL AUTO_INCREMENT,
resource_link_pk int(11) NOT NULL,
item_title varchar(200) NOT NULL,
item_text text,
item_url varchar(200) DEFAULT NULL,
max_rating int(2) NOT NULL DEFAULT '5',
step int(1) NOT NULL DEFAULT '1',
visible tinyint(1) NOT NULL DEFAULT '0',
sequence int(3) NOT NULL DEFAULT '0',
created datetime NOT NULL,
updated datetime NOT NULL,
PRIMARY KEY (item_pk)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE rating (
item_pk int(11) NOT NULL,
user_pk int(11) NOT NULL,
rating decimal(10,2) NOT NULL,
PRIMARY KEY (item_pk, user_pk)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE item
ADD CONSTRAINT item_lti_resource_link_FK1 FOREIGN KEY (resource_link_pk)
REFERENCES lti_resource_link (resource_link_pk)
ON UPDATE CASCADE;
ALTER TABLE rating
ADD CONSTRAINT rating_item_FK1 FOREIGN KEY (item_pk)
REFERENCES item (item_pk);
In addition, the tables used by the LTI class library are also used.
When using a MySQL or SQLite database the required database tables are created automatically when calling the Manage tool consumers page (provided the database user has the CREATE privilege).
The following database configuration settings may be specified in the config.php file (use the config-dist.php file as a template):
-
DB_NAME
- a PDO connection string such as '''mysql:dbname=MyDb;host=localhost''' or '''sqlite:php-rating.sqlitedb''' -
DB_USERNAME
- the database username with SELECT, INSERT, UPDATE and DELETE privileges for the database tables used by the application -
DB_PASSWORD
- the password for the database user -
DB_TABLENAME_PREFIX
- an optional prefix to insert before each table name
(The DB_USERNAME and DB_PASSWORD settings should be left empty for an SQLite database connection.)
Version 5 of this application is an update for PHP 8.1 and so now requires the version 5 (or later) of the PHP LTI class library. It also updates the underlying JavaScipt libraries to their latest releases.
Version 4 of this application adds the following configuration settings to add support for LTI 1.3:
-
SIGNATURE_METHOD
- the signature method to use when signing JWTs (this would normally beRS256
which is the standard method prescribed in the LTI specification); the method will be used for all platforms -
KID
- a random string to use as the key ID value when signing JWTs -
PRIVATE_KEY
- the key to use when signing messages and service requests to platforms; this should be in PEM format
Version 4.1 of this application adds the following configuration settings to add support for dynamic registration (see the Usage page for more details):
-
AUTO_ENABLE
- Whentrue
newly registered platforms will be automatically enabled -
ENABLE_FOR_DAYS
- When the auto-enabling option is being used, this option can be used to set the number of days for which the platform will be enabled
The admin directory is used to manage access to the application; on a production server, therefore, steps should be taken to prevent unauthorised access to this directory. For example, on an Apache web server a .htaccess file with an associated user password file could be used.
© 2020 Stephen P Vickers. All Rights Reserved.