All Data Structures Functions Variables Pages
DefaultTimeQueueController.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  const ZERO_MODELS_CHECK_FILTER_PATH = 'application.modules.workflows.controllers.filters.WorkflowZeroModelsCheckControllerFilter';
43 
44  public static function getListBreadcrumbLinks()
45  {
46  $title = Zurmo::t('WorkflowsModule', 'Time Queue');
47  return array($title);
48  }
49 
50  public function filters()
51  {
52  return array_merge(parent::filters(),
53  array(
54  array(
55  static::ZERO_MODELS_CHECK_FILTER_PATH . ' + list, index',
56  'controller' => $this,
57  'activeActionElementType' => 'ByTimeWorkflowInQueuesMenu',
58  'breadCrumbLinks' => static::getListBreadcrumbLinks(),
59  ),
60  )
61  );
62  }
63 
64  public function actionIndex()
65  {
66  $this->actionList();
67  }
68 
69  public function actionList()
70  {
71  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
72  'listPageSize', get_class($this->getModule()));
73  $activeActionElementType = 'ByTimeWorkflowInQueuesMenu';
74  $model = new ByTimeWorkflowInQueue(false);
75  $searchForm = new ByTimeWorkflowInQueuesSearchForm($model);
76  $dataProvider = $this->resolveSearchDataProvider($searchForm, $pageSize, null,
77  'ByTimeWorkflowInQueuesSearchView');
78  $breadCrumbLinks = static::getListBreadcrumbLinks();
79  if (isset($_GET['ajax']) && $_GET['ajax'] == 'list-view')
80  {
81  $mixedView = $this->makeListView(
82  $searchForm,
83  $dataProvider,
84  'ByTimeWorkflowInQueuesListView'
85  );
86  $view = new WorkflowsPageView($mixedView);
87  }
88  else
89  {
90  $mixedView = $this->makeActionBarSearchAndListView($searchForm, $dataProvider,
91  'SecuredActionBarForWorkflowsSearchAndListView', 'ByTimeWorkflowInQueues', $activeActionElementType);
93  makeViewWithBreadcrumbsForCurrentUser(
94  $this, $mixedView, $breadCrumbLinks, 'WorkflowBreadCrumbView'));
95  }
96  echo $view->render();
97  }
98 
113  public function actionMassDelete()
114  {
115  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
116  'massDeleteProgressPageSize');
117  $queueItem = new ByTimeWorkflowInQueue(false);
118 
119  $activeAttributes = $this->resolveActiveAttributesFromMassDeletePost();
120  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
121  new ByTimeWorkflowInQueuesSearchForm($queueItem),
122  $pageSize,
123  Yii::app()->user->userModel->id,
124  null,
125  'ByTimeWorkflowInQueuesSearchView');
126  $selectedRecordCount = static::getSelectedRecordCountByResolvingSelectAllFromGet($dataProvider);
127  $queueItem = $this->processMassDelete(
128  $pageSize,
129  $activeAttributes,
130  $selectedRecordCount,
131  'WorkflowsPageView',
132  $queueItem,
133  Zurmo::t('WorkflowsModule', 'Time Queue'),
134  $dataProvider,
135  array($this->getId() . '/list')
136  );
137  $massDeleteView = $this->makeMassDeleteView(
138  $queueItem,
139  $activeAttributes,
140  $selectedRecordCount,
141  Zurmo::t('WorkflowsModule', 'Time Queue'),
142  'MassDeleteView',
143  false
144  );
146  makeStandardViewForCurrentUser($this, $massDeleteView));
147  echo $view->render();
148  }
149 
157  public function actionMassDeleteProgress()
158  {
159  $pageSize = Yii::app()->pagination->resolveActiveForCurrentUserByType(
160  'massDeleteProgressPageSize');
161  $queueItem = new ByTimeWorkflowInQueue(false);
162  $dataProvider = $this->getDataProviderByResolvingSelectAllFromGet(
163  new ByTimeWorkflowInQueuesSearchForm($queueItem),
164  $pageSize,
165  Yii::app()->user->userModel->id,
166  null,
167  'ByTimeWorkflowInQueuesSearchView'
168  );
169  $this->processMassDeleteProgress(
170  'ByTimeWorkflowInQueue',
171  $pageSize,
172  Zurmo::t('WorkflowsModule', 'Time Queue'),
173  $dataProvider
174  );
175  }
176  }
177 ?>
makeMassDeleteView($model, $activeAttributes, $selectedRecordCount, $title, $massDeleteViewClassName= 'MassDeleteView', $useModuleClassNameForItemLabel=true)
Definition: Controller.php:296
resolveActiveAttributesFromMassDeletePost()
Definition: Controller.php:270
processMassDelete($pageSize, $activeAttributes, $selectedRecordCount, $pageViewClassName, $listModel, $title, $dataProvider=null, $redirectUrl=null)
Generated on Tue Apr 7 2020 07:10:46