function smarty_modifier_group($group, $type = 'micro') { global $globals; $str = '<a href="groups/see/' . $group->name() . '" title="' . $group->label() . '">'; if ($type == 'micro' || $type == 'both') { $image = $group->image(); if (!$image) { $image = new StaticImage($globals->images->group); } $str .= '<img src="' . $image->src('micro') . '" />'; } if ($type == 'text' || $type == 'both' || $type == 'textAndNewsNumber') { $str .= $group->label(); } if ($type == 'textAndNewsNumber') { $n = $group->nb_news(); if ($n > 0) { $str .= '<b> (' . $n . ')</b>'; } } $str .= '</a>'; if ($type == 'premises') { $str = ''; $roomMasterCss = $group->isRoomMaster() ? ' room_master' : ''; foreach ($group->rooms() as $premise) { $state = $premise->open() ? 'open' : 'close'; $str .= '<div class="' . $state . '" rid="' . $premise->id() . '">' . '<div class="traffic_light_switcher' . $roomMasterCss . '" title="' . $premise->comment() . '">' . '</div></div>' . PHP_EOL; } } return $str; }
function smarty_modifier_image($image, $size, $fallback = 'default') { global $globals; if (!$image) { $image = new StaticImage($globals->images->{$fallback}); } return $image->src($size); }
public function export($bits = null) { global $globals; $img = $this->image(); if (!$img) { $img = new StaticImage($globals->images->group); } $json = array("id" => $this->id(), "name" => $this->name(), "label" => $this->label(), "src" => $img->src('micro')); return $json; }