Ejemplo n.º 1
0
 /**
  * Displays a view
  *
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $AuditeventusersController = new AuditeventusersController();
     $AuditeventusersController->register(3, 1);
     $this->set('pqrscompletadas', ClassRegistry::init('Pqr')->find('count', array('conditions' => array('Pqr.state' => 3, 'Pqr.id_client' => 1))));
     $this->set('totalcompletadas', ClassRegistry::init('Pqr')->find('count', array('conditions' => array('Pqr.id_client' => 1))));
     $this->set('documentosactualizados', ClassRegistry::init('Clientdocument')->find('count', array('conditions' => array('Clientdocument.state' => 3, 'Clientdocument.client' => 1))));
     $this->set('totaldocumentos', ClassRegistry::init('Clientdocument')->find('count', array('conditions' => array('Clientdocument.client' => 2))));
     $this->set('userauth', ClassRegistry::init('User')->findById(1));
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
 public function viewdocument($id)
 {
     if (!$this->Clientdocument->exists($id)) {
         throw new NotFoundException(__('Invalid clientdocument'));
     }
     $AuditeventusersController = new AuditeventusersController();
     $AuditeventusersController->register(15, 1);
     $options = array('conditions' => array('Clientdocument.' . $this->Clientdocument->primaryKey => $id));
     $this->set('clientdocument', $this->Clientdocument->find('first', $options));
 }
Ejemplo n.º 3
0
 /**
  * add method
  *
  * @return void
  */
 public function add()
 {
     if ($this->request->is('post')) {
         $file = $this->request->data['document']['document_path_adjunt'];
         $pathDocument = WWW_ROOT . 'data\\documents' . DS . $file['name'];
         move_uploaded_file($file['tmp_name'], $pathDocument);
         $this->Document->create();
         $this->Document->set('document_path_adjunt', $pathDocument);
         $this->Document->set('name', $this->request->data['document']['name']);
         $this->Document->set('active', $this->request->data['document']['active']);
         $this->Document->set('type', $this->request->data['document']['type']);
         if ($this->Document->save($this->request->data)) {
             $AuditeventusersController = new AuditeventusersController();
             $AuditeventusersController->register(10, 1);
             $this->Flash->success(__('Documento creado exitosamente!'));
             return $this->redirect(array('action' => 'index'));
         } else {
             $this->Flash->error(__('The document could not be saved. Please, try again.'));
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * delete method
  *
  * @throws NotFoundException
  * @param string $id
  * @return void
  */
 public function delete($id = null)
 {
     $this->Pqr->id = $id;
     if (!$this->Pqr->exists()) {
         throw new NotFoundException(__('Invalid pqr'));
     }
     $this->request->allowMethod('post', 'delete');
     if ($this->Pqr->delete()) {
         $AuditeventusersController = new AuditeventusersController();
         $AuditeventusersController->register(7, 1);
         $this->Flash->success(__('The pqr has been deleted.'));
     } else {
         $this->Flash->error(__('The pqr could not be deleted. Please, try again.'));
     }
     return $this->redirect(array('action' => 'mypqrs'));
 }