1 <div id=
"bootstrap-theme" class=
"api4-explorer-page">
2 <div crm-ui-debug=
"availableParams"></div>
5 {{ ts('CiviCRM APIv4') }}{{ entity ? (' (' + entity + '::' + action + ')') : '' }}
8 <!--This warning will show if bootstrap is unavailable. Normally it will be hidden by the bootstrap .collapse class.-->
9 <div class=
"messages warning no-popup collapse">
11 <i class=
"crm-i fa-exclamation-triangle"></i>
12 <strong>{{ ts('Bootstrap theme not found.') }}
</strong>
14 <p>{{ ts('This screen may not work correctly without a bootstrap-based theme such as Shoreditch installed.') }}
</p>
17 <div class=
"api4-explorer-row">
18 <form name=
"api4-explorer" class=
"panel panel-default explorer-params-panel">
19 <div class=
"panel-heading">
20 <div class=
"form-inline">
21 <span ng-mouseenter=
"help('entity', paramDoc('$entity'))" ng-mouseleave=
"help()">
22 <input class=
"collapsible-optgroups form-control" ng-model=
"entity" ng-disabled=
"!entities.length" ng-class=
"{loading: !entities.length}" crm-ui-select=
"{placeholder: ts('Entity'), data: entities}" />
24 <span ng-mouseenter=
"help('action', paramDoc('$action'))" ng-mouseleave=
"help()">
25 <input class=
"collapsible-optgroups form-control" ng-model=
"action" ng-disabled=
"!entity || !actions.length" ng-class=
"{loading: entity && !actions.length}" crm-ui-select=
"{placeholder: ts('Action'), data: actions}" />
27 <input class=
"form-control api4-index" type=
"search" ng-model=
"index" ng-mouseenter=
"help('index', paramDoc('$index'))" ng-mouseleave=
"help()" placeholder=
"{{ ts('Index') }}" />
28 <button class=
"btn btn-success pull-right" crm-icon=
"fa-bolt" ng-disabled=
"!entity || !action || loading" ng-click=
"execute()" ng-mouseenter=
"help(ts('Execute'), executeDoc())" ng-mouseleave=
"help()">{{ ts('Execute') }}
</button>
29 <button class=
"btn btn-primary pull-right" crm-icon=
"fa-save" ng-show=
"perm.editGroups && entity === 'Contact' && action === 'get'" ng-click=
"save()" ng-mouseenter=
"help(ts('Save smart group'), saveDoc())" ng-mouseleave=
"help()">{{ ts('Save...') }}
</button>
32 <div class=
"panel-body">
33 <div class=
"api4-input form-inline">
34 <label class=
"form-control" ng-mouseenter=
"help(name, param)" ng-mouseleave=
"help()" ng-class=
"{'api4-option-selected': params[name]}" ng-repeat=
"(name, param) in availableParams" ng-if=
"!isSpecial(name) && param.type[0] === 'bool' && param.default !== null">
35 <input type=
"checkbox" id=
"api4-param-{{ name }}" ng-model=
"params[name]"/>
36 {{ name }}
<span class=
"crm-marker" ng-if=
"param.required"> *
</span>
38 <label class=
"form-control" ng-mouseenter=
"help('selectRowCount', availableParams.select)" ng-mouseleave=
"help()" ng-class=
"{'api4-option-selected': isSelectRowCount()}" ng-if=
"availableParams.select">
39 <input type=
"checkbox" id=
"api4-param-selectRowCount" ng-checked=
"isSelectRowCount()" ng-click=
"selectRowCount()" />
43 <div class=
"api4-input form-inline" ng-mouseenter=
"help(name, param)" ng-mouseleave=
"help()" ng-repeat=
"(name, param) in availableParams" ng-if=
"!isSpecial(name) && param.type[0] === 'bool' && param.default === null">
44 <label>{{ name }}
<span class=
"crm-marker" ng-if=
"param.required"> *
</span></label>
45 <label class=
"radio-inline">
46 <input type=
"radio" ng-model=
"params[name]" ng-value=
"true" />true
48 <label class=
"radio-inline">
49 <input type=
"radio" ng-model=
"params[name]" ng-value=
"false" />false
51 <a href
class=
"crm-hover-button" title=
"Clear" ng-click=
"clearParam(name)" ng-show=
"params[name] !== null"><i class=
"crm-i fa-times"></i></a>
53 <fieldset class=
"api4-input form-inline" ng-mouseenter=
"help('select', availableParams.select)" ng-mouseleave=
"help()" ng-if=
"availableParams.select && !isSelectRowCount()">
54 <legend>select
<span class=
"crm-marker" ng-if=
"availableParams.select.required"> *
</span></legend>
55 <div ng-model=
"params.select" ui-sortable=
"{axis: 'y'}">
56 <div class=
"api4-input form-inline" ng-repeat=
"item in params.select track by $index">
57 <i class=
"crm-i fa-arrows"></i>
58 <input class=
"form-control huge" type=
"text" ng-model=
"params.select[$index]" />
59 <a href
class=
"crm-hover-button" title=
"Clear" ng-click=
"clearParam('select', $index)"><i class=
"crm-i fa-times"></i></a>
62 <div class=
"api4-input form-inline">
63 <input class=
"collapsible-optgroups form-control huge" ng-model=
"controls.select" crm-ui-select=
"{data: fieldsAndJoinsAndFunctionsAndWildcards}" placeholder=
"Add select" />
66 <div class=
"api4-input form-inline" ng-mouseenter=
"help('fields', availableParams.fields)" ng-mouseleave=
"help()"ng-if=
"availableParams.fields">
67 <label for=
"api4-param-fields">fields
<span class=
"crm-marker" ng-if=
"availableParams.fields.required"> *
</span></label>
68 <input class=
"form-control" ng-list
crm-ui-select=
"{data: fields, multiple: true}" id=
"api4-param-fields" ng-model=
"params.fields" style=
"width: 85%;"/>
70 <div class=
"api4-input form-inline" ng-mouseenter=
"help('action', availableParams.action)" ng-mouseleave=
"help()"ng-if=
"availableParams.action">
71 <label for=
"api4-param-action">action
<span class=
"crm-marker" ng-if=
"availableParams.action.required"> *
</span></label>
72 <input class=
"form-control" crm-ui-select=
"{data: actions, allowClear: true, placeholder: 'None'}" id=
"api4-param-action" ng-model=
"params.action"/>
74 <div class=
"api4-input form-inline" ng-mouseenter=
"help(name, param)" ng-mouseleave=
"help()" ng-repeat=
"(name, param) in availableParams" ng-if=
"!isSpecial(name) && (param.type[0] === 'string' || param.type[0] === 'int')">
75 <label for=
"api4-param-{{ name }}">{{ name }}
<span class=
"crm-marker" ng-if=
"param.required"> *
</span></label>
76 <input class=
"form-control" ng-if=
"!param.options" type=
"{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id=
"api4-param-{{ name }}" ng-model=
"params[name]"/>
77 <select class=
"form-control" ng-if=
"param.options" ng-options=
"o for o in param.options" id=
"api4-param-{{ name }}" ng-model=
"params[name]"></select>
78 <a href
class=
"crm-hover-button" title=
"Clear" ng-click=
"clearParam(name)" ng-show=
"!!params[name]"><i class=
"crm-i fa-times"></i></a>
80 <div class=
"api4-input" ng-mouseenter=
"help(name, param)" ng-mouseleave=
"help()" ng-repeat=
"(name, param) in availableParams" ng-if=
"!isSpecial(name) && (param.type[0] === 'array' || param.type[0] === 'mixed')">
81 <label for=
"api4-param-{{ name }}">{{ name }}
<span class=
"crm-marker" ng-if=
"param.required"> *
</span></label>
82 <textarea class=
"form-control" type=
"{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id=
"api4-param-{{ name }}" ng-model=
"params[name]">
85 <fieldset ng-if=
"availableParams.where" class=
"api4-clause-fieldset" ng-mouseenter=
"help('where', availableParams.where)" ng-mouseleave=
"help()" crm-api4-clause=
"{type: 'where', clauses: params.where, required: availableParams.where.required, op: 'AND', label: 'where', fields: fieldsAndJoins}">
87 <fieldset ng-repeat=
"name in ['values', 'defaults']" ng-if=
"availableParams[name]" ng-mouseenter=
"help(name, availableParams[name])" ng-mouseleave=
"help()">
88 <legend>{{ name }}
<span class=
"crm-marker" ng-if=
"availableParams[name].required"> *
</span></legend>
89 <div class=
"api4-input form-inline" ng-repeat=
"clause in params[name]" ng-mouseenter=
"help('value: ' + clause[0], fieldHelp(clause[0]))" ng-mouseleave=
"help(name, availableParams[name])">
90 <input class=
"collapsible-optgroups form-control" ng-model=
"clause[0]" crm-ui-select=
"{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: fieldList(name), allowClear: true, placeholder: 'Field'}" />
91 <input class=
"form-control" ng-model=
"clause[1]" api4-exp-value=
"{field: clause[0], action: action === 'getFields' ? params.action || 'get' : action}" />
93 <div class=
"api4-input form-inline">
94 <input class=
"collapsible-optgroups form-control" ng-model=
"controls[name]" crm-ui-select=
"{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: fieldList(name), placeholder: ts('Add %1', {1: name.slice(0, -1)})}"/>
97 <fieldset ng-if=
"availableParams.groupBy" ng-mouseenter=
"help('groupBy', availableParams.groupBy)" ng-mouseleave=
"help()">
98 <legend>groupBy
<span class=
"crm-marker" ng-if=
"availableParams.groupBy.required"> *
</span></legend>
99 <div ng-model=
"params.groupBy" ui-sortable=
"{axis: 'y'}">
100 <div class=
"api4-input form-inline" ng-repeat=
"item in params.groupBy track by $index">
101 <i class=
"crm-i fa-arrows"></i>
102 <input class=
"form-control huge" type=
"text" ng-model=
"params.groupBy[$index]" />
103 <a href
class=
"crm-hover-button" title=
"Clear" ng-click=
"clearParam('groupBy', $index)"><i class=
"crm-i fa-times"></i></a>
106 <div class=
"api4-input form-inline">
107 <input class=
"collapsible-optgroups form-control huge" ng-model=
"controls.groupBy" crm-ui-select=
"{data: fieldsAndJoinsAndFunctions}" placeholder=
"Add groupBy" />
110 <fieldset ng-if=
"availableParams.orderBy" ng-mouseenter=
"help('orderBy', availableParams.orderBy)" ng-mouseleave=
"help()">
111 <legend>orderBy
<span class=
"crm-marker" ng-if=
"availableParams.orderBy.required"> *
</span></legend>
112 <div ng-model=
"params.orderBy" ui-sortable=
"{axis: 'y'}">
113 <div class=
"api4-input form-inline" ng-repeat=
"clause in params.orderBy">
114 <i class=
"crm-i fa-arrows"></i>
115 <input class=
"form-control huge" type=
"text" ng-model=
"clause[0]" />
116 <select class=
"form-control" ng-model=
"clause[1]">
117 <option value=
"ASC">ASC
</option>
118 <option value=
"DESC">DESC
</option>
120 <a href
class=
"crm-hover-button" title=
"Clear" ng-click=
"clearParam('orderBy', $index)"><i class=
"crm-i fa-times"></i></a>
123 <div class=
"api4-input form-inline">
124 <input class=
"collapsible-optgroups form-control huge" ng-model=
"controls.orderBy" crm-ui-select=
"{data: fieldsAndJoinsAndFunctions}" placeholder=
"Add orderBy" />
127 <fieldset ng-if=
"availableParams.limit && availableParams.offset">
128 <div class=
"api4-input form-inline">
129 <span ng-mouseenter=
"help('limit', availableParams.limit)" ng-mouseleave=
"help()">
130 <label for=
"api4-param-limit">limit
<span class=
"crm-marker" ng-if=
"availableParams.limit.required"> *
</span></label>
131 <input class=
"form-control" type=
"number" min=
"0" id=
"api4-param-limit" ng-model=
"params.limit"/>
133 <span ng-mouseenter=
"help('offset', availableParams.offset)" ng-mouseleave=
"help()">
134 <label for=
"api4-param-offset">offset
<span class=
"crm-marker" ng-if=
"availableParams.offset.required"> *
</span></label>
135 <input class=
"form-control" type=
"number" min=
"0" id=
"api4-param-offset" ng-model=
"params.offset"/>
137 <a href
class=
"crm-hover-button" title=
"Clear" ng-click=
"clearParam('limit');clearParam('offset');" ng-show=
"!!params.limit || !!params.offset"><i class=
"crm-i fa-times"></i></a>
140 <fieldset ng-if=
"availableParams.chain" ng-mouseenter=
"help('chain', availableParams.chain)" ng-mouseleave=
"help()">
141 <legend>chain
</legend>
142 <div class=
"api4-input form-inline" ng-repeat=
"clause in params.chain" api4-exp-chain=
"clause" entities=
"entities" main-entity=
"entity" >
144 <div class=
"api4-input form-inline">
145 <input class=
"form-control" ng-model=
"controls.chain" crm-ui-select=
"{data: entities}" placeholder=
"Add chain" />
150 <div class=
"panel panel-info explorer-help-panel">
151 <div class=
"panel-heading">
152 <h3 class=
"panel-title" crm-icon=
"fa-info-circle">{{ helpTitle }}
</h3>
154 <div class=
"panel-body">
155 <h4 ng-bind-html=
"helpContent.description"></h4>
156 <div ng-bind-html=
"helpContent.comment"></div>
157 <p ng-repeat=
"(key, item) in helpContent" ng-if=
"key !== 'description' && key !== 'comment' && key !== 'see'">
158 <strong>{{ key }}:
</strong> {{ item }}
160 <div ng-if=
"helpContent.see">
161 <strong>See:
</strong>
163 <li ng-repeat=
"ref in helpContent.see" ng-bind-html=
"ref"> </li>
169 <div class=
"api4-explorer-row">
170 <div class=
"panel panel-warning explorer-code-panel">
171 <ul class=
"panel-heading nav nav-tabs">
172 <li role=
"presentation" ng-repeat=
"tab in code" ng-class=
"{active: selectedTab.code === tab.lang}">
173 <a href
ng-click=
"selectedTab.code = tab.lang">
178 <div class=
"panel-body">
179 <table ng-repeat=
"tab in code" ng-show=
"selectedTab.code === tab.lang">
180 <tr ng-repeat=
"style in tab.style">
181 <td>{{ style.label }}
</td>
182 <td><pre class=
"prettyprint" ng-bind-html=
"style.code"></pre></td>
187 <div class=
"panel explorer-result-panel panel-{{ status }}" >
188 <ul class=
"panel-heading nav nav-tabs">
189 <li role=
"presentation" ng-class=
"{active: selectedTab.result === 'result'}">
190 <a href
ng-click=
"selectedTab.result = 'result'">
191 <i class=
"fa fa-fw fa-circle-o" ng-if=
"status === 'default'"></i>
192 <i class=
"fa fa-fw fa-check-circle" ng-if=
"status === 'success'"></i>
193 <i class=
"fa fa-fw fa-minus-circle" ng-if=
"status === 'danger'"></i>
194 <i class=
"fa fa-fw fa-spinner fa-pulse" ng-if=
"status === 'warning'"></i>
195 <span>{{ ts('Result') }}
</span>
198 <li role=
"presentation" ng-if=
"perm.accessDebugOutput" ng-class=
"{active: selectedTab.result === 'debug'}">
199 <a href
ng-click=
"selectedTab.result = 'debug'">
200 <i class=
"fa fa-fw fa-{{ debug ? 'bug' : 'circle-o' }}"></i>
201 <span>{{ ts('Debug') }}
</span>
205 <div class=
"panel-body">
206 <div ng-show=
"selectedTab.result === 'result'">
207 <pre class=
"prettyprint" ng-repeat=
"code in result" ng-bind-html=
"code"></pre>
209 <div ng-show=
"selectedTab.result === 'debug'">
210 <pre ng-if=
"debug" class=
"prettyprint" ng-bind-html=
"debug"></pre>
212 {{ ts('To view debugging output, enable the debug param before executing.') }}
215 {{ ts('Enable backtrace in system settings to see error backtraces.') }}