public function newAction() { $form = new Admin_Form_Musica(); $obj = new Application_Entity_RunSql('Musica'); if ($this->_request->isPost()) { $dataForm = $this->_request->getPost(); try { $msj = array(); // if (!$form->avanzado->receive() || !$form->basico360->receive()) { // $msj[] = $form->getMessages(); // } else { // $nombre = ""; // $code = ""; // $fInfo = $form->avanzado->getFileInfo(); // $nombres = explode('.', $fInfo['avanzado']['name']); // $ext = $nombres[count($nombres) - 1]; // $code = Core_Utils_Utils::getRamdomChars(15, 'A'); // $nombre = $code . '.' . $ext; // if (isset($nombres[0]) || $nombres[0] != '') { // rename($form->avanzado->getFileName(), ROOT_IMG_DINAMIC . '/musica/avanzado/' . $nombre); // rename($form->basico360->getFileName(), ROOT_IMG_DINAMIC . '/musica/basico360/' . $nombre); // } $modelBanner = new Admin_Model_Musica(); $dataForm['fecha_edicion'] = date('Y-m-d H:i:s'); if (empty($dataForm['idmusica'])) { $dataForm['fecha_creacion'] = date('Y-m-d H:i:s'); $dataForm['img'] = $nombre; $obj->save = $dataForm; $imagen = $modelBanner->idImg($obj->save); $nombre = $imagen["img"]; } else { if (!isset($nombres[0]) || $nombres[0] == '') { $imagen = $modelBanner->idImg($dataForm['idmusica']); $nombre = $imagen["img"]; } $dataForm['img'] = $nombre; $obj->edit = $dataForm; } $this->coneccionSshImg($nombre, 'MUSICA'); $path = $this->_config['app']['jsonMusica']; $this->coneccionSsh($path, 'MUSICA'); $this->_redirect('/admin/musica'); // } } catch (Exception $e) { echo $e->getMessage(); } } else { $this->view->titulo = "Nueva Música"; $this->view->submit = "Guardar"; $this->view->action = "/admin/musica/new"; $form->addDecoratorCustom('forms/_formMusica.phtml'); echo $form; } }