Issues (1798)

public/main/admin/filler.php (2 issues)

Labels
Severity
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Index of the admin tools.
6
 */
7
8
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
9
use Chamilo\CoreBundle\Component\Utils\ObjectIcon;
10
11
// resetting the course id
12
$cidReset = true;
13
14
// including some necessary chamilo files
15
require_once __DIR__.'/../inc/global.inc.php';
16
17
// setting the section (for the tabs)
18
$this_section = SECTION_PLATFORM_ADMIN;
19
20
// Access restrictions
21
api_protect_admin_script(true);
22
23
$nameTools = get_lang('Administration');
24
25
// setting breadcrumbs
26
$interbreadcrumb[] = ['url' => 'index.php', 'name' => $nameTools];
27
28
// setting the name of the tool
29
$nameTools = get_lang('Data filler');
30
31
$output = [];
32
if (!empty($_GET['fill'])) {
33
    switch ($_GET['fill']) {
34
        case 'users':
35
            require __DIR__.'/../../../tests/datafiller/fill_users.php';
36
            $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

36
            $output = /** @scrutinizer ignore-call */ fill_users();
Loading history...
37
            break;
38
        case 'courses':
39
            require __DIR__.'/../../../tests/datafiller/fill_courses.php';
40
            $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

40
            $output = /** @scrutinizer ignore-call */ fill_courses();
Loading history...
41
            break;
42
        default:
43
            break;
44
    }
45
}
46
47
// Displaying the header
48
Display::display_header($nameTools);
49
50
$result = '';
51
if (count($output) > 0) {
52
    $result = '<div class="filler-report">'."\n";
53
    $result .= '<table>';
54
    foreach ($output as $line) {
55
        $result .= '<tr>';
56
        $result .= '<td class="filler-report-data-init">'.$line['line-init'].' </td>
57
                    <td class="filler-report-data">'.$line['line-info'].'</td>';
58
        $result .= '</tr>';
59
    }
60
    $result .= '</table>';
61
    $result .= '</div>';
62
    echo Display::return_message($output[0]['title'], 'normal', false);
63
    echo $result;
64
}
65
?>
66
<div id="datafiller" class="card">
67
    <div class="card-body">
68
    <h4><?php
69
        echo Display::getMdiIcon(ActionIcon::FILL, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Data filler')).' '.get_lang('Data filler');
70
        ?>
71
    </h4>
72
    <div class="description"><?php echo get_lang('This section is only visible on installations from source code, not in packaged versions of the platform. It will allow you to quickly populate your platform with test data. Use with care (data is really inserted) and only on development or testing installations.'); ?></div>
73
    <ul class="fillers">
74
      <li>
75
          <a href="filler.php?fill=users">
76
            <?php
77
            echo Display::getMdiIcon(ObjectIcon::USER, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Fill users')).
78
                ' '.get_lang('Fill users');
79
            ?>
80
          </a></li>
81
      <li>
82
          <a href="filler.php?fill=courses">
83
          <?php
84
          echo Display::getMdiIcon(ObjectIcon::COURSE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Fill courses')).
85
              ' '.get_lang('Fill courses');
86
            ?>
87
        </a>
88
      </li>
89
    </ul>
90
    </div>
91
</div>
92
<?php
93
/* FOOTER */
94
Display::display_footer();
95