All Data Structures Functions Variables Pages
DefaultContactWebFormEntryController.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 
40  Yii::import('application.modules.contactWebForms.controllers.DefaultController', true);
42  {
43  public static function getListBreadcrumbLinks()
44  {
45  $title = Zurmo::t('ContactWebFormsModule', 'Contact Web Form Entries');
46  return array($title);
47  }
48 
49  public function filters()
50  {
51  $modelClassName = $this->getModule()->getPrimaryModelName();
52  $viewClassName = $modelClassName . 'EditAndDetailsView';
53  return array_merge(parent::filters(),
54  array(
55  array(
56  ZurmoBaseController::REQUIRED_ATTRIBUTES_FILTER_PATH . ' + create, createFromRelation, edit',
57  'moduleClassName' => get_class($this->getModule()),
58  'viewClassName' => $viewClassName,
59  ),
60  array(
61  ContactWebFormsDefaultController::ZERO_MODELS_CHECK_FILTER_PATH . ' + list, index',
62  'controller' => $this,
63  'activeActionElementType' => 'ContactWebFormEntriesListLink',
64  'breadCrumbLinks' => static::getListBreadcrumbLinks(),
65  ),
66  )
67  );
68  }
69 
70  public function actionIndex()
71  {
72  $this->actionList();
73  }
74 
75  public function actionList()
76  {
77  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
78  'listPageSize', get_class($this->getModule()));
79  $activeActionElementType = 'ContactWebFormEntriesListMenu';
80  $model = new ContactWebFormEntry(false);
81  $searchForm = new ContactWebFormEntrySearchForm($model);
82  $dataProvider = $this->resolveSearchDataProvider($searchForm, $pageSize, null,
83  'ContactWebFormEntrySearchView');
84  $breadCrumbLinks = static::getListBreadcrumbLinks();
85  if (isset($_GET['ajax']) && $_GET['ajax'] == 'list-view')
86  {
87  $mixedView = $this->makeListView(
88  $searchForm,
89  $dataProvider,
90  'ContactWebFormEntryListView'
91  );
92  $view = new ContactWebFormsPageView($mixedView);
93  }
94  else
95  {
96  $mixedView = $this->makeActionBarSearchAndListView($searchForm, $dataProvider,
97  'SecuredActionBarForContactWebFormEntrySearchAndListView', 'ContactWebFormEntry',
98  $activeActionElementType);
100  makeViewWithBreadcrumbsForCurrentUser(
101  $this, $mixedView, $breadCrumbLinks, 'ContactWebFormsBreadCrumbView'));
102  }
103  echo $view->render();
104  }
105 
106  public function actionMassDelete()
107  {
108  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize');
109  $contactWebFormEntry = new ContactWebFormEntry(false);
110  $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
111  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
112  new ContactWebFormEntrySearchForm($contactWebFormEntry), $pageSize, null, null);
113  $selectedRecordCount = static::getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
114  $contactWebFormEntry = $this->processMassDelete($pageSize, $activeAttributes, $selectedRecordCount,
115  'ContactWebFormsPageView', $contactWebFormEntry,
116  ContactWebFormEntry::getModelLabelByTypeAndLanguage('Plural'), $dataProvider,
117  array($this->getId() . '/list'));
118  $massDeleteView = $this->makeMassDeleteView($contactWebFormEntry, $activeAttributes, $selectedRecordCount,
119  ContactWebFormEntry::getModelLabelByTypeAndLanguage('Plural'));
121  makeStandardViewForCurrentUser($this, $massDeleteView));
122  echo $view->render();
123  }
124 
125  public function actionMassDeleteProgress()
126  {
127  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType('massDeleteProgressPageSize');
128  $contactWebFormEntry = new ContactWebFormEntry(false);
129  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
130  new ContactWebFormsSearchForm($contactWebFormEntry), $pageSize, null, null);
131  $this->processMassDeleteProgress('ContactWebFormEntry', $pageSize,
132  ContactWebFormEntry::getModelLabelByTypeAndLanguage('Plural'),
133  $dataProvider);
134  }
135 
136  protected function makeMassDeleteView($model, $activeAttributes, $selectedRecordCount, $title,
137  $massDeleteViewClassName = 'MassDeleteView',
138  $useModuleClassNameForItemLabel = true)
139  {
140  return parent::makeMassDeleteView($model, $activeAttributes, $selectedRecordCount, $title,
141  $massDeleteViewClassName = 'MassDeleteView', false);
142  }
143  }
144 ?>
resolveActiveAttributesFromMassDeletePost()
Definition: Controller.php:270
processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, $pageViewClassName, $listModel, $title, $dataProvider=null, $redirectUrl=null)
Generated on Sun May 31 2020 07:10:30