$practicalLink = "<a href='http://{$record->url}' target='practical'>Practical</a>";
         $answersLink = "<a href='{$CFG->wwwroot}/mod/quiz/review.php?attempt={$record->attemptid}'>Answers</a>";
         $userview = get_record('user', 'username', $record->username);
         if (!empty($userview)) {
             echo "<tr{$odd}>";
             echo "<td>{$userview->lastname}</td>";
             echo "<td>{$userview->firstname}</td>";
             echo "<td><a href='{$CFG->wwwroot}/question/grades.php?courseid={$course->id}&uid={$record->username}'>{$record->username}</a></td>";
             echo "<td>" . date("m/d/Y", $record->starttime) . "</td>";
             echo "<td>" . date("H:i:s A", $record->starttime) . "</td>";
             echo "<td>" . date("H:i:s A", $record->endtime) . "</td>";
             //echo "<td>".quiz_format_grade($record->quizid, $record->grade1)."</td>";
             echo "<td>" . $record->grade1 . "</td>";
             echo "<td id='{$record->id}'>";
             if (!empty($param->edit) && $quiz->id == $param->edit) {
                 print_textfield($record->id, $record->grade2, '', 5);
             } else {
                 echo $record->grade2;
             }
             echo "</td>";
             echo "<td>{$instr1}</td>";
             echo "<td>{$answersLink}</td>";
             echo "<td>{$instr2}</td>";
             echo "<td>{$practicalLink}</td>";
             echo "</tr>";
         }
         $odd = " class='odd'";
     }
     //$records->close();
     echo "</tbody>";
 } else {
Example #2
0
/**
* displays form to create group
*
* @param int $courseid courseid for course
*/
function tao_new_group_form($courseid)
{
    global $CFG;
    return '<form action="' . $CFG->wwwroot . '/blocks/tao_team_groups/managegroup.php" method="post">' . '<input type="hidden" name="id" value="' . $courseid . '"/>' . '<br/><strong>' . get_string('startmygroup', 'block_tao_team_groups') . ':&nbsp;</strong>' . print_textfield('groupname', '', '', 15, 0, true) . '<input type="submit" value="' . get_string('createnewgroup', 'block_tao_team_groups') . '"/></form>' . get_string('createnewgroupdesc', 'block_tao_team_groups');
}
Example #3
0
     }
     $nch++;
 }
 echo '</li>';
 // Reset all param of the searching
 echo '<li>';
 echo '<a href="' . $wwwroot . '/blocks/email_list/email/participants.php?id=' . $courseid . '&amp;group=' . $selgroup . '">' . get_string('allusersincourse', 'block_email_list') . '</a>';
 echo '</li></ul></div>';
 // Search input
 echo '<div onclick="switchMenu(\'srch\', \'' . $CFG->pixpath . '/t/\')">';
 echo '<img id="srch_icon" src="' . $CFG->pixpath . '/t/switch_plus.gif"/>';
 print_spacer(1, 4, false);
 echo get_string('searchparticipant', 'block_email_list') . '</div>';
 echo '<div id="srch" style="display:none;">';
 echo '<form method="post" action="participants.php">';
 print_textfield('search', $search, get_string('searchparticipant', 'block_email_list'), '50', '150');
 echo '<input type="hidden" name="id" value="' . $courseid . '"/>';
 echo '<input type="hidden" name="group" value="' . $selgroup . '"/>';
 echo '<input type="hidden" name="page" value="' . $page . '"/>';
 echo '<input type="hidden" name="perpage" value="' . $perpage . '"/>';
 echo '<input type="hidden" name="roleid" value="' . $roleid . '"/>';
 echo '<input type="hidden" name="fname" value="' . $firstinitial . '"/>';
 echo '<input type="hidden" name="lname" value="' . $lastinitial . '"/>';
 echo '<input type="submit" name="doit" value="' . get_string('search') . '" />' . '</form>';
 echo '</div>';
 echo '<br />';
 if ($courseid == SITEID) {
     $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
     // SYSTEM context
 } else {
     $context = get_context_instance(CONTEXT_COURSE, $courseid);
function displayMainContextPage($course)
{
    global $CFG;
    $url = "{$CFG->wwwroot}/question/context.php";
    // Set RecordSets
    $group_records = get_records('context_key_groups', 'courseid', $course->id);
    $key_records = get_records('quiz_context_keys', 'courseid', $course->id, "key_id ASC");
    $quizkey_count = count_records('quiz_context_keys', 'courseid', $course->id);
    $group_count = count_records('context_key_groups', 'courseid', $course->id);
    print_heading($strspecialcategories);
    // Setup Form Values
    $selects = array();
    //if ($group_records = $DB->get_recordset('context_key_groups', array('courseid'=>$course->id))) {
    foreach ($group_records as $record) {
        $selects[$record->id] = $record->name;
    }
    //$group_records->close();
    // Print the Main Context Keys Page
    echo "<table border='0' cellpadding='5' cellspacing='5' class='boxwidthwide boxaligncenter generalbox questioncategories contextlevel'>";
    echo "<tr><td>";
    // Display Add Context Group Form
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    echo "<b>Add a Context Key Group</b><br/><br/>";
    $options = array('courseid' => $course->id, 'edit' => 1);
    print_form_start($url);
    print_textfield('addgroup', '', '', 25);
    echo "<br/>";
    print_button('Add Group', $options);
    print_form_end();
    print_box_end();
    echo "</td>";
    echo "<td>";
    // Display Remove Context Group Form
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    echo "<b>Remove a Context Key Group</b><br/><br/>";
    $options = array('courseid' => $course->id, 'edit' => 2);
    print_form_start($url);
    echo "Select Context Group:<br/>";
    choose_from_menu($selects, 'gid');
    echo "<br/>";
    print_button('Remove Group', $options);
    print_form_end();
    print_box_end();
    echo "</td></tr>";
    echo "<tr><td>";
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    //echo "<b>Add a Context Keyword</b><br/><br/>";
    $options = array('courseid' => $course->id);
    print_form_start($url);
    echo "<table border='0' cellpadding='5' cellspacing='5'>";
    echo "<tr><th colspan='2' align='left'>Add a Keyword</th></tr>";
    echo "<tr>";
    echo "<td>Keyword Name:</td>";
    echo "<td>";
    print_textfield('addkeyword', '', '', 25);
    echo "</td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td colspan='2' align='right'>";
    print_button('Add Keyword', $options);
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    print_form_end();
    print_box_end();
    echo "</td>";
    echo "<td>";
    // KeyWord Scroll Table
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    echo "<table summary='' cellpadding='0' cellspacing='1' align='center' title='' width='400' border='0' bgcolor='black'>";
    echo "<tr><td>";
    echo "<table summary='' cellpadding='0' cellspacing='0' width='100%' align='center' border='0'>";
    echo "<tr bgcolor='#FAFAFA'><td colspan='5' align='center'><b>Available Keywords</b></td></tr>";
    echo "<tr bgcolor='silver'>";
    echo "<td width='10%'> </td>";
    echo "<td width='28%'>Order</td>";
    echo "<td width='48%'>Keyword Name</td>";
    echo "<td width='14%'> </td>";
    echo "</tr></table></td></tr>";
    echo "<tr><td>";
    echo "<div style='width:100%; overflow:auto;height:150px;background-color:#FAFAFA'>";
    echo "<table summary='' cellpadding='0' cellspacing='0' width='96%' bgcolor='#FAFAFA'>";
    if ($quizkey_count) {
        //$key_records = $DB->get_recordset('quiz_context_keys', array('courseid'=>$course->id), "key_id ASC");
        foreach ($key_records as $r) {
            echo "<tr>";
            echo "<td width='10%'></td>";
            echo "<td width='30%'>" . $r->key_id . "</td>";
            echo "<td width='50%'>" . $r->key_code . "</td>";
            echo "<td width='10%'><a href='{$url}?courseid={$course->id}&editkey={$r->id}'>edit</a></td>";
            echo "</tr>";
        }
        //$key_records->close();
    } else {
        echo "<tr><td colspan='4' width='100%'><font size='2'>Currently, there are no available keywords.</font></td></tr>";
    }
    echo "</table></div>";
    echo "</td></tr></table>";
    print_box_end();
    echo "</td></tr>";
    echo "<tr><td colspan='2'>";
    $options = array('courseid' => $course->id);
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    echo "<table border='0' cellpadding='5' cellspacing='5'>";
    echo "<tr><th align='left'>Context</th><th></th><th align='left'>Define Keywords</th></tr>";
    echo "<tr>";
    echo "<td valign='top'>";
    // Display the list of Context Groups
    echo "<ol>";
    $group_records = get_records('context_key_groups', 'courseid', $course->id);
    foreach ($group_records as $r) {
        echo "<li><a style='color:blue'; onclick='getContext(" . $r->id . "," . $group_count . ");'>" . $r->name . "</a></li>";
    }
    //$group_records->close();
    echo "</ol>";
    echo "</td>";
    echo "<td width='100px'>";
    echo "</td>";
    echo "<td>";
    echo "<div id='define_keywords' style='display: ;'>Select a Context to edit keywords.</div>";
    // Display the Define Keyword Forms
    $group_records = get_records('context_key_groups', 'courseid', $course->id);
    foreach ($group_records as $rec) {
        echo "<div id='define_keywords_" . $rec->id . "' style='display: none;'>";
        print_form_start($url);
        echo $rec->name . "<br/>";
        echo "<table border='0' cellpadding='5' cellspacing='5'>";
        echo "<tr><th align='left'>KeyWord</th><th align='left'>Definition</th></tr>";
        $key_records = get_records('quiz_context_keys', 'courseid', $course->id, "key_id ASC");
        foreach ($key_records as $r) {
            $record = get_record_select('context_key_words', "key_group = '{$rec->id}' AND key_id = '{$r->key_id}' AND courseid = '{$course->id}'");
            echo "<tr>";
            echo "<td>" . $r->key_code . "</td>";
            echo "<td>";
            print_textfield('keyword' . $r->key_id, $record->keyword, '', 25);
            echo "</td>";
            echo "</tr>";
        }
        //$key_records->close();
        echo "<tr><td colspan='2' align='right'>";
        echo "<div id='define_keys_" . $rec->id . "'><input type='hidden' value='" . $rec->id . "' name='contextgroupid' /></div>";
        echo "</td></tr>";
        echo "<tr><td align='right'><br/><input type='button' onclick='closeDefine(" . $rec->id . ");' value='Cancel'/>";
        echo "</td><td align='left'>";
        print_button('Define Keywords', $options);
        echo "</td></tr>";
        echo "</table>";
        print_form_end();
        echo "</div>";
    }
    //$group_records->close();
    echo "</td>";
    echo "</table>";
    // JavaScript Functions
    echo "<script type='text/javascript'>";
    echo "function getContext(id,total) {";
    echo "var div;";
    echo "var i=0;";
    $i = 0;
    echo "var mydivs = new Array();";
    $group_records = get_records('context_key_groups', 'courseid', $course->id);
    foreach ($group_records as $r) {
        echo "mydivs[" . $i . "] = " . $r->id . ";";
        $i++;
    }
    //$group_records->close();
    echo "var cur=document.getElementById('define_keywords_'+id);";
    echo "var spc=document.getElementById('define_keywords');";
    //echo "for(i=1;i<=total;i++){";
    echo "for (i=0;i<mydivs.length;i++){";
    echo "div=document.getElementById('define_keywords_'+mydivs[i]);";
    echo "div.style.display='none';";
    echo "}";
    echo "spc.style.display='none';";
    echo "cur.style.display='';";
    echo "}";
    echo "function closeDefine(id) {";
    echo "var div=document.getElementById('define_keywords_'+id);";
    echo "var spc=document.getElementById('define_keywords');";
    echo "div.style.display='none';";
    echo "spc.style.display='';";
    echo "}";
    echo "</script>";
    print_box_end();
    echo "</td></tr>";
    echo "<tr><td colspan='2'>";
    // Nothing
    echo "</td></tr>";
    echo "<tr><td colspan='2'>";
    // Nothing
    echo "</td></tr>";
    echo "</table>";
}
Example #5
0
 /**
  * Creates the screen for editing tasks.
  *
  * @uses $CFG
  * @return string
  **/
 function make_edit()
 {
     global $CFG;
     $type = optional_param('type', '', PARAM_ALPHA);
     $taskaction = optional_param('taskaction', '', PARAM_ALPHA);
     $taskid = optional_param('taskid', 0, PARAM_INT);
     $output = '';
     if (!$this->can_edit()) {
         error('You are not authorized to view this page');
     }
     /// Actions that handle Processing
     switch ($taskaction) {
         case 'confirmed':
             // Confirmation of deletion
             if (!confirm_sesskey()) {
                 error(get_string('confirmsesskeybad', 'error'));
             }
             if (delete_records('block_task_list', 'id', $taskid)) {
                 // This replaces the ID:
                 //  Anywhere in the list (except the first spot)
                 //  OR at the beginning of the list
                 //  OR the ID is the list and replaces it
                 $this->config->taskorder = preg_replace("/,{$taskid}\\b|\\b{$taskid},|\\b{$taskid}\\b/", '', $this->config->taskorder);
                 $this->instance_config_commit();
                 // Remove from out task list
                 unset($this->tasks[$taskid]);
                 $this->set_message(get_string('taskdeleted', 'block_task_list'), 'notifysuccess');
             } else {
                 $this->set_message(get_string('taskdeletefailed', 'block_task_list'));
             }
             break;
         case 'save':
             // Saving an add or edit form
             if (confirm_sesskey() and data_submitted()) {
                 $task = new stdClass();
                 $task->instanceid = $this->instance->id;
                 $task->type = required_param('type', PARAM_ALPHA);
                 if ($task->type == 'category') {
                     $task->name = required_param('taskname', PARAM_TEXT);
                 } else {
                     $task->name = required_param('taskname', PARAM_RAW);
                 }
                 $task->format = required_param('format', PARAM_INT);
                 $task->timemodified = time();
                 if ($id = optional_param('taskid', 0, PARAM_INT)) {
                     $task->id = $id;
                     $result = update_record('block_task_list', $task);
                 } else {
                     $result = $task->id = insert_record('block_task_list', $task);
                     if ($task->id) {
                         if (empty($this->config->taskorder)) {
                             $this->config->taskorder = $task->id;
                         } else {
                             $this->config->taskorder .= ",{$task->id}";
                         }
                         // Save the order
                         $this->instance_config_commit();
                     }
                 }
                 if ($result) {
                     // Update the tasks object
                     $this->tasks[$task->id] = $task;
                     $this->set_message(get_string('taskitemsaved', 'block_task_list'), 'notifysuccess');
                 } else {
                     $this->set_message(get_string('taskitemnotsaved', 'block_task_list'));
                 }
             }
             break;
     }
     /// Actions that handle display
     switch ($taskaction) {
         case 'edit':
             // Edit button was pushed
             if (!confirm_sesskey()) {
                 error(get_string('confirmsesskeybad', 'error'));
             }
             $name = get_field('block_task_list', 'name', 'id', $taskid);
         case 'add':
             // An option in the add task menu was selected
             if (empty($name)) {
                 $name = '';
             }
             if ($usehtmleditor = can_use_html_editor()) {
                 $format = FORMAT_HTML;
                 $formatstr = get_string('formathtml');
             } else {
                 $format = FORMAT_MOODLE;
                 $formatstr = get_string('formattext');
             }
             $addform = '<h2>' . get_string('editingtask', 'block_task_list', get_string($type, 'block_task_list')) . "</h2>\n                            <form action=\"{$this->baseurl}\" method=\"post\" accept-charset=\"utf-8\">\n                            <input type=\"hidden\" name=\"taskmode\" value=\"edit\" />\n                            <input type=\"hidden\" name=\"taskaction\" value=\"save\" />\n                            <input type=\"hidden\" name=\"taskid\" value=\"{$taskid}\" />\n                            <input type=\"hidden\" name=\"type\" value=\"{$type}\" />\n                            <input type=\"hidden\" name=\"format\" value=\"{$format}\" />\n                            <input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . '" />';
             if ($type == 'category') {
                 $addform .= '<strong>' . get_string('name', 'block_task_list') . ':&nbsp;</strong>' . print_textfield('taskname', s($name), get_string('name', 'block_task_list'), 50, 0, true);
             } else {
                 $addform .= print_textarea($usehtmleditor, 10, 65, 0, 0, 'taskname', $name, $this->course->id, true) . "<br />{$formatstr} " . helpbutton('textformat', get_string('helpformatting'), 'moodle', true, false, '', true);
             }
             $addform .= '<p><span class="button"><input type="submit" value="' . get_string('savechanges') . '" /></span></p>
                          </form>';
             $output .= print_box($addform, 'generalbox boxaligncenter taskedit', '', true);
             // A little hack to make the HTML editor work
             if ($usehtmleditor and $type != 'category') {
                 ob_start();
                 use_html_editor('taskname');
                 $output .= ob_get_contents();
                 ob_end_clean();
             }
             break;
         case 'delete':
             // Delete button pushed
             if (!confirm_sesskey()) {
                 error(get_string('confirmsesskeybad', 'error'));
             }
             // Don't like it, but it works...
             ob_start();
             notice_yesno(get_string('confirmdeletetask', 'block_task_list', $this->print_name($this->tasks[$taskid], true)), $this->baseurl . '&amp;taskmode=edit&amp;taskaction=confirmed&amp;taskid=' . $taskid . '&amp;sesskey=' . sesskey(), $this->baseurl . '&amp;taskmode=edit');
             $output .= ob_get_contents();
             ob_end_clean();
             break;
         default:
             if (empty($this->tasks)) {
                 $this->set_message(get_string('notasksfound', 'block_task_list'));
             } else {
                 // Table setup
                 $table->head = array(get_string('taskitem', 'block_task_list'), get_string('type', 'block_task_list'), get_string('action', 'block_task_list'));
                 $table->align = array('left', 'left', 'center');
                 $table->width = '70%';
                 $table->tablealign = 'center';
                 $table->cellpadding = '5px';
                 $table->cellspacing = '0';
                 $table->data = array();
                 // Get task IDs
                 $taskids = explode(',', $this->config->taskorder);
                 foreach ($taskids as $taskid) {
                     $task = $this->tasks[$taskid];
                     $url = "{$this->baseurl}&amp;taskmode=edit&amp;taskid={$taskid}&amp;sesskey=" . sesskey() . '&amp;';
                     $buttons = '<a href="' . $url . 'taskaction=edit&amp;type=' . $task->type . '">' . '<img src="' . $CFG->pixpath . '/t/edit.gif" height="11" width="11" border="0" alt="' . get_string('edit') . '" /></a>' . '&nbsp;' . '<a href="' . $url . 'taskaction=delete">' . '<img src="' . $CFG->pixpath . '/t/delete.gif" height="11" width="11" border="0" alt="' . get_string('delete') . '" /></a>' . '&nbsp;' . '<a href="' . $this->baseurl . '&amp;taskmode=move&amp;moving=' . $taskid . '">' . '<img src="' . $CFG->pixpath . '/t/move.gif" height="11" width="11" border="0" alt="' . get_string('move') . '" /></a>';
                     $table->data[] = array($this->print_name($task, true), get_string($task->type, 'block_task_list'), $buttons);
                 }
                 $output .= $this->print_table($table, true);
             }
             // Add task item drop-down
             $output .= '<div class="addtaskitem">' . get_string('addtaskitem', 'block_task_list') . ': ' . popup_form($this->baseurl . '&amp;taskmode=edit&amp;taskaction=add&amp;type=', $this->get_task_menu(), 'addtaskitem', '', 'choose', '', '', true) . '</div>';
             break;
     }
     return $output;
 }
 echo "<tr>";
 echo "<td>Quiz ID:</td>";
 echo "<td colspan='2'>";
 print_textfield('quizid', '', '', 25);
 echo "</td>";
 echo "</tr>";
 echo "<tr>";
 echo "<td>Username:</td>";
 echo "<td colspan='2'>";
 print_textfield('username', '', '', 25);
 echo "</td>";
 echo "</tr>";
 echo "<tr>";
 echo "<td>URL:</td>";
 echo "<td colspan='2'>";
 print_textfield('url', '', '', 25);
 echo "</td>";
 echo "</tr>";
 echo "<tr><td></td><td>Date (DD/MM/YYYY)</td><td>Time (HH:MM)</td></tr>";
 echo "<tr>";
 echo "<td>Start Time:</td>";
 echo "<td>";
 print_date_selector("sday", "smon", "syear", 0, false);
 echo "</td>";
 echo "<td>";
 print_time_selector("shour", "smin", 0, 5, false);
 echo "</td>";
 echo "</tr>";
 echo "<tr><td></td><td>Date (DD/MM/YYYY)</td><td>Time (HH:MM)</td></tr>";
 echo "<tr>";
 echo "<td>End Time:</td>";
<form id="theform" method="post" action="edittitle.php">
<table summary="Summary of week" cellpadding="5" class="boxaligncenter">
<tr valign="top">
    <td align="right">
      <p><b><?php 
print_string("directoryname", "format_project");
?>
      <?php 
echo helpbutton('format/project/directoryname', get_string("directoryname", "format_project"), 'moodle', true, false, '', true);
?>
      :</b></p>
    </td>
    <td>
      <?php 
print_textfield('directoryname', $form->directoryname, get_string("directoryname", "format_project"), 30, 30);
?>
    </td>
</tr>
<tr>
    <td colspan="2" align="center">
        <input type="hidden" name="id" value="<?php 
echo $form->id;
?>
" />
        <input type="hidden" name="sesskey" value="<?php 
echo sesskey();
?>
" />
        <input type="hidden" name="olddirectoryname" value="<?php 
echo $form->directoryname;
?>
 $sql_coursepromocodes = "SELECT id, code, description FROM mdl_course_promocodes";
 $coursepromocodes = get_records_sql($sql_coursepromocodes);
 echo "<br/><b>Existing Course Promo Codes:</b>";
 echo "<ol>";
 foreach ($coursepromocodes as $coursepromocode) {
     echo "<li><a href='edit_promocodes.php?codeid=" . $coursepromocode->id . "'>" . $coursepromocode->code . "</a></li>";
 }
 echo "</ol>";
 print_box_start('');
 echo "<br/><b>Create: Course Promo Code</b><br/><br/>";
 print_form_start($url);
 echo "<table border='0' cellpadding='5' cellspacing='5'>";
 echo "<tr>";
 echo "<td>Promo Code:</td>";
 echo "<td colspan='2'>";
 print_textfield('code', '', '', 25);
 echo "</td>";
 echo "</tr>";
 echo "<tr>";
 echo "<td>Description:</td>";
 echo "<td colspan='2'>";
 print_textarea(true, 14, 58, 0, 0, 'description');
 echo "</td>";
 echo "</tr>";
 echo "<tr>";
 echo "<td colspan='3' align='right'>";
 print_button('Create Entry', array('saved' => 1, 'add' => 1));
 echo "</td>";
 echo "</tr>";
 echo "</table>";
 print_form_end();
function displayMainContextPage($course, $selects)
{
    print_heading($strspecialcategories);
    // Print the Main Instructions Page
    echo "<table border='0' cellpadding='5' cellspacing='5' class='boxwidthwide boxaligncenter generalbox questioncategories contextlevel'>";
    echo "<tr><td>";
    // Display Add Instruction Type Form
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    echo "<b>Add Instructions Type</b><br/><br/>";
    $options = array('courseid' => $course->id, 'add' => 1);
    print_form_start($url);
    echo "Name: ";
    print_textfield('name', '', '', 25);
    //echo "Description: ";
    //print_textfield ('desc', '','',25);
    echo "<br/>";
    print_button('Add Type', $options);
    print_form_end();
    print_box_end();
    echo "</td>";
    echo "<td rowspan='2'>";
    // Edit Instructions Scroll Table
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    echo "<table summary='' cellpadding='0' cellspacing='1' align='center' title='' width='400' border='0' bgcolor='#FAFAFA'>";
    echo "<tr><td>";
    echo "<table summary='' cellpadding='0' cellspacing='0' width='100%' align='center' border='0'>";
    echo "<tr bgcolor='#FAFAFA'><td colspan='5' align='center'><b>Available Instructions</b></td></tr>";
    echo "<tr bgcolor='silver'>";
    echo "<td width='20%'> </td>";
    echo "<td width='28%'> </td>";
    echo "<td width='28%'> </td>";
    echo "<td width='20%'> </td>";
    echo "<td width='4%'> </td>";
    echo "</tr></table></td></tr>";
    echo "<tr><td>";
    echo "<div style='width:100%; overflow:auto;height:150px;background-color:#FAFAFA'>";
    echo "<table summary='' cellpadding='0' cellspacing='0' width='96%' bgcolor='#FAFAFA'>";
    if (count_records('instructions_type', 'courseid', $course->id)) {
        $records = get_records('instructions_type', 'courseid', $course->id);
        foreach ($records as $r) {
            $style = " style='background-color:#555555; color:#ffffff;'";
            echo "<tr><td colspan='5' width='100%'" . $style . ">Type " . $r->count . ": " . $r->name . "</td></tr>";
            $style = "";
            $recs = get_records_select('instructions', "typeid = '{$r->id}' AND courseid = '{$course->id}'", "count ASC");
            foreach ($recs as $i) {
                echo "<tr" . $style . ">";
                echo "<td width='20%'></td>";
                echo "<td width='25%'>" . $i->count . "</td>";
                if ($i->active > 0) {
                    echo "<td width='20%'><font color='red'>Active: " . $i->active . "</font></td>";
                } else {
                    echo "<td width='20%'><font color='green'>Inactive</font></td>";
                }
                // Get Quiz Name
                $quiz = get_record('quiz', 'id', $i->quizid);
                echo "<td width='20%'><i>{$quiz->name}</i></td>";
                echo "<td width='20%'><a href='" . $url . "?courseid=" . $course->id . "&view=" . $i->id . "'>View</a></td>";
                echo "</tr>";
                echo "<tr" . $style . "><td colspan='4' width='100%'>" . $r->text . "</td></tr>";
                //Swapping bgcolor of table
                if (empty($style)) {
                    $style = " bgcolor='silver'";
                } else {
                    $style = "";
                }
            }
            //$recs->close();
        }
        //$records->close();
    } else {
        echo "<tr><td colspan='4' width='100%'><font size='2'>Currently, there are no available instructions.</font></td></tr>";
    }
    echo "</table></div>";
    echo "</td></tr></table>";
    print_box_end();
    echo "</td></tr>";
    echo "<tr><td>";
    // Display Add Instruction Form
    $options = array('courseid' => $course->id, 'addInstr' => 1);
    print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel');
    //echo "<b>Add a Context Keyword</b><br/><br/>";
    //$options  = array('courseid'=>$course->id,'add'=>2);
    print_form_start($url);
    echo "<table border='0' cellpadding='5' cellspacing='5'>";
    echo "<tr><th colspan='2' align='left'>Add Instructions</th></tr>";
    echo "<tr>";
    echo "<td colspan='2' align='right'>";
    print_button('Add Instructions', $options);
    //button_to_popup_window("/question/instructions.php?courseid={$course->id}&amp;addInstr=1","addinstr","Instructions",600,650);
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    print_form_end();
    print_box_end();
    echo "</td></tr>";
    echo "</table>";
}
     }
     $nch++;
 }
 echo '</li>';
 // Reset all param of the searching
 echo '<li>';
 echo '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/participants.php?id=' . $courseid . '&amp;group=' . $selgroup . '">' . get_string('allusersincourse', 'block_email_list') . '</a>';
 echo '</li></ul></div>';
 // Search input
 echo '<div onclick="switchMenu(\'srch\', \'' . $CFG->pixpath . '/t/\')">';
 echo '<img id="srch_icon" src="' . $CFG->pixpath . '/t/switch_plus.gif"/>';
 print_spacer(1, 4, false);
 echo get_string('searchparticipant', 'block_email_list') . '</div>';
 echo '<div id="srch" style="display:none;">';
 echo '<form method="post" action="participants.php">';
 print_textfield('search', $search, get_string('searchparticipants', 'block_email_list'));
 echo '<input type="hidden" name="id" value="' . $courseid . '"/>';
 echo '<input type="hidden" name="group" value="' . $selgroup . '"/>';
 echo '<input type="hidden" name="page" value="' . $page . '"/>';
 echo '<input type="hidden" name="perpage" value="' . $perpage . '"/>';
 echo '<input type="hidden" name="roleid" value="' . $roleid . '"/>';
 echo '<input type="hidden" name="fname" value="' . $firstinitial . '"/>';
 echo '<input type="hidden" name="lname" value="' . $lastinitial . '"/>';
 echo '<input type="submit" name="doit" value="' . get_string('search') . '" />' . '</form>';
 echo '</div>';
 echo '<br />';
 if ($courseid == SITEID) {
     $context = get_context_instance(CONTEXT_SYSTEM, SITEID);
     // SYSTEM context
 } else {
     $context = get_context_instance(CONTEXT_COURSE, $courseid);
Example #11
0
 public function output_html($data, $query = '')
 {
     global $CFG;
     $output = "";
     //search all web service users
     $users = get_users(true, '', false, null, 'firstname ASC', '', '', '', 1000);
     $table = new StdClass();
     $table->head = array('username', 'whitelist');
     $table->align = array('left', 'center');
     $table->data = array();
     foreach ($users as $user) {
         if (has_capability("moodle/site:usewebservices", get_system_context(), $user->id)) {
             //test if the users has has_capability('use_webservice')
             $wsusersetting = ' <a href="' . $this->baseurl . '&amp;username='******'">' . get_string("settings") . '</a>' . "\n";
             $textfield = print_textfield('whitelist_' . $user->username, '', '', 50, 0, true);
             $table->data[] = array($user->username, $wsusersetting);
         }
     }
     $output .= print_table($table, true);
     return highlight($query, $output);
 }
Example #12
0
print_field($data, "created", 11);
print_field($data, "lastmodified", 11, "", "");
echo '<input type="checkbox" name="update[lastmodified]" value="1" title=":= time()"><br>';
#-- [save]
echo "\n<small><br>\n" . '<input type="submit" name="save" value="update database entry">' . "\n<br></small><br>\n";
#-- {content}
if ($data["flags"] & EWIKI_DB_F_BINARY && !$_REQUEST["show_content"]) {
    echo '<label for="show_content">content</label><br>' . '<input id="show_content" type="submit" name="show_content" value="show" title="contains binary data, beware!"><br><br>';
} else {
    print_textfield($data["content"], "content", 16);
}
#-- {meta}
print_textfield(flatten_meta($data["meta"]), "meta", 5);
#-- {refs}
$inj = ' &nbsp;<input type="checkbox" checked name="update[refs]" value="1" id="update_refs">' . '<label for="update_refs"> update automatically</label><br>';
print_textfield(ltrim($data["refs"]), "refs", 4, $inj);
// done
#------------------------------------------------------- helper functions ---
#-- output <input> tag for one of the database {field}s
function print_field(&$data, $name, $size, $inj = "", $add = "<br>")
{
    echo "<nobr><label for=\"d_{$name}\">{$name}&nbsp;</label>" . "<input id=\"d_{$name}\" type=\"text\" size=\"{$size}\" name=\"new[{$name}]\" value=\"" . htmlentities($data[$name]) . "\"{$inj}></nobr>{$add}\n";
}
#-- output checkboxes for {flags}
function print_flags(&$data)
{
    $names = array("txt", "bin", "off", "htm", "ro", "wr", "app", "sys", "prt", "min", "hid", "arv", "u12", 17 => "exe");
    echo "<label for=\"d_flags\">flags</label>&nbsp;<small id=\"d_flags\">";
    foreach ($names as $i => $str) {
        echo "<input type=\"checkbox\" id=\"d_f_{$i}\" name=\"new_flags[{$i}]\"" . " value=\"1\"" . ($data["flags"] & 1 << $i ? " checked" : "") . "><label for=\"d_f_{$i}\">{$str}</label> ";
    }