/** * * @param Proyecto $elem * @return boolean */ function save($elem) { if (!file_exists($elem->getRuta())) { mkdir($elem->getRuta()); } //TODO: actualizar config.xml $jsonProy = new stdClass(); $jsonProy->nombre = $elem->getNombre(); $jsonProy->ruta = $elem->getRuta(); $jsonProy->id = $elem->getId(); $jsonProy->dbConfig = $elem->getDbConfig(); if (empty($jsonProy->id)) { $maxId = 0; $existentes = $this->findBy(); foreach ($existentes as $proy) { $maxId = max($proy->getId(), $maxId); } $jsonProy->id = $maxId + 1; } $fp = fopen(DIR_PROYECTOS . $elem->getNombre() . ".json", 'w'); fwrite($fp, json_encode($jsonProy)); fclose($fp); return true; }
</tr> <?php foreach ($tareas as $t) { $toshow = ""; echo "<tr id='linea_" . $t['id'] . "'>"; foreach ($tarea->campos as $c => $nombre) { switch ($c) { case 'duracion_est': $toshow = secondsToHuman($t[$c]); break; case 'creada': $toshow = datetohuman(new DateTime($t[$c]), "h:i d-m-Y"); break; case 'id_proyecto': $pro = new Proyecto($t[$c]); $toshow = $pro->getNombre(); break; case 'estado': if ($t[$c] == 1) { $toshow = "<div class='text-center estado'><i class='fa fa-cog fa-spin'></i></div>"; } else { $toshow = "<div class='text-center estado'><i class='fa fa-cog'></i></div>"; } break; default: $toshow = $t[$c]; break; } echo "<td>" . $toshow . "</td>"; } $job = new Tarea($t['id']);