function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible chatrooms on the course
    // Get the ID of the chat type
    $rec = get_record('modules', 'name', 'chat');
    if (!$rec) {
        sloodle_debug("Failed to get chatroom module type.");
        exit;
    }
    $chatmoduleid = $rec->id;
    // Get all visible chatrooms in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$chatmoduleid} AND visible = 1");
    if (!$recs) {
        error(get_string('nochatrooms', 'sloodle'));
        exit;
    }
    $chatrooms = array();
    foreach ($recs as $cm) {
        // Fetch the chatroom instance
        $inst = get_record('chat', 'id', $cm->instance);
        if (!$inst) {
            continue;
        }
        // Store the chatroom details
        $chatrooms[$cm->id] = $inst->name;
    }
    // Sort the list by name
    natcasesort($chatrooms);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    $sloodlelistentoobjects = (int) sloodle_get_value($settings, 'sloodlelistentoobjects', 0);
    $sloodleautodeactivate = (int) sloodle_get_value($settings, 'sloodleautodeactivate', 1);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select a chatroom
    echo get_string('selectchatroom', 'sloodle') . ': ';
    choose_from_menu($chatrooms, 'sloodlemoduleid', $sloodlemoduleid, '');
    echo "<br><br>\n";
    // Listening to object chat
    echo get_string('listentoobjects', 'sloodle') . ': ';
    choose_from_menu_yesno('sloodlelistentoobjects', $sloodlelistentoobjects);
    echo "<br><br>\n";
    // Allowing auto-deactivation
    echo get_string('allowautodeactivation', 'sloodle') . ': ';
    choose_from_menu_yesno('sloodleautodeactivate', $sloodleautodeactivate);
    echo "<br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    sloodle_print_access_level_options($settings);
}
function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible choices on the course
    // Get the ID of the choice type
    $rec = get_record('modules', 'name', 'choice');
    if (!$rec) {
        sloodle_debug("Failed to get choice module type.");
        exit;
    }
    $choicemoduleid = $rec->id;
    // Get all visible choices in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$choicemoduleid} AND visible = 1");
    if (!$recs) {
        error(get_string('nochoices', 'sloodle'));
        exit;
    }
    $choices = array();
    foreach ($recs as $cm) {
        // Fetch the choice instance
        $inst = get_record('choice', 'id', $cm->instance);
        if (!$inst) {
            continue;
        }
        // Store the choice details
        $choices[$cm->id] = $inst->name;
    }
    // Sort the list by name
    natcasesort($choices);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    $sloodlerefreshtime = (int) sloodle_get_value($settings, 'sloodlerefreshtime', 600);
    $sloodlerelative = (int) sloodle_get_value($settings, 'sloodlerelative', 0);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select a choice
    echo get_string('selectchoice', 'sloodle') . ': ';
    choose_from_menu($choices, 'sloodlemoduleid', $sloodlemoduleid, '');
    echo "<br><br>\n";
    // Ask the user for a refresh period (# seconds between automatic updates)
    echo get_string('refreshtimeseconds', 'sloodle') . ': ';
    echo '<input type="text" name="sloodlerefreshtime" value="' . $sloodlerefreshtime . '" size="8" maxlength="8" />';
    echo "<br><br>\n";
    // Show relative results
    echo get_string('relativeresults', 'sloodle') . ': ';
    choose_from_menu_yesno('sloodlerelative', $sloodlerelative);
    echo "<br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    sloodle_print_access_level_options($settings, true, false, true);
}
function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible Sloodle Object assignments on the course
    // Get the ID of the assignment type
    $rec = get_record('modules', 'name', 'assignment');
    if (!$rec) {
        sloodle_debug("Failed to get assignment module type.");
        exit;
    }
    $assignmentmoduleid = $rec->id;
    // Get all visible assignments in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$assignmentmoduleid} AND visible = 1");
    if (!$recs) {
        error(get_string('noassignments', 'sloodle'));
        exit;
    }
    $assignments = array();
    foreach ($recs as $cm) {
        // Fetch the assignment instance
        $inst = get_record('assignment', 'id', $cm->instance);
        if (!$inst) {
            continue;
        }
        // Ignore anything except Sloodle Object assignments
        if ($inst->assignmenttype != 'sloodleobject') {
            continue;
        }
        // Store the assignment details
        $assignments[$cm->id] = $inst->name;
    }
    // Make sure that we got some Sloodle Object assignments
    if (count($assignments) == 0) {
        error(get_string('nosloodleassignments', 'sloodle'));
        exit;
    }
    // Sort the list by name
    natcasesort($assignments);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select an assignment
    echo get_string('selectassignment', 'sloodle') . ': ';
    choose_from_menu($assignments, 'sloodlemoduleid', $sloodlemoduleid, '');
    echo "<br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    sloodle_print_access_level_options($settings);
}
Esempio n. 4
0
function memorization_print_new_verse_box()
{
    global $CFG, $USER;
    print_box_start('add-verse-box generalbox box');
    print_heading(get_string('newverse', 'memorization'));
    $biblebooks = biblebooks_array();
    // create the book selector
    $biblebookoptions = '';
    foreach ($biblebooks as $booknumber => $bookofbible) {
        if ($booknumber == 0) {
            continue;
        }
        $biblebookoptions .= '<option value="' . $booknumber . '">' . $bookofbible . '</option>';
    }
    $startbookid = '<select name="startbookid">' . $biblebookoptions . '</select>';
    $endbookid = '<select name="endbookid">' . $biblebookoptions . '</select>';
    // create the chapter inputs
    $startchapter = '<input type="text" name="startchapter" size="5" />';
    $endchapter = '<input type="text" name="endchapter" size="5"/>';
    // create the verse inputs
    $startverse = '<input type="text" name="startverse" size="5"/>';
    $endverse = '<input type="text" name="endverse" size="5"/>';
    // create the version chooser
    $versions = get_records('memorization_version');
    if (!empty($versions)) {
        $versionselect = '<select name="versionid">';
        $lastversionid = get_field_sql("SELECT versionid FROM {$CFG->prefix}memorization_verse WHERE userid={$USER->id} ORDER BY id DESC");
        foreach ($versions as $versionid => $version) {
            $selected = $versionid == $lastversionid ? ' SELECTED="selected" ' : '';
            $versionselect .= '<option ' . $selected . ' value="' . $versionid . '">' . $version->value . '</option>';
        }
        $versionselect .= '</select>';
    }
    $currenturl = new moodle_url(qualified_me());
    echo '<form method="POST" action="addverse.php?' . $currenturl->get_query_string() . '">
          <input type="hidden" name="sesskey" value="' . sesskey() . '">
          <table>
            <tr>
              <td>' . get_string('fromverse', 'memorization') . '</td>
              <td>' . $startbookid . ' ' . $startchapter . ':' . $startverse . '</td>
            </tr>

            <tr>
              <td>' . get_string('toverse', 'memorization') . '</td>
              <td>' . $endbookid . ' ' . $endchapter . ':' . $endverse . '</td>
            </tr>

            <tr>
              <td>' . get_string('version', 'memorization') . '</td>
              <td>' . $versionselect . '</td>
            </tr>
          </table>
          <input type="submit">
          </form>';
    print_box_end();
}
function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible distributors on the course
    // Get the ID of the Sloodle type
    $rec = get_record('modules', 'name', 'sloodle');
    if (!$rec) {
        sloodle_debug("Failed to get Sloodle module type.");
        exit;
    }
    // Get all visible Sloodle modules in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$rec->id} AND visible = 1");
    if (!is_array($recs)) {
        $recs = array();
    }
    $distributors = array();
    foreach ($recs as $cm) {
        // Fetch the distributor instance
        $inst = get_record('sloodle', 'id', $cm->instance, 'type', SLOODLE_TYPE_DISTRIB);
        if (!$inst) {
            continue;
        }
        // Store the distributor details
        $distributors[$cm->id] = $inst->name;
    }
    // Sort the list by name
    natcasesort($distributors);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    $sloodlerefreshtime = (int) sloodle_get_value($settings, 'sloodlerefreshtime', 3600);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select a distributor
    echo get_string('selectdistributor', 'sloodle') . ': ';
    choose_from_menu($distributors, 'sloodlemoduleid', $sloodlemoduleid, '<i>(' . get_string('nodistributorinterface', 'sloodle') . ')</i>', '', 0);
    echo "<br><br>\n";
    // Ask the user for a refresh period (# seconds between automatic updates)
    echo get_string('refreshtimeseconds', 'sloodle') . ': ';
    echo '<input type="text" name="sloodlerefreshtime" value="' . $sloodlerefreshtime . '" size="8" maxlength="8" />';
    echo "<br><br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    // There is no need for server access controls, as users cannot access the server through the object
    // (server access is entirely done through Moodle for this one)
    sloodle_print_access_level_options($settings, true, true, false);
}
function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // Determine which course is being accessed
    $courseid = $auth_obj->course->get_course_id();
    // We need to fetch a list of visible presenters on the course
    // Get the ID of the chat type
    $rec = get_record('modules', 'name', 'sloodle');
    if (!$rec) {
        sloodle_debug("Failed to get Sloodle module type.");
        exit;
    }
    $sloodlemoduleid = $rec->id;
    // Get all visible presenters in the current course
    $recs = get_records_select('course_modules', "course = {$courseid} AND module = {$sloodlemoduleid} AND visible = 1");
    $presenters = array();
    foreach ($recs as $cm) {
        // Fetch the Sloodle instance
        $inst = get_record('sloodle', 'id', $cm->instance, 'type', SLOODLE_TYPE_PRESENTER);
        if (!$inst) {
            continue;
        }
        // Store the Sloodle details
        $presenters[$cm->id] = $inst->name;
    }
    // Make sure there are some presenters to be had
    if (count($presenters) < 1) {
        error(get_string('nopresenters', 'sloodle'));
        exit;
    }
    // Sort the list by name
    natcasesort($presenters);
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlemoduleid = (int) sloodle_get_value($settings, 'sloodlemoduleid', 0);
    $sloodlelistentoobjects = (int) sloodle_get_value($settings, 'sloodlelistentoobjects', 0);
    $sloodleautodeactivate = (int) sloodle_get_value($settings, 'sloodleautodeactivate', 1);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user to select a Slideshow
    echo get_string('selectpresenter', 'sloodle') . ': ';
    choose_from_menu($presenters, 'sloodlemoduleid', $sloodlemoduleid, '');
    echo "<br><br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    sloodle_print_access_level_options($settings, false, true, false);
}
Esempio n. 7
0
/**
 * Print a message along with "Ok" link for the user to continue and "Cancel" link to close window.
 *
 * @param string $message The text to display
 * @param string $linkok The link to take the user to if they choose "Ok"
 * TODO Document remaining arguments
 */
