Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
MashableActivityRules.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 
42  abstract class MashableActivityRules
43  {
49  abstract public function resolveSearchAttributesDataByRelatedItemId($relationItemId);
50 
56  abstract public function resolveSearchAttributesDataByRelatedItemIds($relationItemIds);
57 
63  abstract public function resolveSearchAttributeDataForLatestActivities($searchAttributeData);
64 
68  abstract public function getLatestActivitiesOrderByAttributeName();
69 
73  abstract public function getLatestActivityExtraDisplayStringByModel($model);
74 
80  {
81  }
82 
89  public function resolveSearchAttributeDataForAllLatestActivities($searchAttributeData)
90  {
91  return $searchAttributeData;
92  }
93 
99  public function getSummaryContentTemplate($ownedByFilter, $viewModuleClassName)
100  {
101  assert('is_string($ownedByFilter)');
102  assert('is_string($viewModuleClassName)');
103  if ($ownedByFilter != LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER)
104  {
105  return "<span>{modelStringContent}</span><span class='less-pronounced-text'>" .
106  Zurmo::t('ZurmoModule', 'by {ownerStringContent}') . "</span><span>{extraContent}</span>";
107  }
108  else
109  {
110  return "<span>{modelStringContent}</span><span>{extraContent}</span>";
111  }
112  }
113 
118  protected static function resolveStringValueModelsDataToStringContent($modelsAndStringData)
119  {
120  assert('is_array($modelsAndStringData)');
121  $content = null;
122  foreach ($modelsAndStringData as $modelStringContent)
123  {
124  if ($content != null)
125  {
126  $content .= ', ';
127  }
128  $content .= $modelStringContent;
129  }
130  return $content;
131  }
132 
137  public static function resolveSearchAttributesDataByOwnedByFilter(& $searchAttributesData, $ownedByFilter)
138  {
139  assert('is_array($searchAttributesData)');
140  assert('$ownedByFilter == LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL ||
141  $ownedByFilter == LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER ||
142  is_int($ownedByFilter)');
143  if ($ownedByFilter == LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER || is_int($ownedByFilter))
144  {
145  if (is_int($ownedByFilter))
146  {
147  $userId = $ownedByFilter;
148  }
149  else
150  {
151  $userId = Yii::app()->user->userModel->id;
152  }
153  static::resolveSearchAttributesDataByOwnedByFilterClauses($searchAttributesData, $userId);
154  }
155  }
156 
162  public static function resolveSearchAttributesDataStructure(& $searchAttributesDataStructure)
163  {
164  assert('is_string($searchAttributesDataStructure) || $searchAttributesDataStructure === null');
165  }
166 
177  $modelClassName, $relationItemIds, $ownedByFilter,
178  $shouldResolveSearchAttributeDataForLatestActivities,
179  & $modelClassNamesAndSearchAttributeData)
180  {
181  }
182 
187  protected static function resolveSearchAttributesDataByOwnedByFilterClauses(& $searchAttributesData, $userId)
188  {
189  assert('is_array($searchAttributesData)');
190  assert('is_int($userId)');
191  $clauseCount = count($searchAttributesData['clauses']);
192  $searchAttributesData['clauses'][] = array(
193  'attributeName' => 'owner',
194  'operatorType' => 'equals',
195  'value' => $userId,
196  );
197  if ($clauseCount == 0)
198  {
199  $searchAttributesData['structure'] = '0';
200  }
201  else
202  {
203  $searchAttributesData['structure'] = $searchAttributesData['structure'] . ' and ' . ($clauseCount + 1);
204  }
205  }
206  }
207 ?>
resolveSearchAttributeDataForAllLatestActivities($searchAttributeData)
renderRelatedModelsByImportanceContent(RedBeanModel $model)
static resolveStringValueModelsDataToStringContent($modelsAndStringData)
getSummaryContentTemplate($ownedByFilter, $viewModuleClassName)
getLatestActivitiesOrderByAttributeName()
static resolveSearchAttributesDataStructure(&$searchAttributesDataStructure)
static resolveSearchAttributesDataByOwnedByFilterClauses(&$searchAttributesData, $userId)
resolveAdditionalSearchAttributesDataByModelClassNameAndRelatedItemIds($modelClassName, $relationItemIds, $ownedByFilter, $shouldResolveSearchAttributeDataForLatestActivities, &$modelClassNamesAndSearchAttributeData)
resolveSearchAttributesDataByRelatedItemId($relationItemId)
resolveSearchAttributeDataForLatestActivities($searchAttributeData)
getLatestActivityExtraDisplayStringByModel($model)
static resolveSearchAttributesDataByOwnedByFilter(&$searchAttributesData, $ownedByFilter)
resolveSearchAttributesDataByRelatedItemIds($relationItemIds)
Generated on Fri Jul 3 2020 07:10:37
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.