本文整理汇总了PHP中isteacheredit函数的典型用法代码示例。如果您正苦于以下问题:PHP isteacheredit函数的具体用法?PHP isteacheredit怎么用?PHP isteacheredit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isteacheredit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_get_user_displayname
/**
* 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;
}
示例2: getRoleForWimbaTools
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;
}
示例3: array
$link1 = "<a class=\"dimmed\" href=\"{$CFG->wwwroot}/course/mod.php?update=" . $metadatalom->coursemodule . "&sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strupdate . "\" /></a> <a class=\"dimmed\" href=\"{$CFG->wwwroot}/course/mod.php?delete=" . $metadatalom->coursemodule . "&sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strdelete . "\" /></a> <a class=\"dimmed\" href=\"{$CFG->wwwroot}/course/mod.php?show=" . $metadatalom->coursemodule . "&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 . "&sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/edit.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strupdate . "\" /></a> <a href=\"{$CFG->wwwroot}/course/mod.php?delete=" . $metadatalom->coursemodule . "&sesskey=" . $USER->sesskey . "\"><img src=\"" . $CFG->pixpath . "/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"" . $strdelete . "\" /></a> <a href=\"{$CFG->wwwroot}/course/mod.php?hide=" . $metadatalom->coursemodule . "&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);
示例4: get_string
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>";
}
}
示例5: create_tree_menu
/**
* 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)));
}
}
}
}
示例6:
$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>
示例7: feedback_is_completed
function feedback_is_completed($mod, $userid)
{
return isteacheredit($mod->course) || get_record("feedback_completed", "feedback", $mod->instance, "userid", $userid) ? true : false;
}
示例8: nanogong_unlock_all_messages
/**
* 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;
}
示例9: required_param
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") {
示例10: hiperbook_edit_button
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 '';
}
}
示例11: p
<?php
if (!empty($mod->scale) && $mod->scale != 0 && $isteacher) {
?>
| <a href="grades.php?id=<?php
p($cm->id);
?>
&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);
?>
&sesskey=<?php
p($USER->sesskey);
?>
"><?php
echo $stroutpublished;
?>
</a> ]
<?php
} else {
echo " ]";
示例12: book_edit_button
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 '';
}
}
示例13: error
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;
示例14: array
$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) {
示例15: optional_param
$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;