Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
TagCloudElement.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  protected $dataAndLabels = null;
40 
41  //Not used, we override getEditableInputId and getEditableInputName
42  protected function getFormName()
43  {
44  return null;
45  }
46 
47  protected function assertModelType()
48  {
49  assert('$this->model->{$this->attribute} instanceof MultipleValuesCustomField');
50  }
51 
52  protected function getWidgetSourceUrl()
53  {
54  return Yii::app()->createUrl('zurmo/default/autoCompleteCustomFieldData/',
55  array('name' => $this->model->{$this->attribute}->data->name));
56  }
57 
58  protected function getUnqualifiedIdForIdField()
59  {
60  return '_' . $this->attribute . '_values';
61  }
62 
63  protected function getUnqualifiedNameForIdField()
64  {
65  return '[' . $this->attribute . '][values]';
66  }
67 
68  protected function getWidgetHintText()
69  {
70  return Zurmo::t('Core', 'Type to find a tag');
71  }
72 
73  protected function getRelationName()
74  {
75  return null; // we override getRelatedRecords instead.
76  }
77 
78  protected function getRelatedRecords()
79  {
80  $multipleValuesCustomField = $this->model->{$this->attribute};
81  $relatedRecords = $multipleValuesCustomField->values;
82  return $relatedRecords;
83  }
84 
85  protected function resolveIdAndNameByModel(RedBeanModel $customFieldValue)
86  {
87  if (!isset($this->dataAndLabels))
88  {
89  $multipleValuesCustomField = $this->model->{$this->attribute};
91  $multipleValuesCustomField->data, Yii::app()->language);
92  }
93  if ($customFieldValue->value != null)
94  {
95  return array('id' => $customFieldValue->value,
96  'name' => $this->dataAndLabels[$customFieldValue->value]);
97  }
98  }
99 
100  public function getIdForSelectInput()
101  {
102  return $this->getEditableInputId($this->attribute, 'values');
103  }
104 
105  protected function getFormattedAttributeLabel()
106  {
107  return Yii::app()->format->text($this->model->getAttributeLabel($this->attribute));
108  }
109 
110  protected function getEditableInputId($attributeName = null, $relationAttributeName = null)
111  {
112  $inputPrefix = $this->resolveInputIdPrefix();
113  return $inputPrefix . $this->getUnqualifiedIdForIdField();
114  }
115 
116  protected function getEditableInputName($attributeName = null, $relationAttributeName = null)
117  {
118  $inputPrefix = $this->resolveInputNamePrefix();
119  return $inputPrefix . $this->getUnqualifiedNameForIdField();
120  }
121 
126  protected function renderError()
127  {
128  if ($this->form !== null)
129  {
130  return $this->form->error($this->model, $this->attribute,
131  array('inputID' => $this->getEditableInputId()));
132  }
133  else
134  {
135  return null;
136  }
137  }
138 
143  protected function renderLabel()
144  {
145  if ($this->form === null)
146  {
147  return $this->getFormattedAttributeLabel();
148  }
149  $htmlOptions = array('for' => $this->resolveIdForLabel());
150  if (isset($this->params['labelHtmlOptions']))
151  {
152  $htmlOptions = CMap::mergeArray($htmlOptions, $this->params['labelHtmlOptions']);
153  }
154  if (isset($this->params['showTooltip']))
155  {
156  $tooltipContent = $this->generateElementTooltipHelpContent($this->resolveIdForLabel() . '_tooltip');
157  return $this->form->labelEx($this->model, $this->attribute, $htmlOptions) . $tooltipContent;
158  }
159  else
160  {
161  return $this->form->labelEx($this->model, $this->attribute, $htmlOptions);
162  }
163  }
164 
169  protected function generateElementTooltipHelpContent($id)
170  {
171  $title = Zurmo::t('Core', 'Original values will be overwritten.');
172  $content = '<span id="'.$id.'" class="tooltip" title="' . $title . '">?</span>'; // Not Coding Standard
173  $qtip = new ZurmoTip();
174  $qtip->addQTip("#$id");
175  return $content;
176  }
177  }
178 ?>
static getDataIndexedByDataAndTranslatedLabelsByLanguage(CustomFieldData $customFieldData, $language)
generateElementTooltipHelpContent($id)
Generated on Wed Dec 2 2020 07:10:23
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.