All Data Structures Functions Variables Pages
MixedAttributeTypesForWorkflowActionAttributeElement.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 
42  {
43  abstract protected function renderEditableFirstValueContent();
44 
45  abstract protected function renderEditableSecondValueContent();
46 
50  protected function renderControlEditable()
51  {
52  $firstValueSpanAreaId = $this->getFirstValueEditableInputId() . '-first-value-area';
53  $secondValueSpanAreaId = $this->getSecondValueEditableInputId() . '-second-value-area';
54  $startingDivStyleFirstValue = null;
55  $startingDivStyleSecondValue = null;
56  if (!$this->shouldDisableSecondValueInputs())
57  {
58  $startingDivStyleFirstValue = "display:none;";
59  }
60  else
61  {
62  $startingDivStyleSecondValue = "display:none;";
63  }
64  $content = ZurmoHtml::tag('div', array('id' => $firstValueSpanAreaId,
65  'class' => 'first-value-area',
66  'style' => $startingDivStyleFirstValue),
67  $this->renderEditableFirstValueContent());
68  $content .= ZurmoHtml::tag('div', array('id' => $secondValueSpanAreaId,
69  'class' => 'second-value-area',
70  'style' => $startingDivStyleSecondValue),
71  $this->renderEditableSecondValueContent());
72  return $content;
73  }
74 
78  protected function shouldDisableSecondValueInputs()
79  {
80  if ($this->getActionAttributeType() != WorkflowActionAttributeForm::TYPE_STATIC &&
81  $this->getActionAttributeType() != null)
82  {
83  return false;
84  }
85  return true;
86  }
87 
91  protected function getHtmlOptionsForFirstValue()
92  {
93  $htmlOptions = array(
94  'id' => $this->getFirstValueEditableInputId(),
95  'name' => $this->getFirstValueEditableInputName(),
96  );
97  if (!$this->shouldDisableSecondValueInputs())
98  {
99  $htmlOptions['disabled'] = 'disabled';
100  }
101  return $htmlOptions;
102  }
103 
107  protected function getHtmlOptionsForSecondValue()
108  {
109  $htmlOptions = array(
110  'id' => $this->getSecondValueEditableInputId(),
111  'name' => $this->getSecondValueEditableInputName(),
112  );
113  if ($this->shouldDisableSecondValueInputs())
114  {
115  $htmlOptions['disabled'] = 'disabled';
116  }
117  return $htmlOptions;
118  }
119 
125  protected function renderControlNonEditable()
126  {
127  throw new NotSupportedException();
128  }
129 
133  protected function renderLabel()
134  {
135  $label = $this->getFormattedAttributeLabel();
136  if ($this->form === null)
137  {
138  return $label;
139  }
140  return ZurmoHtml::label($label, false);
141  }
142 
146  protected function getActionAttributeType()
147  {
148  return $this->model->type;
149  }
150 
156  protected function renderError()
157  {
158  }
159 
163  protected function getFirstValueEditableInputId()
164  {
165  return $this->getEditableInputId('value');
166  }
167 
171  protected function getSecondValueEditableInputId()
172  {
173  return $this->getEditableInputId('alternateValue');
174  }
175 
180  protected function getFirstValueEditableInputName()
181  {
182  return $this->getEditableInputName('value');
183  }
184 
188  protected function getSecondValueEditableInputName()
189  {
190  return $this->getEditableInputName('value');
191  }
192  }
193 ?>
getEditableInputName($attributeName=null, $relationAttributeName=null)
Definition: Element.php:303
getEditableInputId($attributeName=null, $relationAttributeName=null)
Definition: Element.php:277
Generated on Sat Mar 28 2020 07:10:44