Difference between revisions of "ResourceTemplateHelper class"

From Catglobe Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
|Name=<nowiki>ResourceTemplateHelper</nowiki>
 
|Name=<nowiki>ResourceTemplateHelper</nowiki>
 
|Description=<nowiki>Helper class for fetching information about resource templates</nowiki>
 
|Description=<nowiki>Helper class for fetching information about resource templates</nowiki>
|Constructors=
+
|InheritsFrom=object|Constructors=
 
{{CGscriptConstructors_Template|Description=<nowiki>Make new helper</nowiki>}}
 
{{CGscriptConstructors_Template|Description=<nowiki>Make new helper</nowiki>}}
 
|Methods=
 
|Methods=
Line 12: Line 12:
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceType</nowiki>|Description=<nowiki>RESOURCE_TYPE_x to determine which list of resource templates to get. 0 to fetch all</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceType</nowiki>|Description=<nowiki>RESOURCE_TYPE_x to determine which list of resource templates to get. 0 to fetch all</nowiki>}}
 
|Description=<nowiki>Get resource templates specified by the resource type constant</nowiki>}}
 
|Description=<nowiki>Get resource templates specified by the resource type constant</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Array of UserResourceTemplate|Name=<nowiki>GetAllUserTemplates</nowiki>|Description=<nowiki>Get all templates of the given type</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=ResourceTemplate|Name=<nowiki>GetTemplate</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=ResourceTemplate|Name=<nowiki>GetTemplate</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>Resource Id</nowiki>}}
 
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>Resource Id</nowiki>}}
Line 18: Line 19:
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Resource name</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceType</nowiki>|Description=<nowiki>RESOURCE_TYPE_x to determine which list of resource templates to get</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Resource name</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceType</nowiki>|Description=<nowiki>RESOURCE_TYPE_x to determine which list of resource templates to get</nowiki>}}
 
|Description=<nowiki>Get resource templates specified by the resource name</nowiki>}}
 
|Description=<nowiki>Get resource templates specified by the resource name</nowiki>}}
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|Properties=
 
|Properties=
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 
|StaticMethods=
 
|StaticMethods=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>ResourceTemplateHelper_initAllLocalizations</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>ResourceTemplateHelper_initAllLocalizations</nowiki>|Parameters=
Line 27: Line 28:
 
|Description=<nowiki>Fetch all localization from the db in one query</nowiki>}}
 
|Description=<nowiki>Fetch all localization from the db in one query</nowiki>}}
 
}}
 
}}
 +
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
  

Latest revision as of 08:38, 2 July 2020

ResourceTemplateHelper



Helper class for fetching information about resource templates

Parent class

Inherits from object

Constructors

  • () - Make new helper

Methods

  • Array of BulkmailResourceTemplate GetAllBulkMailTemplates() - Get all templates of the given type
  • Array of BulkSMSResourceTemplate GetAllBulkSmsTemplates() - Get all templates of the given type
  • Array of FolderResourceTemplate GetAllFolderTemplates() - Get all templates of the given type
  • Array of QuestionnaireResourceTemplate GetAllQuestionnaireTemplates() - Get all templates of the given type
  • Array of ResourceTemplate GetAllTemplates(int resourceType "RESOURCE_TYPE_x to determine which list of resource templates to get. 0 to fetch all") - Get resource templates specified by the resource type constant
  • Array of UserResourceTemplate GetAllUserTemplates() - Get all templates of the given type
  • ResourceTemplate GetTemplate(int resourceId "Resource Id") - Get resource templates specified by the resource id
  • ResourceTemplate GetTemplate(string name "Resource name", int resourceType "RESOURCE_TYPE_x to determine which list of resource templates to get") - Get resource templates specified by the resource name
  • (From object) string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.

Static Methods

  • Empty ResourceTemplateHelper_initAllLocalizations(Array of ResourceTemplate resourceTemplates "List of resource template to init for") - Fetch all localization from the db in one query

Examples

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);


// 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 );
}