Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
ProjectFeedListViewColumnAdapter.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  ********************************************************************************/
40  {
45  public function renderGridViewData()
46  {
47  return array(
48  'name' => $this->attribute,
49  'value' => 'ProjectFeedListViewColumnAdapter::getFeedInformationForDashboard($data)',
50  'type' => 'raw'
51  );
52  }
53 
59  public static function getFeedInformationForDashboard(ProjectAuditEvent $projectAuditEvent)
60  {
61  assert('$projectAuditEvent instanceof ProjectAuditEvent');
62  $project = Project::getById(intval($projectAuditEvent->project->id));
63  $dateTime = DateTimeUtil::getTimeSinceDisplayContent($projectAuditEvent->dateTime);
64  $data = array('{timeSpanLabel}' => $dateTime);
65  if (ActionSecurityUtil::canCurrentUserPerformAction('Details', $project))
66  {
67  $projectName = static::resolveProjectName($project);
68  $data['{projectname}'] = $projectName;
69  $user = User::getById($projectAuditEvent->user->id);
70  $data['{username}'] = $user->getFullName();
71  $unserializedData = unserialize($projectAuditEvent->serializedData);
72  if (is_array($unserializedData))
73  {
74  $data = array_merge($unserializedData, $data);
75  }
76  }
77  else
78  {
79  return Zurmo::t('ProjectsModule', '<strong>Activity on a restricted project
80  </strong> <small>about {timeSpanLabel}</small>', $data);
81  }
82  return static::getMessageContentByEventAndData($projectAuditEvent->eventName, $data);
83  }
84 
90  protected static function resolveProjectName($project)
91  {
92  assert('$project instanceof Project');
93  return ZurmoHtml::link($project->name,
94  Yii::app()->createUrl('projects/default/details', array('id' => $project->id, 'kanbanBoard' => 1)));
95  }
96 
103  public static function getMessageContentByEventAndData($event, $data)
104  {
105  assert('is_string($event)');
106  assert('is_array($data)');
107  if ($event == ProjectAuditEvent::PROJECT_CREATED)
108  {
109  return Zurmo::t('ProjectsModule', '<strong><i>{projectname}</i></strong> is added by user
110  <strong>{username}</strong>
111  <small>about {timeSpanLabel}</small>', $data);
112  }
113  elseif ($event == ProjectAuditEvent::PROJECT_ARCHIVED)
114  {
115  return Zurmo::t('ProjectsModule', '<strong><i>{projectname}</i></strong> is archived by user
116  <strong>{username}</strong>
117  <small>about {timeSpanLabel}</small>', $data);
118  }
119  elseif ($event == ProjectAuditEvent::TASK_STATUS_CHANGED)
120  {
121  return Zurmo::t('ProjectsModule', '<strong><i>{projectname}</i> {username} changed status
122  from "{fromstatus} to {tostatus}"</strong>
123  <small>about {timeSpanLabel}</small>', $data);
124  }
125  elseif ($event == ProjectAuditEvent::TASK_ADDED)
126  {
127  return Zurmo::t('ProjectsModule', '<strong><i>{projectname}</i> {username}
128  added task "{taskname}"</strong>
129  <small>about {timeSpanLabel}</small>', $data);
130  }
131  elseif ($event == ProjectAuditEvent::COMMENT_ADDED)
132  {
133  return Zurmo::t('ProjectsModule', '<strong><i>{projectname}</i> {username}
134  added comment "{comment}"</strong>
135  <small>about {timeSpanLabel}</small>', $data);
136  }
137  elseif ($event == ProjectAuditEvent::CHECKLIST_ITEM_ADDED)
138  {
139  return Zurmo::t('ProjectsModule', '<strong><i>{projectname}</i> {username}
140  added checklist item "{taskcheckitemname} in Task {taskname}"
141  </strong> <small>about {timeSpanLabel}</small>', $data);
142  }
143  }
144  }
145 ?>
static getTimeSinceDisplayContent($dateTime, $durationDisplayFormat=false)
static canCurrentUserPerformAction($actionType, $model)
static getFeedInformationForDashboard(ProjectAuditEvent $projectAuditEvent)
static getById($id, $modelClassName=null)
Generated on Tue Sep 22 2020 07:10:35
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.