Ejemplo n.º 1
0
 public function Save($request)
 {
     $form = $request['params'];
     $emp = new Employees();
     $salary = new Salaries();
     $dept_emp = new DeptEmp();
     $title = new Titles();
     $emp = $emp->getFromArray($form);
     $salary = $salary->getFromArray($form);
     $dept_emp = $dept_emp->getFromArray($form);
     $title = $title->getFromArray($form);
     $em = new EmployeesEntityManager();
     $result = $em->saveWithAllData($emp, $dept_emp, $salary, $title);
     if ($result == "1") {
         $output = json_encode(array('OK' => 'Success'));
     } else {
         $output = json_encode(array('error' => array('error' => $result)));
     }
     $response = null;
     //start output
     header('Content-Type: application/x-json');
     header("HTTP/1.1 200 OK");
     $response = $output;
     echo $response;
 }
Ejemplo n.º 2
0
 public function currentUser($params)
 {
     $datos = InitEmployees::inicializarPropiedades();
     $em = new EmployeesEntityManager();
     switch (count($params)) {
         case 2:
             $elements = $em->findCurrentStatusEmploye($params[1], null, null);
             break;
         case 3:
             $elements = $em->findCurrentStatusEmploye($params[1], $params[2], null);
             break;
         case 4:
             $elements = $em->findCurrentStatusEmploye($params[1], $params[2], $params[3]);
             break;
         default:
             $elements = $this->current(null, null);
             break;
     }
     $datos->setElements($elements);
     View::set('datos', $datos);
     View::render("crud/detail");
 }