Create this php file and uploaded to these following path:
/intranet/holidays/classes/HpWhoOutComponent.php
<?php class HpWhoOutComponent extends TemplaterComponentTmpl { public function Show($attributes) { global $args; HpViewWhosOut::Draw($args); $args['everyone_in.visible'] = true; foreach($args['day_types.datasrc'] as $k=>$ar) { //my_print_r($ar); if(count($ar['users_list.datasrc']) > 0) { $args['day_types.datasrc'][$k]['day_type.visible'] = true; $args['everyone_in.visible'] = false; break; } } //my_print_r($args); return $this->CallTemplater('holidays/who_out_component.html', $args); } } <code> 2. Create html templater and put it under /interface_default/holidays/who_out_component.html <code html> <div style="padding:5px;"> <span name="everyone_in"><strong>Everyone's in today!</strong></span> <table class="HolidaysPlainTable" width="100%"> <tbody name="day_types" datasrc=""> <tr name="day_type" visible="0"> <td> <b name="day_type_name">Holiday</b> </td> <td> <txt name="users_list" datasrc=""> <ifempty> <!-- Display nothing --> </ifempty> <a href="../people/viewprofile.php?id={userid}" name="user_href">Name</a> (<txt name="day_part_txt">All day</txt>)<br /> </txt> </td> </tr> </tbody> </table> </div>
3. Call this component from
/interface_custom/main/right_column.html
<!-- Who's out? --> <div class="infobox"> <h3>Who's Out</h3> <component class="HpWhoOutComponent"> </div>
Discussion