All Data Structures Functions Variables Pages
UserInterfaceDevelopmentUtil.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  public static function makePaginationData()
44  {
45  $account = new Account();
46  $account->owner = Yii::app()->user->userModel;
47  $account->name = 'Full Load Account';
48  $saved = $account->save();
49  if (!$saved)
50  {
51  throw new NotSupportedException();
52  }
53  //Load past meetings that will show up as latest activities
54  for ($i = 0; $i < 15; $i++)
55  {
56  $meeting = new Meeting();
57  $meeting->name = 'MyMeeting ' . $i;
58  $meeting->owner = Yii::app()->user->userModel;
59  $startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 10000 - ($i * 3600 * 24));
60  $meeting->startDateTime = $startStamp;
61  $meeting->activityItems->add($account);
62  $saved = $meeting->save();
63  if (!$saved)
64  {
65  throw new NotSupportedException();
66  }
67  }
68  //Load upcoming tasks
69  for ($i = 0; $i < 15; $i++)
70  {
71  $task = new Task();
72  $task->name = 'MyTask ' . $i;
73  $task->completed = false;
74  $task->owner = Yii::app()->user->userModel;
75  $dueDateStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000 + ($i * 3600 * 24));
76  $task->dueDateTime = $dueDateStamp;
77  $task->activityItems->add($account);
78  $saved = $task->save();
79  if (!$saved)
80  {
81  throw new NotSupportedException();
82  }
83  }
84  //Load 20 so there is sufficient data for list view pagination testing
85  for ($i = 0; $i < 20; $i++)
86  {
87  $account = new Account();
88  $account->owner = Yii::app()->user->userModel;
89  $account->name = 'List View Pagination Test Account ' . $i;
90  $saved = $account->save();
91  if (!$saved)
92  {
93  throw new NotSupportedException();
94  }
95  }
96  }
97 
98  public static function makeMassDeleteData()
99  {
100  $account = new Account();
101  $account->owner = Yii::app()->user->userModel;
102  $account->name = 'Mass Delete Full Load Account';
103  $saved = $account->save();
104  if (!$saved)
105  {
106  throw new NotSupportedException();
107  }
108  //Load past meetings that will show up as latest activities
109  for ($i = 0; $i < 15; $i++)
110  {
111  $meeting = new Meeting();
112  $meeting->name = 'MyMeeting ' . $i;
113  $meeting->owner = Yii::app()->user->userModel;
114  $startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 10000 - ($i * 3600 * 24));
115  $meeting->startDateTime = $startStamp;
116  $meeting->activityItems->add($account);
117  $saved = $meeting->save();
118  if (!$saved)
119  {
120  throw new NotSupportedException();
121  }
122  }
123  //Load upcoming tasks
124  for ($i = 0; $i < 15; $i++)
125  {
126  $task = new Task();
127  $task->name = 'MyTask ' . $i;
128  $task->completed = false;
129  $task->owner = Yii::app()->user->userModel;
130  $dueDateStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000 + ($i * 3600 * 24));
131  $task->dueDateTime = $dueDateStamp;
132  $task->activityItems->add($account);
133  $saved = $task->save();
134  if (!$saved)
135  {
136  throw new NotSupportedException();
137  }
138  }
139  //Load 20 so there is sufficient data for list view pagination testing
140  for ($i = 0; $i < 20; $i++)
141  {
142  $account = new Account();
143  $account->owner = Yii::app()->user->userModel;
144  $account->name = 'Mass Delete Test Account ' . $i;
145  $saved = $account->save();
146  if (!$saved)
147  {
148  throw new NotSupportedException();
149  }
150  }
151  }
152  }
153 ?>
Definition: Task.php:37
Generated on Fri May 29 2020 07:10:36