All Data Structures Functions Variables Pages
CheckServicesView.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  abstract class CheckServicesView extends View
42  {
43  protected $controllerId;
44 
45  protected $moduleId;
46 
47  protected $checkResultsDisplayData;
48 
54  public function __construct($controllerId, $moduleId, $checkResultsDisplayData)
55  {
56  assert('is_string($controllerId) && $controllerId != ""');
57  assert('is_string($moduleId) && $moduleId != ""');
58  assert('is_array($checkResultsDisplayData)');
59  $this->controllerId = $controllerId;
60  $this->moduleId = $moduleId;
61  $this->checkResultsDisplayData = $checkResultsDisplayData;
62  }
63 
64  protected function renderContent()
65  {
66  $failedIndexId = CheckServicesUtil::CHECK_FAILED;
67  $passedIndexId = CheckServicesUtil::CHECK_PASSED;
68  $warningIndexId = CheckServicesUtil::CHECK_WARNING;
69  $requiredIndexId = ServiceHelper::REQUIRED_SERVICE;
70  $optionalIndexId = ServiceHelper::OPTIONAL_SERVICE;
71  $content = '<div class="MetadataView">';
72  $content .= '<table>';
73  $content .= '<tr><td>';
74  $content .= $this->renderIntroductionContent();
75  $content .= '<br/><br/>';
76  if (count($this->checkResultsDisplayData[$failedIndexId]) > 0)
77  {
78  if (count($this->checkResultsDisplayData[$failedIndexId][$requiredIndexId]) > 0)
79  {
81  Zurmo::t('InstallModule', 'Failed Required Services'),
82  $this->checkResultsDisplayData[$failedIndexId][$requiredIndexId],
83  '<span class="fail">' . Zurmo::t('InstallModule', 'FAIL') . '</span>');
84  }
85  if (count($this->checkResultsDisplayData[$failedIndexId][$optionalIndexId]) > 0)
86  {
88  Zurmo::t('InstallModule', 'Failed Optional Services'),
89  $this->checkResultsDisplayData[$failedIndexId][$optionalIndexId],
90  '<span class="fail">' . Zurmo::t('InstallModule', 'FAIL') . '</span>');
91  }
92  }
93  if (count($this->checkResultsDisplayData[$warningIndexId]) > 0)
94  {
96  Zurmo::t('InstallModule', 'Service Status Partially Known'),
97  $this->checkResultsDisplayData[$warningIndexId],
98  '<span class="warning">' . Zurmo::t('Core', 'WARNING') . '</span>');
99  }
100 
101  if (count($this->checkResultsDisplayData[$passedIndexId]) > 0)
102  {
104  Zurmo::t('InstallModule', 'Correctly Installed Services'),
105  $this->checkResultsDisplayData[$passedIndexId],
106  '<span class="pass">' . Zurmo::t('InstallModule', 'PASS') . '</span>');
107  }
108  $content .= $this->renderActionBarContent();
109  $content .= '</td></tr></table>';
110  $content .= '</div>';
111  return $content;
112  }
113 
120  protected function renderServiceGroupDisplayByServiceDataAndCheckResult($groupLabel, $groupData,
121  $checkResultLabel)
122  {
123  assert('is_string($groupLabel) && $groupLabel != ""');
124  assert('is_array($groupData)');
125  assert('is_string($checkResultLabel) && $checkResultLabel != ""');
126  $content = '<table class="checked-services">';
127  $content .= '<colgroup><col/><col style="width:100px;" /></colgroup>';
128  $content .= '<tr><td>' . $groupLabel . '</td><td></td></tr>';
129  foreach ($groupData as $serviceDisplayData)
130  {
131  $content .= '<tr><td>' . Yii::app()->format->formatNtext($serviceDisplayData['message']) . '</td>';
132  $content .= '<td>' . $checkResultLabel . '</td></tr>';
133  }
134  $content .= '</table>';
135  return $content;
136  }
137 
138  protected function renderIntroductionContent()
139  {
140  }
141 
142  protected function renderActionBarContent()
143  {
144  }
145  }
146 ?>
__construct($controllerId, $moduleId, $checkResultsDisplayData)
Definition: View.php:43
renderServiceGroupDisplayByServiceDataAndCheckResult($groupLabel, $groupData, $checkResultLabel)
Generated on Sat Feb 22 2020 07:10:31