function notice_okcancel($message, $linkok, $optionsok = NULL, $methodok = 'post')
{
    global $CFG;
    $message = clean_text($message);
    $linkok = clean_text($linkok);
    print_box_start('generalbox', 'notice');
    echo '<p>' . $message . '</p>';
    echo '<div class="buttons">';
    print_single_button($linkok, $optionsok, get_string('ok'), $methodok, $CFG->framename);
    close_window_button('cancel');
    echo '</div>';
    print_box_end();
}
Esempio n. 8
0
 function print_form()
 {
     if ($this->path == 'all') {
         $sports = $this->sql_sports;
     } else {
         $sports = array($this->sql_sports[$this->path]);
     }
     print_box_start();
     echo '<form method="POST">
             ' . array_reduce($sports, array($this, 'reduce_sport'), '') . '
             <input type="hidden" name="type" value="' . $this->type . '">
             <input type="hidden" name="path" value="' . $this->path . '">
             <input type="hidden" name="userid" value="' . $this->userid . '">
             <input type="submit" value="' . get_string('submit') . '">
           </form>';
     print_box_end();
 }
function sloodle_display_config_form($sloodleauthid, $auth_obj)
{
    //--------------------------------------------------------
    // SETUP
    // No setup to do
    //--------------------------------------------------------
    // FORM
    // Get the current object configuration
    $settings = SloodleController::get_object_configuration($sloodleauthid);
    // Setup our default values
    $sloodlerefreshtime = (int) sloodle_get_value($settings, 'sloodlerefreshtime', 600);
    ///// GENERAL CONFIGURATION /////
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('generalconfiguration', 'sloodle') . '</h3>';
    // Ask the user for a refresh period (# seconds between automatic updates)
    echo get_string('refreshtimeseconds', 'sloodle') . ': ';
    echo '<input type="text" name="sloodlerefreshtime" value="' . $sloodlerefreshtime . '" size="8" maxlength="8" />';
    echo "<br><br>\n";
    print_box_end();
    ///// ACCESS LEVELS /////
    // No access levels needed
}
Esempio n. 10
0
}
print_header(get_string("summaryof", "", $course->fullname));
print_heading(format_string($course->fullname) . '<br />(' . format_string($course->shortname) . ')');
if ($course->guest || $course->password) {
    print_box_start('generalbox icons');
    if ($course->guest) {
        $strallowguests = get_string('allowguests');
        echo "<div><img alt=\"\" class=\"icon guest\" src=\"{$CFG->pixpath}/i/guest.gif\" />&nbsp;{$strallowguests}</div>";
    }
    if ($course->password) {
        $strrequireskey = get_string('requireskey');
        echo "<div><img alt=\"\" class=\"icon key\" src=\"{$CFG->pixpath}/i/key.gif\" />&nbsp;{$strrequireskey}</div>";
    }
    print_box_end();
}
print_box_start('generalbox info');
echo filter_text(text_to_html($course->summary), $course->id);
if ($managerroles = get_config('', 'coursemanager')) {
    $coursemanagerroles = split(',', $managerroles);
    foreach ($coursemanagerroles as $roleid) {
        $role = get_record('role', 'id', $roleid);
        $canseehidden = has_capability('moodle/role:viewhiddenassigns', $context);
        $roleid = (int) $roleid;
        if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', $canseehidden)) {
            foreach ($users as $teacher) {
                $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
                $namesarray[] = format_string($role->name) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $teacher->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>';
            }
        }
    }
    if (!empty($namesarray)) {
Esempio n. 11
0
    function print_item($item, $value = false, $readonly = false, $edit = false, $highlightrequire = false)
    {
        $info = $this->get_info($item);
        $align = get_string('thisdirection') == 'ltr' ? 'left' : 'right';
        $presentation = explode(FEEDBACK_MULTICHOICE_LINE_SEP, stripslashes_safe($info->presentation));
        //test if required and no value is set so we have to mark this item
        //we have to differ check and the other subtypes
        if ($info->subtype == 'c') {
            if (is_array($value)) {
                $values = $value;
            } else {
                $values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
            }
            if ($highlightrequire and $item->required and $values[0] == '') {
                $highlight = 'bgcolor="#FFAAAA" class="missingrequire"';
            } else {
                $highlight = '';
            }
            $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
            echo '<td ' . $highlight . ' valign="top" align="' . $align . '">' . format_text(stripslashes_safe($item->name) . $requiredmark, true, false, false) . '</td>';
            echo '<td valign="top" align="' . $align . '">';
        } else {
            if ($highlightrequire and $item->required and intval($value) <= 0) {
                $highlight = 'bgcolor="#FFAAAA" class="missingrequire"';
            } else {
                $highlight = '';
            }
            $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
            ?>
                <td <?php 
            echo $highlight;
            ?>
 valign="top" align="<?php 
            echo $align;
            ?>
"><?php 
            echo format_text(stripslashes_safe($item->name) . $requiredmark, true, false, false);
            ?>
</td>
                <td valign="top" align="<?php 
            echo $align;
            ?>
">
            <?php 
        }
        $index = 1;
        $checked = '';
        if ($readonly) {
            if ($info->subtype == 'c') {
                print_box_start('generalbox boxalign' . $align);
                foreach ($presentation as $pres) {
                    foreach ($values as $val) {
                        if ($val == $index) {
                            echo text_to_html($pres . '<br />', true, false, false);
                            break;
                        }
                    }
                    $index++;
                }
                // print_simple_box_end();
                print_box_end();
            } else {
                foreach ($presentation as $pres) {
                    if ($value == $index) {
                        // print_simple_box_start($align);
                        print_box_start('generalbox boxalign' . $align);
                        echo text_to_html($pres, true, false, false);
                        // print_simple_box_end();
                        print_box_end();
                        break;
                    }
                    $index++;
                }
            }
        } else {
            //print the "not_selected" item on radiobuttons
            if ($info->subtype == 'r') {
                ?>
                <table><tr>
                <td valign="top" align="<?php 
                echo $align;
                ?>
"><input type="radio"
                        name="<?php 
                echo $item->typ . '_' . $item->id;
                ?>
"
                        id="<?php 
                echo $item->typ . '_' . $item->id . '_xxx';
                ?>
"
                        value="" <?php 
                echo $value ? '' : 'checked="checked"';
                ?>
 />
                </td>
                <td align="<?php 
                echo $align;
                ?>
">
                    <label for="<?php 
                echo $item->typ . '_' . $item->id . '_xxx';
                ?>
"><?php 
                print_string('not_selected', 'feedback');
                ?>
&nbsp;</label>
                </td>
                </tr></table>
    <?php 
            }
            if ($info->subtype != 'd') {
                if ($info->horizontal) {
                    echo '<table><tr>';
                }
            }
            switch ($info->subtype) {
                case 'r':
                    $this->print_item_radio($presentation, $item, $value, $info, $align);
                    break;
                case 'c':
                    $this->print_item_check($presentation, $item, $value, $info, $align);
                    break;
                case 'd':
                    $this->print_item_dropdown($presentation, $item, $value, $info, $align);
                    break;
            }
            if ($info->subtype != 'd') {
                if ($info->horizontal) {
                    echo '</tr></table>';
                }
            }
            /*
            if($item->required == 1) {
                echo '<input type="hidden" name="'.$item->typ . '_' . $item->id.'" value="1" />';
            }
            */
        }
        ?>
        </td>
    <?php 
    }
Esempio n. 12
0
    function print_item($item, $value = false, $readonly = false, $edit = false, $highlightrequire = false)
    {
        global $USER, $DB;
        $align = get_string('thisdirection') == 'ltr' ? 'left' : 'right';
        $presentation = $item->presentation;
        if ($highlightrequire and $item->required and strval($value) == '') {
            $highlight = 'bgcolor="#FFAAAA" class="missingrequire"';
        } else {
            $highlight = '';
        }
        $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
        ?>
        <td <?php 
        echo $highlight;
        ?>
 valign="top" align="<?php 
        echo $align;
        ?>
">
        <?php 
        if ($edit or $readonly) {
            echo '(' . $item->label . ') ';
        }
        echo format_text($item->name . $requiredmark, true, false, false);
        ?>
        </td>
        <td valign="top" align="<?php 
        echo $align;
        ?>
">
    <?php 
        if ($readonly) {
            // print_simple_box_start($align);
            print_box_start('generalbox boxalign' . $align);
            echo $value ? UserDate($value) : '&nbsp;';
            // print_simple_box_end();
            print_box_end();
        } else {
            $feedback = $DB->get_record('feedback', array('id' => $item->feedback));
            $course = $DB->get_record('course', array('id' => $feedback->course));
            $coursecategory = $DB->get_record('course_categories', array('id' => $course->category));
            switch ($presentation) {
                case 1:
                    $itemvalue = time();
                    $itemshowvalue = UserDate($itemvalue);
                    break;
                case 2:
                    $itemvalue = $course->shortname;
                    $itemshowvalue = $itemvalue;
                    break;
                case 3:
                    $itemvalue = $coursecategory->name;
                    $itemshowvalue = $itemvalue;
                    break;
            }
            ?>
            <input type="hidden" name="<?php 
            echo $item->typ . '_' . $item->id;
            ?>
"
                                    value="<?php 
            echo $itemvalue;
            ?>
" />
            <span><?php 
            echo $itemshowvalue;
            ?>
</span>
    <?php 
        }
        ?>
        </td>
    <?php 
    }
if ($mform->is_cancelled()) {
    redirect('show_entries.php?id=' . $id . '&do_show=showentries');
}
if (isset($formdata->confirmdelete) and $formdata->confirmdelete == 1) {
    if ($completed = $DB->get_record('feedback_completed', array('id' => $completedid))) {
        feedback_delete_completed($completedid);
        add_to_log($course->id, 'feedback', 'delete', 'view.php?id=' . $cm->id, $feedback->id, $cm->id);
        redirect('show_entries.php?id=' . $id . '&do_show=showentries');
    }
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
$navlinks = array();
$navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($feedback->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm));
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
print_heading(format_text($feedback->name));
// print_simple_box_start("center", "60%", "#FFAAAA", 20, "noticebox");
print_box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal');
print_heading(get_string('confirmdeleteentry', 'feedback'));
$mform->display();
// print_simple_box_end();
print_box_end();
print_footer($course);
Esempio n. 14
0
    print_box_end();
}
///////////////////////////////////////////////////////////////////////////
///print the Item-Edit-section
///////////////////////////////////////////////////////////////////////////
if ($do_show == 'edit') {
    $add_item_form->display();
    if (is_array($feedbackitems)) {
        $itemnr = 0;
        $helpbutton = helpbutton('preview', get_string('preview', 'feedback'), 'feedback', true, false, '', true);
        print_heading($helpbutton . get_string('preview', 'feedback'));
        if (isset($SESSION->feedback->moving) and $SESSION->feedback->moving->shouldmoving == 1) {
            print_heading('<a href="' . htmlspecialchars($ME . '?id=' . $id) . '">' . get_string('cancel_moving', 'feedback') . '</a>');
        }
        // print_simple_box_start('center', '80%');
        print_box_start('generalbox boxaligncenter boxwidthwide');
        //check, if there exists required-elements
        $countreq = $DB->count_records('feedback_item', array('feedback' => $feedback->id, 'required' => 1));
        if ($countreq > 0) {
            // echo '<font color="red">(*)' . get_string('items_are_required', 'feedback') . '</font>';
            echo '<span class="feedback_required_mark">(*)' . get_string('items_are_required', 'feedback') . '</span>';
        }
        echo '<table>';
        if (isset($SESSION->feedback->moving) and $SESSION->feedback->moving->shouldmoving == 1) {
            $moveposition = 1;
            echo '<tr>';
            //only shown if shouldmoving = 1
            echo '<td>';
            $buttonlink = $ME . '?' . htmlspecialchars(feedback_edit_get_default_query($id, $do_show) . '&movehere=' . $moveposition);
            echo '<a title="' . get_string('move_here', 'feedback') . '" href="' . $buttonlink . '">
                            <img class="movetarget" alt="' . get_string('move_here', 'feedback') . '" src="' . $CFG->pixpath . '/movehere.gif" />
Esempio n. 15
0
/**
 * Abstracted version of box_start() / print_box_start() to work with Moodle 1.8 through 2.0
 *
 * @param string $classes The CSS class for the box HTML element
 * @param string $ids An optional ID
 * @param boolean Return the output or print it to screen directly
 * @return string the HTML to output.
 */
function turnitintool_box_start($classes = 'generalbox', $ids = '', $return = false)
{
    global $OUTPUT;
    if (is_callable(array($OUTPUT, 'box_start')) and !$return) {
        echo $OUTPUT->box_start($classes, $ids);
    } else {
        if (is_callable(array($OUTPUT, 'box_start'))) {
            return $OUTPUT->box_start($classes, $ids);
        } else {
            return print_box_start($classes, $ids, $return);
        }
    }
}
Esempio n. 16
0
/**
 * Outputs the standard form elements for access levels in object configuration.
 * Each part can be optionally hidden, and default values can be provided.
 * (Note: the server access level must be communicated from the object back to Moodle... rubbish implementation, but it works!)
 * @param array $current_config An associative array of setting names to values, containing defaults. (Ignored if null).
 * @param bool $show_use_object Determines whether or not the "Use Object" setting is shown
 * @param bool $show_control_object Determines whether or not the "Control Object" setting is shown
 * @param bool $show_server Determines whether or not the server access setting is shown
 * @return void
 */
function sloodle_print_access_level_options($current_config, $show_use_object = true, $show_control_object = true, $show_server = true)
{
    // Quick-escape: if everything is being suppressed, then do nothing
    if (!($show_use_object || $show_control_object || $show_server)) {
        return;
    }
    // Fetch default values from the configuration, if possible
    $sloodleobjectaccessleveluse = sloodle_get_value($current_config, 'sloodleobjectaccessleveluse', SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC);
    $sloodleobjectaccesslevelctrl = sloodle_get_value($current_config, 'sloodleobjectaccesslevelctrl', SLOODLE_OBJECT_ACCESS_LEVEL_OWNER);
    $sloodleserveraccesslevel = sloodle_get_value($current_config, 'sloodleserveraccesslevel', SLOODLE_SERVER_ACCESS_LEVEL_PUBLIC);
    // Define our object access level array
    $object_access_levels = array(SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC => get_string('accesslevel:public', 'sloodle'), SLOODLE_OBJECT_ACCESS_LEVEL_GROUP => get_string('accesslevel:group', 'sloodle'), SLOODLE_OBJECT_ACCESS_LEVEL_OWNER => get_string('accesslevel:owner', 'sloodle'));
    // Define our server access level array
    $server_access_levels = array(SLOODLE_SERVER_ACCESS_LEVEL_PUBLIC => get_string('accesslevel:public', 'sloodle'), SLOODLE_SERVER_ACCESS_LEVEL_COURSE => get_string('accesslevel:course', 'sloodle'), SLOODLE_SERVER_ACCESS_LEVEL_SITE => get_string('accesslevel:site', 'sloodle'), SLOODLE_SERVER_ACCESS_LEVEL_STAFF => get_string('accesslevel:staff', 'sloodle'));
    // Display box and a heading
    print_box_start('generalbox boxaligncenter');
    echo '<h3>' . get_string('accesslevel', 'sloodle') . '</h3>';
    // Print the object settings
    if ($show_use_object || $show_control_object) {
        // Object access
        echo '<b>' . get_string('accesslevelobject', 'sloodle') . '</b><br><i>' . get_string('accesslevelobject:desc', 'sloodle') . '</i><br><br>';
        // Use object
        if ($show_use_object) {
            echo get_string('accesslevelobject:use', 'sloodle') . ': ';
            choose_from_menu($object_access_levels, 'sloodleobjectaccessleveluse', $sloodleobjectaccessleveluse, '');
            echo '<br><br>';
        }
        // Control object
        if ($show_control_object) {
            echo get_string('accesslevelobject:control', 'sloodle') . ': ';
            choose_from_menu($object_access_levels, 'sloodleobjectaccesslevelctrl', $sloodleobjectaccesslevelctrl, '');
            echo '<br><br>';
        }
    }
    // Print the server settings
    if ($show_server) {
        // Server access
        echo '<b>' . get_string('accesslevelserver', 'sloodle') . '</b><br><i>' . get_string('accesslevelserver:desc', 'sloodle') . '</i><br><br>';
        echo get_string('accesslevel', 'sloodle') . ': ';
        choose_from_menu($server_access_levels, 'sloodleserveraccesslevel', $sloodleserveraccesslevel, '');
        echo '<br>';
    }
    print_box_end();
}
Esempio n. 17
0
    if (optional_param('cancelpassword', false)) {
        // User clicked cancel in the password form.
        redirect($CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
    } else {
        if (strcmp($quiz->password, $enteredpassword) === 0) {
            // User entered the correct password.
            $SESSION->passwordcheckedquizzes[$quiz->id] = true;
        } else {
            // User entered the wrong password, or has not entered one yet.
            $url = $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . $quiz->id;
            print_header('', '', '', 'quizpassword');
            if (trim(strip_tags($quiz->intro))) {
                $formatoptions->noclean = true;
                print_box(format_text($quiz->intro, FORMAT_MOODLE, $formatoptions), 'generalbox', 'intro');
            }
            print_box_start('generalbox', 'passwordbox');
            if (!empty($enteredpassword)) {
                echo '<p class="notifyproblem">', get_string('passworderror', 'quiz'), '</p>';
            }
            ?>
<p><?php 
            print_string('requirepasswordmessage', 'quiz');
            ?>
</p>
<form id="passwordform" method="post" action="<?php 
            echo $url;
            ?>
" onclick="this.autocomplete='off'">
    <div>
         <label for="quizpassword"><?php 
            print_string('password');
Esempio n. 18
0
    }
    echo "<p><div class=\"boxaligncenter\"><a href=\"{$efile}\">{$txt->download}</a></div></p>";
    echo "<p><div class=\"boxaligncenter\"><font size=\"-1\">{$txt->downloadextra}</font></div></p>";
    print_continue("edit.php?courseid={$course->id}");
    print_footer($course);
    exit;
}
/// Display upload form
// get valid formats to generate dropdown list
$fileformatnames = get_import_export_formats('export');
// get filename
if (empty($exportfilename)) {
    $exportfilename = default_export_filename($course, $category);
}
print_heading_with_help($txt->exportquestions, 'export', 'quiz');
print_box_start('generalbox boxwidthnormal boxaligncenter');
?>

    <form enctype="multipart/form-data" method="post" action="export.php">
        <fieldset class="invisiblefieldset" style="display: block;">
            <input type="hidden" name="sesskey" value="<?php 
echo sesskey();
?>
" />
            <input type="hidden" name="courseid" value="<?php 
echo $course->id;
?>
" />

            <table cellpadding="5">
                <tr>
Esempio n. 19
0
                } else {
                    $userid = $USER->id;
                }
                //Get html code for RSS link
                $row[] = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
            }
            $learningtable->data[] = $row;
        }
    }
}
/// Output the page
$navlinks = array();
$navlinks[] = array('name' => $strforums, 'link' => '', 'type' => 'activity');
print_header("{$course->shortname}: {$strforums}", $course->fullname, build_navigation($navlinks), "", "", true, $searchform, navmenu($course));
if (!isguest()) {
    print_box_start('subscription');
    echo '<span class="helplink">';
    echo '<a href="index.php?id=' . $course->id . '&amp;subscribe=1">' . get_string('allsubscribe', 'forum') . '</a>';
    echo '</span><br /><span class="helplink">';
    echo '<a href="index.php?id=' . $course->id . '&amp;subscribe=0">' . get_string('allunsubscribe', 'forum') . '</a>';
    echo '</span>';
    print_box_end();
    print_box('&nbsp;', 'clearer');
}
if ($generalforums) {
    print_heading(get_string("generalforums", "forum"));
    print_table($generaltable);
}
if ($learningforums) {
    print_heading(get_string("learningforums", "forum"));
    print_table($learningtable);
Esempio n. 20
0
/** 
 *  print some errors to inform users about this.
 *  @return void
 */
function feedback_print_errors()
{
    global $SESSION;
    if (empty($SESSION->feedback->errors)) {
        return;
    }
    // print_simple_box_start("center", "60%", "#FFAAAA", 20, "noticebox");
    print_box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal');
    print_heading(get_string('handling_error', 'feedback'));
    echo '<p align="center"><b><font color="black"><pre>';
    print_r($SESSION->feedback->errors) . "\n";
    echo '</pre></font></b></p>';
    // print_simple_box_end();
    print_box_end();
    echo '<br /><br />';
    $SESSION->feedback->errors = array();
    //remove errors
}
Esempio n. 21
0
/**
 * Prints an individual user box
 *
 * @param $user user object (contains the following fields: id, firstname, lastname and picture)
 * @param $return if true return html string
 */
function tag_print_user_box($user, $return = false)
{
    global $CFG;
    $textlib = textlib_get_instance();
    $usercontext = get_context_instance(CONTEXT_USER, $user->id);
    $profilelink = '';
    if (has_capability('moodle/user:viewdetails', $usercontext) || isteacherinanycourse($user->id)) {
        $profilelink = $CFG->wwwroot . '/user/view.php?id=' . $user->id;
    }
    $output = print_box_start('user-box', 'user' . $user->id, true);
    $fullname = fullname($user);
    $alt = '';
    if (!empty($profilelink)) {
        $output .= '<a href="' . $profilelink . '">';
        $alt = $fullname;
    }
    //print user image - if image is only content of link it needs ALT text!
    if ($user->picture) {
        $output .= '<img alt="' . $alt . '" class="user-image" src="' . $CFG->wwwroot . '/user/pix.php/' . $user->id . '/f1.jpg" />';
    } else {
        $output .= '<img alt="' . $alt . '" class="user-image" src="' . $CFG->wwwroot . '/pix/u/f1.png" />';
    }
    $output .= '<br />';
    if (!empty($profilelink)) {
        $output .= '</a>';
    }
    //truncate name if it's too big
    if ($textlib->strlen($fullname) > 26) {
        $fullname = $textlib->substr($fullname, 0, 26) . '...';
    }
    $output .= '<strong>' . $fullname . '</strong>';
    $output .= print_box_end(true);
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
Esempio n. 22
0
    function print_item($item, $value = false, $readonly = false, $edit = false, $highlightrequire = false)
    {
        $align = get_string('thisdirection') == 'ltr' ? 'left' : 'right';
        //get the range
        $range_from_to = explode('|', $item->presentation);
        //get the min-value
        $range_from = isset($range_from_to[0]) ? intval($range_from_to[0]) : 0;
        //get the max-value
        $range_to = isset($range_from_to[1]) ? intval($range_from_to[1]) : 0;
        if ($highlightrequire and !$this->check_value($value, $item)) {
            $highlight = 'bgcolor="#FFAAAA" class="missingrequire"';
        } else {
            $highlight = '';
        }
        $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
        ?>
        <td <?php 
        echo $highlight;
        ?>
 valign="top" align="<?php 
        echo $align;
        ?>
">
            <?php 
        echo format_text(stripslashes_safe($item->name) . $requiredmark, true, false, false);
        switch (true) {
            case $range_from === 0 and $range_to > 0:
                echo ' (' . get_string('maximal', 'feedback') . ': ' . $range_to . ')';
                break;
            case $range_from > 0 and $range_to === 0:
                echo ' (' . get_string('minimal', 'feedback') . ': ' . $range_from . ')';
                break;
            case $range_from === 0 and $range_to === 0:
                break;
            default:
                echo ' (' . $range_from . '-' . $range_to . ')';
                break;
        }
        ?>
        </td>
        <td valign="top" align="<?php 
        echo $align;
        ?>
">
    <?php 
        if ($readonly) {
            // print_simple_box_start($align);
            print_box_start('generalbox boxalign' . $align);
            echo $value ? $value : '&nbsp;';
            // print_simple_box_end();
            print_box_end();
        } else {
            ?>
            <input type="text" name="<?php 
            echo $item->typ . '_' . $item->id;
            ?>
"
                                    size="10"
                                    maxlength="10"
                                    value="<?php 
            echo $value ? $value : '';
            ?>
" />
    <?php 
        }
        ?>
        </td>
    <?php 
    }
Esempio n. 23
0
        foreach ($availablelangs as $alang) {
            if ($alang[0] == $parent) {
                if (substr($alang[0], -5) == '_utf8') {
                    //Remove the _utf8 suffix from the lang to show
                    $shortlang = substr($alang[0], 0, -5);
                } else {
                    $shortlang = $alang[0];
                }
                $a->parent = $alang[2] . ' (' . $shortlang . ')';
            }
        }
        $info = get_string('missinglangparent', 'admin', $a);
        notify($info, 'notifyproblem');
    }
}
print_box_start();
echo '<table summary="">';
echo '<tr><td align="center" valign="top">';
echo '<form id="uninstallform" action="langimport.php?mode=' . DELETION_OF_SELECTED_LANG . '" method="post">';
echo '<fieldset class="invisiblefieldset">';
echo '<input name="sesskey" type="hidden" value="' . sesskey() . '" />';
/// display installed langs here
echo '<label for="uninstalllang">' . get_string('installedlangs', 'admin') . "</label><br />\n";
echo '<select name="uninstalllang" id="uninstalllang" size="15">';
foreach ($installedlangs as $clang => $ilang) {
    echo '<option value="' . $clang . '">' . $ilang . '</option>';
}
echo '</select>';
echo '<br /><input type="submit" value="' . get_string('uninstall', 'admin') . '" />';
echo '</fieldset>';
echo '</form>';
Esempio n. 24
0
 $fileoldmark = ' (old?)';
 // mark to add to filenames in selection form if the English version is newer
 $filetemplate = '';
 // template for new files, e.g. CVS identification
 if (isset($_POST['currentfile'])) {
     // Save a file
     if (!confirm_sesskey()) {
         print_error('confirmsesskeybad', 'error');
     }
     if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
         notify(get_string("changessaved") . " ({$saveto}/{$currentfile})", "notifysuccess");
     } else {
         error("Could not save the file '{$currentfile}'!", "lang.php?mode=helpfiles&amp;currentfile={$currentfile}&amp;sesskey={$USER->sesskey}");
     }
 }
 print_box_start('generalbox editstrings');
 $menufiles = array();
 $menufiles_coregrp = 1;
 $origlocation = '';
 // the location of the currentfile's English source will be stored here
 $origplugin = '';
 // dtto plugin
 foreach ($helpfiles as $helppath => $helpfile) {
     $item_key = $helpfile['filename'];
     $item_label = $helpfile['filename'];
     if (!file_exists($saveto . '/' . $helpfile['filename']) || filesize($saveto . '/' . $helpfile['filename']) == 0) {
         $item_label .= $filemissingmark;
     } else {
         if (filemtime($saveto . '/' . $helpfile['filename']) < filemtime($helppath)) {
             $item_label .= $fileoldmark;
         }
Esempio n. 25
0
                echo '<form name="frm" action="' . $CFG->wwwroot . '/course/view.php?id=' . $courseid . '" method="post" onsubmit=" ">';
            } else {
                if ($course->id == SITEID) {
                    echo '<form name="frm" action="' . $CFG->wwwroot . '" method="post" onsubmit=" ">';
                } else {
                    echo '<form name="frm" action="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '" method="post" onsubmit=" ">';
                }
            }
            echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
            echo '<input type="hidden" name="courseid" value="' . $courseid . '" />';
            echo '<button type="submit">' . get_string('cancel') . '</button>';
            echo '</form>';
            echo '</div>';
            $SESSION->feedback->is_started = true;
            // print_simple_box_end();
            print_box_end();
        }
    }
} else {
    // print_simple_box_start('center');
    print_box_start('generalbox boxaligncenter');
    echo '<h2><font color="red">' . get_string('this_feedback_is_already_submitted', 'feedback') . '</font></h2>';
    print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id);
    // print_simple_box_end();
    print_box_end();
}
/// Finish the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
print_footer($course);
Esempio n. 26
0
/**
 * Shows the question bank editing interface.
 *
 * The function also processes a number of actions:
 *
 * Actions affecting the question pool:
 * move           Moves a question to a different category
 * deleteselected Deletes the selected questions from the category
 * Other actions:
 * category      Chooses the category
 * displayoptions Sets display options
 *
 * @author Martin Dougiamas and many others. This has recently been extensively
 *         rewritten by Gustav Delius and other members of the Serving Mathematics project
 *         {@link http://maths.york.ac.uk/serving_maths}
 * @param moodle_url $pageurl object representing this pages url.
 */
