Statistiques

Compteur d'affichages des articles
1040032

05 - Modification des fichiers des vues

Il convient de modifier toutes les vues pour prendre en compte les modifications de la table.

administrator/components/com_prestalegals/views/prestalegals/view.html.php

J'ai décidé de supprimer les icônes de création et de suppression.

Suppression des lignes :

		if ($canDo->get('core.create')
            || (count($user->getAuthorisedCategories('com_prestalegals', 'core.create'))) > 0 ) {
			JToolBarHelper::addNew('prestalegal.add');
		}

puis

		if ($this->state->get('filter.published') == -2
            && $canDo->get('core.delete')) {
			JToolBarHelper::deleteList('', 'prestalegals.delete','JTOOLBAR_EMPTY_TRASH');
			JToolBarHelper::divider();

		} else if ($canDo->get('core.edit.state')) {
			JToolBarHelper::trash('prestalegals.trash');
			JToolBarHelper::divider();
		}

administrator/components/com_prestalegals/views/prestalegal/view.html.php

J'ai décidé de supprimer la possibilité de dupliquer la fiche et de créer une autre fiche.

Les lignes suivantes :

		// For new records, check the create permission.
		if ($isNew && (count($user->getAuthorisedCategories('com_prestalegals', 'core.create')) > 0)) {
			JToolBarHelper::apply('prestalegal.apply');
			JToolBarHelper::save('prestalegal.save');
			JToolBarHelper::save2new('prestalegal.save2new');
			JToolBarHelper::cancel('prestalegal.cancel');

deviennent

		if ($isNew && (count($user->getAuthorisedCategories('com_prestalegals', 'core.create')) > 0)) {
			JToolBarHelper::apply('prestalegal.apply');
			JToolBarHelper::save('prestalegal.save');
			JToolBarHelper::cancel('prestalegal.cancel');

Suppression des lignes :

					// We can save this record, but check the create permission to see if we can return to make a new one.
					if ($canDo->get('core.create')) {
						JToolBarHelper::save2new('prestalegal.save2new');
					}

puis

			// If checked out, we can still save
			if ($canDo->get('core.create')) {
				JToolBarHelper::save2copy('prestalegal.save2copy');
			}

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit.php

Dans ce fichier il faut d'abord modifier la fonction Joomla.submitbutton :

<script type="text/javascript">
	Joomla.submitbutton = function(task) {
		if (task == 'prestalegal.cancel' || document.formvalidator.isValid(document.id('item-form'))) {
			<?php echo $this->form->getField('fulltext')->save(); ?>
			Joomla.submitform(task, document.getElementById('item-form'));
		} else {
			alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		}
	}
</script>

Devient :

<script type="text/javascript">
	Joomla.submitbutton = function(task) {
		if (task == 'prestalegal.cancel' || document.formvalidator.isValid(document.id('item-form'))) {
			Joomla.submitform(task, document.getElementById('item-form'));
		} else {
			alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		}
	}
</script>

Nous allons remplacer les lignes :

<ul class="adminformlist">
<li><?php echo $this->form->getLabel('title'); ?>
<?php echo $this->form->getInput('title'); ?></li>

<li><?php echo $this->form->getLabel('subtitle'); ?>
<?php echo $this->form->getInput('subtitle'); ?></li>
</ul>

<div class="clr"></div>
<?php echo $this->form->getLabel('snippet'); ?>
<div class="clr"></div>
<?php echo $this->form->getInput('snippet'); ?>

<div class="clr"></div>
<?php echo $this->form->getLabel('fulltext'); ?>
<div class="clr"></div>
<?php echo $this->form->getInput('fulltext'); ?>
</fieldset>
</div>

par celles-ci :

<ul class="adminformlist">
 				<li><?php echo $this->form->getLabel('title'); ?>
				<?php echo $this->form->getInput('title'); ?></li>
       <li><?php echo $this->form->getLabel('company_status'); ?>
        <?php echo $this->form->getInput('company_status'); ?></li>

        <li><?php echo $this->form->getLabel('company_name'); ?>
        <?php echo $this->form->getInput('company_name'); ?></li>

        <li><?php echo $this->form->getLabel('company_director'); ?>
        <?php echo $this->form->getInput('company_director'); ?></li>

        <li><?php echo $this->form->getLabel('company_siren'); ?>
        <?php echo $this->form->getInput('company_siren'); ?></li>

        <li><?php echo $this->form->getLabel('company_siret'); ?>
        <?php echo $this->form->getInput('company_siret'); ?></li>

        <li><?php echo $this->form->getLabel('company_ape'); ?>
        <?php echo $this->form->getInput('company_ape'); ?></li>

        <li><?php echo $this->form->getLabel('company_tva'); ?>
        <?php echo $this->form->getInput('company_tva'); ?></li>

        <li><?php echo $this->form->getLabel('company_capital'); ?>
        <?php echo $this->form->getInput('company_capital'); ?></li>

        <li><?php echo $this->form->getLabel('company_cnil'); ?>
        <?php echo $this->form->getInput('company_cnil'); ?></li>


    </ul>
</fieldset>	
	<?php echo JHtml::_('sliders.start','content-sliders-'.$this->item->id, array('useCookie'=>1)); ?>
			<?php echo $this->loadTemplate('contact'); ?>
			<?php echo $this->loadTemplate('editor'); ?>
			<?php echo $this->loadTemplate('host'); ?>
			<?php echo $this->loadTemplate('usepolicy'); ?>
			<?php echo $this->loadTemplate('useterms'); ?>
                        <?php echo $this->loadTemplate('usedelivery'); ?>
<?php echo JHtml::_('sliders.end'); ?> </div>

Puis les lignes suivantes :

	<div class="width-40 fltrt">
		<?php echo JHtml::_('sliders.start','content-sliders-'.$this->item->id, array('useCookie'=>1)); ?>

			<?php echo $this->loadTemplate('publishing'); ?>

			<?php echo $this->loadTemplate('custom_fields'); ?>

			<?php echo $this->loadTemplate('parameters'); ?>

			<?php echo $this->loadTemplate('metadata'); ?>

		<?php echo JHtml::_('sliders.end'); ?>
        </div>

Deviennent :

	<div class="width-40 fltrt">
		<?php echo JHtml::_('sliders.start','content-sliders-'.$this->item->id, array('useCookie'=>1)); ?>

			<?php echo $this->loadTemplate('publishing'); ?>

			<?php echo $this->loadTemplate('metadata'); ?>

		<?php echo JHtml::_('sliders.end'); ?>
        </div>

Création des fichiers supplémentaires

Nous devons créer les fichiers suivants :

  • edit_company.php
  • edit_contact.php
  • edit_editor.php
  • edit_host.php
  • edit_usedelivery.php
  • edit_usepolicy.php
  • edit_useterms.php

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_company.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_COMPANY'), 'company-details'); ?>

<fieldset class="panelform">
    <ul class="adminformlist">
 				<li><?php echo $this->form->getLabel('title'); ?>
				<?php echo $this->form->getInput('title'); ?></li>
       <li><?php echo $this->form->getLabel('company_status'); ?>
        <?php echo $this->form->getInput('company_status'); ?></li>

        <li><?php echo $this->form->getLabel('company_name'); ?>
        <?php echo $this->form->getInput('company_name'); ?></li>

        <li><?php echo $this->form->getLabel('company_director'); ?>
        <?php echo $this->form->getInput('company_director'); ?></li>

        <li><?php echo $this->form->getLabel('company_siren'); ?>
        <?php echo $this->form->getInput('company_siren'); ?></li>

        <li><?php echo $this->form->getLabel('company_siret'); ?>
        <?php echo $this->form->getInput('company_siret'); ?></li>

        <li><?php echo $this->form->getLabel('company_ape'); ?>
        <?php echo $this->form->getInput('company_ape'); ?></li>

        <li><?php echo $this->form->getLabel('company_tva'); ?>
        <?php echo $this->form->getInput('company_tva'); ?></li>

        <li><?php echo $this->form->getLabel('company_capital'); ?>
        <?php echo $this->form->getInput('company_capital'); ?></li>

        <li><?php echo $this->form->getLabel('company_cnil'); ?>
        <?php echo $this->form->getInput('company_cnil'); ?></li>


    </ul>
</fieldset>

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_contact.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_CONTACT'), 'contact-details'); ?>

<fieldset class="panelform">
    <ul class="adminformlist">
        <li><?php echo $this->form->getLabel('company_address'); ?>
        <?php echo $this->form->getInput('company_address'); ?></li>

        <li><?php echo $this->form->getLabel('company_address_complement'); ?>
        <?php echo $this->form->getInput('company_address_complement'); ?></li>

        <li><?php echo $this->form->getLabel('company_postbox'); ?>
        <?php echo $this->form->getInput('company_postbox'); ?></li>

        <li><?php echo $this->form->getLabel('company_postcode'); ?>
        <?php echo $this->form->getInput('company_postcode'); ?></li>

        <li><?php echo $this->form->getLabel('company_town'); ?>
        <?php echo $this->form->getInput('company_town'); ?></li>

        <li><?php echo $this->form->getLabel('company_state'); ?>
        <?php echo $this->form->getInput('company_state'); ?></li>

        <li><?php echo $this->form->getLabel('company_country'); ?>
        <?php echo $this->form->getInput('company_country'); ?></li>

        <li><?php echo $this->form->getLabel('company_phone'); ?>
        <?php echo $this->form->getInput('company_phone'); ?></li>

        <li><?php echo $this->form->getLabel('company_fax'); ?>
        <?php echo $this->form->getInput('company_fax'); ?></li>

        <li><?php echo $this->form->getLabel('company_mobile'); ?>
        <?php echo $this->form->getInput('company_mobile'); ?></li>

        <li><?php echo $this->form->getLabel('company_email'); ?>
        <?php echo $this->form->getInput('company_email'); ?></li>

        <li><?php echo $this->form->getLabel('company_url'); ?>
        <?php echo $this->form->getInput('company_url'); ?></li>


    </ul>
</fieldset>

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_editor.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_EDITOR'), 'editor-details'); ?>

<fieldset class="panelform">
    <ul class="adminformlist">
        <li><?php echo $this->form->getLabel('editor_name'); ?>
        <?php echo $this->form->getInput('editor_name'); ?></li>

        <li><?php echo $this->form->getLabel('editor_address'); ?>
        <?php echo $this->form->getInput('editor_address'); ?></li>

        <li><?php echo $this->form->getLabel('editor_address_complement'); ?>
        <?php echo $this->form->getInput('editor_address_complement'); ?></li>

        <li><?php echo $this->form->getLabel('editor_postbox'); ?>
        <?php echo $this->form->getInput('editor_postbox'); ?></li>

        <li><?php echo $this->form->getLabel('editor_postcode'); ?>
        <?php echo $this->form->getInput('editor_postcode'); ?></li>

        <li><?php echo $this->form->getLabel('editor_city'); ?>
        <?php echo $this->form->getInput('editor_city'); ?></li>

        <li><?php echo $this->form->getLabel('editor_country'); ?>
        <?php echo $this->form->getInput('editor_country'); ?></li>

        <li><?php echo $this->form->getLabel('editor_email'); ?>
        <?php echo $this->form->getInput('editor_email'); ?></li>

        <li><?php echo $this->form->getLabel('editor_phone'); ?>
        <?php echo $this->form->getInput('editor_phone'); ?></li>

        <li><?php echo $this->form->getLabel('editor_fax'); ?>
        <?php echo $this->form->getInput('editor_fax'); ?></li>

        <li><?php echo $this->form->getLabel('editor_url'); ?>
        <?php echo $this->form->getInput('editor_url'); ?></li>

    </ul>
</fieldset>

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_host.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_HOST'), 'host-details'); ?>

<fieldset class="panelform">
    <ul class="adminformlist">
        <li><?php echo $this->form->getLabel('host_name'); ?>
        <?php echo $this->form->getInput('host_name'); ?></li>

        <li><?php echo $this->form->getLabel('host_address'); ?>
        <?php echo $this->form->getInput('host_address'); ?></li>

        <li><?php echo $this->form->getLabel('host_address_complement'); ?>
        <?php echo $this->form->getInput('host_address_complement'); ?></li>

        <li><?php echo $this->form->getLabel('host_postbox'); ?>
        <?php echo $this->form->getInput('host_postbox'); ?></li>

        <li><?php echo $this->form->getLabel('host_postcode'); ?>
        <?php echo $this->form->getInput('host_postcode'); ?></li>

        <li><?php echo $this->form->getLabel('host_city'); ?>
        <?php echo $this->form->getInput('host_city'); ?></li>

        <li><?php echo $this->form->getLabel('host_country'); ?>
        <?php echo $this->form->getInput('host_country'); ?></li>

        <li><?php echo $this->form->getLabel('host_email'); ?>
        <?php echo $this->form->getInput('host_email'); ?></li>

        <li><?php echo $this->form->getLabel('host_phone'); ?>
        <?php echo $this->form->getInput('host_phone'); ?></li>

        <li><?php echo $this->form->getLabel('host_fax'); ?>
        <?php echo $this->form->getInput('host_fax'); ?></li>

        <li><?php echo $this->form->getLabel('host_url'); ?>
        <?php echo $this->form->getInput('host_url'); ?></li>

    </ul>
</fieldset>

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_usedelivery.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_DELIVERY'), 'delivery-details'); ?>

<fieldset class="panelform">
   <ul class="adminformlist">
        <li><?php echo $this->form->getInput('use_delivery'); ?></li>
    </ul>
</fieldset>
    

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_usepolicy.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_POLICY'), 'policy-details'); ?>

<fieldset class="panelform">
   <ul class="adminformlist">
        <li><?php echo $this->form->getInput('use_policy'); ?></li>
    </ul>
</fieldset>
    

administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_useterms.php

<?php
/**
 * @version     1.0.0
 * @package     com_prestalegals
 * @copyright   Copyright (C) 2013 Gilbert Marin. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

echo JHtml::_('sliders.panel',JText::_('COM_PRESTALEGALS_FIELDSET_USETERMS'), 'useterms-details'); ?>

<fieldset class="panelform">
    <ul class="adminformlist">
        <li><?php echo $this->form->getInput('use_terms'); ?></li>
    </ul>
</fieldset>
    

Suppression des fichiers suivants :

  • administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_custom_fields.php
  • administrator/components/com_prestalegals/views/prestalegal/tmpl/edit_parameters.php

 

 

Suite au prochain article.