diff --git a/internal/classes/obo/perms/RoleManager.class.php b/internal/classes/obo/perms/RoleManager.class.php index e3f8f4ad4..e54409902 100644 --- a/internal/classes/obo/perms/RoleManager.class.php +++ b/internal/classes/obo/perms/RoleManager.class.php @@ -427,6 +427,15 @@ public function isSuperUser() return $_SESSION['isSuperUser']; } + public function isStatsUser() + { + if(!isset($_SESSION['isStatsUser'])) + { + $_SESSION['isStatsUser'] = $this->doesUserHaveRole(array(\obo\perms\Role::SUPER_STATS, \obo\perms\Role::SUPER_USER)); + } + return $_SESSION['isStatsUser']; + } + public function isSuperStats() { if(!isset($_SESSION['isSuperStats'])) diff --git a/internal/config/cfgLocal.docker.php b/internal/config/cfgLocal.docker.php index f22ccd99c..601966d7a 100644 --- a/internal/config/cfgLocal.docker.php +++ b/internal/config/cfgLocal.docker.php @@ -7,7 +7,7 @@ class AppCfg extends AppCfgDefault // --- DIRECTORYS & PATHS --- const DIR_BASE = '/var/www/html/'; // Define Base Directory [ full path EX: /www/obobjobo/ ] - const URL_WEB = 'https://127.0.0.1:8080/'; // Define the web directory for the base of GS [root inclusive at starting slash: http://obojobo.com/] + const URL_WEB = 'http://127.0.0.1/'; // Define the web directory for the base of GS [root inclusive at starting slash: http://obojobo.com/] // --- Main App DB Connection --- const DB_HOST = 'mysql'; diff --git a/stats-login.php b/stats-login.php new file mode 100644 index 000000000..cb3e6de28 --- /dev/null +++ b/stats-login.php @@ -0,0 +1,14 @@ +getSessionValid()) +{ + header("Location: /stats-login.php"); + exit; +} + +// Check that user has capability +$roleMan = \obo\perms\RoleManager::getInstance(); +if( ! $roleMan->isStatsUser()) +{ + header('HTTP/1.0 404 Not Found'); + exit; +} + +$API = \obo\API::getInstance(); +$gateway = \AppCfg::URL_WEB . \AppCfg::JSON_GATEWAY; + + +// default file locations +$cdn_scripts = [ + 'jquery' => 'https://unpkg.com/jquery@1.12.4/dist/jquery.min.js', + 'datepicker.min.js' => '/wp/wp-includes/js/jquery/ui/datepicker.min.js', + 'jquery.tablesorter.min.js' => '/assets/js/jquery.tablesorter.min.js', + 'jquery.tablesorter.pager.js' => '/assets/js/jquery.tablesorter.pager.js', +]; + +$cdn_scripts_production = [ + 'jquery' => 'https://unpkg.com/jquery@1.12.4/dist/jquery.min.js', + 'datepicker.min.js' => '/wp/wp-includes/js/jquery/ui/datepicker.min.js', + 'jquery.tablesorter.min.js' => '/assets/js/jquery.tablesorter.min.js', + 'jquery.tablesorter.pager.js' => '/assets/js/jquery.tablesorter.pager.js', +]; + +$css = [ + 'fonts' => 'https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i,900,900i|Roboto+Mono:400,400i,700,700i|Noto+Serif:400,400i,700,700i', + 'repository.css' => '/assets/dist/repository.css', + 'jquery-ui-1.8.17.custom.css' => '/wp/wp-content/plugins/obo-stats/css/jquery-ui-1.8.17.custom.css', + 'style.css' => '/assets/images/tablesorter/style.css' +]; + +$js = []; + +// load manifest generated by webpack, override defaults +$manifest_path = __DIR__.'/assets/dist/manifest.json'; +if(file_exists($manifest_path)){ + + // assume we're no longer in dev, use production cdn scripts + $cdn_scripts = $cdn_scripts_production; + + $manifest_contents = file_get_contents(__DIR__.'/assets/dist/manifest.json'); + $manifest = json_decode($manifest_contents, true); + + // move css files over to $css key + foreach($manifest as $key => $value) + { + $endswith = substr($key, -3); + + switch($endswith){ + case 'css': + if(!empty($css[$key])) + { + $css[$key] = $value; + } + break; + case '.js': + if(!empty($js[$key])) + { + $js[$key] = $value; + } + break; + } + } +} + + + + +?> + + + + + Stats | Obojobo™ + "; + } + foreach($js as $file){ + echo ""; + } + + foreach($css as $file){ + echo ""; + } + ?> + + + + + +

Choose Learning Object(s)

+
+ + +
+

Choose Stat

+
+
+
+
+
+
+
+
+
+
+ + + + +

Choose Timeframe

+
+
+ + + + + + + +

Choose Time Resolution

+
+
+
+
+
+
+ +
+
Preview 10 Rows
+
Download CSV
+
+
+ +