Merge pull request #15840 from yashodha/participant_edit
[civicrm-core.git] / CRM / Dashlet / Page / Activity.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 * $Id$
17 *
18 */
19
20/**
21 * Main page for activity dashlet
22 *
23 */
24class CRM_Dashlet_Page_Activity extends CRM_Core_Page {
25
26 /**
fe482240 27 * List activities as dashlet.
6a488035 28 *
355ba699 29 * @return void
6a488035 30 */
00be9182 31 public function run() {
6a488035
TO
32 $session = CRM_Core_Session::singleton();
33 $contactID = $session->get('userID');
34 $this->assign('contactID', $contactID);
35 $this->assign('contactId', $contactID);
36
edc80cda 37 $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'dashlet');
6a488035
TO
38 $this->assign('context', $context);
39
40 // a user can always view their own activity
41 // if they have access CiviCRM permission
42 $permission = CRM_Core_Permission::VIEW;
43
44 // make the permission edit if the user has edit permission on the contact
45 if (CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::EDIT)) {
46 $permission = CRM_Core_Permission::EDIT;
47 }
48
49 $admin = CRM_Core_Permission::check('view all activities') || CRM_Core_Permission::check('administer CiviCRM');
50
51 $this->assign('admin', $admin);
52
53 // also create the form element for the activity filter box
54 $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_ActivityFilter',
55 ts('Activity Filter'), NULL
56 );
57 $controller->setEmbedded(TRUE);
58 $controller->run();
59
60 return parent::run();
61 }
96025800 62
6a488035 63}