當前位置: 首頁>>代碼示例>>PHP>>正文


PHP workshop::get_submissions_grouped方法代碼示例

本文整理匯總了PHP中workshop::get_submissions_grouped方法的典型用法代碼示例。如果您正苦於以下問題:PHP workshop::get_submissions_grouped方法的具體用法?PHP workshop::get_submissions_grouped怎麽用?PHP workshop::get_submissions_grouped使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在workshop的用法示例。


在下文中一共展示了workshop::get_submissions_grouped方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

	}
	$SESSION->workshop_upload_messages = $failures;

} else {

	$usernames = array();
	foreach($csv as $a) {
		$usernames = array_merge($usernames,array_map('trim',array_slice($a,1)));
	}

	$users = $DB->get_records_list('user','username',$usernames,'','username,id,firstname,lastname');
	$groups = groups_get_all_groups($course->id,0,$cm->groupingid,'g.name,g.id');
 
	$failures = array(); // username => reason

	$submissions = $workshop->get_submissions_grouped();
    $submissions_by_group = array();
    foreach($submissions as $k => $s) {
        $submissions_by_group[$s->group->id] = $s;
    }
    
	foreach($csv as $a) {
		if(!empty($a)) {
			$reviewee = trim($a[0]);
			$reviewers = array_slice($a,1);
			
			if (empty($reviewee)) continue;
			if (empty($reviewers)) continue;
			
			if (empty($groups[$reviewee])) {
				$failures[$reviewee] = "error::No group for name $reviewee";
開發者ID:JP-Git,項目名稱:moodle,代碼行數:31,代碼來源:teamupload.php

示例2: __construct


//.........這裏部分代碼省略.........
            } elseif ($workshop->teammode && $workshop->get_submission_by_author($userid,'s.id') !== false) {
              	$task->completed = true;
            } elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
                $task->completed = false;
            } else {
                $task->completed = null;    // still has a chance to submit
            }
            $phase->tasks['submit'] = $task;
        }
        if (has_capability('mod/workshop:allocate', $workshop->context, $userid)) {
            if ($workshop->phaseswitchassessment) {
                $task = new stdClass();
                $allocator = $DB->get_record('workshopallocation_scheduled', array('workshopid' => $workshop->id));
                if (empty($allocator)) {
                    $task->completed = false;
                } else if ($allocator->enabled and is_null($allocator->resultstatus)) {
                    $task->completed = true;
                } else if ($workshop->submissionend > time()) {
                    $task->completed = null;
                } else {
                    $task->completed = false;
                }
                $task->title = get_string('setup', 'workshopallocation_scheduled');
                $task->link = $workshop->allocation_url('scheduled');
                $phase->tasks['allocatescheduled'] = $task;
            }
            $task = new stdclass();
            $task->title = get_string('allocate', 'workshop');
            $task->link = $workshop->allocation_url();
            $numofauthors = $workshop->count_potential_authors(false);
            
            //these two counting methods need different code for teammode and normal mode
            if ($workshop->teammode) {
                $submissions_grouped = $workshop->get_submissions_grouped();
                $numofsubmissions = count($submissions_grouped);
            } else {
                $numofsubmissions = $DB->count_records('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0));
            }
            
            //common sql to teammode and non-teammode count
            if ($workshop->teammode) {
                if (count($submissions_grouped)) {
                    list($inorequal, $params) = $DB->get_in_or_equal(array_keys($submissions_grouped));
                    $sql = "SELECT COUNT(DISTINCT submissionid) FROM {workshop_assessments} WHERE submissionid $inorequal";
                    $numnonallocated = $numofsubmissions - $DB->count_records_sql($sql,$params);
                } else {
                    $numnonallocated = 0;
                }
            } else {
                $sql = 'SELECT COUNT(s.id) FROM {workshop_submissions} s
                 LEFT JOIN {workshop_assessments} a ON (a.submissionid=s.id)
                     WHERE s.workshopid = :workshopid AND s.example=0 AND a.submissionid IS NULL';
                $params['workshopid'] = $workshop->id;
                $numnonallocated = $DB->count_records_sql($sql, $params);
            }
            
            
            
            if ($numofsubmissions == 0) {
                $task->completed = null;
            } elseif ($numnonallocated == 0) {
                $task->completed = true;
            } elseif ($workshop->phase > workshop::PHASE_SUBMISSION) {
                $task->completed = false;
            } else {
                $task->completed = null;    // still has a chance to allocate
開發者ID:JP-Git,項目名稱:moodle,代碼行數:67,代碼來源:locallib.php


注:本文中的workshop::get_submissions_grouped方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。