public function getEdit($parentModel, $relation, $idRow) { $parentList = new $parentModel(); $relation = $parentList->{$relation}(); $sonModel = $relation->getRelated(); $sonObject = $sonModel::find($idRow); $fieldName = Request::get("field"); $fieldValue = Request::get("value"); if (isset($_GET['valuesToChange'])) { if ($_GET['valuesToChange'] == Renderer::INPUT_DATE) { $fieldValue = DateSql::changeToSql($fieldValue); } } $sonObject->{$fieldName} = $fieldValue; $sonObject->save(); }
public function postFichaOferta($id) { if (Input::has("field_nueva_inscripcion")) { $oferta = Oferta::find($id); $oferta->inscritos()->attach(array(Input::get("field_demandante_id") => array('created_at' => DateSql::changeToSql(Input::get("field_created_at")), 'estado' => Input::get("field_estado")))); return Redirect::back()->withOk("Inscrito añadido con éxito a la oferta"); } }
public function getCambioTareaInicio($id) { $tarea = Curso_TareasChecklistInicio::find($id); $nombreField = Request::get("field"); $value = Request::get("value"); if ($nombreField == "fecha_limite") { $value = DateSql::changeToSql($value); } $tarea->{$nombreField} = $value; $tarea->save(); }
public function postFichaDocente($docenteID) { $docente = Docente::find($docenteID); $data = $_POST; foreach ($data as $index => $value) { if ($index == "field_eval_ini_fecha" || $index == "field_eval_situ_fecha" || $index == "field_eval_fin_fecha") { $data[$index] = DateSql::changeToSql($value); } } $this->saveCRUDForm($docente, $data); return Redirect::back()->withOk("Ficha modificada con éxito"); }
public function getOfertasDT($id) { $demandante = Demandante::find($id); $ofertas = $demandante->getOfertasComp(); $i = 0; $return = array(); foreach ($ofertas as $oferta) { $return[$i]['DT_RowId'] = 'row_' . $oferta->id; $return[$i]['compatibilidad'] = $demandante->getCompOferta($oferta) . '%'; $return[$i]['puesto'] = $oferta->puesto; $return[$i]['empresa'] = $oferta->empresa->nombre; $return[$i]['tipo_contrato'] = $oferta->tipo_contrato; $return[$i]['municipio'] = $oferta->municipio->NOMBRE; $return[$i]['created_at'] = DateSql::changeFromSql($oferta->created_at); $i++; if ($i >= 10) { break; } } $return = Sort::sortBy('compatibilidad', $return, 'desc'); $return['data'] = $return; $return['draw'] = Input::get('draw'); $return['recordsTotal'] = $i + 1; $return['recordsFiltered'] = $i + 1; return $return; }
protected function getInputDate($inputName, $defaultValue = "2018-12-20 00:00:00") { $defaultValue = \DateSql::changeFromSql($defaultValue); return '<input type="text" class="form-control datepicker" data-start-view="2" name="' . $inputName . '" id="' . self::generateInputId($inputName) . '" value="' . $defaultValue . '">'; }
public function postFichaEmpresa($id_empresa) { $empresa = Empresa::find($id_empresa); $data = $_POST; foreach ($data as $index => &$value) { if ($index == "field_eval_fecha_evaluacion") { $value = DateSql::changeToSql($value); } } $this->saveCRUDForm($empresa, $data); return Redirect::back()->withOk('Ficha modificada con éxito'); }