Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
ModalView.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 
41  class ModalView extends View
42  {
46  public function __construct(CController $controller, View $view)
47  {
48  $this->view = $view;
49  $this->controller = $controller;
50  }
51 
52  public function render()
53  {
54  $content = parent::render();
55  Yii::app()->clientScript->scriptMap = array(
56  'jquery-ui.min.js' => false,
57  );
58  Yii::app()->getClientScript()->render($content);
59  return $content;
60  }
61 
66  protected function renderContent()
67  {
68  return $this->view->render();
69  }
70 
71  public static function getAjaxOptionsForModalLink($title, $containerId = 'modalContainer', $height = 'auto',
72  $width = 600, $position = array('my'=>'center top+25','at'=>'center top+25'),
73  $class = "''", $extraCloseScript = null)// Not Coding Standard
74  {
75  assert('is_string($containerId)');
76  assert('is_string($title)');
77  assert('$height == "auto" || is_int($height)');
78  assert('is_int($width)');
79  assert('is_string($position) || is_array($position)');
80  assert('is_string($class) || $class == null');
81  assert('is_string($extraCloseScript) || $extraCloseScript == null');
82  return array(
83  'beforeSend' => static::getAjaxBeforeSendOptionForModalLinkContent($title, $containerId,
84  $height, $width, $position,
85  $class, $extraCloseScript),
86  'update' => '#' . $containerId);
87  }
88 
89  public static function getAjaxBeforeSendOptionForModalLinkContent($title,
90  $containerId = 'modalContainer',
91  $height = 'auto',
92  $width = 600,
93  $position = array('my'=>'center top+25','at'=>'center top+25'), // Not Coding Standard
94  $class = "''", // Not Coding Standard
95  $extraCloseScript = null)
96  {
97  assert('is_string($containerId)');
98  assert('is_string($title)');
99  assert('$height == "auto" || is_int($height)');
100  assert('is_int($width)');
101  assert('is_string($position) || is_array($position)');
102  assert('is_string($class) || $class == null');
103  assert('is_string($extraCloseScript) || $extraCloseScript == null');
104  if ($height == 'auto')
105  {
106  $heightContent = "'auto'";
107  }
108  else
109  {
110  $heightContent = $height;
111  }
112  if (is_array($position))
113  {
114  $position = CJSON::encode($position);
115  }
116  else
117  {
118  $position = "'" . $position . "'";
119  }
120  $modalTitle = CJavaScript::quote($title);
121 
122  // Begin Not Coding Standard
123  return "js:function(){
124  jQuery('#{$containerId}').html('');
125  $(this).makeLargeLoadingSpinner(true, '#{$containerId}');
126  jQuery('#{$containerId}').dialog({
127  'title' : '{$modalTitle}',
128  'autoOpen' : true,
129  'modal' : true,
130  'position' : {$position},
131  'dialogClass' : {$class},
132  'height' : {$heightContent},
133  'closeText':'',
134  'open': function( event, ui ) {
135  jQuery('#{$containerId}').parent().addClass('openingModal');
136  // prevent dialog scrolls to top under Chrome, IE
137  $('.ui-dialog-titlebar-close').mousedown(function(ev) {
138  $('#{$containerId}').dialog('close');
139  });
140  $('.ui-dialog .ui-dialog-content').css('height', 'auto');
141  $('.ui-dialog .ui-dialog-content').css('display', 'block');
142  $('.ui-dialog-titlebar-close .ui-button-text').remove();
143  $('#{$containerId}').dialog('moveToTop');
144  var zIndex = jQuery('#{$containerId}').parent().css('zIndex');
145  zIndex = zIndex - 1;
146  $('.ui-widget-overlay').css('zIndex', zIndex);
147  },
148  'close': function( event, ui ) { jQuery('#{$containerId}').parent().removeClass('openingModal');
149  var zIndex = jQuery('#{$containerId}').parent().css('zIndex');
150  zIndex = zIndex - 2;
151  $('.ui-widget-overlay').css('zIndex', zIndex);
152  $('#{$containerId}').dialog('destroy');
153  $('#{$containerId}').css('display', 'none');
154  " . $extraCloseScript . "
155  }
156  });
157  return true;
158  }";
159  // End Not Coding Standard
160  }
161  }
162 ?>
__construct(CController $controller, View $view)
Definition: ModalView.php:46
Definition: View.php:43
renderContent()
Definition: ModalView.php:66
Generated on Tue Jul 7 2020 07:10:30
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.