Ejemplo n.º 1
0
/**
 * Returns the display name of a user - the full name of the user 
 * prefixed by '#' for editing teachers and '-' for teachers.
 * @param int $userid The ID of the user.
 * @param int $courseid The ID of the related-course.
 * @return string The display name of the user.
 */
function groups_get_user_displayname($userid, $courseid)
{
    if ($courseid == false) {
        $fullname = false;
    } else {
        $user = groups_get_user($userid);
        $fullname = fullname($user, true);
        //TODO: isteacher, isteacheredit.
        if (isteacher($courseid, $userid)) {
            if (isteacheredit($courseid, $userid)) {
                $prefix = '# ';
            } else {
                $prefix = '- ';
            }
            $fullname = $prefix . $fullname;
        }
    }
    return $fullname;
}
Ejemplo n.º 2
0
function getRoleForWimbaTools($courseId, $userId)
{
    global $CFG;
    global $USER;
    $role = "";
    if (strstr($CFG->release, "1.7")) {
        $context = get_context_instance(CONTEXT_COURSE, $courseId);
    }
    // the role of the current user is switched
    if (isset($USER->studentview) && $USER->studentview == 1 || isset($context) && isset($USER->switchrole) && !empty($USER->switchrole) && $USER->switchrole[$context->id] > 3) {
        $role = 'StudentBis';
    } else {
        if (isstudent($courseId)) {
            // Student
            $role = 'Student';
        } else {
            if (isadmin() || isteacher($courseId, $USER->id)) {
                // Admin, Teacher
                $role = 'Instructor';
            }
        }
        if (strstr($CFG->release, "1.7")) {
            // 1.7.* version
            if (iscreator()) {
                // Course Creator
                $role = 'Instructor';
            } else {
                if (!isteacheredit($courseId)) {
                    // Non-editing Teacher
                    $role = 'Student';
                }
            }
        }
    }
    return $role;
}
            $link1 = "<a class=\"dimmed\" href=\"{$CFG->wwwroot}/course/mod.php?update=" . $metadatalom->coursemodule . "&amp;sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strupdate . "\" /></a>&nbsp;&nbsp;<a class=\"dimmed\" href=\"{$CFG->wwwroot}/course/mod.php?delete=" . $metadatalom->coursemodule . "&amp;sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strdelete . "\" /></a>&nbsp;&nbsp;<a class=\"dimmed\" href=\"{$CFG->wwwroot}/course/mod.php?show=" . $metadatalom->coursemodule . "&amp;sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/show.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strshow . "\" /></a>";
            $link2 = "<a class=\"dimmed\" href=\"{$CFG->wwwroot}/mod/" . $modlo[$metadatalom->resource] . "/view.php?id=" . $metadatalom->resource . "\">" . $namelo[$metadatalom->resource] . "  (" . $modlo[$metadatalom->resource] . ")</a>";
            $link3 = "<a class=\"dimmed\" href=\"view.php?id={$metadatalom->coursemodule}\"><b>Simple LOM</b></a>";
            $link4 = "<a class=\"dimmed\" href=\"view_lom.php?id={$metadatalom->coursemodule}\"><b>Complete LOM</b></a>";
            $link5 = "<a class=\"dimmed\" href=\"view_imslrm.php?id={$metadatalom->coursemodule}\"><b>IMS-LRM to LOM</b></a>";
        } else {
            //Show normal if the mod is visible
            $link = "<a href=\"view.php?id={$metadatalom->coursemodule}\">{$metadatalom->name}</a>";
            $link1 = "<a href=\"{$CFG->wwwroot}/course/mod.php?update=" . $metadatalom->coursemodule . "&amp;sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strupdate . "\" /></a>&nbsp;&nbsp;<a href=\"{$CFG->wwwroot}/course/mod.php?delete=" . $metadatalom->coursemodule . "&amp;sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strdelete . "\" /></a>&nbsp;&nbsp;<a  href=\"{$CFG->wwwroot}/course/mod.php?hide=" . $metadatalom->coursemodule . "&amp;sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/hide.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strshow . "\" /></a>";
            $link2 = "<a href=\"{$CFG->wwwroot}/mod/" . $modlo[$metadatalom->resource] . "/view.php?id=" . $metadatalom->resource . "\">" . $namelo[$metadatalom->resource] . "  (" . $modlo[$metadatalom->resource] . ")</a>";
            $link3 = "<a href=\"view.php?id={$metadatalom->coursemodule}\"><b>Simple LOM</b></a>";
            $link4 = "<a href=\"view_lom.php?id={$metadatalom->coursemodule}\"><b>Complete LOM</b></a>";
            $link5 = "<a href=\"view_imslrm.php?id={$metadatalom->coursemodule}\"><b>IMS-LRM to LOM</b></a>";
        }
    }
    if (isteacheredit($course->id) & ($course->format == "weeks" or $course->format == "topics")) {
        $table->data[] = array($metadatalom->section, $link, $link2, $link3, $link4, $link5, $link1);
    } elseif (!isteacheredit($course->id) & ($course->format == "weeks" or $course->format == "topics")) {
        $table->data[] = array($metadatalom->section, $link, $link2, $link3, $link4, $link5);
    } elseif (isteacheredit($course->id) & (!$course->format == "weeks" or !$course->format == "topics")) {
        $table->data[] = array($link, $link2, $link3, $link4, $link5, $link1);
    } elseif (!isteacheredit($course->id) & (!$course->format == "weeks" or !$course->format == "topics")) {
        $table->data[] = array($link, $link2, $link3, $link4, $link5);
    } else {
        $table->data[] = array($link, $link2, $link3, $link4, $link5);
    }
}
echo "<br />";
print_table($table);
/// Finish the page
print_footer($course);
                echo "<p style='color:red;text-align:center;margin:0;font-size:0.8em;font-weight:bold;'>" . get_string('errordb', 'podcast') . "</p>";
            }
            break;
        case 1:
            $tab = "add";
            echo "<p style='color:red;text-align:center;font-size:0.8em;font-weight:bold;'>" . get_string('badextension', 'podcast');
            echo " " . implode(", ", get_podcast_limit_mimetypes()) . "</p>";
            break;
        case 2:
            $tab = "add";
            echo "<p style='color:red;text-align:center;font-size:0.8em;font-weight:bold;'>" . get_string('title_empty', 'podcast') . "</p>";
            break;
        default:
    }
}
// Delete Item
$action = optional_param('action', "view", PARAM_ALPHA);
if ($action == "delete" && isteacheredit($course->id)) {
    $id_item = optional_param('id_item', 0, PARAM_INT);
    if (!delete_records_select("podcast_structure", "id = " . $id_item)) {
        error("Could not delete item podcast");
    } else {
        echo "<p style='color:green;text-align:center;font-size:0.8em;font-weight:bold;'>" . get_string('del_ok', 'podcast') . "</p>";
        unset($form);
        // XML
        if (make_xml_podcast($podcast)) {
            echo "<p style='color:green;text-align:center;font-size:0.8em;font-weight:bold;'>" . get_string('xml_ok', 'podcast') . "</p>";
        } else {
            echo "<p style='color:red;text-align:center;font-size:0.8em;font-weight:bold;'>" . get_string('xml_error', 'podcast') . "</p>";
        }
    }
 /**
  * Create whole hierarchical Tree
  *
  * @uses $CFG
  * @param array $categories
  * @param object &$pnode
  * @return void
  */
 function create_tree_menu($categories, &$pnode)
 {
     global $CFG;
     $ficon = 'folder.gif';
     //Cr: changed name of variable from nicon to ficon to better reflect its content
     $feicon = 'folder-expanded.gif';
     //Cr: changed name of variable from eicon to feicon to better reflect its content
     $cicon = 'course.gif';
     $cacticon = 'courseact.gif';
     $cinacticon = 'courseinact.gif';
     $cmycicon = 'coursemyc.gif';
     foreach ($categories as $catid => $catnode) {
         if (!$catnode->hascourses) {
             continue;
         }
         $linkcss = '';
         $cssclass = 'treeMenuDefault';
         $url = $CFG->wwwroot . '/course/category.php?id=' . $catnode->id . '" title="' . htmlspecialchars($catnode->name, ENT_QUOTES) . $linkcss;
         //categories have no fullname field
         if (!empty($this->selectedcat) && $this->selectedcat == $catnode->id) {
             $cssclass = 'treeMenuDefault highlight';
         }
         $node =& $pnode->addItem(new HTML_TreeNode(array('text' => ' ' . $catnode->name, 'link' => $url, 'icon' => $ficon, 'expandedIcon' => $feicon, 'cssClass' => $cssclass)));
         if (!empty($catnode->categories)) {
             $this->create_tree_menu($catnode->categories, $node);
         }
         if (!empty($catnode->courses)) {
             foreach ($catnode->courses as $course) {
                 $linkcss = '';
                 //Cr: I am not sure here, but I guess that a specific css for links could
                 //    be specified here or below
                 if (!$this->admin && $this->teacher && isteacheredit($course->id)) {
                     if ($course->visible) {
                         $icon = $cmycicon;
                     } else {
                         $icon = $cinacticon;
                     }
                 } else {
                     if (!$this->admin && !$this->teacher) {
                         $icon = $cicon;
                     } else {
                         if ($course->visible) {
                             $icon = $cacticon;
                         } else {
                             $linkcss .= '';
                             //Cr: dito for this particular case I guess, like $cssclass
                             $icon = $cinacticon;
                         }
                     }
                 }
                 if ($this->course->id == $course->id) {
                     $url = '';
                     $text = $course->shortname;
                     $cssclass = 'treeMenuBold';
                 } else {
                     $url = $CFG->wwwroot . '/course/view.php?id=' . $course->id . '" title="' . htmlspecialchars($course->fullname, ENT_QUOTES) . $linkcss;
                     $text = $course->shortname;
                     $cssclass = 'treeMenuDefault';
                 }
                 $node->addItem(new HTML_TreeNode(array('text' => $text, 'link' => $url, 'icon' => $icon, 'cssClass' => $cssclass)));
             }
         }
     }
 }
Ejemplo n.º 6
0
				$edit&& (isteacheredit($course->id)) || (($suggestion->opentostudents==1)) &&
				(($suggestion->groupid == 0 )|| ($suggestion->groupid == $groupid))
				) { 							
				?> 
  <a href="suggestions.php?suggestionid=<?=$suggestion->id?>&id=<?=$cm->id?>&backbtn=1&edit=1&chapterid=<?=$chapterid?>&pageid=<?php echo $pageid ?>&suggestionnum=<?= $suggestion->suggestionnum?>&groupid=<?php echo $groupid?>"><img src="<?= $CFG->pixpath?>/t/edit.gif" border="0"></a>
  <a href="suggestions.php?suggestionid=<?=$suggestion->id?>&id=<?=$cm->id?>&delete=1&edit=1&chapterid=<?=$chapterid?>&pageid=<?php echo $pageid ?>&groupid=<?php echo $groupid?>"><img src="<?= $CFG->pixpath?>/t/delete.gif" border="0"></a>
  
  
  
  
      <? $i++;
				
				} 
				
				
					if(isteacheredit($course->id) & $edit){
				
					if ($suggestion->opentostudents==1) {
					
				echo '<a title="'.get_string('lock','hiperbook').'" href="lock.php?id='.$cm->id.'&suggestionid='.$suggestion->id.'&sesskey='.$USER->sesskey.'&mode=suggestion&lock=1"><img src="'.$CFG->pixpath.'/i/lock.gif" height="11" width="11" border="0" /></a>';
				    } else{
			 	echo '<a title="'.get_string('unlock','hiperbook').'" href="lock.php?id='.$cm->id.'&suggestionid='.$suggestion->id.'&sesskey='.$USER->sesskey.'&mode=suggestion&lock=0"><img src="'.$CFG->pixpath.'/i/unlock.gif" height="11" width="11" border="0" /></a>';
				
					}
				
				
				
				}
				
				?> 
   <br> 
