filler.php 2.3 KB

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