Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
DefaultController.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 function filters()
40  {
41  $modelClassName = $this->getModule()->getPrimaryModelName();
42  $viewClassName = $modelClassName . 'EditAndDetailsView';
43  return array_merge(parent::filters(),
44  array(
45  array(
46  ZurmoBaseController::REQUIRED_ATTRIBUTES_FILTER_PATH . ' + create, createFromRelation, edit',
47  'moduleClassName' => get_class($this->getModule()),
48  'viewClassName' => $viewClassName,
49  ),
50  array(
51  ZurmoBaseController::REQUIRED_ATTRIBUTES_FILTER_PATH . ' + modalCreate',
52  'moduleClassName' => get_class($this->getModule()),
53  'viewClassName' => 'AccountModalCreateView',
54  ),
55  array(
56  ZurmoModuleController::ZERO_MODELS_CHECK_FILTER_PATH . ' + list, index',
57  'controller' => $this,
58  ),
59  )
60  );
61  }
62 
63  public function actionList()
64  {
65  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
66  'listPageSize', get_class($this->getModule()));
67  $account = new Account(false);
68  $searchForm = new AccountsSearchForm($account);
69  $listAttributesSelector = new ListAttributesSelector('AccountsListView', get_class($this->getModule()));
70  $searchForm->setListAttributesSelector($listAttributesSelector);
71  $dataProvider = $this->resolveSearchDataProvider(
72  $searchForm,
73  $pageSize,
74  null,
75  'AccountsSearchView'
76  );
77  if (isset($_GET['ajax']) && $_GET['ajax'] == 'list-view')
78  {
79  $mixedView = $this->makeListView(
80  $searchForm,
81  $dataProvider
82  );
83  $view = new AccountsPageView($mixedView);
84  }
85  else
86  {
87  $mixedView = $this->makeActionBarSearchAndListView($searchForm, $dataProvider,
88  'SecuredActionBarForAccountsSearchAndListView');
90  makeStandardViewForCurrentUser($this, $mixedView));
91  }
92  echo $view->render();
93  }
94 
95  public function actionDetails($id)
96  {
97  $account = static::getModelAndCatchNotFoundAndDisplayError('Account', intval($id));
99  AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($account), 'AccountsModule'), $account);
100  if (KanbanUtil::isKanbanRequest() === false)
101  {
102  $breadCrumbView = StickySearchUtil::resolveBreadCrumbViewForDetailsControllerAction($this, 'AccountsSearchView', $account);
103  $detailsAndRelationsView = $this->makeDetailsAndRelationsView($account, 'AccountsModule',
104  'AccountDetailsAndRelationsView',
105  Yii::app()->request->getRequestUri(),
106  $breadCrumbView);
108  makeStandardViewForCurrentUser($this, $detailsAndRelationsView));
109  }
110  else
111  {
112  $pageSize = TasksForRelatedKanbanView::getDefaultPageSize();
113  $task = new Task(false);
114  $searchForm = new TasksForRelatedKanbanSearchForm($task, $account);
115  $stickySearchKey = 'TasksForRelatedKanbanSearchView';
116  $dataProvider = $this->resolveSearchDataProvider(
117  $searchForm,
118  $pageSize,
119  null,
120  $stickySearchKey
121  );
122  $view = TasksUtil::resolveTaskKanbanViewForRelation($account, $this->getModule()->getId(), $this,
123  'TasksForAccountKanbanView', 'AccountsPageView',
124  $searchForm, $dataProvider);
125  }
126  echo $view->render();
127  }
128 
133  protected function resolveFilteredByMetadataBeforeMakingDataProvider($searchForm, & $metadata)
134  {
135  if ($searchForm instanceof TasksForRelatedKanbanSearchForm)
136  {
137  TasksUtil::resolveRelatedAdditionalSearchMetadata($searchForm, $metadata, 'activityItems');
138  }
139  }
140 
141  public function actionCreate()
142  {
143  $editAndDetailsView = $this->makeEditAndDetailsView(
144  $this->attemptToSaveModelFromPost(new Account()), 'Edit');
146  makeStandardViewForCurrentUser($this, $editAndDetailsView));
147  echo $view->render();
148  }
149 
150  public function actionEdit($id, $redirectUrl = null)
151  {
152  $account = Account::getById(intval($id));
154  $this->processEdit($account, $redirectUrl);
155  }
156 
157  public function actionCopy($id)
158  {
159  $copyToAccount = new Account();
160  $postVariableName = get_class($copyToAccount);
161  if (!isset($_POST[$postVariableName]))
162  {
163  $account = Account::getById((int)$id);
165  ZurmoCopyModelUtil::copy($account, $copyToAccount);
166  }
167  $this->processEdit($copyToAccount);
168  }
169 
170  protected function processEdit(Account $account, $redirectUrl = null)
171  {
173  makeStandardViewForCurrentUser($this,
174  $this->makeEditAndDetailsView(
175  $this->attemptToSaveModelFromPost($account, $redirectUrl), 'Edit')));
176  echo $view->render();
177  }
178 
193  public function actionMassEdit()
194  {
195  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
196  'massEditProgressPageSize');
197  $account = new Account(false);
198  $activeAttributes = $this->resolveActiveAttributesFromMassEditPost();
199  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
200  new AccountsSearchForm($account),
201  $pageSize,
202  Yii::app()->user->userModel->id,
203  null,
204  'AccountsSearchView');
205  $selectedRecordCount = static::getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
206  $account = $this->processMassEdit(
207  $pageSize,
208  $activeAttributes,
209  $selectedRecordCount,
210  'AccountsPageView',
211  $account,
212  AccountsModule::getModuleLabelByTypeAndLanguage('Plural'),
213  $dataProvider
214  );
215  $massEditView = $this->makeMassEditView(
216  $account,
217  $activeAttributes,
218  $selectedRecordCount,
219  AccountsModule::getModuleLabelByTypeAndLanguage('Plural')
220  );
222  makeStandardViewForCurrentUser($this, $massEditView));
223  echo $view->render();
224  }
225 
233  public function actionMassEditProgressSave()
234  {
235  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
236  'massEditProgressPageSize');
237  $account = new Account(false);
238  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
239  new AccountsSearchForm($account),
240  $pageSize,
241  Yii::app()->user->userModel->id,
242  null,
243  'AccountsSearchView'
244  );
246  'Account',
247  $pageSize,
248  AccountsModule::getModuleLabelByTypeAndLanguage('Plural'),
249  $dataProvider
250  );
251  }
252 
267  public function actionMassDelete()
268  {
269  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
270  'massDeleteProgressPageSize');
271  $account = new Account(false);
272 
273  $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
274  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
275  new AccountsSearchForm($account),
276  $pageSize,
277  Yii::app()->user->userModel->id,
278  null,
279  'AccountsSearchView');
280  $selectedRecordCount = static::getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
281  $account = $this->processMassDelete(
282  $pageSize,
283  $activeAttributes,
284  $selectedRecordCount,
285  'AccountsPageView',
286  $account,
287  AccountsModule::getModuleLabelByTypeAndLanguage('Plural'),
288  $dataProvider
289  );
290  $massDeleteView = $this->makeMassDeleteView(
291  $account,
292  $activeAttributes,
293  $selectedRecordCount,
294  AccountsModule::getModuleLabelByTypeAndLanguage('Plural')
295  );
297  makeStandardViewForCurrentUser($this, $massDeleteView));
298  echo $view->render();
299  }
300 
308  public function actionMassDeleteProgress()
309  {
310  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
311  'massDeleteProgressPageSize');
312  $account = new Account(false);
313  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
314  new AccountsSearchForm($account),
315  $pageSize,
316  Yii::app()->user->userModel->id,
317  null,
318  'AccountsSearchView'
319  );
320  $this->processMassDeleteProgress(
321  'Account',
322  $pageSize,
323  AccountsModule::getModuleLabelByTypeAndLanguage('Plural'),
324  $dataProvider
325  );
326  }
327 
328  public function actionModalList()
329  {
330  $modalListLinkProvider = new SelectFromRelatedEditModalListLinkProvider(
331  $_GET['modalTransferInformation']['sourceIdFieldId'],
332  $_GET['modalTransferInformation']['sourceNameFieldId'],
333  $_GET['modalTransferInformation']['modalId']
334  );
336  setAjaxModeAndRenderModalSearchList($this, $modalListLinkProvider);
337  }
338 
339  public function actionDelete($id)
340  {
341  $account = Account::GetById(intval($id));
343  $account->delete();
344  $this->redirect(array($this->getId() . '/index'));
345  }
346 
347  protected static function getSearchFormClassName()
348  {
349  return 'AccountsSearchForm';
350  }
351 
352  public function actionExport()
353  {
354  $this->export('AccountsSearchView');
355  }
356 
360  public function actionModalCreate()
361  {
362  $account = new Account();
364  if (isset($_POST['Account']) && Yii::app()->request->isAjaxRequest)
365  {
366  $account = $this->attemptToSaveModelFromPost($account, null, false);
367  if ($account->id > 0)
368  {
369  echo CJSON::encode(array('id' => $account->id, 'name' => $account->name));
370  Yii::app()->end(0, false);
371  }
372  else
373  {
374  throw new FailedToSaveModelException();
375  }
376  }
377  echo ModalEditAndDetailsControllerUtil::setAjaxModeAndRenderModalEditAndDetailsView($this,
378  'AccountModalCreateView',
379  $account, 'Edit');
380  }
381 
385  protected function validateCreateModalPostData()
386  {
387  $account = new Account();
388  if (isset($_POST['ajax']) && Yii::app()->request->isAjaxRequest)
389  {
390  $account = $this->attemptToSaveModelFromPost($account, null, false, true);
392  Yii::app()->end(0, false);
393  }
394  }
395 
399  public function actionSearchForDuplicateModels($attribute, $value)
400  {
401  assert('is_string($attribute)');
402  assert('is_string($value)');
403  $model = new Account();
404  $depudeRules = DedupeRulesFactory::createRulesByModel($model);
405  $viewClassName = $depudeRules->getDedupeViewClassName();
406  $searchResult = $depudeRules->searchForDuplicateModels($attribute, $value);
407  if ($searchResult != null)
408  {
409  $summaryView = new $viewClassName($this->id, $this->module->id, $model, $searchResult['matchedModels']);
410  $content = $summaryView->render();
411  $message = $searchResult['message'];
412  echo CJSON::encode(array('content' => $content, 'message' => $message));
413  }
414  }
415 
419  public function actionListViewMerge()
420  {
421  $this->processListViewMerge('Account',
422  'AccountsListDuplicateMergedModelForm',
423  'AccountsMerged', 'AccountsPageView',
424  '/accounts/default/list');
425  }
426 
427  public function actionOrgGraph()
428  {
429  $renderOrgGraphModalView = new AccountOrgChartModalView();
430  $view = new ModalView($this, $renderOrgGraphModalView);
431  return $view->render();
432  }
433 
439  public function actionInlineCreateCommentFromAjax($id, $uniquePageId)
440  {
441  $comment = new Comment();
442  $redirectUrl = Yii::app()->createUrl('/accounts/default/inlineCreateCommentFromAjax',
443  array('id' => $id,
444  'uniquePageId' => $uniquePageId));
445  $urlParameters = array('relatedModelId' => (int)$id,
446  'relatedModelClassName' => 'Account',
447  'relatedModelRelationName' => 'comments',
448  'redirectUrl' => $redirectUrl); //After save, the url to go to.
449  $uniquePageId = 'CommentInlineEditForModelView';
450  echo ZurmoHtml::tag('h2', array(), Zurmo::t('CommentsModule', 'Add Comment'));
451  $inlineView = new CommentInlineEditView($comment, 'default', 'comments', 'inlineCreateSave',
452  $urlParameters, $uniquePageId);
453  $view = new AjaxPageView($inlineView);
454  echo $view->render();
455  }
456 
461  public function actionAddSubscriber($id)
462  {
463  $account = Account::getById((int)$id);
464  $account = NotificationSubscriberUtil::processSubscriptionRequest($account, Yii::app()->user->userModel);
466  $content .= NotificationSubscriberUtil::resolveSubscriptionLink($account, 'detail-subscribe-model-link', 'detail-unsubscribe-model-link');
467  echo $content;
468  }
469 
474  public function actionRemoveSubscriber($id)
475  {
476  $account = Account::getById((int)$id);
477  $account = NotificationSubscriberUtil::processUnsubscriptionRequest($account, Yii::app()->user->userModel);
479  $content .= NotificationSubscriberUtil::resolveSubscriptionLink($account, 'detail-subscribe-model-link', 'detail-unsubscribe-model-link');
480  if ($content == null)
481  {
482  echo "";
483  }
484  else
485  {
486  echo $content;
487  }
488  }
489  }
490 ?>
static copy(RedBeanModel $model, RedBeanModel $copyToModel)
processMassEditProgressSave($modelClassName, $pageSize, $title, $dataProvider=null)
static resolveAccessCanCurrentUserDeleteModel(RedBeanModel $model, $fromAjax=false)
processListViewMerge($modelClassName, $mergedModelFormClassName, $viewPrefix, $pageView, $redirectUrl)
makeMassDeleteView($model, $activeAttributes, $selectedRecordCount, $title, $massDeleteViewClassName= 'MassDeleteView', $useModuleClassNameForItemLabel=true)
Definition: Controller.php:296
static resolveTaskKanbanViewForRelation($model, $moduleId, $controller, $kanbanView, $pageView, $searchForm, $dataProvider)
Definition: TasksUtil.php:419
static processUnsubscriptionRequest(OwnedSecurableItem $model, User $user)
resolveActiveAttributesFromMassDeletePost()
Definition: Controller.php:270
Definition: Task.php:37
static makeErrorsDataAndResolveForOwnedModelAttributes($model)
actionInlineCreateCommentFromAjax($id, $uniquePageId)
static isKanbanRequest()
Definition: KanbanUtil.php:46
attemptToSaveModelFromPost($model, $redirectUrlParams=null, $redirect=true, $returnOnValidate=false)
static processSubscriptionRequest(OwnedSecurableItem $model, User $user)
static resolveAccessCanCurrentUserReadModel(RedBeanModel $model, $fromAjax=false)
processMassEdit($pageSize, $activeAttributes, $selectedRecordCount, $pageViewClassName, $listModel, $title, $dataProvider=null)
static resolveSubscriptionLink(OwnedSecurableItem $model, $subscribeLinkClass, $unsubscribeLinkClass)
actionSearchForDuplicateModels($attribute, $value)
resolveFilteredByMetadataBeforeMakingDataProvider($searchForm, &$metadata)
static getById($id, $modelClassName=null)
static setAjaxModeAndRenderModalSearchList(CController $controller, $modalListLinkProvider, $stateMetadataAdapterClassName=null)
static resolveBreadCrumbViewForDetailsControllerAction(CController $controller, $stickySearchKey, RedBeanModel $model)
processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, $pageViewClassName, $listModel, $title, $dataProvider=null, $redirectUrl=null)
static getSubscriberData(OwnedSecurableItem $model)
static resolveAccessCanCurrentUserWriteModel(RedBeanModel $model, $fromAjax=false)
Generated on Sat Jul 11 2020 07:10:26
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.