function question_showbank($tabname, $contexts, $pageurl, $cm, $page, $perpage, $sortorder, $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext)
{
    global $COURSE;
    if (optional_param('deleteselected', false, PARAM_BOOL)) {
        // teacher still has to confirm
        // make a list of all the questions that are selected
        $rawquestions = $_REQUEST;
        // This code is called by both POST forms and GET links, so cannot use data_submitted.
        $questionlist = '';
        // comma separated list of ids of questions to be deleted
        $questionnames = '';
        // string with names of questions separated by <br /> with
        // an asterix in front of those that are in use
        $inuse = false;
        // set to true if at least one of the questions is in use
        foreach ($rawquestions as $key => $value) {
            // Parse input for question ids
            if (preg_match('!^q([0-9]+)$!', $key, $matches)) {
                $key = $matches[1];
                $questionlist .= $key . ',';
                question_require_capability_on($key, 'edit');
                if (record_exists('quiz_question_instances', 'question', $key)) {
                    $questionnames .= '* ';
                    $inuse = true;
                }
                $questionnames .= get_field('question', 'name', 'id', $key) . '<br />';
            }
        }
        if (!$questionlist) {
            // no questions were selected
            redirect($pageurl->out());
        }
        $questionlist = rtrim($questionlist, ',');
        // Add an explanation about questions in use
        if ($inuse) {
            $questionnames .= '<br />' . get_string('questionsinuse', 'quiz');
        }
        notice_yesno(get_string("deletequestionscheck", "quiz", $questionnames), $pageurl->out_action(), $pageurl->out(true), array('deleteselected' => $questionlist, 'confirm' => md5($questionlist)), $pageurl->params(), 'post', 'get');
        echo '</td></tr>';
        echo '</table>';
        print_footer($COURSE);
        exit;
    }
    // starts with category selection form
    print_box_start('generalbox questionbank');
    print_heading(get_string('questionbank', 'question'), '', 2);
    question_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext);
    // continues with list of questions
    question_list($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, isset($cm) ? $cm : null, $recurse, $page, $perpage, $showhidden, $sortorder, $sortorderdecoded, $showquestiontext, $contexts->having_cap('moodle/question:add'));
    print_box_end();
}
Esempio n. 27
0
 /**
  * Render the Edit mode of the Presenter (lists all the slides and allows re-ordering).
  * Called from with the {@link render()} function when necessary.
  */
 function render_edit()
 {
     //display any feedback
     if (!empty($this->feedback)) {
         echo $this->feedback;
     }
     global $CFG;
     $streditpresenter = get_string('presenter:edit', 'sloodle');
     $strviewanddelete = get_string('presenter:viewanddelete', 'sloodle');
     $strnoentries = get_string('noentries', 'sloodle');
     $strnoslides = get_string('presenter:empty', 'sloodle');
     $strdelete = get_string('delete', 'sloodle');
     $stradd = get_string('presenter:add', 'sloodle');
     $straddatend = get_string('presenter:addatend', 'sloodle');
     $straddbefore = get_string('presenter:addbefore', 'sloodle');
     $strtype = get_string('type', 'sloodle');
     $strurl = get_string('url', 'sloodle');
     $strname = get_string('name', 'sloodle');
     $stryes = get_string('yes');
     $strno = get_string('no');
     $strmove = get_string('move');
     $stredit = get_string('edit', 'sloodle');
     $strview = get_string('view', 'sloodle');
     $strdelete = get_string('delete');
     $strmoveslide = get_string('presenter:moveslide', 'sloodle');
     $streditslide = get_string('presenter:editslide', 'sloodle');
     $strviewslide = get_string('presenter:viewslide', 'sloodle');
     $strdeleteslide = get_string('presenter:deleteslide', 'sloodle');
     // Get a list of entry URLs
     $entries = $this->presenter->get_slides();
     if (!is_array($entries)) {
         $entries = array();
     }
     $numentries = count($entries);
     // Any images to display?
     if ($entries === false || count($entries) == 0) {
         echo '<h4>' . $strnoslides . '</h4>';
         echo '<h4><a href="' . SLOODLE_WWWROOT . '/view.php?id=' . $this->cm->id . '&amp;mode=addslide">' . $stradd . '</a></h4><br>';
     } else {
         // Are we being asked to confirm the deletion of a slide?
         if ($this->presenter_mode == 'confirmdeleteslide') {
             // Make sure the session key is specified and valid
             if (required_param('sesskey') != sesskey()) {
                 error('Invalid session key');
                 exit;
             }
             // Determine which slide is being deleted
             $entryid = (int) required_param('entry', PARAM_INT);
             // Make sure the specified entry is recognised
             if (isset($entries[$entryid])) {
                 // Construct our links
                 $linkYes = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=deleteslide&amp;entry={$entryid}&amp;sesskey=" . sesskey();
                 $linkNo = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=edit";
                 // Output our confirmation form
                 notice_yesno(get_string('presenter:confirmdelete', 'sloodle', $entries[$entryid]->name), $linkYes, $linkNo);
                 echo "<br/>";
             }
         }
         // Are we being asked to confirm the deletion of multiple slides?
         $deletingentries = array();
         if ($this->presenter_mode == 'confirmdeletemultiple') {
             // Make sure the session key is specified and valid
             if (required_param('sesskey') != sesskey()) {
                 error('Invalid session key');
                 exit;
             }
             // Grab the array of entries to be deleted
             if (isset($_REQUEST['entries'])) {
                 $deletingentries = $_REQUEST['entries'];
             }
             if (is_array($deletingentries) && count($deletingentries) > 0) {
                 // Construct our links
                 $entriesparam = '';
                 foreach ($deletingentries as $de) {
                     $entriesparam .= "entries[]={$de}&amp;";
                 }
                 $linkYes = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=deletemultiple&amp;{$entriesparam}sesskey=" . sesskey();
                 $linkNo = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=edit";
                 // Output our confirmation form
                 notice_yesno(get_string('presenter:confirmdeletemultiple', 'sloodle', count($deletingentries)), $linkYes, $linkNo);
                 echo "<br/>";
             } else {
                 // No slides selected.
                 // Inform the user to select slides first, and then click the button again.
                 notify(get_string('presenter:noslidesfordeletion', 'sloodle'));
             }
         }
         // Are we currently moving a slide?
         if ($this->presenter_mode == 'moveslide') {
             $linkCancel = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=edit";
             $strcancel = get_string('cancel');
             // Display a message and an optional 'cancel' link
             print_box_start('generalbox', 'notice');
             echo "<p>", get_string('presenter:movingslide', 'sloodle', $entries[$this->movingentryid]->name), "</p>\n";
             echo "<p>(<a href=\"{$linkCancel}\">{$strcancel}</a>)</p>\n";
             print_box_end();
         }
         // Setup a table object to display Presenter entries
         $entriesTable = new stdClass();
         $entriesTable->head = array(get_string('position', 'sloodle'), '<div id="selectboxes"><a href="#"><div style=\'text-align:center;\' id="selectall">' . get_string('selectall', 'sloodle') . '</div></a></div>', get_string('name', 'sloodle'), get_string('type', 'sloodle'), get_string('actions', 'sloodle'));
         $entriesTable->align = array('center', 'center', 'left', 'left', 'center');
         $entriesTable->size = array('5%', '5%', '30%', '20%', '30%');
         // Go through each entry
         $numentries = count($entries);
         foreach ($entries as $entryid => $entry) {
             // Create a new row for the table
             $row = array();
             // Extract the entry data
             $slideplugin = $this->_session->plugins->get_plugin('presenter-slide', $entry->type);
             if (is_object($slideplugin)) {
                 $entrytypename = $slideplugin->get_plugin_name();
             } else {
                 $entrytypename = '(unknown type)';
             }
             // Construct the link to the entry source
             $entrylink = "<a href=\"{$entry->source}\" title=\"{$entry->source}\">{$entry->name}</a>";
             // If this is the slide being moved, then completely ignore it
             if ($this->movingentryid == $entryid) {
                 continue;
             }
             // If we are in move mode, then add a 'move here' row before this slide
             if ($this->presenter_mode == 'moveslide') {
                 $movelink = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=setslideposition&amp;entry={$this->movingentryid}&amp;position={$entry->slideposition}";
                 $movebutton = "<a href=\"{$movelink}\" title=\"{$strmove}\"><img src=\"{$CFG->pixpath}/movehere.gif\" class=\"\" alt=\"{$strmove}\" /></a>\n";
                 $entriesTable->data[] = array('', '', $movebutton, '', '', '');
                 // If the current row belongs to the slide being moved, then emphasise it, and append (moving) to the end
                 if ($entryid == $this->movingentryid) {
                     $entrylink = "<strong>{$entrylink}</strong> <em>(" . get_string('moving', 'sloodle') . ')</em>';
                 }
             }
             // Define our action links
             $actionBaseLink = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}";
             $actionLinkMove = $actionBaseLink . "&amp;mode=moveslide&amp;entry={$entryid}";
             $actionLinkEdit = $actionBaseLink . "&amp;mode=editslide&amp;entry={$entryid}";
             $actionLinkView = $actionBaseLink . "&amp;mode=view&amp;sloodledisplayentry={$entry->slideposition}#slide";
             $actionLinkDelete = $actionBaseLink . "&amp;mode=confirmdeleteslide&amp;entry={$entryid}&amp;sesskey=" . sesskey();
             // Prepare the add buttons separately
             $actionLinkAdd = $actionBaseLink . "&amp;mode=addslide&amp;sloodleentryposition={$entry->slideposition}";
             $addButtons = "<a href=\"{$actionLinkAdd}\" title=\"{$straddbefore}\"><img src=\"" . SLOODLE_WWWROOT . "/lib/media/add.png\" alt=\"{$stradd}\" /></a>\n";
             // Construct our list of action buttons
             $actionButtons = '';
             $actionButtons .= "<a href=\"{$actionLinkMove}\" title=\"{$strmoveslide}\"><img src=\"{$CFG->pixpath}/t/move.gif\" class=\"iconsmall\" alt=\"{$strmove}\" /></a>\n";
             $actionButtons .= "<a href=\"{$actionLinkEdit}\" title=\"{$streditslide}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"{$stredit}\" /></a>\n";
             $actionButtons .= "<a href=\"{$actionLinkView}\" title=\"{$strviewslide}\"><img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strview}\" /></a>\n";
             $actionButtons .= "<a href=\"{$actionLinkDelete}\" title=\"{$strdeleteslide}\"><img src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>\n";
             $actionButtons .= $addButtons;
             //create checkbox for multiple edit functions
             $checked = '';
             if (in_array($entryid, $deletingentries)) {
                 $checked = "checked=\"checked\"";
             }
             $checkbox = "<div style='text-align:center;'><input  type=\"checkbox\" name=\"entries[]\" {$checked} value=\"{$entryid}\" /></div>";
             // Add each item of data to our table row.
             // The first item is a check box for multiple deletes
             // The second items are the position and the name of the entry, hyperlinked to the resource.
             // The next is the name of the entry type.
             // The last is a list of action buttons -- move, edit, view, and delete.
             $row[] = $entry->slideposition;
             $row[] = $checkbox;
             $row[] = $entrylink;
             $row[] = $entrytypename;
             $row[] = $actionButtons;
             // Add the row to our table
             $entriesTable->data[] = $row;
         }
         // If we are in move mode, then add a final 'move here' row at the bottom
         // We need to add a final row at the bottom
         // Prepare the action link for this row
         $endentrynum = $entry->slideposition + 1;
         $actionLinkAdd = $actionBaseLink . "&amp;mode=addslide&amp;sloodleentryposition={$endentrynum}";
         $addButtons = "<a href=\"{$actionLinkAdd}\" title=\"{$straddatend}\"><img src=\"" . SLOODLE_WWWROOT . "/lib/media/add.png\" alt=\"{$stradd}\" /></a>\n";
         $sloodleInsert = get_string("presenter:sloodleinsert", "sloodle");
         // It will contain a last 'add' button, and possibly a 'move here' button too (if we are in move mode)
         $movebutton = '';
         if ($this->presenter_mode == 'moveslide') {
             $movelink = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&amp;mode=setslideposition&amp;entry={$this->movingentryid}&amp;position={$endentrynum}";
             $movebutton = "<a href=\"{$movelink}\" title=\"{$strmove}\"><img src=\"{$CFG->pixpath}/movehere.gif\" class=\"\" alt=\"{$strmove}\" /></a>\n";
         }
         // Add a button to delete all selected slides
         $deleteButton = '<input type="submit" value="' . get_string('deleteselected', 'sloodle') . '" />';
         $entriesTable->data[] = array('', ' <div id="selectboxes2"><a href="#"><div style=\'text-align:center;\' id="selectall2">' . get_string('selectall', 'sloodle') . '</div></a></div>', $movebutton, '', $deleteButton . '&nbsp;&nbsp;' . $addButtons);
         // Put our table inside a form to allow us to delete multiple slides based on the checkboxes
         echo '<form action="" method="get" id="editform" name="editform">';
         echo "<input type=\"hidden\" name=\"id\" value=\"{$this->cm->id}\" />\n";
         // Course module ID so that the request comes to the right places
         echo "<input type=\"hidden\" name=\"mode\" value=\"confirmdeletemultiple\" />\n";
         // The operation being conducted
         print_table($entriesTable);
         echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />\n";
         // Session key to ensure unauthorised deletions are not possible (e.g. using XSS)
         echo '</form>';
     }
 }
