File indexing completed on 2024-12-29 05:24:48

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 $modelMember = new Default_Model_MemberEmail();
0024 $listEmails = $modelMember->fetchAllMailAddresses($this->member->member_id);
0025 ?>
0026 
0027 
0028 <div class="panel-collapse " id="email-collapse">
0029     <div class="panel-body">
0030         <div id="form-email-body" class="well">
0031         <p>Your <strong>primary email address</strong> will be used for account-related notifications
0032             (e.g. account changes) as well as any web-based operations
0033             (e.g. login and comment notifications).</p>
0034 
0035         <ul class="group-list">
0036             <?php
0037             foreach ($listEmails as $listEmail) {
0038             ?>
0039             <li class="css-truncate">
0040                 <span title="<?=$listEmail['email_address']?>" class="css-truncate-target"><?=$listEmail['email_address']?></span>
0041                 <?php if ($listEmail['email_primary']) { ?>
0042                 <span class="label default">Primary</span>
0043                 <?php } ?>
0044                 <?php if (empty($listEmail['email_checked'])) { ?>
0045                     <span class="label attention">Unverified</span>
0046                 <?php } ?>
0047                 <span class="email-actions">
0048                     <?php if (empty($listEmail['email_primary'])) { ?>
0049                         <form method="post" action="/settings/removeemail/i/<?=$listEmail['email_id']?>" class="partial"  data-target="#form-email"
0050                               data-trigger="#email-trigger">
0051                             <button data-message="Are you sure you want to remove this email from your account?" data-callback="callbackDelete" aria-label="Delete" class="btn remove">
0052                                 <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
0053                             </button>
0054                         </form>
0055                         <?php if ($listEmail['email_checked']) { ?>
0056                         <form method="post" action="/settings/setdefaultemail/i/<?=$listEmail['email_id']?>"  class="partial"  data-target="#form-email"
0057                               data-trigger="#email-trigger">
0058                             <button class="btn" type="submit">Set as primary</button>
0059                         </form>
0060                         <?php } ?>
0061                     <?php } ?>
0062                     <?php if (empty($listEmail['email_checked'])) { ?>
0063                         <form method="post" action="/settings/resendverification/i/<?=$listEmail['email_id']?>"  class="partial"  data-target="#form-email"
0064                               data-trigger="#email-trigger">
0065                             <button class="btn" type="submit">Resend verification</button>
0066                         </form>
0067                     <?php } ?>
0068                 </span>
0069             </li>
0070             <?php } ?>
0071         </ul>
0072 
0073         <form method="post" action="/settings/addemail/" class="partial"  data-target="#form-email"
0074               data-trigger="#email-trigger">
0075             <dl class="inline">
0076                 <dt><label for="email">Add email address</label></dt>
0077                 <dd><input type="email" size="30" required="required" name="user_email" id="email" class="">
0078                     <button class="btn" type="submit">Add</button></dd>
0079             </dl>
0080         </form>
0081 
0082         <hr>
0083         <div class="row">
0084             <?php
0085             if ($this->messages) {
0086                 foreach ($this->messages as $form_element) {
0087                     foreach ($form_element as $key=>$message) {
0088                         echo "<div>{$message}</div>";
0089                     }
0090                 }
0091             }
0092             ?>
0093         </div>
0094     </div>
0095 </div>
0096     <script>
0097 
0098             function callbackDelete(link) {
0099                 // Do however you want to handle deleting
0100                 // We have the link element and can access it's data attributes
0101 
0102                 $(link).closest('form').submit();
0103             }
0104 
0105     </script>