当前位置: 首页>>代码示例>>PHP>>正文


PHP cm_info::get_course方法代码示例

本文整理汇总了PHP中cm_info::get_course方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::get_course方法的具体用法?PHP cm_info::get_course怎么用?PHP cm_info::get_course使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cm_info的用法示例。


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

示例1: __construct

 /**
  * Cosntructor.
  *
  * @param \stdClass $collaborate
  * @param \stdClass $cm
  * @param \context_module $context
  * @param \mod_collaborate_renderer $renderer
  */
 public function __construct(\stdClass $collaborate, \cm_info $cm, \context_module $context, \mod_collaborate_renderer $renderer)
 {
     $this->collaborate = $collaborate;
     $this->cm = $cm;
     $this->context = $context;
     $this->renderer = $renderer;
     $this->course = $cm->get_course();
 }
开发者ID:mpetrowi,项目名称:moodle-mod_collaborate,代码行数:16,代码来源:view_service.php

示例2: __construct

 /**
  * Constructor
  *
  * @param \stdClass $collaborate
  * @param \cm_info $cm
  * @param \context_module $context;
  * @param \stdClass $user;
  * @throws \coding_exception
  * @throws \require_login_exception
  */
 public function __construct(\stdClass $collaborate, \cm_info $cm, \context_module $context, \stdClass $user)
 {
     global $DB;
     $this->collaborate = $collaborate;
     $this->course = $cm->get_course();
     $this->cm = $cm;
     $this->id = $cm->instance;
     $this->context = $context;
     $this->user = $user;
     $this->collaborate = $DB->get_record('collaborate', array('id' => $this->id), '*', MUST_EXIST);
     $this->api = api::get_api();
 }
开发者ID:mpetrowi,项目名称:moodle-mod_collaborate,代码行数:22,代码来源:forward_service.php

示例3: mod_stopwatch_update_timer

/**
 *
 * @param cm_info $cm
 * @param stdClass $stopwatch
 * @param int $duration
 */
function mod_stopwatch_update_timer(cm_info $cm, $stopwatch, $duration)
{
    global $USER, $DB, $CFG;
    require_once $CFG->libdir . '/completionlib.php';
    $record = $DB->get_record('stopwatch_user', array('stopwatchid' => $cm->instance, 'courseid' => $cm->course, 'userid' => $USER->id));
    if ($record) {
        $data = array('id' => $record->id, 'timemodified' => time(), 'duration' => $duration);
        $DB->update_record('stopwatch_user', $data);
    } else {
        $data = array('courseid' => $cm->course, 'stopwatchid' => $cm->instance, 'userid' => $USER->id, 'timecreated' => time(), 'timemodified' => time(), 'duration' => $duration);
        $DB->insert_record('stopwatch_user', $data);
    }
    // Update completion state
    $completion = new completion_info($cm->get_course());
    if ($completion->is_enabled($cm) && $stopwatch->completiontimed) {
        $completion->update_state($cm, COMPLETION_COMPLETE);
    }
}
开发者ID:marinaglancy,项目名称:moodle-mod_stopwatch,代码行数:24,代码来源:locallib.php

示例4: navbuttons_mod_assignment_showbuttons

/**
 * @param cm_info $cm
 * @return bool
 */
function navbuttons_mod_assignment_showbuttons($cm)
{
    global $DB, $CFG, $USER;
    if (!($assignment = $DB->get_record('assignment', array('id' => $cm->instance)))) {
        return true;
        // Not quite sure what went wrong
    }
    $type = $assignment->assignmenttype;
    if ($type == 'offline') {
        return true;
        // Cannot track 'offline' assignments
    }
    require_once $CFG->dirroot . '/mod/assignment/type/' . $type . '/assignment.class.php';
    $class = 'assignment_' . $type;
    /** @var assignment_base $instance */
    $instance = new $class($cm->id, $assignment, $cm, $cm->get_course());
    if (!($submission = $instance->get_submission($USER->id))) {
        return false;
        // No submission
    }
    if ($type == 'upload' || $type == 'uploadpdf') {
        if ($instance->drafts_tracked()) {
            if ($instance->is_finalized($submission)) {
                return true;
                // Upload submission is 'finalised'
            } else {
                return false;
            }
        }
    }
    if ($submission->timemodified > 0) {
        return true;
        // Submission has a 'modified' time
    }
    return false;
}
开发者ID:kbwebsolutions,项目名称:moodle-navbuttons,代码行数:40,代码来源:activityready.php

示例5: course_get_cm_move

/**
 * Returns the move action.
 *
 * @param cm_info $mod The module to produce a move button for
 * @param int $sr The section to link back to (used for creating the links)
 * @return The markup for the move action, or an empty string if not available.
 */
function course_get_cm_move(cm_info $mod, $sr = null)
{
    global $OUTPUT;
    static $str;
    static $baseurl;
    $modcontext = context_module::instance($mod->id);
    $hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
    if (!isset($str)) {
        $str = get_strings(array('move'));
    }
    if (!isset($baseurl)) {
        $baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
        if ($sr !== null) {
            $baseurl->param('sr', $sr);
        }
    }
    if ($hasmanageactivities) {
        $pixicon = 'i/dragdrop';
        if (!course_ajax_enabled($mod->get_course())) {
            // Override for course frontpage until we get drag/drop working there.
            $pixicon = 't/move';
        }
        return html_writer::link(new moodle_url($baseurl, array('copy' => $mod->id)), $OUTPUT->pix_icon($pixicon, $str->move, 'moodle', array('class' => 'iconsmall', 'title' => '')), array('class' => 'editing_move', 'data-action' => 'move'));
    }
    return '';
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:33,代码来源:lib.php

示例6: course_section_cm_availability

 /**
  * Renders HTML to show course module availability information (for someone who isn't allowed
  * to see the activity itself, or for staff)
  *
  * @param cm_info $mod
  * @param array $displayoptions
  * @return string
  */
 public function course_section_cm_availability(cm_info $mod, $displayoptions = array())
 {
     global $CFG;
     if (!$mod->uservisible) {
         // this is a student who is not allowed to see the module but might be allowed
         // to see availability info (i.e. "Available from ...")
         if (!empty($mod->availableinfo)) {
             $formattedinfo = \core_availability\info::format_info($mod->availableinfo, $mod->get_course());
             $output = html_writer::tag('div', $formattedinfo, array('class' => 'availabilityinfo'));
         }
         return $output;
     }
     // this is a teacher who is allowed to see module but still should see the
     // information that module is not available to all/some students
     $modcontext = context_module::instance($mod->id);
     $canviewhidden = has_capability('moodle/course:viewhiddenactivities', $modcontext);
     if ($canviewhidden && !empty($CFG->enableavailability)) {
         // Don't add availability information if user is not editing and activity is hidden.
         if ($mod->visible || $this->page->user_is_editing()) {
             $hidinfoclass = '';
             if (!$mod->visible) {
                 $hidinfoclass = 'hide';
             }
             $ci = new \core_availability\info_module($mod);
             $fullinfo = $ci->get_full_information();
             if ($fullinfo) {
                 $formattedinfo = \core_availability\info::format_info($fullinfo, $mod->get_course());
                 return html_writer::div($formattedinfo, 'availabilityinfo ' . $hidinfoclass);
             }
         }
     }
     return '';
 }
开发者ID:rushi963,项目名称:moodle,代码行数:41,代码来源:renderer.php

示例7: __construct

 /**
  * Constructs with item details.
  *
  * @param \cm_info $cm Course-module object
  */
 public function __construct(\cm_info $cm)
 {
     parent::__construct($cm->get_course(), $cm->visible, $cm->availability);
     $this->cm = $cm;
 }
开发者ID:adonm,项目名称:learning,代码行数:10,代码来源:info_module.php

示例8: block_intuitel_get_completion_status

/**
 * Retrieves the completion status of the LO for an specific user (100 if this is completed and 0 if not), returns NULL if completion tracking is not enabled for that LO (or the entire course) and if the LO corresponds to a section or course LO
 * @author elever
 * @param cm_info $coursemodule_info : Moodle object with information of a module in a course
 * @param int $userid : moodle identifier of the user
 * @return int $completion_status | null
 */
function block_intuitel_get_completion_status(\cm_info $coursemodule_info, $userid)
{
    $completion = new \completion_info($coursemodule_info->get_course());
    if ($completion->is_enabled($coursemodule_info) > 0) {
        //check if completion is enabled for a particular course and activity, returns 0 if it is not enabled, 1 if completion is enabled and is manual and 2 if automatic
        $completion_status = $completion->get_data($coursemodule_info, false, $userid);
        //this object has also information about viewed...is the row of the related table in the database
        $completion_status = $completion_status->completionstate;
        if ($completion_status > 0) {
            $completion_status = 100;
            // moodle completion system retrieves 0 when the activity is not completed, 1 when the activity is completed (regardless of mark), 2 when the activity is completed with a passed mark, 3 when the activity is completed but with a fail mark
        }
    } else {
        $completion_status = null;
    }
    return $completion_status;
}
开发者ID:juacas,项目名称:moodle-block_intuitel,代码行数:24,代码来源:locallib.php

示例9: mod_forumng_cm_info_view

function mod_forumng_cm_info_view(cm_info $cm)
{
    global $CFG;
    require_once $CFG->dirroot . '/mod/forumng/mod_forumng.php';
    static $forums = null;
    if ($forums === null) {
        // Read tracking is for real users only
        if (mod_forumng::enabled_read_tracking() && !isguestuser() && isloggedin()) {
            $forums = mod_forumng::get_course_forums($cm->get_course(), 0, mod_forumng::UNREAD_BINARY);
        } else {
            $forums = array();
        }
    }
    // If current forum is listed, check whether it's unread or not
    if (array_key_exists($cm->instance, $forums)) {
        if ($forums[$cm->instance]->has_unread_discussions()) {
            $cm->set_after_link('<span class="unread">' . get_string('hasunreadposts', 'forumng') . '</span>');
        }
    }
}
开发者ID:unikent,项目名称:moodle-mod_forumng,代码行数:20,代码来源:lib.php


注:本文中的cm_info::get_course方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。