[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_scheduler/tmpl/task/ -> edit.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_scheduler
   6   *
   7   * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  // Restrict direct access
  12  defined('_JEXEC') or die;
  13  
  14  use Joomla\CMS\Application\AdministratorApplication;
  15  use Joomla\CMS\HTML\HTMLHelper;
  16  use Joomla\CMS\Language\Text;
  17  use Joomla\CMS\Layout\LayoutHelper;
  18  use Joomla\CMS\Router\Route;
  19  use Joomla\Component\Scheduler\Administrator\Task\TaskOption;
  20  use Joomla\Component\Scheduler\Administrator\View\Task\HtmlView;
  21  
  22  /** @var  HtmlView $this */
  23  
  24  $wa = $this->document->getWebAssetManager();
  25  
  26  $wa->useScript('keepalive');
  27  $wa->useScript('form.validate');
  28  $wa->useStyle('com_scheduler.admin-view-task-css');
  29  
  30  /** @var AdministratorApplication $app */
  31  $app = $this->app;
  32  
  33  $input = $app->getInput();
  34  
  35  // Fieldsets to be ignored by the `joomla.edit.params` template.
  36  $this->ignore_fieldsets = ['aside', 'details', 'exec_hist', 'custom-cron-rules', 'basic', 'advanced', 'priority'];
  37  
  38  // Used by the `joomla.edit.params` template to render the right template for UI tabs.
  39  $this->useCoreUI = true;
  40  
  41  $advancedFieldsets = $this->form->getFieldsets('params');
  42  
  43  // Don't show the params fieldset, they will be loaded later
  44  foreach ($advancedFieldsets as $name => $fieldset) :
  45      if ($name === 'task_params') :
  46          unset($advancedFieldsets[$name]);
  47          continue;
  48      endif;
  49  
  50      $this->ignore_fieldsets[] = $fieldset->name;
  51  endforeach;
  52  
  53  ?>
  54  
  55  <form action="<?php echo Route::_('index.php?option=com_scheduler&view=task&layout=edit&id=' . (int) $this->item->id); ?>"
  56        method="post" name="adminForm" id="task-form"
  57        aria-label="<?php echo Text::_('COM_SCHEDULER_FORM_TITLE_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>"
  58        class="form-validate">
  59  
  60      <!-- The task title field -->
  61      <?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
  62  
  63      <!-- The main form card -->
  64      <div class="main-card">
  65          <?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => 'general')); ?>
  66  
  67          <!-- The first (and the main) tab in the form -->
  68          <?php echo
  69          HTMLHelper::_(
  70              'uitab.addTab',
  71              'myTab',
  72              'general',
  73              empty($this->item->id) ? Text::_('COM_SCHEDULER_NEW_TASK') : Text::_('COM_SCHEDULER_EDIT_TASK')
  74          );
  75          ?>
  76          <div class="row">
  77              <div class="col-lg-9">
  78                  <!-- Task type title, description go here -->
  79                  <?php if ($this->item->taskOption) :
  80                      /** @var TaskOption $taskOption */
  81                      $taskOption = $this->item->taskOption; ?>
  82                      <div id="taskOptionInfo">
  83                          <h2 id="taskOptionTitle">
  84                              <?php echo $taskOption->title ?>
  85                          </h2>
  86                          <?php
  87                              $this->fieldset    = 'description';
  88                              $short_description = Text::_($taskOption->desc);
  89                              $long_description  = LayoutHelper::render('joomla.edit.fieldset', $this);
  90  
  91                          if (!$long_description) {
  92                              $truncated = HTMLHelper::_('string.truncate', $short_description, 550, true, false);
  93  
  94                              if (strlen($truncated) > 500) {
  95                                  $long_description  = $short_description;
  96                                  $short_description = HTMLHelper::_('string.truncate', $truncated, 250);
  97  
  98                                  if ($short_description == $long_description) {
  99                                      $long_description = '';
 100                                  }
 101                              }
 102                          }
 103                          ?>
 104                          <p><?php echo $short_description; ?></p>
 105                          <?php if ($long_description) : ?>
 106                              <p class="readmore">
 107                                  <a href="#" onclick="document.getElementById('myTab').activateTab(document.getElementById('description'));">
 108                                      <?php echo Text::_('JGLOBAL_SHOW_FULL_DESCRIPTION'); ?>
 109                                  </a>
 110                              </p>
 111                          <?php endif; ?>
 112                      </div>
 113                      <!-- If TaskOption does not exist -->
 114                  <?php else :
 115                      $app->enqueueMessage(Text::_('COM_SCHEDULER_WARNING_EXISTING_TASK_TYPE_NOT_FOUND'), 'warning');
 116                      ?>
 117                  <?php endif; ?>
 118                  <fieldset class="options-form">
 119                      <legend><?php echo Text::_('COM_SCHEDULER_FIELDSET_BASIC'); ?></legend>
 120                      <?php echo $this->form->renderFieldset('basic'); ?>
 121                  </fieldset>
 122  
 123                  <fieldset class="options-form match-custom"
 124                            data-showon='[{"field":"jform[execution_rules][rule-type]","values":["cron-expression"],"sign":"=","op":""}]'
 125                  >
 126                      <legend><?php echo Text::_('COM_SCHEDULER_FIELDSET_CRON_OPTIONS'); ?></legend>
 127                      <?php echo $this->form->renderFieldset('custom-cron-rules'); ?>
 128                  </fieldset>
 129                  <?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
 130              </div>
 131  
 132              <div class="col-lg-3">
 133                  <?php echo $this->form->renderFieldset('aside'); ?>
 134              </div>
 135          </div>
 136          <?php echo HTMLHelper::_('uitab.endTab'); ?>
 137          <?php if (isset($long_description) && $long_description != '') : ?>
 138              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'description', Text::_('JGLOBAL_FIELDSET_DESCRIPTION')); ?>
 139                  <div class="card">
 140                      <div class="card-body">
 141                          <?php echo $long_description; ?>
 142                      </div>
 143                  </div>
 144              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 145          <?php endif; ?>
 146          <!-- Tab for advanced options -->
 147          <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'advanced', Text::_('JGLOBAL_FIELDSET_ADVANCED')) ?>
 148          <div class="row">
 149              <div class="col-lg-9">
 150              <fieldset class="options-form">
 151                  <legend><?php echo Text::_('COM_SCHEDULER_FIELDSET_PRIORITY') ?></legend>
 152                  <?php echo $this->form->renderFieldset('priority') ?>
 153              </fieldset>
 154              <?php foreach ($advancedFieldsets as $fieldset) : ?>
 155                  <fieldset class="options-form">
 156                      <legend><?php echo Text::_($fieldset->label ?: 'COM_SCHEDULER_FIELDSET_' . $fieldset->name) ?></legend>
 157                      <?php echo $this->form->renderFieldset($fieldset->name) ?>
 158                  </fieldset>
 159              <?php endforeach; ?>
 160              </div>
 161          </div>
 162          <?php echo HTMLHelper::_('uitab.endTab') ?>
 163  
 164          <!-- Tab to show execution history -->
 165          <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'exec_hist', Text::_('COM_SCHEDULER_FIELDSET_EXEC_HIST')); ?>
 166          <div class="row">
 167              <div class="col-lg-9">
 168                  <fieldset class="options-form">
 169                      <legend><?php echo Text::_('COM_SCHEDULER_FIELDSET_EXEC_HIST'); ?></legend>
 170                      <?php echo $this->form->renderFieldset('exec_hist'); ?>
 171                  </fieldset>
 172              </div>
 173          </div>
 174          <?php echo HTMLHelper::_('uitab.endTab'); ?>
 175  
 176          <!-- Tab to show creation details-->
 177          <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', Text::_('JDETAILS')); ?>
 178          <div class="row">
 179              <div class="col-lg-9">
 180                  <fieldset class="options-form">
 181                      <legend><?php echo Text::_('JDETAILS'); ?></legend>
 182                      <?php echo $this->form->renderFieldset('details'); ?>
 183                  </fieldset>
 184              </div>
 185          </div>
 186          <?php echo HTMLHelper::_('uitab.endTab'); ?>
 187  
 188          <!-- Item permissions tab, if user has admin privileges -->
 189          <?php if ($this->canDo->get('core.admin')) : ?>
 190              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'permissions', Text::_('JCONFIG_PERMISSIONS_LABEL')); ?>
 191              <fieldset id="fieldset-permissions" class="options-form">
 192                  <legend><?php echo Text::_('JCONFIG_PERMISSIONS_LABEL'); ?></legend>
 193                  <div>
 194                      <?php echo $this->form->getInput('rules'); ?>
 195                  </div>
 196              </fieldset>
 197              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 198          <?php endif; ?>
 199          <?php echo HTMLHelper::_('uitab.endTabSet'); ?>
 200          <?php echo $this->form->getInput('context'); ?>
 201          <input type="hidden" name="task" value="">
 202          <?php echo HTMLHelper::_('form.token'); ?>
 203      </div>
 204  </form>


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