function empresa_add()
 {
     if (!empty($this->data)) {
         $data = array('Aviso' => $this->data);
         $data['Aviso']['empresa_id'] = $this->SessionUsuarioInterno['Empresa']['id'];
         $data['Aviso']['usuario_interno_id'] = $this->SessionUsuarioInterno['UsuarioInterno']['id'];
         $response = $this->Aviso->guardar($data);
         $this->Session->setFlash($response['message']);
         if ($response['status']) {
             $this->redirect(array('controller' => 'avisos', 'action' => 'index'));
         } else {
             $this->set('errores', $response['error']);
             $this->set('valores', $this->data);
         }
     } elseif (!$this->Aviso->EmpresaProducto->GetByEmpresa($this->SessionUsuarioInterno['Empresa']['id'])) {
         $this->Session->setFlash('No tiene ningun plan de avisos activo,<br>para comprar haga click <a href="' . Router::Url(array('controller' => 'productos', 'action' => 'index')) . '">aqui</a>');
         $this->redirect(array('controller' => 'avisos', 'action' => 'index'));
     }
     $this->set('areas', $this->Aviso->LaboralArea->getCombo());
     $this->set('niveles', $this->Aviso->LaboralNivelPuesto->getCombo());
     $this->set('tipos', $this->Aviso->LaboralTipoTrabajo->getCombo());
     $this->set('paises', $this->Aviso->Provincia->Pais->getCombo());
     $this->set('pais', 18);
     $this->set('provincias', $this->Aviso->Provincia->getCombo());
     $this->set('usuarios_internos', $this->Aviso->UsuarioInterno->find('all', array('conditions' => array('UsuarioInterno.empresa_id' => $this->SessionUsuarioInterno['Empresa']['id']))));
 }
 public function AllMyStickerRecent()
 {
     $this->autoRender = false;
     if (!empty($this->params['url']['uid'])) {
         $uid = $this->params['url']['uid'];
         $this->loadModel('Sticker');
         $this->loadModel('Cart');
         $count = $this->Cart->Find('count', array('conditions' => array('user_id' => $this->params['url']['uid'])));
         $cond = "Sticker.id=Mysticker.sticker_id";
         $conditions = "`Mysticker`.`user_id` = {$uid}  AND `Sticker`.`is_active` = 1 AND `Sticker`.`is_deleted` = 0 AND `Mysticker`.`created` >= NOW() - INTERVAL 2 WEEK";
         $stickers = $this->Sticker->find('all', array('fields' => array('DISTINCT Sticker.id', 'Sticker.name', 'Sticker.image'), 'joins' => array(array('table' => 'mystickers', 'alias' => 'Mysticker', 'type' => 'inner', 'conditions' => $cond)), 'conditions' => $conditions, 'order' => 'Sticker.name ASC'));
         if (!empty($stickers)) {
             $result['status'] = '1';
             $result['message'] = 'success';
             foreach ($stickers as $key => $value) {
                 $result['data'][] = array('id' => $value['Sticker']['id'], 'name' => $value['Sticker']['name'], 'image' => Router::Url('/img/uploads/', true) . $value['Sticker']['image']);
             }
         } else {
             $result['status'] = '0';
             $result['message'] = 'fail';
             $result['data'] = "No Sticker Found";
         }
         $result['count'] = $count;
         echo json_encode($result);
     }
 }