[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_users/tmpl/method/ -> edit.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_users
   6   *
   7   * @copyright   (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  // Prevent direct access
  12  defined('_JEXEC') or die;
  13  
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\Router\Route;
  17  use Joomla\Component\Users\Site\View\Method\HtmlView;
  18  use Joomla\Utilities\ArrayHelper;
  19  
  20  /** @var  HtmlView  $this */
  21  
  22  $cancelURL = Route::_('index.php?option=com_users&task=methods.display&user_id=' . $this->user->id);
  23  
  24  if (!empty($this->returnURL)) {
  25      $cancelURL = $this->escape(base64_decode($this->returnURL));
  26  }
  27  
  28  $recordId     = (int) $this->record->id ?? 0;
  29  $method       = $this->record->method ?? $this->getModel()->getState('method');
  30  $userId       = (int) $this->user->id ?? 0;
  31  $headingLevel = 2;
  32  $hideSubmit   = !$this->renderOptions['show_submit'] && !$this->isEditExisting
  33  ?>
  34  <div class="card card-body">
  35      <form action="<?php echo Route::_(sprintf("index.php?option=com_users&task=method.save&id=%d&method=%s&user_id=%d", $recordId, $method, $userId)) ?>"
  36            class="form form-horizontal" id="com-users-method-edit" method="post">
  37          <?php echo HTMLHelper::_('form.token') ?>
  38          <?php if (!empty($this->returnURL)) : ?>
  39          <input type="hidden" name="returnurl" value="<?php echo $this->escape($this->returnURL) ?>">
  40          <?php endif; ?>
  41  
  42          <?php if (!empty($this->renderOptions['hidden_data'])) : ?>
  43              <?php foreach ($this->renderOptions['hidden_data'] as $key => $value) : ?>
  44          <input type="hidden" name="<?php echo $this->escape($key) ?>" value="<?php echo $this->escape($value) ?>">
  45              <?php endforeach; ?>
  46          <?php endif; ?>
  47  
  48          <?php if (!empty($this->title)) : ?>
  49              <?php if (!empty($this->renderOptions['help_url'])) : ?>
  50              <span class="float-end">
  51                  <a href="<?php echo $this->renderOptions['help_url'] ?>"
  52                     class="btn btn-sm btn-default btn-inverse btn-dark"
  53                     target="_blank"
  54                  >
  55                      <span class="icon icon-question-sign" aria-hidden="true"></span>
  56                      <span class="visually-hidden"><?php echo Text::_('JHELP') ?></span>
  57                  </a>
  58              </span>
  59              <?php endif;?>
  60              <h<?php echo $headingLevel ?> id="com-users-method-edit-head">
  61                  <?php echo Text::_($this->title) ?>
  62              </h<?php echo $headingLevel ?>>
  63              <?php $headingLevel++ ?>
  64          <?php endif; ?>
  65  
  66          <div class="row">
  67              <label class="col-sm-3 col-form-label"
  68                  for="com-users-method-edit-title">
  69                  <?php echo Text::_('COM_USERS_MFA_EDIT_FIELD_TITLE'); ?>
  70              </label>
  71              <div class="col-sm-9">
  72                  <input type="text"
  73                          class="form-control"
  74                          id="com-users-method-edit-title"
  75                          name="title"
  76                          value="<?php echo $this->escape($this->record->title) ?>"
  77                          aria-describedby="com-users-method-edit-help">
  78                  <p class="form-text" id="com-users-method-edit-help">
  79                      <?php echo $this->escape(Text::_('COM_USERS_MFA_EDIT_FIELD_TITLE_DESC')) ?>
  80                  </p>
  81              </div>
  82          </div>
  83  
  84          <div class="row">
  85              <div class="col-sm-9 offset-sm-3">
  86                  <div class="form-check">
  87                      <input class="form-check-input" type="checkbox" id="com-users-is-default-method" <?php echo $this->record->default ? 'checked="checked"' : ''; ?> name="default">
  88                      <label class="form-check-label" for="com-users-is-default-method">
  89                          <?php echo Text::_('COM_USERS_MFA_EDIT_FIELD_DEFAULT'); ?>
  90                      </label>
  91                  </div>
  92              </div>
  93          </div>
  94  
  95          <?php if (!empty($this->renderOptions['pre_message'])) : ?>
  96          <div class="com-users-method-edit-pre-message text-muted mt-4 mb-3">
  97              <?php echo $this->renderOptions['pre_message'] ?>
  98          </div>
  99          <?php endif; ?>
 100  
 101          <?php if (!empty($this->renderOptions['tabular_data'])) : ?>
 102          <div class="com-users-method-edit-tabular-container">
 103              <?php if (!empty($this->renderOptions['table_heading'])) : ?>
 104                  <h<?php echo $headingLevel ?> class="h3 border-bottom mb-3">
 105                      <?php echo $this->renderOptions['table_heading'] ?>
 106                  </h<?php echo $headingLevel ?>>
 107              <?php endif; ?>
 108              <table class="table table-striped">
 109                  <tbody>
 110                  <?php foreach ($this->renderOptions['tabular_data'] as $cell1 => $cell2) : ?>
 111                  <tr>
 112                      <td>
 113                          <?php echo $cell1 ?>
 114                      </td>
 115                      <td>
 116                          <?php echo $cell2 ?>
 117                      </td>
 118                  </tr>
 119                  <?php endforeach; ?>
 120                  </tbody>
 121              </table>
 122          </div>
 123          <?php endif; ?>
 124  
 125          <?php if ($this->renderOptions['field_type'] == 'custom') : ?>
 126              <?php echo $this->renderOptions['html']; ?>
 127          <?php endif; ?>
 128          <div class="row mb-3 <?php echo $this->renderOptions['input_type'] === 'hidden' ? 'd-none' : '' ?>">
 129              <?php if ($this->renderOptions['label']) : ?>
 130              <label class="col-sm-3 col-form-label" for="com-users-method-code">
 131                  <?php echo $this->renderOptions['label']; ?>
 132              </label>
 133              <?php endif; ?>
 134              <div class="col-sm-9" <?php echo $this->renderOptions['label'] ? '' : 'offset-sm-3' ?>>
 135                  <?php
 136                  $attributes = array_merge(
 137                      [
 138                          'type'             => $this->renderOptions['input_type'],
 139                          'name'             => 'code',
 140                          'value'            => $this->escape($this->renderOptions['input_value']),
 141                          'id'               => 'com-users-method-code',
 142                          'class'            => 'form-control',
 143                          'aria-describedby' => 'com-users-method-code-help',
 144                      ],
 145                      $this->renderOptions['input_attributes']
 146                  );
 147  
 148                  if (strpos($attributes['class'], 'form-control') === false) {
 149                      $attributes['class'] .= ' form-control';
 150                  }
 151                  ?>
 152                  <input <?php echo ArrayHelper::toString($attributes) ?>>
 153  
 154                  <p class="form-text" id="com-users-method-code-help">
 155                      <?php echo $this->escape($this->renderOptions['placeholder']) ?>
 156                  </p>
 157              </div>
 158          </div>
 159  
 160          <div class="row mb-3">
 161              <div class="col-sm-9 offset-sm-3">
 162                  <button type="submit" class="btn btn-primary me-3 <?php echo $hideSubmit ? 'd-none' : '' ?> <?php echo $this->renderOptions['submit_class'] ?>">
 163                      <span class="<?php echo $this->renderOptions['submit_icon'] ?>" aria-hidden="true"></span>
 164                      <?php echo Text::_($this->renderOptions['submit_text']); ?>
 165                  </button>
 166  
 167                  <a href="<?php echo $cancelURL ?>"
 168                     class="btn btn-sm btn-danger">
 169                      <span class="icon icon-cancel-2" aria-hidden="true"></span>
 170                      <?php echo Text::_('JCANCEL'); ?>
 171                  </a>
 172              </div>
 173          </div>
 174  
 175          <?php if (!empty($this->renderOptions['post_message'])) : ?>
 176              <div class="com-users-method-edit-post-message text-muted">
 177                  <?php echo $this->renderOptions['post_message'] ?>
 178              </div>
 179          <?php endif; ?>
 180      </form>
 181  </div>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer