示例#1
0
function vpl_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0)
{
    global $CFG, $USER, $DB;
    $grader = false;
    $vpl = new mod_vpl($cmid);
    $modinfo =& get_fast_modinfo($vpl->get_course());
    $cm = $modinfo->cms[$cmid];
    if ($vpl->is_visible()) {
        $vplid = $vpl->get_instance()->id;
        $grader = $vpl->has_capability(VPL_GRADE_CAPABILITY);
    } else {
        return;
    }
    $select = '(vpl = ?)';
    $select .= ' and ((datesubmitted >= ?) or (dategraded >= ?))';
    $parms = array($vplid, $timestart, $timestart);
    if (!$grader) {
        //Own activity
        array_unshift($parms, $USER->id);
        $select = '(userid = ?) and ' . $select;
    }
    $subs = $DB->get_records_select(VPL_SUBMISSIONS, $select, $parms, 'datesubmitted DESC');
    $aname = format_string($vpl->get_printable_name(), true);
    foreach ($subs as $sub) {
        //Show recent activity
        $activity = new stdClass();
        $activity->type = 'vpl';
        $activity->cmid = $cm->id;
        $activity->name = $aname;
        $activity->sectionnum = $cm->sectionnum;
        $activity->timestamp = $sub->datesubmitted;
        if ($grader) {
            $activity->grade = $sub->grade;
        }
        $activity->user = $DB->get_record('user', array('id' => $sub->userid));
        $activities[$index++] = $activity;
    }
    return true;
}
示例#2
0
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Show URL to web service with token
 *
 * @package mod_vpl
 * @copyright 2014 Juan Carlos Rodríguez-del-Pino
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @author Juan Carlos Rodríguez-del-Pino <*****@*****.**>
 */
require_once dirname(__FILE__) . '/../../../config.php';
require_once dirname(__FILE__) . '/../vpl.class.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('views/show_webservice.php', array('id' => $id));
$vpl->require_capability(VPL_VIEW_CAPABILITY);
$log_url = vpl_rel_url('views/show_webservice.php', 'id', $id);
if (!$vpl->is_visible()) {
    notice(get_string('notavailable'));
}
$vpl->print_header(get_string('createtokenforuser', 'core_webservice'));
$vpl->print_view_tabs('view.php');
echo '<h1>' . get_string('webservice', 'core_webservice') . '</h1>';
echo '<h3>' . get_string('createtokenforuserdescription', 'core_webservice') . '</h3>';
$service_url = vpl_get_webservice_urlbase($vpl);
echo $OUTPUT->box('<div style="white-space: pre-wrap">' . s($service_url) . '</div>');
\mod_vpl\event\vpl_webservice_token_viewed::log($vpl);
notice('', vpl_mod_href('view.php', 'id', $id));
$vpl->print_footer();
示例#3
0
    $urls[$url_base->out(false)] = get_string($sel, VPL);
    $urlindex[$sel] = $url_base->out(false);
}
echo $OUTPUT->url_select($urls, $urlindex[$instanceselection], array());
if (!($cms = get_coursemodules_in_course(VPL, $course->id, "m.shortdescription, m.startdate, m.duedate"))) {
    notice($strnopls, vpl_abs_href('/course/view.php', 'id', $course->id));
    die;
}
$ovpls = get_all_instances_in_course(VPL, $course);
$timenow = time();
$vpls = array();
//Get and select vpls to show
foreach ($ovpls as $ovpl) {
    $vpl = new mod_vpl(false, $ovpl->id);
    $instance = $vpl->get_instance();
    if ($vpl->is_visible()) {
        switch ($instanceselection) {
            case 'all':
                $vpls[] = $vpl;
                break;
            case 'open':
                $min = $instance->startdate;
                $max = $instance->duedate == 0 ? PHP_INT_MAX : $instance->duedate;
                if ($timenow >= $min && $timenow <= $max) {
                    $vpls[] = $vpl;
                }
                break;
            case 'closed':
                $min = $instance->startdate;
                $max = $instance->duedate == 0 ? PHP_INT_MAX : $instance->duedate;
                if ($timenow < $min || $timenow > $max) {