function feedback_is_completed($mod, $userid)
{
    return isteacheredit($mod->course) || get_record("feedback_completed", "feedback", $mod->instance, "userid", $userid) ? true : false;
}
Ejemplo n.º 8
0
/**
 * Unlock messages in the NanoGong database.
 **/
function nanogong_unlock_all_messages($nanogong, $groupid)
{
    global $CFG, $USER;
    if (!isteacheredit($nanogong->course)) {
        return false;
    }
    if (empty($groupid)) {
        $students = get_course_students($nanogong->course, "u.lastname, u.firstname");
    } else {
        $students = get_course_students($nanogong->course, "u.lastname, u.firstname", '', '', '', '', '', $groupid);
    }
    if (!$students) {
        $students = array();
    }
    foreach ($students as $student) {
        $nanogong_messages = get_records_select("nanogong_message", "nanogongid={$nanogong->id} AND userid={$student->id}");
        if (!$nanogong_messages) {
            $nanogong_messages = array();
        }
        foreach ($nanogong_messages as $nanogong_message) {
            $nanogong_message->locked = 0;
            update_record("nanogong_message", $nanogong_message);
        }
    }
    return true;
}
Ejemplo n.º 9
0
require_once "../../config.php";
require_once "lib.php";
//edited Justin 2008/08/08
$id = required_param('id', PARAM_INT);
// course
//require_variable($id);   // course
if (!($course = get_record("course", "id", $id))) {
    error("Course ID is incorrect");
}
require_login($course->id);
add_to_log($course->id, "poodllflashcard", "view all", "index.php?id={$course->id}", "");
/// Get all required strings
$strflashcards = get_string("modulenameplural", "poodllflashcard");
$strflashcard = get_string("modulename", "poodllflashcard");
/// Print the header
$streditquestions = isteacheredit($course->id) ? "<form target=\"_parent\" method=\"get\" " . " action=\"{$CFG->wwwroot}/mod/quiz/edit.php\">" . "<input type=\"hidden\" name=\"courseid\" " . " value=\"{$course->id}\" />" . "<input type=\"submit\" " . " value=\"" . get_string("editquestions", "quiz") . "\" /></form>" : "";
if ($course->category) {
    $navigation = "<A HREF=\"../../course/view.php?id={$course->id}\">{$course->shortname}</A> ->";
}
print_header("{$course->shortname}: {$strflashcards}", "{$course->fullname}", "{$navigation} {$strflashcards}", "", "", true, $streditquestions, navmenu($course));
/// Get all the appropriate data
if (!($flashcards = get_all_instances_in_course("poodllflashcard", $course))) {
    notice("There are no PoodLL Flashcards", "../../course/view.php?id={$course->id}");
    die;
}
/// Print the list of instances (your module will probably extend this)
$timenow = time();
$strname = get_string("name");
$strweek = get_string("week");
$strtopic = get_string("topic");
if ($course->format == "weeks") {
Ejemplo n.º 10
0
function hiperbook_edit_button($id, $courseid, $chapterid, $navigationnum, $pagenum, $target_navigation_chapter)
{
    global $CFG, $USER;
    if (isteacheredit($courseid)) {
        if (!empty($USER->editing)) {
            $string = get_string("turneditingoff");
            $edit = '0';
        } else {
            $string = get_string("turneditingon");
            $edit = '1';
        }
        return '<form target="' . $CFG->framename . '" method="get" action="' . $CFG->wwwroot . '/mod/hiperbook/view.php">' . '<input type="hidden" name="id" value="' . $id . '" />' . '<input type="hidden" name="chapterid" value="' . $chapterid . '" />' . '<input type="hidden" name="navigationnum" value="' . $navigationnum . '" />' . '<input type="hidden" name="pagenum" value="' . $pagenum . '" />' . '<input type="hidden" name="target_navigation_chapter" value="' . $target_navigation_chapter . '" />' . '<input type="hidden" name="edit" value="' . $edit . '" />' . '<input type="submit" value="' . $string . '" /></form>';
    } else {
        return '';
    }
}
<?php 
if (!empty($mod->scale) && $mod->scale != 0 && $isteacher) {
    ?>
 | <a href="grades.php?id=<?php 
    p($cm->id);
    ?>
&amp;sesskey=<?php 
    p($USER->sesskey);
    ?>
"><?php 
    print_string("grades");
    ?>
</a>
    <?php 
}
if (isteacheredit($course->id) and $canbepublished) {
    $stroutpublished = empty($mod->published) ? get_string('outpublish', 'netpublish') : get_string('outunpublish', 'netpublish');
    ?>
 | <a href="outpublish.php?id=<?php 
    p($cm->id);
    ?>
&amp;sesskey=<?php 
    p($USER->sesskey);
    ?>
"><?php 
    echo $stroutpublished;
    ?>
</a> ]
        <?php 
} else {
    echo " ]";
Ejemplo n.º 12
0
function book_edit_button($id, $courseid, $chapterid)
{
    global $CFG, $USER;
    if (isteacheredit($courseid)) {
        if (!empty($USER->editing)) {
            $string = get_string("turneditingoff");
            $edit = '0';
        } else {
            $string = get_string("turneditingon");
            $edit = '1';
        }
        return '<form method="get" action="' . $CFG->wwwroot . '/mod/book/view.php"><div>' . '<input type="hidden" name="id" value="' . $id . '" />' . '<input type="hidden" name="chapterid" value="' . $chapterid . '" />' . '<input type="hidden" name="edit" value="' . $edit . '" />' . '<input type="submit" value="' . $string . '" /></div></form>';
    } else {
        return '';
    }
}
Ejemplo n.º 13
0
    error('Course Module ID is incorrect');
}
if (!($course = get_record('course', 'id', $cm->course))) {
    error('Course is misconfigured');
}
if ($course->category) {
    require_login($course->id);
}
if (!($book = get_record('hiperbook', 'id', $cm->instance))) {
    error('Course module is incorrect');
}
$navchapter = get_record('hiperbook_navigation_chapters', 'id', $target_navigation_chapter);
if (!($chapter = get_record('hiperbook_chapters', 'id', $navchapter->chapterid))) {
    error('Chapter is misconfigured');
}
if (!isteacheredit($course->id) & $chapter->opentostudents == 0) {
    error('Only editing teachers can edit hiperbooks!', $_SERVER['HTTP_REFERER']);
}
if ($addprev == 0 & $addnext == 0) {
    $page = get_record('hiperbook_chapters_pages', 'chapterid', $navchapter->chapterid, 'pagenum', $pagenum);
}
// =========================================================================
// security checks END
// =========================================================================
$usehtmleditor = can_use_html_editor();
if ($delete == 1) {
    //echo 'apaga';
    // apaga a pagina com pagenum do parametro, subtraindo 1 de pagenum das paginas com pagenum > pagenum apagada
    delete_records('hiperbook_chapters_pages', 'chapterid', $chapter->id, 'pagenum', $pagenum);
    $err = execute_sql("update " . $CFG->prefix . "hiperbook_chapters_pages set pagenum = (pagenum -1) where chapterid = '{$chapter->id}' and pagenum > '{$pagenum}'");
    $npnum = $page->pagenum - 1;
Ejemplo n.º 14
0
    $table->align = array("center", "left");
} else {
    if ($course->format == "topics") {
        $table->head = array($strtopic, $strname);
        $table->align = array("center", "left");
    } else {
        $table->head = array($strname);
        $table->align = array("left");
    }
}
if (function_exists('groups_get_all_groups')) {
    $currentgroup = groups_get_all_groups($course->id);
} else {
    $currentgroup = get_current_group($course->id);
}
if ($currentgroup and isteacheredit($course->id)) {
    $group = $DB->get_record("groups", array("id" => $currentgroup));
    $groupname = " ({$group->name})";
} else {
    $groupname = "";
}
$currentsection = "";
foreach ($equellas as $equella) {
    $url = new moodle_url('/mod/equella/view.php', array('id' => $equella->coursemodule));
    $attr = array();
    if (!$equella->visible) {
        $attr = array('class' => 'dimmed');
    }
    $link = html_writer::link($url, $equella->name, $attr);
    $printsection = "";
    if ($equella->section !== $currentsection) {
Ejemplo n.º 15
0
$add = optional_param('add', 0, PARAM_INT);
// View mode
require_login();
if (!($cm = get_record('course_modules', 'id', $id))) {
    error('Course Module ID was incorrect');
}
if (!($course = get_record('course', 'id', $cm->course))) {
    error('Course is misconfigured');
}
if (!($book = get_record('hiperbook', 'id', $cm->instance))) {
    error('Course module is incorrect');
}
if (!($page = get_record('hiperbook_chapters_pages', 'id', $pageid))) {
    error('Page incorrect');
}
if (!isteacheredit($course->id) and !$page->opentostudents) {
    error('Unable to edit!', $_SERVER['HTTP_REFERER']);
}
$usehtmleditor = can_use_html_editor();
print_header("", null, "", '', '<style type="text/css">@import url(' . $CFG->wwwroot . '/mod/hiperbook/book_theme.css);</style>', true, null, null);
?>


<style type="text/css">

.corpotexto {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #003366; text-align: left; line-height: 15px}

-->

<?php 
echo $CFG->default_template_css;
Ejemplo n.º 16
0
function get_list_members($course, &$nonmembers, &$listgroups)
{
    /// First, get everyone into the nonmembers array
    if ($students = get_course_students($course->id)) {
        foreach ($students as $student) {
            $nonmembers[$student->id] = fullname($student, true);
        }
        unset($students);
    }
    if ($teachers = get_course_teachers($course->id)) {
        foreach ($teachers as $teacher) {
            $prefix = '- ';
            if (isteacheredit($course->id, $teacher->id)) {
                $prefix = '# ';
            }
            $nonmembers[$teacher->id] = $prefix . fullname($teacher, true);
        }
        unset($teachers);
    }
    /// Pull out all the members into little arrays
    $groups = get_groups($course->id);
    if ($groups) {
        foreach ($groups as $group) {
            $countusers = 0;
            $listmembers[$group->id] = array();
            if ($groupusers = get_group_users($group->id)) {
                foreach ($groupusers as $groupuser) {
                    $listmembers[$group->id][$groupuser->id] = $nonmembers[$groupuser->id];
                    //unset($nonmembers[$groupuser->id]);
                    $countusers++;
                }
                natcasesort($listmembers[$group->id]);
            }
            $listgroups[$group->id] = $group->name . " ({$countusers})";
        }
        natcasesort($listgroups);
    }
    natcasesort($nonmembers);
    if (empty($selectedgroup)) {
        // Choose the first group by default
        if (!empty($listgroups) && ($selectedgroup = array_shift(array_keys($listgroups)))) {
            $members = $listmembers[$selectedgroup];
        }
    } else {
        $members = $listmembers[$selectedgroup];
    }
    return $listmembers;
}
Ejemplo n.º 17
0
function exercise_list_submissions_for_admin($exercise)
{
    // list the teacher sublmissions first
    global $CFG, $USER;
    if (!($course = get_record("course", "id", $exercise->course))) {
        error("Course is misconfigured");
    }
    if (!($cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id))) {
        error("Course Module ID was incorrect");
    }
    $groupid = get_current_group($course->id);
    exercise_print_assignment_info($exercise);
    print_heading_with_help(get_string("administration"), "administration", "exercise");
    echo "<p align=\"center\"><b><a href=\"assessments.php?action=teachertable&amp;id={$cm->id}\">" . get_string("teacherassessmenttable", "exercise", $course->teacher) . "</a></b></p>\n";
    if (isteacheredit($course->id)) {
        // list any teacher submissions
        $table->head = array(get_string("title", "exercise"), get_string("submitted", "exercise"), get_string("action", "exercise"));
        $table->align = array("left", "left", "left");
        $table->size = array("*", "*", "*");
        $table->cellpadding = 2;
        $table->cellspacing = 0;
        if ($submissions = exercise_get_teacher_submissions($exercise)) {
            foreach ($submissions as $submission) {
                $action = "<a href=\"submissions.php?action=adminamendtitle&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("amendtitle", "exercise") . "</a>";
                if (isteacheredit($course->id)) {
                    $action .= " | <a href=\"submissions.php?action=adminconfirmdelete&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("delete", "exercise") . "</a>";
                }
                $table->data[] = array(exercise_print_submission_title($exercise, $submission), userdate($submission->timecreated), $action);
            }
            print_heading(get_string("studentsubmissions", "exercise", $course->teacher), "center");
            print_table($table);
        }
    }
    // list student assessments
    // Get all the students...
    if ($users = get_course_students($course->id, "u.lastname, u.firstname")) {
        $timenow = time();
        unset($table);
        $table->head = array(get_string("name"), get_string("title", "exercise"), get_string("assessed", "exercise"), get_string("action", "exercise"));
        $table->align = array("left", "left", "left", "left");
        $table->size = array("*", "*", "*", "*");
        $table->cellpadding = 2;
        $table->cellspacing = 0;
        $nassessments = 0;
        foreach ($users as $user) {
            // check group membership, if necessary
            if ($groupid) {
                // check user's group
                if (!groups_is_member($groupid, $user->id)) {
                    continue;
                    // skip this user
                }
            }
            if ($assessments = exercise_get_user_assessments($exercise, $user)) {
                $title = '';
                foreach ($assessments as $assessment) {
                    if (!($submission = get_record("exercise_submissions", "id", $assessment->submissionid))) {
                        error("exercise_list_submissions_for_admin: Submission record not found!");
                    }
                    $title .= $submission->title;
                    // test for allocated assesments which have not been done
                    if ($assessment->timecreated < $timenow) {
                        // show only warm or cold assessments
                        $title .= " {" . number_format($assessment->grade * $exercise->grade / 100.0, 0);
                        if ($assessment->timegraded) {
                            $title .= "/" . number_format($assessment->gradinggrade * $exercise->gradinggrade / 100.0, 0);
                        }
                        $title .= "} ";
                        if ($realassessments = exercise_count_user_assessments_done($exercise, $user)) {
                            $action = "<a href=\"assessments.php?action=adminlistbystudent&amp;id={$cm->id}&amp;userid={$user->id}\">" . get_string("view", "exercise") . "</a>";
                        } else {
                            $action = "";
                        }
                        $nassessments++;
                        $table->data[] = array(fullname($user), $title, userdate($assessment->timecreated), $action);
                    }
                }
            }
        }
        if (isset($table->data)) {
            if ($groupid) {
                if (!groups_group_exists($groupid)) {
                    //TODO:
                    error("List unassessed student submissions: group not found");
                }
                print_heading("{$group->name} " . get_string("studentassessments", "exercise", $course->student) . " [{$nassessments}]");
            } else {
                print_heading(get_string("studentassessments", "exercise", $course->student) . " [{$nassessments}]");
            }
            print_table($table);
            echo "<p align=\"center\">" . get_string("noteonstudentassessments", "exercise");
            echo "<br />{" . get_string("maximumgrade") . ": {$exercise->grade} / " . get_string("maximumgrade") . ": {$exercise->gradinggrade}}</p>\n";
            // grading grade analysis
            unset($table);
            $table->head = array(get_string("count", "exercise"), get_string("mean", "exercise"), get_string("standarddeviation", "exercise"), get_string("maximum", "exercise"), get_string("minimum", "exercise"));
            $table->align = array("center", "center", "center", "center", "center");
            $table->size = array("*", "*", "*", "*", "*");
            $table->cellpadding = 2;
            $table->cellspacing = 0;
            if ($groupid) {
                $stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean, \n                        STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max \n                        FROM {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_assessments a \n                        WHERE g.groupid = {$groupid} AND a.userid = g.userid AND a.timegraded > 0 \n                        AND a.exerciseid = {$exercise->id}");
            } else {
                // no group/all participants
                $stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean, \n                        STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max \n                        FROM {$CFG->prefix}exercise_assessments a \n                        WHERE a.timegraded > 0 AND a.exerciseid = {$exercise->id}");
            }
            $table->data[] = array($stats->count, number_format($stats->mean * $exercise->gradinggrade / 100.0, 1), number_format($stats->stddev * $exercise->gradinggrade / 100.0, 1), number_format($stats->max * $exercise->gradinggrade / 100.0, 1), number_format($stats->min * $exercise->gradinggrade / 100.0, 1));
            print_heading(get_string("gradinggrade", "exercise") . " " . get_string("analysis", "exercise"));
            print_table($table);
            echo "<p align=\"center\"><a href=\"assessments.php?id={$cm->id}&amp;action=regradestudentassessments\">" . get_string("regradestudentassessments", "exercise") . "</a> ";
            helpbutton("regrading", get_string("regradestudentassessments", "exercise"), "exercise");
            echo "</p>\n";
        }
    }
    // now the sudent submissions
    unset($table);
    if ($users) {
        $table->head = array(get_string("submittedby", "exercise"), get_string("title", "exercise"), get_string("submitted", "exercise"), get_string("action", "exercise"));
        $table->align = array("left", "left", "left", "left");
        $table->size = array("*", "*", "*", "*");
        $table->cellpadding = 2;
        $table->cellspacing = 0;
        $nsubmissions = 0;
        foreach ($users as $user) {
            // check group membership, if necessary
            if ($groupid) {
                // check user's group
                if (!groups_is_member($groupid, $user->id)) {
                    continue;
                    // skip this user
                }
            }
            if ($submissions = exercise_get_user_submissions($exercise, $user)) {
                foreach ($submissions as $submission) {
                    $action = "<a href=\"submissions.php?action=adminamendtitle&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("amendtitle", "exercise") . "</a>";
                    // has teacher already assessed this submission
                    if ($assessment = get_record_select("exercise_assessments", "submissionid = {$submission->id} AND userid = {$USER->id}")) {
                        $curtime = time();
                        if ($curtime - $assessment->timecreated > $CFG->maxeditingtime) {
                            $action .= " | <a href=\"assessments.php?action=assesssubmission&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("reassess", "exercise") . "</a>";
                        } else {
                            // there's still time left to edit...
                            $action .= " | <a href=\"assessments.php?action=assesssubmission&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("edit", "exercise") . "</a>";
                        }
                    } else {
                        // user has not assessed this submission
                        $action .= " | <a href=\"assessments.php?action=assesssubmission&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("assess", "exercise") . "</a>";
                    }
                    if ($nassessments = exercise_count_assessments($submission)) {
                        $action .= " | <a href=\"assessments.php?action=adminlist&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("view", "exercise") . " ({$nassessments})</a>";
                    }
                    if ($submission->late) {
                        $action .= " | <a href=\"submissions.php?action=adminlateflag&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("clearlateflag", "exercise") . "</a>";
                    }
                    $action .= " | <a href=\"submissions.php?action=adminconfirmdelete&amp;id={$cm->id}&amp;sid={$submission->id}\">" . get_string("delete", "exercise") . "</a>";
                    $title = $submission->title;
                    if ($submission->resubmit) {
                        $title .= "*";
                    }
                    $datesubmitted = userdate($submission->timecreated);
                    if ($submission->late) {
                        $datesubmitted = "<font color=\"red\">" . $datesubmitted . "</font>";
                    }
                    $table->data[] = array(fullname($user), $title . " " . exercise_print_submission_assessments($exercise, $submission), $datesubmitted, $action);
                    $nsubmissions++;
                }
            }
        }
        if (isset($table->data)) {
            if ($groupid) {
                if (!groups_group_exists($groupid)) {
                    error("List unassessed student submissions: group not found");
                }
                print_heading("{$group->name} " . get_string("studentsubmissions", "exercise", $course->student) . " [{$nsubmissions}]");
            } else {
                print_heading(get_string("studentsubmissions", "exercise", $course->student) . " [{$nsubmissions}]", "center");
            }
            print_table($table);
            echo "<p align=\"center\">[] - " . get_string("gradeforsubmission", "exercise");
            echo "<br />" . get_string("maximumgrade") . ": {$exercise->grade}</p>\n";
            echo "<p align=\"center\">" . get_string("resubmitnote", "exercise", $course->student) . "</p>\n";
            // grade analysis
            unset($table);
            $table->head = array(get_string("count", "exercise"), get_string("mean", "exercise"), get_string("standarddeviation", "exercise"), get_string("maximum", "exercise"), get_string("minimum", "exercise"));
            $table->align = array("center", "center", "center", "center", "center");
            $table->size = array("*", "*", "*", "*", "*");
            $table->cellpadding = 2;
            $table->cellspacing = 0;
            /// NOTE:  user_teachers was ripped from the following SQL without a proper fix - XXX TO DO
            if ($groupid) {
                $stats = get_record_sql("SELECT COUNT(*) as count, AVG(grade) AS mean, \n                        STDDEV(grade) AS stddev, MIN(grade) AS min, MAX(grade) AS max \n                        FROM {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_assessments a, \n                        {$CFG->prefix}exercise_submissions s\n                        WHERE g.groupid = {$groupid} AND s.userid = g.userid AND a.submissionid = s.id \n                        AND a.exerciseid = {$exercise->id}");
            } else {
                // no group/all participants
                $stats = get_record_sql("SELECT COUNT(*) as count, AVG(grade) AS mean, \n                        STDDEV(grade) AS stddev, MIN(grade) AS min, MAX(grade) AS max \n                        FROM {$CFG->prefix}exercise_assessments a\n                        WHERE a.exerciseid = {$exercise->id}");
            }
            $table->data[] = array($stats->count, number_format($stats->mean * $exercise->grade / 100.0, 1), number_format($stats->stddev * $exercise->grade / 100.0, 1), number_format($stats->max * $exercise->grade / 100.0, 1), number_format($stats->min * $exercise->grade / 100.0, 1));
            print_heading(get_string("grade") . " " . get_string("analysis", "exercise"));
            print_table($table);
        }
    }
}
Ejemplo n.º 18
0
if (!($cm = get_record('course_modules', 'id', $id))) {
    error('Course Module ID is incorrect');
}
if (!($course = get_record('course', 'id', $cm->course))) {
    error('Course is misconfigured');
}
if ($course->category) {
    require_login($course->id);
}
if (!($book = get_record('hiperbook', 'id', $cm->instance))) {
    error('Course module is incorrect');
}
$groupmode = groupmode($course, $cm);
$navpath = get_record('hiperbook_navigationpath', 'navpathnum', $navigationnum, 'bookid', $book->id);
// permiteeditar capitulo apenas se navpath estiver aberto ou para professores
if (!isteacheredit($course->id) & $navpath->opentostudents != 1) {
    error('Only editing teachers can edit books!', $_SERVER['HTTP_REFERER']);
}
$chapter = get_record('hiperbook_chapters', 'id', $chapterid);
//check all variables
unset($id);
unset($chapterid);
if ($chapter) {
    if ($chapter->bookid != $book->id) {
        //chapter id not in this book!!!!
        error('Chapter not part of this book!');
    }
    //   $chapternum = $chapter->chapternum;
}
// =========================================================================
// security checks END
Ejemplo n.º 19
0
function fn_all_mandatory_completed($courseid, &$mods)
{
    global $USER;
    if (isteacheredit($courseid)) {
        return true;
    }
    foreach ($mods as $mod) {
        if ($mod->mandatory && $mod->visible && is_activity_complete($mod, $USER->id) === false) {
            return false;
        }
    }
    return true;
}
Ejemplo n.º 20
0
    notify(get_string("feedbackupdated", "journal", "{$count}"), "green");
} else {
    add_to_log($course->id, "journal", "view responses", "report.php?id={$cm->id}", "{$journal->id}", $cm->id);
}
/// Print out the journal entries
if ($currentgroup) {
    $users = get_group_users($currentgroup);
} else {
    $users = get_course_students($course->id);
}
if (!$users) {
    print_heading(get_string("nousersyet"));
} else {
    $grades = make_grades_menu($journal->assessed);
    $teachers = get_course_teachers($course->id);
    $allowedtograde = ($groupmode != VISIBLEGROUPS or isteacheredit($course->id) or ismember($currentgroup));
    if ($allowedtograde) {
        echo '<form action="report.php" method="post">';
    }
    if ($usersdone = journal_get_users_done($journal)) {
        foreach ($usersdone as $user) {
            if ($currentgroup) {
                if (!ismember($currentgroup, $user->id)) {
                    /// Yes, it's inefficient, but this module will die
                    continue;
                }
            }
            journal_print_user_entry($course, $user, $entrybyuser[$user->id], $teachers, $grades);
            unset($users[$user->id]);
        }
    }
Ejemplo n.º 21
0
	
	}else{
	
	// se nao definiu navigation chapter nem mudou de aba
	// busca o primeiro navchapter do capitulo da primeira aba
		//$navchapter = get_record_sql('select nc.* from '.$CFG->prefix.'hiperbook_navigation_chapters nc,'.$CFG->prefix.'hiperbook_navigationpath np where np.navpathnum = 1 and np.id = nc.navigationid		and nc.parentnavchapterid = 0 and np.bookid='.$book->id);	
		$navchapter->id = 0;	
		$navigationnum =1;
		
			$navpath = get_record_sql('select * from '.$CFG->prefix.'hiperbook_navigationpath np where bookid = '.$book->id. ' and navpathnum = 1 ' );	
	}
	
}

$isteacher = isteacheredit($course->id);
if ($isteacher) {
    if($edit != -1) {
        $USER->editing = $edit;
    } else {
        if (isset($USER->editing)) {
            $edit = $USER->editing;
        } else {
            $edit = 0;
        }
    }
} else {
    $edit = 0;
}

Ejemplo n.º 22
0
    } else {
        // Edit message
        if ($action === "edit") {
            $messageid = required_param('messageid', PARAM_INT);
            // Message ID
            if (!($nanogong_message = get_record("nanogong_message", "nanogongid", $nanogong->id, "userid", $USER->id, "id", $messageid))) {
                error(get_string("messagenotfound", "nanogong"), $url);
            }
            nanogong_print_edit_message_form($id, $nanogong, $nanogong_message);
        } else {
            // Message list
            nanogong_print_message_list_student($course, $id, $nanogong, $groupid);
        }
    }
} else {
    if (isteacheredit($course->id)) {
        // Message is edited
        if ($action === "editsubmit") {
            $messageid = required_param('messageid', PARAM_INT);
            // Message Id
            $title = required_param('title', PARAM_TEXT);
            // Title
            $path = required_param('path', PARAM_PATH);
            // Path
            if ($path == "") {
                error(get_string("pathmissing", "nanogong"), $url);
            }
            $message = optional_param('message', '', PARAM_CLEANHTML);
            // Message
            $comments = optional_param('comments', '', PARAM_CLEANHTML);
            // Comments
Ejemplo n.º 23
0
<?php

// $Id: frontpage.php,v 1.2 2006/10/01 09:27:05 gustav_delius Exp $
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
ob_start();
if (!empty($pagedata)) {
    if (!empty($pagedata->requirelogin)) {
        require_login();
    }
    if (!empty($pagedata->requirelogin) && (isguest() && !$pagedata->allowguest)) {
        print_string('pageviewdenied', 'cms');
    } else {
        $modified = userdate($pagedata->modified);
        $toolbar = '';
        if (isadmin() || isteacheredit($courseid)) {
            $stredit = get_string('edit');
            $stradd = get_string('addchild', 'cms');
            $strhistory = get_string('pagehistory', 'cms');
            $strdelete = get_string('delete');
            $editlink = $CFG->wwwroot . '/cms/pageupdate.php?id=' . $pagedata->id . '&amp;sesskey=' . $USER->sesskey . '&amp;course=' . $courseid;
            $editicon = $CFG->wwwroot . '/pix/i/edit.gif';
            $addlink = $CFG->wwwroot . '/cms/pageadd.php?id=' . $pagedata->id . '&amp;' . 'sesskey=' . $USER->sesskey . '&amp;parentid=' . $pagedata->id . '&amp;course=' . $courseid . '';
            $addicon = $CFG->wwwroot . '/cms/pix/add.gif';
            $historylink = $CFG->wwwroot . '/cms/pagehistory.php?pageid=' . $pagedata->id . '&amp;' . 'sesskey=' . $USER->sesskey;
            $historyicon = $CFG->wwwroot . '/cms/pix/history.gif';
            $deletelink = $CFG->wwwroot . '/cms/pagedelete.php?id=' . $pagedata->id . '&amp;' . 'sesskey=' . $USER->sesskey . '&amp;course=' . $courseid . '';
            $deleteicon = $CFG->wwwroot . '/pix/t/delete.gif';
            $toolbar = '<div class="cms-frontpage-toolbar"><a href="' . $editlink . '"><img src="' . $editicon . '"' . ' width="16" height="16" alt="' . $stredit . '"' . ' title="' . $stredit . '" /></a>' . "\n" . ' <a href="' . $addlink . '"><img src="' . $addicon . '"' . ' width="11" height="11" alt="' . $stradd . '"' . ' title="' . $stradd . '" /></a>' . "\n" . ' <a href="' . $historylink . '"><img src="' . $historyicon . '"' . ' width="16" height="16" alt="' . $strhistory . '"' . ' title="' . $strhistory . '" /></a>' . "\n";
            if (isadmin() and intval($pagedata->isfp) != 1) {
                $toolbar .= ' <a href="' . $deletelink . '"><img src="' . $deleteicon . '"' . ' width="11" height="11" alt="' . $strdelete . '"' . ' title="' . $strdelete . '" /></a>';
            }