Current situation:
When logged in as Admin or other controlling group member I normally like my template.tv to present records in a table as a normal list. However when a user logs in and is set to view only their own few records I like to show them the template.tv in the form of Cards i.e. BS4 BOX CARDS etc.
Until now it's been either/or for all groups for any particular table.
Solution:
I've now discovered that is is quite easy to have a different template.tv for given groups, suiting my requirement perfectly.
The inspiration, solution came from fter viewing help from A.Gneady's post: https://bigprof.com/blog/appgini/how-to ... ser-group/
- It was not the direct solution to my senario but gave me the insite on how to do it:
If you follow the well detailed easy to follow instructions from A.Gneady in the link and ignore steps: 4+6 regarding hiding the customers column (unless you also want a column removed) and proceed to the end.
You now have a hooks file where you can edit your template.tv that will not be overwritten and is easily updated to suit whatever layout you want to use for the template.tv for diferent groups
Done!
This is the code I used in my project on a simple small table: Templatename.php hooks folder
Code: Select all
function member_init(&$options, $memberInfo, &$args) {
$hide_groups = array('All Members');
if(in_array($memberInfo['group'], $hide_groups)) {
$options->ColWidth = [150, 150, 150, 150, 100, ];
$options->ColCaption = ['Profile Pic', 'Name', 'Mobile or Phone', 'Group', 'Your Horse(s):', ];
$options->ColFieldName = ['profile_pic', 'name', 'mobile', 'group', '%your_horse.name%', ];
$options->ColNumber = [4, 6, 8, 10, -1, ];
$options->ShowTableHeader = 0;
// template paths below are based on the app main directory
$options->Template = 'hooks/member_templateTV.html';
$options->SelectedTemplate = 'hooks/member_templateTVS.html';
}
return TRUE;
}
Code: Select all
<style>
.panel-heading{
margin-top: 1px;
height: 70px;
overflow: auto;
}
.panel-footer{
margin-top: 0px;
height: 80px;
overflow: auto;
}
</style>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-2">
<hr>
<div class="panel panel-default" style="margin-top: 5px; min-height: 650px; max-height: 850px; overflow: auto; border-style:solid; border-width:1px; border-color:default">
<button type="button" class="btn btn-info btn-sm btn-block"></button>
<div class="panel-heading"><big><b><%%VALUE(name)%%></b></big><%%SELECT%%><big>More details</big><%%ENDSELECT%%></div>
<div class="panel-body">
<big>
<dd id="member-profile_pic-<%%VALUE(id)%%>" class="member-profile_pic"><a href="<%%TRANSLATION(ImageFolder)%%><%%VALUE(profile_pic)%%>" data-lightbox="member-profile_pic"><img src="images/<%%VALUE(profile_pic)%%>"style="width:100%"></a></dd>
<dd id="member-name-<%%VALUE(id)%%>" class="member-name">Name: <%%SELECT%%><%%VALUE(name)%%><%%ENDSELECT%%></dd>
<dd id="member-mobile-<%%VALUE(id)%%>" class="member-mobile">Mobile: <%%SELECT%%><%%VALUE(mobile)%%><%%ENDSELECT%%></dd>
<dd id="member-group-<%%VALUE(id)%%>" class="member-group">Group: <%%SELECT%%><%%VALUE(group)%%><%%ENDSELECT%%></dd>
</big>
</div>
</div>
</div>
<script>
$j("#order-by-selector").closest("tr").hide().remove();
$j("#select_all_records").closest("th").hide().remove();
$j(".record_selector").closest("td").hide().remove();
</script>
Hope that is of help to someone.