php - How do I set a CSS class on a table row based on a property of an ATK node attribute in ATK-Framework? -
i have atk-framework i'm inheriting previous (departed) developer, , i'm finding documentation sparse , poorly structured.
we have subscription system customer register account, , there can multiple subscriptions on account. classes accounts , subscriptions inherit atknode.
i want able highlight row in table of subscriptions easier see, @ glance, when particular subscription has expired. expiry date of subscription property of node.
i can find code node created in framework's modules - try hard can, can't find corresponding html template display information, , can't find anyway add in required logic highlight these rows.
-- update:
after more clicking around, i've found templates - they're in main atk framework directory (including custom templates predecessor has created).
they appear smarty-like templates, modifying/extending them shouldn't hard.
--
so, found following in template:
{foreach from=$rows item=row} <tr id="{$row.id}" class="row{if $row.rownum % 2 == 0 }1{else}2{/if}" {if $row.background!=""}style="background-color:{$row.background}" {/if} onmouseover="highlightrow(this, '{$row.highlight}')" onmouseout="resetrow(this)" onclick="selectrow(this, '{$listid}', {$row.rownum})"> {section name=colloop loop=$row.cols} <{if $row.type == "subtotal"}th{else}td{/if} class="{if $smarty.section.colloop.index===0}recordlisttdfirst{else}recordlisttd{/if}{if $row.cols[colloop].type == "data"} clickable{/if}" valign="{$vorientation}" {if isset($row.cols[colloop].htmlattributes)}{$row.cols[colloop].htmlattributes}{/if} {if $row.cols[colloop].type == "data"} onclick="rl_try('{$listid}', event, {$row.rownum}, ['select', 'edit', 'view'], false);"{/if}> {if $row.cols[colloop].content != ""}{$row.cols[colloop].content}{else} {/if} </{if $row.type == "subtotal"}th{else}td{/if}> {/section} </tr> {/foreach}
i'm guessing $row , $cols set class...
there's couple of problems - recordlist.tpl generic template. means can't jam check expiry date @ point.
is there way override template 1 specific node/recordset?
i downloaded atk zip , said, appears smarty (atk/ui/smarty), if can throw template tag {debug} template anywhere should smarty debug window, in can see how arrays/objects have been assigned/structured in smarty template engine.
if property has been assiend row focus on {$row.x} if property against column focus on {$row.cols[colloop].x}, if date unix timestamp should able
class="row{if $row.rownum % 2 == 0 }1{else}2{/if}{if $row.timestamp_var < $smarty.now} your_class_name{/if}"
for simple date comparison.
Comments
Post a Comment