configuration.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script displays setting api key user.
  5. */
  6. use \ChamiloSession as Session;
  7. require_once '../config.php';
  8. $course_plugin = 'sepe';
  9. $plugin = SepePlugin::create();
  10. $_cid = 0;
  11. if (api_is_platform_admin()) {
  12. $tUser = Database::get_main_table(TABLE_MAIN_USER);
  13. $tApi = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
  14. $login = 'SEPE';
  15. $sql = "SELECT a.api_key AS api FROM $tUser u, $tApi a WHERE u.username='".$login."' and u.user_id = a.user_id AND a.api_service = 'dokeos';";
  16. $result = Database::query($sql);
  17. if (Database::num_rows($result) > 0) {
  18. $tmp = Database::fetch_assoc($result);
  19. $info = $tmp['api'];
  20. } else {
  21. $info = '';
  22. }
  23. $templateName = $plugin->get_lang('Setting');
  24. $interbreadcrumb[] = array("url" => "/plugin/sepe/src/sepe-administration-menu.php", "name" => $plugin->get_lang('MenuSepe'));
  25. $tpl = new Template($templateName);
  26. $tpl->assign('info', $info);
  27. $listing_tpl = 'sepe/view/configuration.tpl';
  28. $content = $tpl->fetch($listing_tpl);
  29. $tpl->assign('content', $content);
  30. $tpl->display_one_col_template();
  31. } else {
  32. header('Location:'.api_get_path(WEB_PATH));
  33. }