Difference between revisions of "ResourceTemplateHelper"

From Catglobe Wiki
Jump to: navigation, search
(Replaced content with "Category:Archive")
(Tag: Replaced)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{CGscriptClass_Template
+
[[Category:Archive]]
|Name=ResourceTemplateHelper
 
|Description=Helper class for fetching information about resource templates
 
|Constructors=
 
{{CGscriptConstructors_Template|Description=Make new helper}}
 
|Methods=
 
{{CGscriptMethods_Template|ReturnType=Array of objects|Name=GetAllBulkMailTemplates|Description=Get all templates of the given type}}
 
{{CGscriptMethods_Template|ReturnType=Array of objects|Name=GetAllBulkSmsTemplates|Description=Get all templates of the given type}}
 
{{CGscriptMethods_Template|ReturnType=Array of objects|Name=GetAllFolderTemplates|Description=Get all templates of the given type}}
 
{{CGscriptMethods_Template|ReturnType=Array of objects|Name=GetAllQuestionnaireTemplates|Description=Get all templates of the given type}}
 
{{CGscriptMethods_Template|ReturnType=Array of objects|Name=GetAllTemplates|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=resourceType|Description=RESOURCE_TYPE_x to determine which list of resource templates to get}}
 
|Description=Get resource templates specified by the resource type constant}}
 
{{CGscriptMethods_Template|ReturnType=ResourceTemplate|Name=GetTemplate|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=resourceId|Description=Resource Id}}
 
|Description=Get resource templates specified by the resource id}}
 
{{CGscriptMethods_Template|ReturnType=ResourceTemplate|Name=GetTemplate|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=name|Description=Resource name|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=resourceType|Description=RESOURCE_TYPE_x to determine which list of resource templates to get}}
 
|Description=Get resource templates specified by the resource name}}
 
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
 
|Properties=
 
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
}}
 
 
 
=== Examples ===
 
 
 
<source lang="javascript">
 
array list={
 
Resource_Type_BulkSms
 
};
 
ResourceTemplateHelper a;
 
array s=a.GetAllTemplates(list[0]);
 
print(s);
 
for(number i=0;i<s.Count;i++)
 
{
 
print("-----------");
 
BulkSMSResourceTemplate n=s[i];
 
print(n.ResourceId);
 
print(n.ResourceName);
 
print(n.LocalizedNames);
 
};
 
BulkSMSResourceTemplate templates=new BulkSMSResourceTemplate("Test bulk mail new SMS");
 
templates.IsBulkDependant =true;
 
templates.DependantSendToPartly = true;
 
templates.DependantSendToCompleted = true;
 
templates.DependantSendToNotStarted = true;
 
templates.LocalizedNames = {"da-DK": "Test bulk mail"};
 
templates.DefaultLanguage("da-DK");
 
templates.Save();
 
print("-----------");
 
print(templates.ResourceId);
 
print(templates.ResourceName);
 
print(templates.LocalizedNames);
 
</source>
 
 
 
<br/><source lang="javascript">
 
// EX for using GetTemplate, GetAllFolderTemplates, GetAllQuestionnaireTemplates
 
number i;
 
number folderResourceTemplateRId = 15547989;
 
 
 
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
 
 
 
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
 
print(folderRT.ResourceName);
 
 
 
array allFolderResourceTemplate = rth.GetAllFolderTemplates();
 
for(i=0;i<allFolderResourceTemplate.Count ;i++)
 
{
 
print(allFolderResourceTemplate[i].ResourceName );
 
}
 
 
 
array allQuestionnaireResourceTemplate = rth.GetAllQuestionnaireTemplates();
 
for(i=0;i<allQuestionnaireResourceTemplate.Count ;i++)
 
{
 
print(allQuestionnaireResourceTemplate[i].ResourceName );
 
}
 
 
 
 
 
</source>
 

Latest revision as of 03:16, 28 February 2019