示例#1
0
 public static function iniciar()
 {
     $s = SessaoController::porUsuario();
     if ($s) {
         if ($s->getSize() <= 3) {
             if ($s->getSize() == 3) {
                 $s1 = Sessao::fromArray($s->getElement(0));
                 $s1->setCodigo(UsuarioController::get("codigo"));
                 $o = $s1->refresh();
                 if ($o) {
                     SessaoController::gerar_token();
                 }
             } else {
                 self::$sessao->setUsuario(UsuarioController::get("id"));
                 self::$sessao->setCodigo(UsuarioController::get("codigo"));
                 $o = self::$sessao->persistir();
                 if ($o) {
                     SessaoController::gerar_token();
                 }
             }
         }
     }
 }
示例#2
0
 public static function fromJSON($js, $attrs)
 {
     $vect = json_decode($js, true);
     $o = Sessao::fromArray($vect, $attrs);
     return $o;
 }