예제 #1
0
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;
}
예제 #2
0
function smarty_modifier_image($image, $size, $fallback = 'default')
{
    global $globals;
    if (!$image) {
        $image = new StaticImage($globals->images->{$fallback});
    }
    return $image->src($size);
}
예제 #3
0
파일: group.php 프로젝트: netixx/frankiz
 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;
 }
예제 #4
0
파일: images.php 프로젝트: netixx/frankiz
 function handler_image($page, $size, $iid = null)
 {
     global $globals;
     $image = new FrankizImage($iid);
     $image->select(FrankizImageSelect::caste());
     $user = S::user();
     try {
         if ($user && $user->canSee($image->caste())) {
             $image->send($size);
             return;
         }
     } catch (DataNotFetchedException $e) {
     }
     // Not found of error => HTTP 403
     header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
     $img = new StaticImage($globals->images->forbidden);
     $img->send($size);
 }