<?php
namespace view;
class Site
{
  public static function show()
  {
    global $user, $current_module;

    $tpl = new \Tpl;
    $tpl -> content = \controls\Site::route();

    if ( !$user )
      return $tpl -> render( 'site/layout-unlogged' );
    else
    {
      $tpl -> user = $user;
      $tpl -> current_module = $current_module;
      $tpl -> campaign_alerts_count = \factory\CampaignAlerts::get_unseen_count();
      if ( $alert = \S::get_session( 'alert' ) )
      {
        $tpl -> alert = $alert;
        unset( $_SESSION['alert'] );
      }
      return $tpl -> render( 'site/layout-logged' );
    }
  }
}
