Passed
Push — 1.11.x ( bce6cd...c146d9 )
by Angel Fernando Quiroz
12:25
created

main/admin/filler.php (2 issues)

1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Index of the admin tools.
6
 */
7
8
// resetting the course id
9
$cidReset = true;
10
11
// including some necessary chamilo files
12
require_once __DIR__.'/../inc/global.inc.php';
13
14
// setting the section (for the tabs)
15
$this_section = SECTION_PLATFORM_ADMIN;
16
17
// Access restrictions
18
api_protect_admin_script(true);
19
20
$nameTools = get_lang('PlatformAdmin');
21
22
// setting breadcrumbs
23
$interbreadcrumb[] = ['url' => 'index.php', 'name' => $nameTools];
24
25
// setting the name of the tool
26
$nameTools = get_lang('DataFiller');
27
28
$output = [];
29
if (!empty($_GET['fill'])) {
30
    switch ($_GET['fill']) {
31
        case 'users':
32
            require api_get_path(SYS_TEST_PATH).'datafiller/fill_users.php';
33
            $output = fill_users();
0 ignored issues
show
The function fill_users was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
            $output = /** @scrutinizer ignore-call */ fill_users();
Loading history...
34
            break;
35
        case 'courses':
36
            require api_get_path(SYS_TEST_PATH).'datafiller/fill_courses.php';
37
            $output = fill_courses();
0 ignored issues
show
The function fill_courses was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
            $output = /** @scrutinizer ignore-call */ fill_courses();
Loading history...
38
            break;
39
        default:
40
            break;
41
    }
42
}
43
44
// Displaying the header
45
Display::display_header($nameTools);
46
47
$result = '';
48
if (count($output) > 0) {
49
    $result = '<div class="filler-report">'."\n";
50
    $result .= '<h3>'.$output[0]['title'].'</h3>'."\n";
51
    $result .= '<table>';
52
    foreach ($output as $line) {
53
        $result .= '<tr>';
54
        $result .= '<td class="filler-report-data-init">'.$line['line-init'].' </td>
55
                    <td class="filler-report-data">'.$line['line-info'].'</td>';
56
        $result .= '</tr>';
57
    }
58
    $result .= '</table>';
59
    $result .= '</div>';
60
    echo Display::return_message($result, 'normal', false);
61
}
62
?>
63
<div id="datafiller" class="panel panel-default">
64
    <div class="panel-body">
65
    <h4><?php
66
        echo Display::return_icon('bug.png', get_lang('DataFiller'), null, ICON_SIZE_MEDIUM).' '.get_lang('DataFiller');
67
        ?>
68
    </h4>
69
    <div class="description"><?php echo get_lang('ThisSectionIsOnlyVisibleOnSourceInstalls'); ?></div>
70
    <ul class="fillers">
71
      <li>
72
          <a href="filler.php?fill=users">
73
            <?php
74
            echo Display::return_icon('user.png', get_lang('FillUsers'), null, ICON_SIZE_SMALL).
75
                ' '.get_lang('FillUsers');
76
            ?>
77
          </a></li>
78
      <li>
79
          <a href="filler.php?fill=courses">
80
          <?php
81
          echo Display::return_icon('new-course.png', get_lang('FillCourses'), null, ICON_SIZE_SMALL).
82
              ' '.get_lang('FillCourses');
83
            ?>
84
        </a>
85
      </li>
86
    </ul>
87
    </div>
88
</div>
89
<?php
90
/* FOOTER */
91
Display::display_footer();
92