예제 #1
0
 public function getPetshoprede($status)
 {
     $dados = array();
     $petshopredes = Petshoprede::model()->findAll("petshop=:petshop AND status=:status", array(':petshop' => Yii::app()->user->petatual, ':status' => $status));
     foreach ($petshopredes as $key => $petshoprede) {
         $rede = Rede::model()->findByPk($petshoprede->rede);
         $usuario = Usuario::model()->findByPk($rede->usuario);
         $redeDTO = new RedeDTO();
         $redeDTO->id = $petshoprede->id;
         $redeDTO->petshop = Yii::app()->user->petatual;
         $redeDTO->rede = $petshoprede->rede;
         $redeDTO->redenome = $rede->nome;
         $redeDTO->usuario = $usuario->id;
         $redeDTO->usuarionome = $usuario->nome . ' ' . $usuario->sobrenome;
         $redeDTO->status = $petshoprede->status;
         $redeDTO->mensagem = $petshoprede->mensagem;
         $redeDTO->data = $petshoprede->data;
         $redeDTO->sede = $petshoprede->sede;
         $dados[] = $redeDTO;
     }
     return $dados;
 }
예제 #2
0
 public function actionBuscar()
 {
     $parametros = Util::getParametrosJSON();
     $rede = Rede::model()->find("usuario=:usuario", array(':usuario' => Yii::app()->user->id));
     $dados = array();
     if ($rede != null) {
         $dados['id'] = $rede->id;
         $dados['nome'] = $rede->nome;
         $dados['descricao'] = $rede->descricao;
         $dados['cnpj'] = $rede->cnpj;
         $dados['datainicio'] = $rede->datainicio;
         $dados['logo'] = $rede->logo;
         $dados['usuario'] = $rede->usuario;
         $petshopredes = Petshoprede::model()->findAll("rede=:rede", array(':rede' => $rede->id));
         $dados['listapetshoprede'] = array();
         foreach ($petshopredes as $key => $petshoprede) {
             $redeDTO = new RedeDTO();
             $redeDTO->id = $petshoprede->id;
             $redeDTO->rede = $petshoprede->rede;
             $redeDTO->petshop = $petshoprede->petshop;
             $redeDTO->status = $petshoprede->status;
             $redeDTO->mensagem = $petshoprede->mensagem;
             $redeDTO->data = $petshoprede->data;
             $petshop = Petshop::model()->findByPk($petshoprede->petshop);
             $redeDTO->petshopnome = $petshop->nome;
             $redeDTO->petshopid = $petshop->id;
             $dados['listapetshoprede'][] = $redeDTO;
         }
     } else {
         $dados['nome'] = '';
         $dados['descricao'] = '';
         $dados['cnpj'] = '';
         $dados['datainicio'] = '';
         $dados['logo'] = '';
         $dados['usuario'] = '';
         $dados['listapetshoprede'] = array();
     }
     Util::setParametrosJSON($dados);
 }