Exemplo n.º 1
0
if (empty($schoollist_string)) {
    echo get_string('no_records', 'local_request');

    echo $OUTPUT->footer();
    die;
}
$tools = $DB->get_records_sql('select * from {local_module} where schoolid in (' . $schoollist_string . ')');
$data = array();
$capabilities_array = array('local/modules:manage', 'local/modules:delete', 'local/modules:update', 'local/modules:visible');
$assigncourse_cap = array('local/modules:manage', 'local/modules:assigncourse');
foreach ($tools as $tool) {
    $line = array();
    $linkcss = $tool->visible ? ' ' : 'class="dimmed" ';
    $line[] = '<a ' . $linkcss . ' href="' . $CFG->wwwroot . '/local/modules/view.php?id=' . $tool->id . '">' . format_string($tool->fullname) . '</a>';
    $school_name = $DB->get_record('local_school', array('id' => $tool->schoolid));
    $programname = $instance->get_programname($tool->programid);
    $line[] = $DB->get_field('local_program', 'fullname', array('id' => $tool->programid));
    if (count($schools) > 1) {
        $line[] = $school_name->fullname;
    }

    if (has_any_capability($assigncourse_cap, $systemcontext)) {
        $line[] = '<a ' . $linkcss . ' title="Assign Course" href="' . $CFG->wwwroot . '/local/modules/assigncourse.php?moduleid=' . $tool->id . '&sesskey=' . sesskey() . '">Assign Courses</a>';
    } else
        $line[] = '<a ' . $linkcss . ' title="Permission denied" >Assign Courses</a>';

    // ------------------- Edited by hema------------------------------

    if (has_any_capability($capabilities_array, $systemcontext)) {
        $pluginname = 'modules';
        $plugin = 'module';