Esempio n. 28
0
        echo "</td></tr></table>";
        echo "<br />";
    }
}
/// Print out all the courses
unset($course);
// To avoid unwanted language effects later
$courses = get_courses_page($category->id, 'c.sortorder ASC', 'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible,c.teacher,c.guest,c.password', $totalcount, $page * $perpage, $perpage);
$numcourses = count($courses);
if (!$courses) {
    if (empty($subcategorieswereshown)) {
        print_heading(get_string("nocoursesyet"));
    }
} else {
    if ($numcourses <= COURSE_MAX_SUMMARIES_PER_PAGE and !$page and !$creatorediting) {
        print_box_start('courseboxes');
        print_courses($category);
        print_box_end();
    } else {
        print_paging_bar($totalcount, $page, $perpage, "category.php?id={$category->id}&amp;perpage={$perpage}&amp;");
        $strcourses = get_string("courses");
        $strselect = get_string("select");
        $stredit = get_string("edit");
        $strdelete = get_string("delete");
        $strbackup = get_string("backup");
        $strrestore = get_string("restore");
        $strmoveup = get_string("moveup");
        $strmovedown = get_string("movedown");
        $strupdate = get_string("update");
        $strhide = get_string("hide");
        $strshow = get_string("show");
Esempio n. 29
0
                         // admin should not see list of courses when there are too many of them
                         print_heading_block(get_string('availablecourses'));
                         print_courses(0);
                     }
                 }
                 break;
             case FRONTPAGECATEGORYNAMES:
                 print_heading_block(get_string('categories'));
                 print_box_start('generalbox categorybox');
                 print_whole_category_list(NULL, NULL, NULL, -1, false);
                 print_box_end();
                 print_course_search('', false, 'short');
                 break;
             case FRONTPAGECATEGORYCOMBO:
                 print_heading_block(get_string('categories'));
                 print_box_start('generalbox categorybox');
                 print_whole_category_list(NULL, NULL, NULL, -1, true);
                 print_box_end();
                 print_course_search('', false, 'short');
                 break;
             case FRONTPAGETOPICONLY:
                 // Do nothing!!  :-)
                 break;
         }
         echo '<br />';
     }
     print_container_end();
     echo '</td>';
     break;
 case 'right':
     // The right column
Esempio n. 30
0
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/glossary:export', $context);
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$strallcategories = get_string("allcategories", "glossary");
$straddentry = get_string("addentry", "glossary");
$strnoentries = get_string("noentries", "glossary");
$strsearchconcept = get_string("searchconcept", "glossary");
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
$strexportfile = get_string("exportfile", "glossary");
$strexportentries = get_string('exportentries', 'glossary');
$navigation = build_navigation('', $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
print_heading($strexportentries);
print_box_start('glossarydisplay generalbox');
?>
    <form action="exportfile.php" method="post">
    <table border="0" cellpadding="6" cellspacing="6" width="100%">
    <tr><td align="center">
        <input type="submit" value="<?php 
p($strexportfile);
?>
" />
    </td></tr></table>
    <div>
    <input type="hidden" name="id" value="<?php 
p($id);
?>
" />
    <input type="hidden" name="cat" value="<?php