Esempio n. 1
0
					$mapleta->endtime = $element->end;
					$mapleta->policy = $element->policy;
					
					$grades = array (
										'id' => $user->id,
										'userid' => $user->id,
										'rawgrade' => $subelement->score,
										'dategraded' => $subelement->dateGraded,
										'datesubmitted' => $subelement->dateGraded
									);
									
					if (mapleta_grade_item_update($mapleta, $grades) != GRADE_UPDATE_FAILED) {
						mapleta_ws_send_success();
					} else {
						mapleta_ws_send_error('Failed updating grade');
					}
					
				} else {
					mapleta_ws_send_error('No user found');
									}
			} else {
				mapleta_ws_send_error('No assignment found');
			}
		} else {
			mapleta_ws_send_error('No course mapping found');
		}
	} else {
		mapleta_ws_send_empty('No grade data received');
	}
?>
//					mapleta_ws_send_error('No assignment found');
				}
			} else {
				mapleta_ws_send_error('No course mapping found');
				return;
			}
		}
		
		$message = 	"$success_counter grade(s) updated";
		
		if ($grade_failure_counter > 0) {
			$message = $message . "\\n$grade_failure_counter update(s) failed";
		}
		if ($assignment_failure_counter > 0) {
			$message = $message . "\\n$assignment_failure_counter assignment(s) not found";
		}
		if ($user_failure_counter > 0) {
			$message = $message . "\\n$user_failure_counter user(s) not found";
		}
		
		if ($failure_counter == 0) {
			mapleta_ws_send_success($message);	
		} else {
			mapleta_ws_send_error($message);	
		}
		
	} else {
		mapleta_ws_send_empty('No grade data received');
	}
?>