• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP isteacher函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中isteacher函数的典型用法代码示例。如果您正苦于以下问题:PHP isteacher函数的具体用法?PHP isteacher怎么用?PHP isteacher使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isteacher函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: test_allowed_to_update

function test_allowed_to_update()
{
    // TODO: Proper roles & capabilities
    global $cid;
    if (!isteacher($cid)) {
        error(get_string('pollwarning', 'block_poll'));
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:8,代码来源:poll_action.php


示例2: get_content

 function get_content()
 {
     global $CFG, $COURSE;
     $daysnb = $CFG->block_graph_stats_daysnb;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->footer = '';
     if (empty($this->instance)) {
         $this->content->text = '';
         return $this->content;
     }
     $this->content->text = '<center><font size=1>' . get_string('graphtitle', 'block_graph_stats', $daysnb) . '</center>';
     if (isadmin() or isteacher($COURSE->id)) {
         $name = 'popup';
         $title = get_string('connectedtoday', 'block_graph_stats');
         $url = '/blocks/' . $this->name() . '/details.php';
         $options = 'menubar=0,location=0,scrollbars,resizable,width=400,height=500';
         $fullscreen = 0;
         $linkname = '<img src="' . $CFG->wwwroot . '/blocks/' . $this->name() . '/graph.php?course_id=' . $COURSE->id . '" alt="' . get_string('graphtitle', 'block_graph_stats', $daysnb) . '" />';
         $this->content->text .= '<center><a target="' . $name . '" title="' . $title . '" href="' . $CFG->wwwroot . $url . '" ' . "onclick=\"return openpopup('{$url}', '{$name}', '{$options}', {$fullscreen});\">{$linkname}</a></center>";
     } else {
         $this->content->text .= '<center><img src="' . $CFG->wwwroot . '/blocks/' . $this->name() . '/graph.php?course_id=' . $COURSE->id . '" alt="' . get_string('graphtitle', 'block_graph_stats', $daysnb) . '" /></center>';
     }
     // Check if we are in a course or on the first page
     if ($COURSE->id > 1) {
         // In a course
         $connections = count_records_select('log', 'time > ' . mktime(0, 0, 0, date("m"), date("d"), date("Y")) . ' AND action = "view" AND course = ' . $COURSE->id . ' ', 'COUNT(DISTINCT(userid))');
         $this->content->text .= '<center><font size=1>' . get_string('connectedtoday', 'block_graph_stats') . $connections . '</font></center>';
     } else {
         // On the first page
         $connections = count_records_select('log', 'time > ' . mktime(0, 0, 0, date("m"), date("d"), date("Y")) . ' AND action = "login"', 'COUNT(userid)');
         $this->content->text .= '<center><font size=1>' . get_string('connectedtoday', 'block_graph_stats') . $connections . '</font></center>';
         // Show details
         $users = count_records('user', 'deleted', 0, 'confirmed', 1);
         $courses = count_records('course', 'visible', 1);
         $this->content->text .= '<hr />';
         $this->content->text .= get_string('membersnb', 'block_graph_stats') . $users . '<br />';
         $this->content->text .= get_string('coursesnb', 'block_graph_stats') . $courses . '<br />';
     }
     return $this->content;
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:43,代码来源:block_graph_stats.php


示例3: 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;
}
开发者ID:veritech,项目名称:pare-project,代码行数:26,代码来源:utillib.php


示例4: tinymce

 /**
  * PHP4 style class constructor.
  *
  * @param int $courseid
  */
 function tinymce($courseid)
 {
     parent::editorObject();
     $this->courseid = clean_param($courseid, PARAM_INT);
     $isteacher = isteacher($courseid);
     $this->defaults = array("mode" => "textareas", "theme" => $this->cfg->tinymcetheme, "language" => $this->__get_language(), "width" => "100%", "plugins" => !empty($this->cfg->tinymceplugins) ? $this->cfg->tinymceplugins : '', "content_css" => !empty($this->cfg->tinymcecontentcss) ? $this->cfg->tinymcecontentcss : '', "popup_css" => !empty($this->cfg->tinymcepopupcss) ? $this->cfg->tinymcepopupcss : '', "editor_css" => !empty($this->cfg->tinymceeditorcss) ? $this->cfg->tinymceeditorcss : '', "file_browser_callback" => has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $courseid)) ? 'moodleFileBrowser' : '', "convert_urls" => false, "relative_urls" => false);
     if ($this->cfg->tinymcetheme == 'advanced') {
         $this->defaults['theme_advanced_buttons1_add'] = "fontselect,fontsizeselect";
         $this->defaults['theme_advanced_buttons2_add'] = "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor,liststyle";
         $this->defaults['theme_advanced_buttons2_add_before'] = "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator";
         $this->defaults['theme_advanced_buttons3_add_before'] = "tablecontrols,separator";
         $this->defaults['theme_advanced_buttons3_add'] = "emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen";
         $this->defaults['theme_advanced_toolbar_location'] = "top";
         $this->defaults['theme_advanced_toolbar_align'] = "left";
         $this->defaults['theme_advanced_statusbar_location'] = "bottom";
         $this->defaults['theme_advanced_resizing'] = true;
         $this->defaults['theme_advanced_resize_horizontal'] = true;
     }
     $this->printdialogs = has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $courseid)) ? true : false;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:25,代码来源:tinymce.class.php


