Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
UpcomingMeetingsCalendarView.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  {
42  protected function makeDayEvents()
43  {
44  return $this->getDataProvider()->getData();
45  }
46 
51  protected function makeDataProvider($stringTime = null)
52  {
53  assert('is_string($stringTime) || $stringTime == null');
54  return new MeetingsCalendarDataProvider('Meeting', $this->makeSearchAttributeData($stringTime));
55  }
56 
61  protected function makeSearchAttributeData($stringTime = null)
62  {
63  assert('is_string($stringTime) || $stringTime == null');
64  $searchAttributeData = array();
65  $searchAttributeData['clauses'] = array(
66  1 => array(
67  'attributeName' => 'startDateTime',
68  'operatorType' => 'greaterThan',
69  'value' => DateTimeUtil::
70  convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay(
71  DateTimeUtil::getFirstDayOfAMonthDate($stringTime))
72  ),
73  2 => array(
74  'attributeName' => 'startDateTime',
75  'operatorType' => 'lessThan',
76  'value' => DateTimeUtil::
77  convertDateIntoTimeZoneAdjustedDateTimeEndOfDay(
78  DateTimeUtil::getLastDayOfAMonthDate($stringTime))
79  ),
80  3 => array(
81  'attributeName' => 'logged',
82  'operatorType' => 'doesNotEqual',
83  'value' => true
84  ),
85  4 => array(
86  'attributeName' => 'logged',
87  'operatorType' => 'isNull',
88  'value' => null
89  )
90  );
91  $searchAttributeData['structure'] = '(1 and 2 and (3 or 4))';
92  return $searchAttributeData;
93  }
94 
95  public static function getModuleClassName()
96  {
97  return 'MeetingsModule';
98  }
99 
100  protected function getOnChangeMonthScript()
101  {
102  // Begin Not Coding Standard
103  return "js:function(year, month, inst) {
104  //Call to render new events
105  $.ajax({
106  url : $.param.querystring('" . $this->getPortletChangeMonthUrl() . "', '&month=' + month + '&year=' + year),
107  async : false,
108  type : 'GET',
109  dataType : 'html',
110  success : function(data)
111  {
112  eval(data);
113  //Since the home page for some reason cannot render this properly in beforeShow, we are using a trick.
114  setTimeout('addSpansToDatesOnCalendar(\"' + inst.id + '\")', 100);
115  },
116  error : function()
117  {
118  //todo: error call
119  }
120  });
121  }";
122  // End Not Coding Standard
123  }
124 
125  protected function getOnSelectScript()
126  {
127  // Begin Not Coding Standard
128  return "js:function(dateText, inst) {
129  $.ajax({
130  url : $.param.querystring('" . $this->getPortletSelectDayUrl() . "', '&stringTime=' + $('#calendarSelectedDate" . $this->uniqueLayoutId . "').val()),
131  async : false,
132  type : 'GET',
133  'beforeSend' : function(){
134  jQuery('#modalContainer').html('');
135  $(this).makeLargeLoadingSpinner(true, '#modalContainer');
136  jQuery('#modalContainer').dialog({'title': dateText,
137  'autoOpen':true,
138  'modal': true,
139  'height': 'auto',
140  'position': { my: \"center\", at: \"center\", of: window },
141  'width':600,
142  'closeText':''}); return true;},
143  success : function(data)
144  {
145  jQuery('#modalContainer').html(data);
146  jQuery('.ui-dialog .ui-dialog-content').css('height', 'auto');
147  jQuery('.ui-dialog-titlebar-close .ui-button-text').remove();
148  //Since the home page for some reason cannot render this properly in beforeShow, we are using a trick.
149  setTimeout('addSpansToDatesOnCalendar(\"' + inst.id + '\")', 100);
150  },
151  error : function()
152  {
153  //todo: error call
154  }
155  });
156  }";
157  // End Not Coding Standard
158  }
159 
160  protected function getPortletChangeMonthUrl()
161  {
162  return Yii::app()->createUrl('/' . $this->resolvePortletModuleId() . '/defaultPortlet/viewAction',
163  array_merge($_GET, array(
164  'action' => 'renderMonthEvents',
165  'portletId' => $this->params['portletId'],
166  'uniqueLayoutId' => $this->uniqueLayoutId)));
167  }
168 
169  protected function getPortletSelectDayUrl()
170  {
171  return Yii::app()->createUrl('/meetings/default/daysMeetingsFromCalendarModalList', $_GET);
172  }
173 
177  public function renderMonthEvents()
178  {
179  $month = str_pad($_GET['month'], 2, '0', STR_PAD_LEFT);
180  $year = $_GET['year'];
181  $dayEvents = $this->makeDataProvider($year . '-' . $month . '-01')->getData();
182  foreach ($dayEvents as $event)
183  {
184  $dateTimestamp = DateTimeUtil::convertDbFormatDateTimeToTimestamp($event['dbDate']);
185  $dateForJavascript = date('M j, Y', $dateTimestamp);
186  echo "console.log('" . $dateForJavascript . "');calendarEvents[new Date('" . $dateForJavascript . "')] = new CalendarEvent('" . $event['label'] . "', '" . $event['className'] . "'); \n";
187  }
188  }
189 
193  public function resolvePortletModuleId()
194  {
195  throw new NotImplementedException();
196  }
197  }
198 ?>
Generated on Tue Sep 22 2020 07:10:34
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.