elements access level in custom details template

mahmoodee

Member
Hello,
I am trying to show elements in details view as table with two columns (labels in first column and values in second columns)
so I create custom details template to do that and it work fine
the problem is :
when the element access level is special , it show empty row in table.
I want to hide the full row in table not only the element.
is there a way to hide <tr></tr> or div which include not accessible element , beacause my table show empyt row based on access level.
the default.php code is (I only edit default.php)
Code:
<?php
/**
* Bootstrap Details Template
*
* @package     Joomla
* @subpackage  Fabrik
* @copyright   Copyright (C) 2005-2015 fabrikar.com - All rights reserved.
* @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @since       3.1
*/

// No direct access
defined('_JEXEC') or die('Restricted access');

$form = $this->form;
$model = $this->getModel();

if ($this->params->get('show_page_heading', 1)) : ?>
    <div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>">
        <?php echo $this->escape($this->params->get('page_heading')); ?>
    </div>
<?php
endif;

if ($this->params->get('show-title', 1)) :?>
<div class="page-header">
 
</div>
<?php
endif;

echo $form->intro;
echo '<div class="fabrikForm fabrikDetails" id="' . $form->formid . '">';
echo $this->plugintop;
echo $this->loadTemplate('buttons');
echo $this->loadTemplate('relateddata');

$demo1=$this->groups['resident'];
$elements=$demo1->elements;

$rname=$elements['r_name']->element;
$rnamelabel=$elements['r_name']->label;
$rnationality=$elements['r_nationality']->element;
$rnationalitylabel=$elements['r_nationality']->label;
$rsqu=$elements['r_squ_id']->element;
$rsqulabel=$elements['r_squ_id']->label;
$rgrade=$elements['r_grade']->element;
$rgradelabel=$elements['r_grade']->label;
    ?>
 
 
<div class="row-fluid" >


<table class="table table-striped table-bordered table-hover">

    <tbody>
 
      <tr>
        <td class="span4"><?php echo $rnamelabel; ?></td>
        <td class="span8"><?php echo $rname; ?></td>
    
      </tr>
      <tr>
        <td class="span4"><?php echo $rnationalitylabel; ?></td>
        <td class="span8"><?php echo $rnationality; ?></td>
     
      </tr>
      <tr>
        <td class="span4"><?php echo $rsqulabel; ?></td>
        <td class="span8"><?php echo $rsqu; ?></td>
   
      </tr>
      <tr>
        <td class="span4"><?php echo $rgradelabel; ?></td>
        <td class="span8"><?php echo $rgrade; ?></td>
   
      </tr>
  
  
    </tbody>
  </table> </div>


     
<?php


echo $this->pluginbottom;
echo $this->loadTemplate('actions');
echo '</div>';
echo $form->outro;
echo $this->pluginend;

thank you
 
I try this solution and it worked
for table row which have element with access level , I use this code
Code:
<?php
     $gradaccess=$elements['r_grade'];
     if (in_array($gradaccess, $elements, true)){
     ?>
   
<tr>
        <td class="span4"><?php echo $rgradelabel; ?></td>
        <td class="span8"><?php echo $rgrade; ?></td>
 
      </tr>
      <?php
     }; ?>
Is this solution good? or there is better solution .
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top