Пример #1
0
include_once "../Librerias/Cursos.php";
include_once "../Librerias/Variables.php";
include_once "../Librerias/Artesano.php";
include_once "../Librerias/ArtesanoDao.php";
$conn = new Datasource($dbhost, $dbName, $dbUser, $dbPassword);
$cdao = new CursosDao();
$adao = new ArtesanoDao();
$cursos = new Cursos();
$cursos->setFecha_lim($_POST["fecha"]);
$cursos->setDescripcion($_POST["descripcion"]);
$cursos->setHorario($_POST["horario"]);
$dirfoto = $_FILES["foto"]["tmp_name"];
$formatofoto = substr($_FILES["foto"]["name"], strrpos($_FILES["foto"]["name"], "."));
//Obtener la última aparición del punto y por consiguiente, el formato
$destinofoto = $filelocation . "/fotoCurso" . $_POST["descripcion"] . $formatofoto;
$cursos->setFoto("fotoCurso" . $_POST["descripcion"] . $formatofoto);
$correcto = true;
if (!move_uploaded_file($dirfoto, $destinofoto)) {
    ?>
			<meta http-equiv="REFRESH" content="0,url=../Interfaces/agregarCurso.php">
			<script type="text/javascript">
				alert("Error subiendo los archivos");
				</script>
		<?php 
} else {
    if ($cdao->create($conn, $cursos)) {
        $artesanos = $adao->loadAll($conn);
        $cabeceras = 'MIME-Version: 1.0' . "\r\n";
        $cabeceras .= 'Content-type: text/html; charset=utf-8' . "\r\n";
        $asunto = "Nueva capacitación: " . $_POST['descripcion'];
        for ($i = 0; count($artesanos); $i++) {
Пример #2
0
 /**
  * Clone will return identical deep copy of this valueObject.
  * Note, that this method is different than the clone() which
  * is defined in java.lang.Object. Here, the retuned cloned object
  * will also have all its attributes cloned.
  */
 function cloneObject()
 {
     $cloned = new Cursos();
     $cloned->setId($this->id);
     $cloned->setFoto($this->foto);
     $cloned->setDescripcion($this->descripcion);
     $cloned->setFecha_lim($this->fecha_lim);
     $cloned->setHorario($this->horario);
     return $cloned;
 }