Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
BuilderSocialElement.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 isUIAccessible()
40  {
41  return true;
42  }
43 
44  protected static function resolveLabel()
45  {
46  return Zurmo::t('EmailTemplatesModule', 'Social');
47  }
48 
49  protected function resolveDefaultProperties()
50  {
51  $properties = array(
52  'backend' => array(
53  'layout' => 'horizontal',
54  'services' => array(
55  'Website' => array(
56  'enabled' => 1,
57  'url' => Yii::app()->createAbsoluteUrl('/'),
58  ),
59  ),
60  'sizeClass' => 'button',
61  ),
62  );
63  return $properties;
64  }
65 
66  protected function renderControlContentNonEditable()
67  {
68  if (!isset($this->properties['backend']['services']))
69  {
70  return null;
71  }
72  $content = null;
73  $sizeClass = null;
74  if (isset($this->properties['backend']['sizeClass']))
75  {
76  $sizeClass = $this->properties['backend']['sizeClass'];
77  }
78  foreach ($this->properties['backend']['services'] as $serviceName => $serviceDetails)
79  {
80  if (ArrayUtil::getArrayValue($serviceDetails, 'enabled') and ArrayUtil::getArrayValue($serviceDetails, 'url'))
81  {
82  $properties = array();
83  $properties['frontend']['href'] = $serviceDetails['url'];
84  $properties['frontend']['target'] = '_blank';
85  $properties['backend']['text'] = $serviceName;
86  $properties['backend']['sizeClass'] = 'button social-button ' . $serviceName . ' ' . $sizeClass;
87  $id = $this->id . '_' . $serviceName;
88  $element = BuilderElementRenderUtil::resolveElement('BuilderSocialButtonElement', $this->renderForCanvas, $id, $properties);
89 
90  $content .= $element->renderNonEditable();
91  $content .= $this->resolveSpacerContentForVerticalLayout();
92  $content .= $this->resolveTdCloseAndOpenContentForHorizontalLayout();
93  }
94  }
95  return $content;
96  }
97 
98  protected function renderSettingsTab(ZurmoActiveForm $form)
99  {
100  $propertiesForm = BuilderSocialElementPropertiesEditableElementsUtil::render($this->model, $form);
101  return $propertiesForm;
102  }
103 
104  protected function renderContentTab(ZurmoActiveForm $form)
105  {
106  return null;
107  }
108 
109  protected function resolveNonEditableWrapperHtmlOptions()
110  {
111  $htmlOptions = parent::resolveNonEditableWrapperHtmlOptions();
112  $htmlOptions['class'] .= ' ' . $this->properties['backend']['layout'];
113  return $htmlOptions;
114  }
115 
116  protected function resolveNonEditableContentWrappingTdHtmlOptions()
117  {
118  return array();
119  }
120 
121  protected function resolveSpacerContentForVerticalLayout()
122  {
123  if ($this->getLayout() == 'vertical')
124  {
125  $urlToImage = PlaceholderImageUtil::resolveTransparentImageUrl(true);
126  return ZurmoHtml::image($urlToImage, '', array('width' => '100%', 'height' => '15'));
127  }
128  }
129 
130  protected function resolveTdCloseAndOpenContentForHorizontalLayout()
131  {
132  if ($this->getLayout() == 'horizontal')
133  {
134  $urlToImage = PlaceholderImageUtil::resolveTransparentImageUrl(true);
135  $content = ZurmoHtml::closeTag('td');
136  $content .= ZurmoHtml::openTag('td', array('class' => 'social-horizontal-expander'));
137  $content .= ZurmoHtml::image($urlToImage, '', array('width' => '15', 'height' => '15'));
138  $content .= ZurmoHtml::closeTag('td');
139  $content .= ZurmoHtml::openTag('td');
140  return $content;
141  }
142  }
143 
144  protected function getLayout()
145  {
146  return $this->properties['backend']['layout'];
147  }
148  }
149 ?>
static getArrayValue($array, $element, $defaultValue=null)
Definition: ArrayUtil.php:45
static resolveElement($className, $renderForCanvas=false, $id=null, $properties=null, $content=null, $params=null)
Generated on Sun Oct 25 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.