Add communications page.
authorDavid Thompson <davet@gnu.org>
Wed, 1 Oct 2014 20:54:21 +0000 (16:54 -0400)
committerDavid Thompson <davet@gnu.org>
Wed, 1 Oct 2014 20:54:21 +0000 (16:54 -0400)
* CRM/Memberdashboard/Page/Communications.php: New file.
* templates/CRM/Memberdashboard/Page/Communications.tpl: New file.
* templates/CRM/Memberdashboard/Page/Element/CiviEvent.tpl: New file.
* templates/CRM/Memberdashboard/Page/MemberDashboard.tpl: Link to new page.
* xml/Menu/memberdashboard.xml (<menu>): Add item for new page.

CRM/Memberdashboard/Page/Communications.php [new file with mode: 0644]
templates/CRM/Memberdashboard/Page/Communications.tpl [new file with mode: 0644]
templates/CRM/Memberdashboard/Page/Element/CiviEvent.tpl [new file with mode: 0644]
templates/CRM/Memberdashboard/Page/MemberDashboard.tpl
xml/Menu/memberdashboard.xml

diff --git a/CRM/Memberdashboard/Page/Communications.php b/CRM/Memberdashboard/Page/Communications.php
new file mode 100644 (file)
index 0000000..8119172
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * FSF Member Dashboard
+ * Copyright © 2014 Free Software Foundation, Inc.
+ *
+ * This file is a part of FSF Member Dashboard.
+ *
+ * FSF Member Dashboard is free software; you can copy, modify, and
+ * distribute it under the terms of the GNU Affero General Public
+ * License Version 3, 19 November 2007 and the CiviCRM Licensing
+ * Exception.
+ *
+ * FSF Member Dashboard is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FSF Member Dashboard.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+require_once 'CRM/Core/Page.php';
+
+class CRM_Memberdashboard_Page_Communications extends CRM_Core_Page {
+  function run() {
+    $helper = new CRM_Memberdashboard_Page_ComponentHelper(array('CiviEvent'));
+    $helper->run();
+    $this->assign('dashboardElements', $helper->buildDashboardElements());
+    $gContact = new CRM_Contact_Page_View_UserDashBoard_GroupContact();
+    $gContact->run();
+
+    CRM_Utils_System::setTitle('Communications');
+
+    parent::run();
+  }
+}
diff --git a/templates/CRM/Memberdashboard/Page/Communications.tpl b/templates/CRM/Memberdashboard/Page/Communications.tpl
new file mode 100644 (file)
index 0000000..9a12250
--- /dev/null
@@ -0,0 +1,30 @@
+{*
+  FSF Member Dashboard
+  Copyright © 2014 Free Software Foundation, Inc.
+
+  This file is a part of FSF Member Dashboard.
+
+  FSF Member Dashboard is free software: you can redistribute it
+  and/or modify it under the terms of the GNU Affero General Public
+  License as published by the Free Software Foundation, either version
+  3 of the License, or (at your option) any later version.
+
+  FSF Member Dashboard is distributed in the hope that it will be
+  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with FSF Member Dashboard.  If not, see
+  <http://www.gnu.org/licenses/>.
+*}
+
+<div class="crm-dashboard-groups">
+  <div class="header-dark">
+    {ts}Your Group(s){/ts}
+  </div>
+  {include file="CRM/Contact/Page/View/UserDashBoard/GroupContact.tpl"}
+</div>
+
+{include file="CRM/Memberdashboard/Page/DashboardElement.tpl"
+         element=$dashboardElements.CiviEvent }
diff --git a/templates/CRM/Memberdashboard/Page/Element/CiviEvent.tpl b/templates/CRM/Memberdashboard/Page/Element/CiviEvent.tpl
new file mode 100644 (file)
index 0000000..fae0daa
--- /dev/null
@@ -0,0 +1,72 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.5                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+<div class="view-content">
+    {if $event_rows}
+        {strip}
+            <div class="description">
+                {ts}Click on the event name for more information.{/ts}
+            </div>
+            <table class="selector">
+                <tr class="columnheader">
+                    <th>{ts}Event{/ts}</th>
+                    <th>{ts}Event Date(s){/ts}</th>
+                    <th>{ts}Status{/ts}</th>
+                    <th></th>
+                </tr>
+                {counter start=0 skip=1 print=false}
+                {foreach from=$event_rows item=row}
+                    <tr id='rowid{$row.participant_id}' class=" crm-event-participant-id_{$row.participant_id} {cycle values="odd-row,even-row"}{if $row.status eq Cancelled} disabled{/if}">
+                       <td class="crm-participant-event-id_{$row.event_id}"><a href="{crmURL p='civicrm/event/info' q="reset=1&id=`$row.event_id`&context=dashboard"}">{$row.event_title}</a></td>
+                       <td class="crm-participant-event_start_date">
+                            {$row.event_start_date|crmDate}
+                            {if $row.event_end_date}
+                                &nbsp; - &nbsp;
+                                {* Only show end time if end date = start date *}
+                                {if $row.event_end_date|date_format:"%Y%m%d" == $row.event_start_date|date_format:"%Y%m%d"}
+                                    {$row.event_end_date|crmDate:0:1}
+                                {else}
+                                    {$row.event_end_date|crmDate}
+                                {/if}
+                            {/if}
+                       </td>
+                       <td class="crm-participant-participant_status">{$row.participant_status}</td>
+                       <td class="crm-participant-showConfirmUrl">
+                            {if $row.showConfirmUrl}
+                                <a href="{crmURL p='civicrm/event/confirm' q="reset=1&participantId=`$row.participant_id`"}">{ts}Confirm Registration{/ts}</a>
+                            {/if}
+                        </td>
+                    </tr>
+                {/foreach}
+            </table>
+        {/strip}
+    {else}
+        <div class="messages status no-popup">
+           <div class="icon inform-icon"></div>&nbsp;
+                 {ts}You are not registered for any current or upcoming Events.{/ts}
+
+        </div>
+    {/if}
+</div>
index c3f76d3c87a17f3329aa37f23bf2fad74eafe438..491dfaea65e0917935d1c70702c4dc93535d36ea 100644 (file)
@@ -19,6 +19,8 @@
   <http://www.gnu.org/licenses/>.
 *}
 
+<a href="{crmURL p='civicrm/member-dashboard/communications'}">Go to Communications</a>
+
 {include file="CRM/Memberdashboard/Page/DashboardElement.tpl"
          element=$dashboardElements.CiviMember }
 
index df439045f65b64a0f0dbf3f2e7c0c9b44735d30c..e6b3b0b8070dd65617696a29b372ce97ef6bb6fe 100644 (file)
@@ -6,4 +6,10 @@
     <title>MemberDashboard</title>
     <access_arguments>access CiviCRM</access_arguments>
   </item>
+  <item>
+    <path>civicrm/member-dashboard/communications</path>
+    <page_callback>CRM_Memberdashboard_Page_Communications</page_callback>
+    <title>MemberDashboard</title>
+    <access_arguments>access CiviCRM</access_arguments>
+  </item>
 </menu>