Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
ProjectZurmoControllerUtil.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 $projectAccounts;
43 
48  protected function afterSetAttributesDuringSave($model, $explicitReadWriteModelPermissions)
49  {
50  assert('$model instanceof Project');
51  $postData = PostUtil::getData();
52  if (isset($postData['ProjectAccountsForm']))
53  {
54  $this->projectAccounts = self::resolveProjectManyManyAccountsFromPost($model,
55  $postData['ProjectAccountsForm']);
56  }
57  if (isset($postData['ProjectContactsForm']))
58  {
59  $this->projectContacts = self::resolveProjectManyManyContactsFromPost($model,
60  $postData['ProjectContactsForm']);
61  }
62  if (isset($postData['ProjectOpportunitiesForm']))
63  {
64  $this->projectOpportunities = self::resolveProjectManyManyOpportunitiesFromPost($model,
65  $postData['ProjectOpportunitiesForm']);
66  }
67  }
68 
76  Project $project, $postData)
77  {
78  assert('$project instanceof Project');
79  $newAccount = array();
80  if (isset($postData['accountIds']) && strlen($postData['accountIds']) > 0)
81  {
82  $accountIds = explode(",", $postData['accountIds']); // Not Coding Standard
83  foreach ($accountIds as $accountId)
84  {
85  $newAccount[$accountId] = Account::getById((int)$accountId);
86  }
87  if ($project->accounts->count() > 0)
88  {
89  $project->accounts->removeAll();
90  }
91  //Now add missing accounts
92  foreach ($newAccount as $account)
93  {
94  $project->accounts->add($account);
95  }
96  }
97  else
98  {
99  //remove all accounts
100  $project->accounts->removeAll();
101  }
102  return $newAccount;
103  }
104 
112  Project $project, $postData)
113  {
114  assert('$project instanceof Project');
115  $newContact = array();
116  if (isset($postData['contactIds']) && strlen($postData['contactIds']) > 0)
117  {
118  $contactIds = explode(",", $postData['contactIds']); // Not Coding Standard
119  foreach ($contactIds as $contactId)
120  {
121  $newContact[$contactId] = Contact::getById((int)$contactId);
122  }
123  if ($project->contacts->count() > 0)
124  {
125  $project->contacts->removeAll();
126  }
127  //Now add missing contacts
128  foreach ($newContact as $contact)
129  {
130  $project->contacts->add($contact);
131  }
132  }
133  else
134  {
135  //remove all contacts
136  $project->contacts->removeAll();
137  }
138  return $newContact;
139  }
140 
148  Project $project, $postData)
149  {
150  assert('$project instanceof Project');
151  $newOpportunity = array();
152  if (isset($postData['opportunityIds']) && strlen($postData['opportunityIds']) > 0)
153  {
154  $opportunityIds = explode(",", $postData['opportunityIds']); // Not Coding Standard
155  foreach ($opportunityIds as $opportunityId)
156  {
157  $newOpportunity[$opportunityId] = Opportunity::getById((int)$opportunityId);
158  }
159  if ($project->opportunities->count() > 0)
160  {
161  $project->opportunities->removeAll();
162  }
163  //Now add missing contacts
164  foreach ($newOpportunity as $opportunity)
165  {
166  $project->opportunities->add($opportunity);
167  }
168  }
169  else
170  {
171  //remove all opportunities
172  $project->opportunities->removeAll();
173  }
174  return $newOpportunity;
175  }
176 
181  public static function getProjectsLatestActivityFeedView($controller, $pageSize)
182  {
183  $project = new Project(false);
184  $searchForm = new ProjectsSearchForm($project);
186  array(),
187  'ProjectAuditEvent',
188  'RedBeanModelDataProvider',
189  'dateTime',
190  true,
191  $pageSize
192  );
193  $listView = new ProjectsFeedListView(
194  $controller->id,
195  $controller->getModule()->getId(),
196  get_class($searchForm->getModel()),
197  $dataProvider,
199  null,
200  array(),
201  $searchForm->getListAttributesSelector(),
202  $searchForm->getKanbanBoard());
203  return $listView;
204  }
205  }
206 ?>
static resolveSelectedIdsFromGet()
Definition: GetUtil.php:65
static resolveProjectManyManyContactsFromPost(Project $project, $postData)
afterSetAttributesDuringSave($model, $explicitReadWriteModelPermissions)
static getById($id, $modelClassName=null)
static resolveProjectManyManyAccountsFromPost(Project $project, $postData)
static makeDataProvider(array $metadata, $listModelClassName, $dataProviderClassName, $sortAttribute, $sortDescending, $pageSize, $stateMetadataAdapterClassName=null)
static resolveProjectManyManyOpportunitiesFromPost(Project $project, $postData)
static getProjectsLatestActivityFeedView($controller, $pageSize)
Generated on Fri Jul 3 2020 07:10:34
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.