filler.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Index of the admin tools
  5. *
  6. * @package chamilo.admin
  7. */
  8. // resetting the course id
  9. $cidReset = true;
  10. // including some necessary chamilo files
  11. require_once __DIR__.'/../inc/global.inc.php';
  12. // setting the section (for the tabs)
  13. $this_section = SECTION_PLATFORM_ADMIN;
  14. // Access restrictions
  15. api_protect_admin_script(true);
  16. $nameTools = get_lang('PlatformAdmin');
  17. // setting breadcrumbs
  18. $interbreadcrumb[] = array('url' => 'index.php', 'name' => $nameTools);
  19. // setting the name of the tool
  20. $nameTools = get_lang('DataFiller');
  21. $output = array();
  22. if (!empty($_GET['fill'])) {
  23. switch ($_GET['fill']) {
  24. case 'users':
  25. require api_get_path(SYS_TEST_PATH).'datafiller/fill_users.php';
  26. $output = fill_users();
  27. break;
  28. case 'courses':
  29. require api_get_path(SYS_TEST_PATH).'datafiller/fill_courses.php';
  30. $output = fill_courses();
  31. break;
  32. default:
  33. break;
  34. }
  35. }
  36. // Displaying the header
  37. Display::display_header($nameTools);
  38. $result = '';
  39. if (count($output) > 0) {
  40. $result = '<div class="filler-report">'."\n";
  41. $result .= '<h3>'.$output[0]['title'].'</h3>'."\n";
  42. $result .= '<table>';
  43. foreach ($output as $line) {
  44. $result .= '<tr>';
  45. $result .= '<td class="filler-report-data-init">'.$line['line-init'].' </td><td class="filler-report-data">'.$line['line-info'].'</td>';
  46. $result .= '</tr>';
  47. }
  48. $result .= '</table>';
  49. $result .= '</div>';
  50. Display::addFlash(Display::return_message($result, 'normal', false));
  51. }
  52. ?>
  53. <div id="datafiller" class="panel panel-default">
  54. <div class="panel-body">
  55. <h4><?php echo Display::return_icon('bug.png', get_lang('DataFiller'), null, ICON_SIZE_MEDIUM).' '.get_lang('DataFiller')?></h4>
  56. <div class="description"><?php echo get_lang('ThisSectionIsOnlyVisibleOnSourceInstalls'); ?></div>
  57. <ul class="fillers">
  58. <li><a href="filler.php?fill=users"><?php echo Display::return_icon('user.png', get_lang('FillUsers'), null, ICON_SIZE_SMALL).' '.get_lang('FillUsers'); ?></a></li>
  59. <li><a href="filler.php?fill=courses"><?php echo Display::return_icon('new-course.png', get_lang('FillCourses'), null, ICON_SIZE_SMALL).' '.get_lang('FillCourses'); ?></a></li>
  60. </ul>
  61. </div>
  62. </div>
  63. <?php
  64. /* FOOTER */
  65. Display::display_footer();