forked from RusticiSoftware/TinCan.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ActivityDefinition has been extended to include: interactionType correctResponsesPattern choices scale target step This as been based on the work carried out by Paul Carpenter and is my first GitHub submission.
- Loading branch information
1 parent
b633f78
commit 8a3a563
Showing
6 changed files
with
293 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
Copyright 2014 Rustici Software | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json.Linq; | ||
using TinCan.Json; | ||
|
||
namespace TinCan | ||
{ | ||
public class InteractionComponent : JsonModel | ||
{ | ||
public String id; | ||
public LanguageMap description { get; set; } | ||
|
||
public InteractionComponent() | ||
{ | ||
|
||
} | ||
|
||
public InteractionComponent(JObject jobj) | ||
{ | ||
if (jobj["id"] != null) | ||
{ | ||
id = jobj.Value<String>("id"); | ||
} | ||
if (jobj["description"] != null) | ||
{ | ||
description = (LanguageMap)jobj.Value<JObject>("description"); | ||
} | ||
|
||
} | ||
|
||
public override JObject ToJObject(TCAPIVersion version) { | ||
JObject result = new JObject(); | ||
|
||
if (id != null) | ||
{ | ||
result.Add("id", id); | ||
} | ||
if (description != null && !description.isEmpty()) | ||
{ | ||
result.Add("description", description.ToJObject(version)); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public static explicit operator InteractionComponent(JObject jobj) | ||
{ | ||
return new InteractionComponent(jobj); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace TinCan | ||
{ | ||
public sealed class InteractionType | ||
{ | ||
private const string choice = "choice"; | ||
private const string sequencing = "sequencing"; | ||
private const string likert = "likert"; | ||
private const string matching = "matching"; | ||
private const string performance = "performance"; | ||
private const string truefalse = "true-false"; | ||
private const string fillin = "fill-in"; | ||
private const string numeric = "numeric"; | ||
private const string other = "other"; | ||
|
||
|
||
public static readonly InteractionType Choice = new InteractionType("choice"); | ||
public static readonly InteractionType Sequencing = new InteractionType("sequencing"); | ||
public static readonly InteractionType Likert = new InteractionType("likert"); | ||
public static readonly InteractionType Matching = new InteractionType("matching"); | ||
public static readonly InteractionType Performance = new InteractionType("performance"); | ||
public static readonly InteractionType TrueFalse = new InteractionType("true-false"); | ||
public static readonly InteractionType FillIn = new InteractionType("fill-in"); | ||
public static readonly InteractionType Numeric = new InteractionType("numeric"); | ||
public static readonly InteractionType Other = new InteractionType("other"); | ||
|
||
|
||
private InteractionType(string value) | ||
{ | ||
Value = value; | ||
} | ||
|
||
public static InteractionType FromValue(string value) | ||
{ | ||
switch (value) | ||
{ | ||
case choice: | ||
return Choice; | ||
|
||
case sequencing: | ||
return Sequencing; | ||
|
||
case likert: | ||
return Likert; | ||
|
||
case matching: | ||
return Matching; | ||
|
||
case performance: | ||
return Performance; | ||
|
||
case truefalse: | ||
return TrueFalse; | ||
|
||
case fillin: | ||
return FillIn; | ||
|
||
case numeric: | ||
return Numeric; | ||
|
||
case other: | ||
return Other; | ||
|
||
default: | ||
return null; | ||
|
||
} | ||
} | ||
|
||
public string Value { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters