Merge pull request #4375 from totten/master-mysqli-compat
[civicrm-core.git] / templates / CRM / Price / Form / PriceSet.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 *}
26 <div id="priceset" class="crm-section price_set-section">
27 {if $priceSet.help_pre}
28 <div class="messages help">{$priceSet.help_pre}</div>
29 {/if}
30
31 {assign var='adminFld' value=false}
32 {if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM') }
33 {assign var='adminFld' value=true}
34 {/if}
35
36 {foreach from=$priceSet.fields item=element key=field_id}
37 {* Skip 'Admin' visibility price fields WHEN this tpl is used in online registration unless user has administer CiviCRM permission. *}
38 {if $element.visibility EQ 'public' || ($element.visibility EQ 'admin' && $adminFld EQ true) || $context eq 'standalone' || $context eq 'advanced' || $context eq 'search' || $context eq 'participant' || $context eq 'dashboard' || $action eq 1024}
39 <div class="crm-section {$element.name}-section">
40 {if ($element.html_type eq 'CheckBox' || $element.html_type == 'Radio') && $element.options_per_line}
41 {assign var="element_name" value="price_"|cat:$field_id}
42 <div class="label">{$form.$element_name.label}</div>
43 <div class="content {$element.name}-content">
44 {assign var="rowCount" value="1"}
45 {assign var="count" value="1"}
46 {foreach name=outer key=key item=item from=$form.$element_name}
47 {if is_numeric($key) }
48 {if $count == 1}<div class="price-set-row {$element.name}-row{$rowCount}">{/if}
49 <span class="price-set-option-content">{$form.$element_name.$key.html}</span>
50 {if $count == $element.options_per_line}
51 </div>
52 {assign var="rowCount" value=`$rowCount+1`}
53 {assign var="count" value="1"}
54 {else}
55 {assign var="count" value=`$count+1`}
56 {/if}
57 {/if}
58 {/foreach}
59 {if $element.help_post}
60 <div class="description">{$element.help_post}</div>
61 {/if}
62 </div>
63 <div class="clear"></div>
64
65 {else}
66
67 {assign var="element_name" value="price_"|cat:$field_id}
68
69 <div class="label">{$form.$element_name.label}</div>
70 <div class="content {$element.name}-content">{$form.$element_name.html}
71 {if $element.is_display_amounts && $element.html_type eq 'Text'}
72 <span class="price-field-amount">
73 {foreach item=option from=$element.options}
74 {if ($option.tax_amount || $option.tax_amount == "0") && $displayOpt && $invoicing}
75 {assign var="amount" value=`$option.amount+$option.tax_amount`}
76 {if $displayOpt == 'Do_not_show'}
77 {$amount|crmMoney}
78 {elseif $displayOpt == 'Inclusive'}
79 {$amount|crmMoney}
80 <span class='crm-price-amount-label'> (includes {$taxTerm} of {$option.tax_amount|crmMoney})</span>
81 {else}
82 {$option.amount|crmMoney}
83 <span class='crm-price-amount-label'> + {$option.tax_amount|crmMoney} {$taxTerm}</span>
84 {/if}
85 {else}
86 {$option.amount|crmMoney}
87 {/if}
88 {/foreach}
89 </span>
90 {/if}
91 {if $element.help_post}<br /><span class="description">{$element.help_post}</span>{/if}
92 </div>
93 <div class="clear"></div>
94
95 {/if}
96 </div>
97 {/if}
98 {/foreach}
99
100 {if $priceSet.help_post}
101 <div class="messages help">{$priceSet.help_post}</div>
102 {/if}
103
104 {* Include the total calculation widget if this is NOT a quickconfig event/contribution page. *}
105 {if !$quickConfig and !$dontInclCal}
106 {include file="CRM/Price/Form/Calculate.tpl"}
107 {/if}
108 </div>