@@ -7,34 +7,34 @@ |
||
7 | 7 | use Battis\BootstrapSmarty\NotificationMessage; |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['hack'])) { |
10 | - while (list($id, $setting) = each($_REQUEST['hack'])) { |
|
11 | - try { |
|
12 | - $hack = CanvasHack::getCanvasHackById($sql, $id); |
|
13 | - if ($setting === 'enable') { |
|
14 | - $hack->enable(); |
|
15 | - } else { |
|
16 | - $hack->disable(); |
|
17 | - } |
|
18 | - } catch (CanvasHack_Exception $e) { |
|
19 | - $smarty->addMessage('Exception ' . $e->getCode(), $e->getMessage(), NotificationMessage::ERROR); |
|
20 | - } |
|
21 | - } |
|
10 | + while (list($id, $setting) = each($_REQUEST['hack'])) { |
|
11 | + try { |
|
12 | + $hack = CanvasHack::getCanvasHackById($sql, $id); |
|
13 | + if ($setting === 'enable') { |
|
14 | + $hack->enable(); |
|
15 | + } else { |
|
16 | + $hack->disable(); |
|
17 | + } |
|
18 | + } catch (CanvasHack_Exception $e) { |
|
19 | + $smarty->addMessage('Exception ' . $e->getCode(), $e->getMessage(), NotificationMessage::ERROR); |
|
20 | + } |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $hacksContents = scandir(realpath(__DIR__ . '/hacks'), SCANDIR_SORT_ASCENDING); |
25 | 25 | $hacks = array(); |
26 | 26 | foreach ($hacksContents as $item) { |
27 | - if (is_dir($path = realpath(__DIR__ . "/hacks/$item")) && file_exists($manifest = "$path/manifest.xml")) { |
|
28 | - try { |
|
29 | - $hacks[$item] = new CanvasHack($sql, $path); |
|
30 | - } catch (CanvasHack_Exception $e) { |
|
31 | - $smarty->addMessage( |
|
32 | - 'CanvasHack Manifest Error ['. $e->getCode() . ']', |
|
33 | - $e->getMessage(), |
|
34 | - NotificationMessage::ERROR |
|
35 | - ); |
|
36 | - } |
|
37 | - } |
|
27 | + if (is_dir($path = realpath(__DIR__ . "/hacks/$item")) && file_exists($manifest = "$path/manifest.xml")) { |
|
28 | + try { |
|
29 | + $hacks[$item] = new CanvasHack($sql, $path); |
|
30 | + } catch (CanvasHack_Exception $e) { |
|
31 | + $smarty->addMessage( |
|
32 | + 'CanvasHack Manifest Error ['. $e->getCode() . ']', |
|
33 | + $e->getMessage(), |
|
34 | + NotificationMessage::ERROR |
|
35 | + ); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $smarty->assign('appURL', $metadata['APP_URL']); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $hacks[$item] = new CanvasHack($sql, $path); |
30 | 30 | } catch (CanvasHack_Exception $e) { |
31 | 31 | $smarty->addMessage( |
32 | - 'CanvasHack Manifest Error ['. $e->getCode() . ']', |
|
32 | + 'CanvasHack Manifest Error [' . $e->getCode() . ']', |
|
33 | 33 | $e->getMessage(), |
34 | 34 | NotificationMessage::ERROR |
35 | 35 | ); |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | /* prepare the toolbox */ |
15 | 15 | if (empty($_SESSION[Toolbox::class])) { |
16 | - $_SESSION[Toolbox::class] =& Toolbox::fromConfiguration(CONFIG_FILE); |
|
16 | + $_SESSION[Toolbox::class] = & Toolbox::fromConfiguration(CONFIG_FILE); |
|
17 | 17 | } |
18 | -$toolbox =& $_SESSION[Toolbox::class]; |
|
18 | +$toolbox = & $_SESSION[Toolbox::class]; |
|
19 | 19 | $toolbox->smarty_prependTemplateDir(__DIR__ . '/templates', basename(__DIR__)); |
20 | 20 | $toolbox->smarty_assign([ |
21 | 21 | 'category' => DataUtilities::titleCase(preg_replace('/[\-_]+/', ' ', basename(__DIR__))) |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | /* |
25 | 25 | * FIXME convience variables until plugins are all updated |
26 | 26 | */ |
27 | - $api =& $toolbox->getAPI(); |
|
28 | - $sql =& $toolbox->getMySQL(); |
|
29 | - $smarty =& $toolbox->getSmarty(); |
|
30 | - $customPrefs =& $toolbox->getCustomPrefs(); |
|
27 | + $api = & $toolbox->getAPI(); |
|
28 | + $sql = & $toolbox->getMySQL(); |
|
29 | + $smarty = & $toolbox->getSmarty(); |
|
30 | + $customPrefs = & $toolbox->getCustomPrefs(); |
|
31 | 31 | |
32 | 32 | /* set the Tool Consumer's instance URL, if present */ |
33 | 33 | if (empty($_SESSION[CANVAS_INSTANCE_URL]) && |
@@ -7,79 +7,79 @@ |
||
7 | 7 | |
8 | 8 | class Toolbox extends \smtech\StMarksReflexiveCanvasLTI\Toolbox |
9 | 9 | { |
10 | - /** |
|
11 | - * Custom Preferences database |
|
12 | - * @var mysqli |
|
13 | - */ |
|
14 | - protected $customPrefs; |
|
10 | + /** |
|
11 | + * Custom Preferences database |
|
12 | + * @var mysqli |
|
13 | + */ |
|
14 | + protected $customPrefs; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Configure account navigation placement |
|
18 | - * |
|
19 | - * @return Generator |
|
20 | - */ |
|
21 | - public function getGenerator() |
|
22 | - { |
|
23 | - parent::getGenerator(); |
|
16 | + /** |
|
17 | + * Configure account navigation placement |
|
18 | + * |
|
19 | + * @return Generator |
|
20 | + */ |
|
21 | + public function getGenerator() |
|
22 | + { |
|
23 | + parent::getGenerator(); |
|
24 | 24 | |
25 | - $this->generator->setOptionProperty( |
|
26 | - Option::COURSE_NAVIGATION(), |
|
27 | - 'visibility', |
|
28 | - 'admins' |
|
29 | - ); |
|
25 | + $this->generator->setOptionProperty( |
|
26 | + Option::COURSE_NAVIGATION(), |
|
27 | + 'visibility', |
|
28 | + 'admins' |
|
29 | + ); |
|
30 | 30 | |
31 | - return $this->generator; |
|
32 | - } |
|
31 | + return $this->generator; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Update a Toolbox instance from a configuration file |
|
36 | - * |
|
37 | - * @see Toolbox::fromConfiguration() Use `Toolbox::fromConfiguration()` |
|
38 | - * |
|
39 | - * @param string $configFilePath |
|
40 | - * @param boolean $forceRecache |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - protected function loadConfiguration($configFilePath, $forceRecache = false) |
|
44 | - { |
|
45 | - parent::loadConfiguration($configFilePath, $forceRecache); |
|
34 | + /** |
|
35 | + * Update a Toolbox instance from a configuration file |
|
36 | + * |
|
37 | + * @see Toolbox::fromConfiguration() Use `Toolbox::fromConfiguration()` |
|
38 | + * |
|
39 | + * @param string $configFilePath |
|
40 | + * @param boolean $forceRecache |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + protected function loadConfiguration($configFilePath, $forceRecache = false) |
|
44 | + { |
|
45 | + parent::loadConfiguration($configFilePath, $forceRecache); |
|
46 | 46 | |
47 | - $config = new ConfigXML($configFilePath); |
|
47 | + $config = new ConfigXML($configFilePath); |
|
48 | 48 | |
49 | - /* configure database connections */ |
|
50 | - $this->setCustomPrefs($config->newInstanceOf(mysqli::class, '/config/mysql/customprefs')); |
|
51 | - } |
|
49 | + /* configure database connections */ |
|
50 | + $this->setCustomPrefs($config->newInstanceOf(mysqli::class, '/config/mysql/customprefs')); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Set MySQL connection object |
|
55 | - * |
|
56 | - * @param mysqli $mysql |
|
57 | - */ |
|
58 | - public function setCustomPrefs(mysqli $mysql) |
|
59 | - { |
|
60 | - $this->customPrefs = $mysql; |
|
61 | - } |
|
53 | + /** |
|
54 | + * Set MySQL connection object |
|
55 | + * |
|
56 | + * @param mysqli $mysql |
|
57 | + */ |
|
58 | + public function setCustomPrefs(mysqli $mysql) |
|
59 | + { |
|
60 | + $this->customPrefs = $mysql; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Get MySQL connection object |
|
65 | - * |
|
66 | - * @return mysqli |
|
67 | - */ |
|
68 | - public function getCustomPrefs() |
|
69 | - { |
|
70 | - return $this->customPrefs; |
|
71 | - } |
|
63 | + /** |
|
64 | + * Get MySQL connection object |
|
65 | + * |
|
66 | + * @return mysqli |
|
67 | + */ |
|
68 | + public function getCustomPrefs() |
|
69 | + { |
|
70 | + return $this->customPrefs; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Make a MySQL query |
|
75 | - * |
|
76 | - * @link http://php.net/manual/en/mysqli.query.php Pass-through to `mysqli::query()` |
|
77 | - * @param string $query |
|
78 | - * @param int $resultMode (Optional, defaults to `MYSQLI_STORE_RESULT`) |
|
79 | - * @return mixed |
|
80 | - */ |
|
81 | - public function customPrefs_query($query, $resultMode = MYSQLI_STORE_RESULT) |
|
82 | - { |
|
83 | - return $this->getCustomPrefs()->query($query, $resultMode); |
|
84 | - } |
|
73 | + /** |
|
74 | + * Make a MySQL query |
|
75 | + * |
|
76 | + * @link http://php.net/manual/en/mysqli.query.php Pass-through to `mysqli::query()` |
|
77 | + * @param string $query |
|
78 | + * @param int $resultMode (Optional, defaults to `MYSQLI_STORE_RESULT`) |
|
79 | + * @return mixed |
|
80 | + */ |
|
81 | + public function customPrefs_query($query, $resultMode = MYSQLI_STORE_RESULT) |
|
82 | + { |
|
83 | + return $this->getCustomPrefs()->query($query, $resultMode); |
|
84 | + } |
|
85 | 85 | } |