public function create() { $id = parent::create(); if ($id and $this->Idioma == 0) { $this->actualizaNombreAmigable(); if ($this->subeDocumento()) { $this->save(); foreach ($_SESSION['idiomas']['disponibles'] as $key => $value) { if ($key > 0) { $doc = new CpanDocs($this->Id); $doc->setId(''); $doc->setPrimaryKeyMD5(''); $doc->setIdioma($key); $doc->create(); } } } } return $id; }