All Data Structures Functions Variables Pages
AutoresponderEditAndDetailsView.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
38  {
39  public static function getDefaultMetadata()
40  {
41  $metadata = array(
42  'global' => array(
43  'toolbar' => array(
44  'elements' => array(
45  array('type' => 'SaveButton', 'renderType' => 'Edit'),
46  array('type' => 'AutorespondersCancelLink', 'renderType' => 'Edit'),
47  array('type' => 'EditLink', 'renderType' => 'Details'),
48  array('type' => 'AutoresponderDeleteLink'),
49  ),
50  ),
51  'panels' => array(
52  array(
53  'rows' => array(
54  array('cells' =>
55  array(
56  array(
57  'elements' => array(
58  array('attributeName' => 'operationType',
59  'type' => 'AutoresponderOperationType'),
60  ),
61  ),
62  )
63  ),
64  array('cells' =>
65  array(
66  array(
67  'elements' => array(
68  array('attributeName' => 'null',
69  'type' => 'AutoresponderFromOperationDuration'),
70  ),
71  ),
72  )
73  ),
74  array('cells' =>
75  array(
76  array(
77  'elements' => array(
78  array('attributeName' => 'subject', 'type' => 'Text'),
79  ),
80  ),
81  )
82  ),
83  array('cells' =>
84  array(
85  array(
86  'elements' => array(
87  array('attributeName' => 'enableTracking',
88  'type' => 'EnableTrackingCheckBox'),
89  ),
90  ),
91  )
92  ),
93  array('cells' =>
94  array(
95  array(
96  // TODO: @Shoaibi: Low: change this to constant after refactoring
97  'detailViewOnly' => 2, // using 2 here to mean: "do not render on details"
98  'elements' => array(
99  array('attributeName' => 'null', 'type' => 'EmailTemplate')
100  ),
101  ),
102  )
103  ),
104  array('cells' =>
105  array(
106  array(
107  'elements' => array(
108  array('attributeName' => 'null', 'type' => 'Files'),
109  ),
110  ),
111  )
112  ),
113  ),
114  ),
115  ),
116  ),
117  );
118  return $metadata;
119  }
120 
121  protected function renderAfterFormLayout($form)
122  {
123  $content = $this->renderHtmlAndTextContentElement($this->model, null, $form);
124  return ZurmoHtml::tag('div', array('class' => 'email-template-combined-content left-column full-width strong-right clearfix'), $content);
125  }
126 
127  protected function renderAfterFormLayoutForDetailsContent($form = null)
128  {
129  return $this->renderHtmlAndTextContentElement($this->model, null, $form) .
130  parent::renderAfterFormLayout($form);
131  }
132 
133  protected function renderHtmlAndTextContentElement($model, $attribute, $form)
134  {
135  $element = new EmailTemplateHtmlAndTextContentElement($model, $attribute , $form);
136  $element->plugins = array('fontfamily', 'fontsize', 'fontcolor');
137  if ($form !== null)
138  {
139  $this->resolveElementDuringFormLayoutRender($element);
140  }
141  $content = ZurmoHtml::tag('div', array('class' => 'left-column'), $this->renderMergeTagsContent());
142  $content .= ZurmoHtml::tag('div', array('class' => 'email-template-combined-content right-column'), $element->render());
143  return $content;
144  }
145 
146  protected function renderMergeTagsContent()
147  {
148  $title = ZurmoHtml::tag('h3', array(), Zurmo::t('Default', 'Merge Tags'));
149  $view = new MergeTagsView('Autoresponder',
150  Element::resolveInputIdPrefixIntoString(array(get_class($this->model), 'textContent')),
151  Element::resolveInputIdPrefixIntoString(array(get_class($this->model), 'htmlContent')),
152  false);
153  $content = $view->render();
154  return $title . $content;
155  }
156 
157  protected function resolveElementDuringFormLayoutRender(& $element)
158  {
159  if ($this->alwaysShowErrorSummary())
160  {
161  $element->editableTemplate = str_replace('{error}', '', $element->editableTemplate);
162  }
163  }
164 
165  protected function alwaysShowErrorSummary()
166  {
167  return true;
168  }
169 
170  protected function getNewModelTitleLabel()
171  {
172  return Zurmo::t('Default', 'Create AutorespondersModuleSingularLabel',
174  }
175 
176  protected function shouldDisplayCell($detailViewOnly)
177  {
178  // TODO: @Shoaibi: Low: change this to constant after refactoring and port to parent.
179  if ($detailViewOnly == 2)
180  {
181  return ($this->renderType != 'Details');// this if would only be true for contactEmailTemplateNamesDropDown.
182  }
183  return parent::shouldDisplayCell($detailViewOnly);
184  }
185 
186  protected function resolveElementInformationDuringFormLayoutRender(& $elementInformation)
187  {
188  // we need this for EmailTemplate element because it extends ModelElement and usually ModelElements
189  // can't have a null attribute associated with them.
190  if ($elementInformation['attributeName'] === 'null')
191  {
192  return;
193  }
194  }
195  }
196 ?>
static getTranslationParamsForAllModules()
Definition: LabelUtil.php:75
Generated on Fri May 29 2020 07:10:29