示例5: has_capability

     $new_course["can_edit"] = has_capability('moodle/course:manageactivities', $context);
 } else {
     if ($course->id != 1) {
         $new_course["can_edit"] = isteacher($course->id, $USER->id, true);
     }
 }
 $course_sections = get_all_sections($course->id, 'fullname ASC', 0, 1);
 $sections_array = array();
 get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
 foreach ($course_sections as $section) {
     $show_hidden_sections = FALSE;
     if ($CFG->rolesactive) {
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
         $show_hidden_sections = has_capability('moodle/course:viewhiddensections', $context);
     } else {
         $show_hidden_sections = isteacher($course->id, $USER->id, true);
     }
     $showsection = ($section->visible or $show_hidden_sections);
     $new_section = array();
     $new_section[" id"] = $section->id;
     $new_section["sequence"] = $section->sequence;
     $new_section["section"] = $section->section;
     $new_section["visible"] = $section->visible;
     if ($showsection) {
         $new_section["summary"] = $section->summary;
         $section_modules = array();
         foreach ($mods as $mod) {
             if ($mod->section == $section->id or $mod->sectionnum == $section->id) {
                 $section_modules[] = $mod;
             }
         }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:main.php


示例6: print_feedback_picture

/**
 * outputs HTML for picture item
 * 
 * Outputs HTML code to browser window showing the picture item,
 * item may have already a $value (a sumitted form has been received), and
 * it is possible to show only the selected picture ($readonly=true)
 * 
 * Radio button values are numbered starting from 1 ($index)
 * 
 * @param object $item contains the item data (a record from prefix_feedback_item table)
 * @param integer $value gives the index to the selected picture (if any)
 * @param boolean $readonly if true, only the selected picture is shown
 */
function print_feedback_picture($item, $value = false, $readonly = false)
{
    global $CFG;
    global $SESSION;
    $presentation = explode("|", $item->presentation);
    $requiredmark = $item->required == 1 ? '<font color="red">*</font>' : '';
    ?>
   <td valign="top" align="left" style="padding-right: 40px;"><?php 
    echo text_to_html(stripslashes_safe($item->name) . $requiredmark, true, false, false);
    ?>
</td>
   <td valign="top" align="left">
<?php 
    $index = 1;
    $checked = '';
    if ($readonly) {
        // here we want to show the selected picture only, $value must be provided
        // this is used by feedback/show_entries.php, for example
        foreach ($presentation as $pic) {
            if ($value == $index) {
                print_simple_box_start('left');
                echo '<img style="padding-left: 20px;" src="' . $CFG->wwwroot . feedback_PICTURE_FILES . '/' . $pic . '" />';
                print_simple_box_end();
                break;
            }
            $index++;
        }
    } else {
        // this is what we want most of the time, to show the picture item so that answering is possible
        // item may have already a value, after a failed saving attempt, say)
        $currentpic = 0;
        $piccount = count($presentation);
        $course_module = get_record('course_modules', 'id', $SESSION->feedback->coursemoduleid);
        foreach ($presentation as $pic) {
            // do we have somehting already selected?
            if ($value == $index) {
                $checked = 'checked="checked"';
            } else {
                $checked = '';
            }
            // generate the HTML for the item
            ?>
         <table><tr>
         <td valign="top"><input type="radio"
               name="<?php 
            echo $item->typ . '_' . $item->id;
            ?>
"
               value="<?php 
            echo $index;
            ?>
" <?php 
            echo $checked;
            ?>
 />
         </td><td><?php 
            echo '<img style="padding-left: 20px;" src="' . $CFG->wwwroot . feedback_PICTURE_FILES . '/' . $pic . '" />';
            ?>
&nbsp;
		 <?php 
            $currentpic++;
            if (isadmin() || isteacher($course_module->course)) {
                if ($currentpic != 1) {
                    echo '</td><td width="20"> ' . feedback_create_action_form('moveup_picture', array($item, $currentpic), 'up.gif');
                } else {
                    echo '</td><td width="20"> &nbsp;';
                }
                if ($currentpic < $piccount) {
                    echo '</td><td width="50"> ' . feedback_create_action_form('movedown_picture', array($item, $currentpic), 'down.gif');
                } else {
                    echo '</td><td width="50"> &nbsp;';
                }
            }
            ?>
         </td></tr></table>
<?php 
            $index++;
        }
    }
    ?>
   </td>
<?php 
}
开发者ID:stokekld,项目名称:TemasMoodleMineria,代码行数:96,代码来源:lib.php


示例7: array

 $section = 1;
 $weekofseconds = 604800;
 $course->enddate = $course->startdate + $weekofseconds * $course->numsections;
 $sectionmenu = array();
 //  Calculate the current week based on today's date and the starting date of the course.
 $currentweek = $timenow > $course->startdate ? (int) (($timenow - $course->startdate) / $weekofseconds + 1) : 0;
 $currentweek = min($currentweek, $course->numsections);
 $strftimedateshort = " " . get_string("strftimedateshort");
 /// If the selected_week variable is 0, all weeks are selected.
 if ($selected_week == -1 && $currentweek == 0) {
     $selected_week = 0;
     $section = $selected_week;
     $numsections = $course->numsections;
 } else {
     if ($selected_week == -1) {
         if (isteacher($course->id) || !empty($course->activitytracking) && ($selected_week = $cobject->first_unfinished_section()) === false) {
             $selected_week = $currentweek;
         }
         $selected_week = $selected_week > $currentweek ? $currentweek : $selected_week;
         $section = $selected_week;
         $numsections = MAX($section, 1);
     } else {
         if ($selected_week != 0) {
             /// Teachers can select a future week; students can't.
             if ($selected_week > $currentweek && !$isteacher) {
                 $section = $currentweek;
             } else {
                 $section = $selected_week;
             }
             $numsections = $section;
         } else {
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:format.php


示例8: required_param

<?php

// $Id: report.php,v 1.34.6.2 2007/10/10 21:09:28 iarenaza Exp $
require_once "../../config.php";
require_once "lib.php";
$id = required_param('id', PARAM_INT);
// course module
if (!($cm = get_coursemodule_from_id('journal', $id))) {
    error("Course Module ID was incorrect");
}
if (!($course = get_record("course", "id", $cm->course))) {
    error("Course module is misconfigured");
}
require_login($course->id, false);
if (!isteacher($course->id)) {
    error("Only teachers can look at this page");
}
if (!($journal = get_record("journal", "id", $cm->instance))) {
    error("Course module is incorrect");
}
// make some easy ways to access the entries.
if ($eee = get_records("journal_entries", "journal", $journal->id)) {
    foreach ($eee as $ee) {
        $entrybyuser[$ee->userid] = $ee;
        $entrybyentry[$ee->id] = $ee;
    }
} else {
    $entrybyuser = array();
    $entrybyentry = array();
}
$strentries = get_string("entries", "journal");
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:report.php


示例9: game_get_recent_mod_activity

/**
 * Returns all game graded users since a given time for specified game
 */
function game_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0)
{
    global $CFG, $COURSE, $USER;
    if ($COURSE->id == $courseid) {
        $course = $COURSE;
    } else {
        $course = get_record('course', 'id', $courseid);
    }
    $modinfo =& get_fast_modinfo($course);
    $cm = $modinfo->cms[$cmid];
    if ($userid) {
        $userselect = "AND u.id = {$userid}";
    } else {
        $userselect = "";
    }
    if ($groupid) {
        $groupselect = "AND gm.groupid = {$groupid}";
        $groupjoin = "JOIN {$CFG->prefix}groups_members gm ON  gm.userid=u.id";
    } else {
        $groupselect = "";
        $groupjoin = "";
    }
    if (!($attempts = get_records_sql("SELECT qa.*, q.grade,\n                                             u.firstname, u.lastname, u.email, u.picture \n                                        FROM {$CFG->prefix}game_attempts qa\n                                             JOIN {$CFG->prefix}game q ON q.id = qa.gameid\n                                             JOIN {$CFG->prefix}user u ON u.id = qa.userid\n                                             {$groupjoin}\n                                       WHERE qa.timefinish > {$timestart} AND q.id = {$cm->instance}\n                                             {$userselect} {$groupselect}\n                                    ORDER BY qa.timefinish ASC"))) {
        return;
    }
    $cm_context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $grader = has_capability('moodle/grade:viewall', $cm_context);
    $accessallgroups = has_capability('moodle/site:accessallgroups', $cm_context);
    $viewfullnames = has_capability('moodle/site:viewfullnames', $cm_context);
    //$grader          = has_capability('mod/game:grade', $cm_context);
    $grader = isteacher($courseid, $userid);
    $groupmode = groups_get_activity_groupmode($cm, $course);
    if (is_null($modinfo->groups)) {
        $modinfo->groups = groups_get_user_groups($course->id);
        // load all my groups and cache it in modinfo
    }
    $aname = format_string($cm->name, true);
    foreach ($attempts as $attempt) {
        if ($attempt->userid != $USER->id) {
            if (!$grader) {
                // grade permission required
                continue;
            }
            if ($groupmode == SEPARATEGROUPS and !$accessallgroups) {
                $usersgroups = groups_get_all_groups($course->id, $attempt->userid, $cm->groupingid);
                if (!is_array($usersgroups)) {
                    continue;
                }
                $usersgroups = array_keys($usersgroups);
                $interset = array_intersect($usersgroups, $modinfo->groups[$cm->id]);
                if (empty($intersect)) {
                    continue;
                }
            }
        }
        $tmpactivity = new object();
        $tmpactivity->type = 'game';
        $tmpactivity->cmid = $cm->id;
        $tmpactivity->name = $aname;
        $tmpactivity->sectionnum = $cm->sectionnum;
        $tmpactivity->timestamp = $attempt->timefinish;
        $tmpactivity->content->attemptid = $attempt->id;
        $tmpactivity->content->sumgrades = $attempt->score * $attempt->grade;
        $tmpactivity->content->maxgrade = $attempt->grade;
        $tmpactivity->content->attempt = $attempt->attempt;
        $tmpactivity->user->userid = $attempt->userid;
        $tmpactivity->user->fullname = fullname($attempt, $viewfullnames);
        $tmpactivity->user->picture = $attempt->picture;
        $activities[$index++] = $tmpactivity;
    }
    return;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:75,代码来源:lib.php


示例10: blocks_print_group

if (!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
    echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    echo '</td>';
}
echo '<td id="middle-column">';
// Print the main part of the page
// Print heading and tabs (if there is more than one).
$currenttab = 'info';
include 'tabs.php';
// Print game name
print_heading(format_string($game->name));
$available = true;
// Show number of attempts summary to those who can view reports.
//    if (has_capability('mod/game:viewreports', $context)) {
if (isteacher($game->course, $USER->id)) {
    if ($a->attemptnum = count_records('game_attempts', 'gameid', $game->id)) {
        $a->studentnum = count_records_select('game_attempts', "gameid = '{$game->id}' ", 'COUNT(DISTINCT userid)');
        $a->studentstring = $course->students;
        notify("<a href=\"report.php?mode=overview&amp;id={$cm->id}\">" . get_string('numattempts', 'game', $a) . '</a>');
    }
}
//    }
//if (has_capability('mod/game:attempt', $context)) {
if ($game->gamekind != '') {
    //Only if the teacher sets the parameters allow playing
    game_view_capability_attempt($game, $context, $course, $available, $cm);
} else {
    echo get_string('useeditgame', 'game');
}
//}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:view.php


示例11: array_for_blocks

function array_for_blocks($blocks)
{
    if (empty($blocks)) {
        return array();
    }
    $return_array = array();
    $block_types = blocks_get_record();
    foreach ($blocks as $block) {
        // Only use roles if they're enabled.
        $can_see_hidden_blocks = FALSE;
        if ($CFG->rolesactive) {
            $context = get_context_instance(CONTEXT_COURSE, $course->id);
            $can_see_hidden_blocks = (has_capability('moodle/site:manageblocks', $context) or $block->visible);
        } else {
            $can_see_hidden_blocks = isteacher($course->id, $USER->id, true);
        }
        $show_block = ($block->visible or $can_see_hidden_blocks);
        if ($show_block) {
            $this_block_type = $block_types[intval($block->blockid)];
            if ($this_block_type->name == "calendar_upcoming") {
                $block_array = array();
                $block_array["name"] = $this_block_type->name;
                $return_array[] = $block_array;
            } else {
                if ($this_block_type->name == "calendar_month") {
                    $block_array = array();
                    $block_array["name"] = $this_block_type->name;
                    $return_array[] = $block_array;
                }
            }
        }
    }
    return $return_array;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:34,代码来源:lib.php


示例12: webquest_print_teams

function webquest_print_teams($webquest, $cm, $userid)
{
    if (isteacher($cm->course)) {
        print_heading_with_help(get_string("teams", "webquest"), "teams", "webquest");
        if ($webquest->teamsmode == 0) {
            print_simple_box_start('center', '70%');
            echo '<div align="center">';
            print_string("teamsnotifyteacher", "webquest");
            echo '</div>';
            print_simple_box_end();
        } else {
            webquest_print_teams_forteacher($webquest, $cm);
        }
    } else {
        print_heading_with_help(get_string("yourteam", "webquest"), "teams", "webquest");
        if ($webquest->teamsmode == 0) {
            print_simple_box_start('center', '70%');
            echo '<div align="center">';
            print_string("teamsnotifystudent", "webquest");
            echo '</div>';
            print_simple_box_end();
        } else {
            webquest_print_teams_forstudent($webquest, $userid);
        }
    }
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:26,代码来源:locallib.php


示例13: get_course_students

     }
 } else {
     if ($type == "chat") {
         echo "<h2>Chat:</h2><br />";
         echo '<a href="get_csv.php?id=' . $id . '&type=chat">Download CSV</a><br /><br />';
         if ($tf == 0) {
             $allstudents = get_course_students($course->id);
             foreach ($allstudents as $allstudent) {
                 if (isteacher($course->id) || $allstudent->id == $USER->id) {
                     echo '<a href="?id=' . $id . '&jid=' . $jid . '&type=chat&tf=1&student=' . $allstudent->id . '">' . fullname($allstudent) . '</a> count of posts:' . count_records("chat_messages", "userid", $allstudent->id) . '<br />';
                 }
             }
         } else {
             $chats = get_records("chat_messages", "userid", $student, "timestamp");
             foreach ($chats as $chat) {
                 if (isteacher($course->id) || $chat->userid == $USER->id) {
                     $text .= $chat->message . " ";
                 }
             }
             $userdata = get_record("user", "id", $student);
             $imagepath = textanalysis_getuserimage($student);
             echo '<table border="1" cellspacing="0" valign="top" cellpadding="10">';
             echo '<tr><td rowspan="2" width="35" valign="top"><a  href="' . $CFG->wwwroot . '/courses/user/view.php?id=' . $chat->userid . '&course=' . $course->id . '"><img class="userpicture" align="middle" src="' . $imagepath . '" border="0" width="35" height="35" alt="" /></a></td><td nowrap="nowrap" width="100%">' . fullname($userdata) . '</td></tr><tr><td width="100%"><hr />';
             textanalysis_printanalizeform($text);
             echo '</td></tr>';
             echo '</table>';
         }
     } else {
         if ($type == "gallery") {
             $alluserslink = "";
             if ($_POST['addselect']) {
开发者ID:e-rasvet,项目名称:textanalysis,代码行数:31,代码来源:view.php


示例14: poll_user_eligible

 function poll_user_eligible()
 {
     // TODO: Proper roles & capabilities
     return $this->poll->eligible == 'all' || $this->poll->eligible == 'students' && isstudent($this->instance->pageid) || $this->poll->eligible == 'teachers' && isteacher($this->instance->pageid);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:5,代码来源:block_poll.php


示例15: fn_display_category_content

/**
 * Function used by the site index page to display category specific information.
 */
function fn_display_category_content($course, $catid)
{
    global $USER, $CFG;
    $totcount = 99;
    $isteacher = isteacher($course->id);
    $isediting = isediting($course->id);
    $ismoving = ismoving($course->id);
    if (!($category = get_record('course_categories', 'id', $catid))) {
        error('Invalid category requested.');
    }
    $courses = get_courses_page($catid, 'c.sortorder ASC', 'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible,c.teacher,c.guest,c.password', $totcount);
    /// Store a course section per category id. Code it by using the 'catid' plus 10 as the section number.
    $sectnum = $catid + 10;
    if (!($section = get_record('course_sections', 'course', $course->id, 'section', $sectnum))) {
        $section = new stdClass();
        $section->course = $course->id;
        $section->section = $sectnum;
        $section->summary = $category->name;
        $section->sequence = '';
        $section->visible = 1;
        if (!($section->id = insert_record('course_sections', $section))) {
            error('Could not create section for category ' . $category->name);
        }
    }
    if (!empty($section) || $isediting) {
        get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
    }
    $groupbuttons = $course->groupmode;
    $groupbuttonslink = !$course->groupmodeforce;
    if ($ismoving) {
        $strmovehere = get_string('movehere');
        $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
        $strcancel = get_string('cancel');
        $stractivityclipboard = $USER->activitycopyname;
    }
    $modinfo = unserialize($course->modinfo);
    $editbuttons = '';
    print_simple_box_start("center", "100%", '', 5, "coursebox");
    echo '<table class="topics" width="100%">';
    echo '<tr id="section-' . $section . '" class="section main">';
    echo '<td class="content">';
    print_heading_block('<div align="center">' . $category->name . '</div>');
    echo '<table class="section" width="100%">';
    if (!empty($section) && !empty($section->sequence)) {
        $sectionmods = explode(',', $section->sequence);
        foreach ($sectionmods as $modnumber) {
            if (empty($mods[$modnumber])) {
                continue;
            }
            $mod = $mods[$modnumber];
            if ($isediting && !$ismoving) {
                if ($groupbuttons) {
                    if (!($mod->groupmodelink = $groupbuttonslink)) {
                        $mod->groupmode = $course->groupmode;
                    }
                } else {
                    $mod->groupmode = false;
                }
                $editbuttons = '<br />' . make_editing_buttons($mod, true, true);
            } else {
                $editbuttons = '';
            }
            if ($mod->visible || $isteacher) {
                echo '<tr><td class="activity ' . $mod->modname . '">';
                if ($ismoving) {
                    if ($mod->id == $USER->activitycopy) {
                        continue;
                    }
                    echo '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img height="16" width="80" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" border="0" /></a>';
                }
                $instancename = urldecode($modinfo[$modnumber]->name);
                $instancename = format_string($instancename, true, $course->id);
                $linkcss = $mod->visible ? '' : ' class="dimmed" ';
                if (!empty($modinfo[$modnumber]->extra)) {
                    $extra = urldecode($modinfo[$modnumber]->extra);
                } else {
                    $extra = '';
                }
                if (!empty($modinfo[$modnumber]->icon)) {
                    $icon = $CFG->pixpath . '/' . urldecode($modinfo[$modnumber]->icon);
                } else {
                    $icon = $CFG->modpixpath . '/' . $mod->modname . '/icon.gif';
                }
                if ($mod->modname == 'label') {
                    echo format_text($extra, FORMAT_HTML) . $editbuttons;
                } else {
                    echo '<img src="' . $icon . '" height="16" width="16" alt="' . $mod->modfullname . '" /> ' . '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . $instancename . '</a>' . $editbuttons;
                }
                echo "</td>";
                echo "</tr>";
            }
        }
    } else {
        echo "<tr><td></td></tr>";
        // needed for XHTML compatibility
    }
    if ($ismoving) {
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:lib.php


示例16: exercise_get_user_submissions

function exercise_get_user_submissions($exercise, $user)
{
    // return submission of user oldest first, newest last
    // teachers submit "exercises"
    if (!($course = get_record("course", "id", $exercise->course))) {
        error("Course is misconfigured");
    }
    if (isteacher($course->id, $user->id)) {
        return get_records_select("exercise_submissions", "exerciseid = {$exercise->id} AND isexercise = 1", "timecreated");
    }
    return get_records_select("exercise_submissions", "exerciseid = {$exercise->id} AND userid = {$user->id}", "timecreated");
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:12,代码来源:lib.php


示例17: print_heading_with_help

        }
    } else {
        $graded = true;
    }
    print_heading_with_help(get_string("assessthissubmission", "webquest"), "grading", "webquest");
    $redirect = "view.php?id={$cm->id}&amp;action=evaluation";
    // show assessment and allow changes
    webquest_print_assessment($webquest, $graded, true, true, $redirect, $sid);
} elseif ($action == 'delete') {
    $submission = get_record("webquest_submissions", "id", $sid);
    if ($webquest->teamsmode) {
        $userid = get_record("webquest_team_members", "teamid", $submission->userid, "userid", $USER->id);
        $userid = $userid->teamid;
    } else {
        $userid = $USER->id;
    }
    if (!(isteacher($course->id) or $userid = $submission->userid and $timenow < $webquest->submissionend and $timenow < $submission->timecreated + $CFG->maxeditingtime)) {
        error("You are not authorized to delete submission");
    }
    if (count_records("webquest_grades", "sid", $submission->id)) {
        if (!delete_records("webquest_grades", "sid", $submission->id)) {
            error("Could not delete grades for this submission");
        }
    }
    webquest_delete_submitted_files($webquest, $submission);
    if (!delete_records("webquest_submissions", "id", $sid)) {
        error("Could not delete submission");
    }
    redirect("view.php?id={$cm->id}&amp;action=evaluation");
}
print_footer($course);
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:submissions.php


示例18: groups_m_has_permission

/**
 * Indicates if a specified user has a particular type of permission for a 
 * particular group for this module instance.
 * @uses $USER      
 * @param int $cmid The id of the module instance. This is necessary because the 
 * same group can be used in different module instances with different 
 * permission setups. 
 * @param int $groupid The id of the group
 * @param int $permissiontype The permission type - see note on permission types 
 * above
 * @userid int $userid The id of the user, defaults to the current user
 * @return boolean True if the user has the specified permission type, false 
 * otherwise or if an error occurred. 
 */
function groups_m_has_permission($cm, $groupid, $permissiontype, $userid = null)
{
    if (!$userid) {
        global $USER;
        $userid = $USER->id;
    }
    $groupingid = groups_get_grouping_for_coursemodule($cm);
    if (!$groupingid || !is_object($cm) || !isset($cm->course)) {
        return false;
    }
    $courseid = $cm->course;
    $isstudent = isstudent($courseid, $userid);
    $isteacher = isteacher($courseid, $userid);
    $groupmember = groups_is_member($groupid, $userid);
    $memberofsomegroup = groups_is_member_of_some_group_in_grouping($userid, $groupingid);
    $groupingsettings = groups_get_grouping_settings($groupingid);
    $viewowngroup = $groupingsettings->viewowngroup;
    $viewallgroupsmembers = $groupingsettings->viewallgroupmembers;
    $viewallgroupsactivities = $groupingsettings->viewallgroupsactivities;
    $teachersgroupsmark = $groupingsettings->teachersgroupsmark;
    $teachersgroupsview = $groupingsettings->teachersgroupsview;
    $teachersgroupmark = $groupingsettings->teachersgroupmark;
    $teachersgroupview = $groupingsettings->teachersgroupview;
    $teachersoverride = $groupingsettings->teachersoverride;
    $permission = false;
    switch ($permissiontype) {
        case 'view':
            if ($isstudent and $groupmember or $isteacher and $groupmember or $isstudent and $viewallgroupsactivities or $isteacher and !$teachersgroupview or $isteacher and !$memberofsomegroup and $teachersoverride) {
                $permission = true;
            }
            break;
        case 'studentcontribute':
            if ($isstudent and $groupmember or $isteacher and $groupmember or $isteacher and !$memberofsomegroup and $teachersoverride) {
                $permission = true;
            }
            break;
        case 'teachermark':
            if ($isteacher and $groupmember or $isteacher and !$teachersgroupmark or $isteacher and !$memberofsomegroup and $teachersoverride) {
                $permission = true;
            }
            break;
        case 'viewmembers':
            if ($isstudent and $groupmember and $viewowngroup or $isstudent and $viewallgroupsmembers or $isteacher and $groupmember or $isteacher and !$teachersgroupview or $isteacher and !$memberofsomegroup and $teachersoverride or $isteacheredit) {
                $permission = true;
            }
            break;
    }
    return $permission;
}
开发者ID:veritech,项目名称:pare-project,代码行数:63,代码来源:modulelib.php


示例19: slideshow_show_slide

function slideshow_show_slide($p)
{
    //########## $CFG was missing,  edited Justin 20110514
    // global $id, $course, $USER, $searchtext;
    global $id, $course, $USER, $searchtext, $CFG;
    //############# End of edit 20110514
    print_simple_box_start('center', '800px', '#ffffff', 10);
    $data_ = get_record("slideshow_files", "id", $p);
    if (strstr($data_->text, "{FMS:SLIDESHOW=")) {
        $fmslink = explode("{FMS:SLIDESHOW=", $data_->text);
        $fmslink = $fmslink[1];
        $fmslink = explode("}", $fmslink);
        $fmslink = $fmslink[0];
        //$fmshtml = '<div style="margin: 10px;"><h3><a href="view.php?id='.$id.'&p='.$data_->id.'">'.$data_->name.'</a></h3></div><div style="clean:both;"></div><div style="border: 1px #666666 solid;float:left;width:500px;margin-right: 20px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="500" height="428" id="audioplayer" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="'.$fmslink.'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'.$fmslink.'" quality="high" bgcolor="#ffffff" width="500" height="428" name="audioplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP isteacheredit函数代码示例发布时间:2022-05-15
下一篇:
PHP issetor函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap