public function listTachesAction($codeUseCase) { $taches = Tache::find('codeUseCase LIKE "' . $codeUseCase . '"'); $ar = $taches->toArray(); print_r(json_encode($ar)); $this->view->disable(); }
public function _updateAction($post) { $object = $this->getInstance($post["id"]); $this->setValuesToObject($object); if ($post["id"]) { try { $object->save(); $msg = new DisplayedMessage($this->model . " `{$object}` mis à jour"); } catch (\Exception $e) { $msg = new DisplayedMessage("Impossible de modifier l'instance de " . $this->model, "danger"); } } else { try { $object->save(); $msg = new DisplayedMessage("Instance de " . $this->model . " `{$object}` ajoutée"); } catch (\Exception $e) { $msg = new DisplayedMessage("Impossible d'ajouter l'instance de " . $this->model, "danger"); } } try { $a = 0; $usecase = Usecase::findFirst("code='" . $object->getCodeUseCase() . "'"); $taches = Tache::find("codeUseCase LIKE '" . $object->getCodeUseCase() . "'"); foreach ($taches as $tache) { $a += $tache->getAvancement(); } $a = $a / count($taches); $usecase->setAvancement($a); $usecase->save(); } catch (\Exception $e) { $msg = new DisplayedMessage("Impossible de modifier l'avancement de la UseCase " . $usecase, "danger"); } return $msg; }
public function tachesAction($code = NULL) { $taches = Tache::find("codeUseCase='" . $code . "'"); $usecase = Usecase::findFirst("code='" . $code . "'"); $n = $usecase->getNbreTache(); if ($n == 1) { $this->jquery->click("." . $taches[0]->getId(), "\$('#modifier-" . $taches[0]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[0]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[0]->getId() . "').slideToggle('fast');"); } else { for ($i = 0; $i < $n; $i++) { if ($i == 0) { $Apr = $taches[$i + 1]->getId(); $this->jquery->click("." . $taches[$i]->getId(), "\$('#modifier-" . $Apr . "').hide();\$('#supprimer-" . $Apr . "').hide();\$('#icon-" . $Apr . "').hide();\$('#modifier-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[$i]->getId() . "').slideToggle('fast');"); } elseif ($i == $n - 1) { $Avt = $taches[$i - 1]->getId(); $this->jquery->click("." . $taches[$i]->getId(), "\$('#modifier-" . $Avt . "').hide();\$('#supprimer-" . $Avt . "').hide();\$('#icon-" . $Avt . "').hide();\$('#modifier-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[$i]->getId() . "').slideToggle('fast');"); } else { $Apr = $taches[$i + 1]->getId(); $Avt = $taches[$i - 1]->getId(); $this->jquery->click("." . $taches[$i]->getId(), "\$('#modifier-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#supprimer-" . $taches[$i]->getId() . "').slideToggle('slow');\$('#icon-" . $taches[$i]->getId() . "').slideToggle('fast');\$('#modifier-" . $Apr . "').hide(100);\$('#modifier-" . $Avt . "').hide(100);\$('#supprimer-" . $Apr . "').hide(100);\$('#supprimer-" . $Avt . "').hide(100);\$('#icon-" . $Apr . "').hide();\$('#icon-" . $Avt . "').hide();"); } } } $this->jquery->click(".tache", "\$('#modifier-" . $usecase->getCode() . "').hide(400);"); $this->jquery->getOnClick(".modifier-" . $usecase->getCode(), "", "#modifier-" . $usecase->getCode(), array("attr" => "data-ajax", "jsCallback" => "\$('#modifier-" . $usecase->getCode() . "').show(400);")); $this->jquery->click(".ajouter", "\$('#modifier-" . $usecase->getCode() . "').hide(400);"); $this->jquery->getOnClick(".ajouter", "", "#modifier-" . $usecase->getCode(), array("attr" => "data-ajax", "jsCallback" => "\$('#modifier-" . $usecase->getCode() . "').show(400);")); $this->jquery->getOnclick(".supprimer", "", "#supprimer-" . $usecase->getCode(), array("attr" => "data-ajax", "jsCallback" => "\$('#supprimer-" . $usecase->getCode() . "').show(400);")); $this->jquery->compile($this->view); $this->view->setVars(array("taches" => $taches, "code" => $code, "n" => $i, "usecase" => $usecase)); }
public function testUpdate() { $sprint1 = Sprint::create(['StartDate' => '2015-11-10', 'EndDate' => '2015-11-16', 'project_id' => '1']); ${$sprint1}->update(['StartDate' => '2015-11-17', 'EndDate' => '2015-11-25', 'project_id' => '1']); $this->assertEquals('2015-11-10', $sprint1->StartDate); $this->assertEquals('2015-11-16', $sprint1->EndDate); $this->assertEquals(1, Tache::all()->count()); }
public function modificationAction($id) { $tache = Tache::findFirst("id=" . $id); $this->view->setVars(array("tache" => $tache)); $this->jquery->postFormOnClick(".validate", "Taches/update/" . $id, "modifier", "#modifie", ""); $use = Usecase::findFirst("code='" . $tache->getCodeUseCase() . "'"); $this->jquery->click(".validate", "\$('#modifier-" . $use->getCode() . "').hide('400')"); $this->jquery->click(".cancel", "\$('#modifier-" . $use->getCode() . "').hide('400')"); $this->jquery->compile($this->view); }
public function calculateAuPlusTard($etat, $arc) { $taches = Tache::all(); foreach ($taches as $tache) { $duree[$tache->code] = abs(strtotime($tache->start_date) - strtotime($tache->end_date)) / 60 / 60 / 24; } if ($arc->isReel()) { if ($arc->getDestination()->getAuPlusTard() - $duree[$arc->getTache()->code] < $etat->getAuPlusTard() || $etat->getAuPlusTard() == -1) { $etat->setAuPlusTard($arc->getDestination()->getAuPlusTard() - $duree[$arc->getTache()->code]); } for ($i = 1; $i <= count($this->getArcReals()); $i++) { $arc = $this->getArcReals()[$i]; if ($arc->getDestination() == $etat) { $this->calculateAuPlusTard($arc->getSource(), $arc); } } } }
case $ACTION_tacheView: if (isset($_GET["tache"]) && $_GET["tache"] != -1) { $_SESSION["tache"] = $_GET["tache"]; } elseif (isset($_GET["tache"]) && $_GET["tache"] == -1) { $_SESSION["tache"] = -1; } break; case $ACTION_tacheDelete: if (isset($_GET["tache"]) && $_GET["tache"] != -1) { $tacheTemp = new Tache($_GET["tache"]); $tacheTemp->delete(); } break; case $ACTION_tacheSave: if ($_SESSION["systemData"]->getUserRole() == 4) { $tempTache = new Tache($_POST["tache"], $_POST["time_spend_value"], $_POST["time_remain_value"], $_POST["progress"]); $tempTache->save(); } else { $tempTache = new Tache($_POST["tache"], $_POST["task_name"], $_POST["task_description"], $_POST["select_task_respo"], $_POST["select_task_contact"], $_POST["task_previous_id"], $_POST["task_mother_id"], $_POST["date_end_soon_value"], $_POST["date_end_late_value"], $_POST["time_spend_value"], $_POST["time_remain_value"], $_POST["progress"]); $tempTache->save(); } break; case $ACTION_tacheCreate: $tempTache = new Tache($_POST["task_name"], $_POST["task_description"], $_POST["select_task_respo"], $_POST["select_task_contact"], $_POST["task_previous_id"], $_POST["task_mother_id"], $_POST["date_end_soon_value"], $_POST["date_end_late_value"], $_POST["time_remain_value"], $_POST["projet"]); $_SESSION["tache"] = $tempTache->create(); break; default: // TO DO: default action (nothing to do) } // supprime l'action car elle a ete effectué deleteAction();
$projetId = $_SESSION['idProjet']; $projet_id = $_SESSION['idProjet']; require './Includes/includesKernel.php'; require './Includes/includesProjet.php'; // Si l'on a un formulaire pour creer une nouvelle Tache : if (isset($_POST['action']) && $_POST['action'] == 'CreerTache') { $intitule = $_POST['intitule']; $commentaire = $_POST['commentaire']; $deadline = $_POST['deadline']; // Si la tache à ajouter est une sous tache: if (isset($_POST['tacheMere'])) { $tache = new Tache($bdd, $intitule, $deadline, $commentaire, $projetId); $tache->isSousTache($_POST['tacheMere']); $tache->newTache(); } else { $tache = new Tache($bdd, $intitule, $deadline, $commentaire, $projetId); $tache->newTache(); } } ?> <!DOCTYPE html> <html> <head> <title>Modifier un Projet</title> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <link rel="stylesheet" href="<?php echo PATH_CSS; ?> "> <script type="text/javascript" src="JS/validFormulaire.js"></script>
if (isset($_SESSION["tache"])) { $tacheId = $_SESSION["tache"]; } else { $tacheId = -1; } $selectedTache = new Tache($tacheId); $_SESSION["client"] = $selectedTache->getProjet()->getClient()->getId(); require_once $path . "html/task.php"; break; case $CURSOR_tacheEdit: if (isset($_SESSION["tache"])) { $tacheId = $_SESSION["tache"]; } else { $tacheId = -1; } $selectedTache = new Tache($tacheId); if ($tacheId == -1) { $_SESSION["projet"] = new Projet($_GET["projet"]); } else { $_SESSION["client"] = $selectedTache->getProjet()->getClient()->getId(); $_SESSION["projet"] = $selectedTache->getProjet(); } if ($_SESSION["systemData"]->getUserRole() == 4) { require_once $path . "html/task_edit_collabo.php"; } else { require_once $path . "html/task_edit_respo.php"; } break; // use as default page // use as default page default:
public function testAdd() { $us1 = Userstory::create(['description' => 'this is a user story of our project', 'priority' => '20', 'difficulty' => '1', 'status' => 'validated', 'project_id' => '1']); $us2 = Userstory::create(['description' => 'yes client this is a user story for your satisfaction', 'priority' => '5', 'difficulty' => '1', 'status' => 'validated', 'project_id' => '1']); $this->assertEquals(2, Tache::all()->count()); }
public function tachesAction($id) { $tache = Tache::findFirst("id='" . $id . "'"); print_r(json_encode($tache->toArray())); $this->view->disable(); }
public function manageTasksAction($id = null, $idUc = null) { $tache = Tache::findFirst($id); if (!$tache) { $tache = new Tache(); $tache->setAvancement(0); $tache->setCodeUseCase($idUc); } $users = User::find("idRole<>3"); $this->view->setVars(array("tache" => $tache, "users" => $users, "baseHref" => $this->url->getBaseUri())); $_SESSION['bread']['object'] = $tache; $this->jquery->exec("\$('input[type=\"range\"]').rangeslider({\n \t\t\t\t\t\t\t\tpolyfill: false,\n\t\t\t\t\t\t\t\tonSlide: function(position, value) {\n\t\t\t\t\t\t\t\t\t\$('.avancementTasks').html(value.toString()+'%');\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});", true); $this->view->pick("projects/manageTasks"); $this->jquery->postFormOnClick(".validateTasks", "Taches/updateFromProject", "frmTasks", ".content"); $this->jquery->click(".cancelTask", "\$('.tasks').hide();"); $this->jquery->compile($this->view); $uc = Usecase::findFirst("code='" . $tache->getCodeUseCase() . "'"); $_SESSION['bread']['object'] = Projet::findFirst($uc->getIdProjet()); }
} //Ouverture du fichier $fe = fopen("./xml/option.xml", "w+"); //Sauvegarde des modifications du fichier d'option fwrite($fe, $xml->saveXML(), strlen($xml->saveXML())); //Fermeture du fichier fclose($fe); //Vérification de l'existence de la table nécessaire au fonctionnement de l'application + Création si nécessaire //Vérification de l'existence de la table tache[xxxx] //Requête de récupération des données $reponse = $base->query('SHOW TABLES FROM vdr_system_gestion LIKE \'tache_' . $year . '\''); $donnees = $reponse->rowCount(); //Si $donnees est vide alors creation de la table if ($donnees == 0) { //Creation des classes "Tache" et "Intervention" $tache = new Tache(); $intervention = new Intervention(); //Nombre de semaine dans l'année $nbresemaine = date("W", mktime(0, 0, 0, 12, 28, $year)); //Définition des semaines de début et fin de campagne d'irrigation $debutcampagne = date("W", mktime(0, 0, 0, 04, 01, $year)); $fincampagne = date("W", mktime(0, 0, 0, 10, 30, $year)); //Creation de la table annuelle tache[xxxx] $tache->creer($base); //Récupération des taches systématiques $listeTache = $intervention->lister($base); //Opérations effectuées sur chacune des lignes récupérées suivant le cycle de l'intervention while ($donnees = $listeTache->fetch()) { $nom_intervention = $donnees['nom_intervention']; $nom_ouvrage = $donnees['nom_ouvrage']; $nom_cycle = $donnees['nom_cycle'];
/** Cette fonction est un grand switch qui sert à renvoyer vers une action donnée en paramètre. @param Action : Action à accomplir… */ function ExecActions($action) { /*=============*/ Lib_myLog("action: ", $action); // On recupere la configuration issue de conf.php global $lang, $taille_ecran, $MSG, $secure, $cle, $config; // On recupere tous les objet contenant les donnees global $data_in, $data_out, $data_srv, $session; // Initialization des variables global $message, $tache; switch ($action) { /** * - Cas Site_Accueil : * . * Le cas (par défaut) Site_Accueil recherche tous les taches, s'occupent des critères de tri, et renvoie vers la vue (page) Site_Accueil.php.... */ case "Accueil": /*=============*/ Lib_myLog("Recuperation de l'arborescence"); $data_in['code_arbo'] = 'suivi'; $data_out['liste_fils'] = Arbo_construire($data_in['code_arbo'], 'tache'); if (isset($data_in['id_arbo_pere'])) { $data_out['id_arbo_pere'] = $data_in['id_arbo_pere']; } if (!isset($data_in['type_affichage'])) { $data_in['type_affichage'] = 'toutes'; } $data_out['type_affichage'] = $data_in['type_affichage']; $data_out['code_arbo'] = $data_in['code_arbo']; $data_out['menu_gauche'] = 'arbo'; $data_out['page'] = 'suivi.php'; break; case "Element_Etat": $arbo = Arbo_recuperer($data_in['id_arbo']); $arbo->etat = $arbo->etat == 'actif' ? $arbo->etat = 'inactif' : ($arbo->etat = 'actif'); $arbo->UPD(); $data_out['message_ok'] = $MSG['fr']['%%arbo_UPD%%']; // On met à jour l'état de l'tache associé à l'élément de l'arbo sélectionné if ($arbo->id_pere != 0 && $arbo->type_pere == 'tache') { $tache = Tache_recuperer($arbo->id_pere); $tache->etat = $arbo->etat; $tache->UPD(); } // On remet à 0 le fichier contenant le "cache" des taches pour l'affichage des blocs Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers $tab_ids_arbos = array($data_in['id_arbo'] => $data_in['id_arbo']); // Arbo_zipDocuments('arbo_docs', $tab_ids_arbos); ExecActions('Accueil'); break; case "Element_Bouger": $tab_positions = explode("|", $data_in['tab_list']); $i = 1; $tab_ids_arbos = array(); foreach ($tab_positions as $position) { $projet = Arbo_recuperer($position); if ($projet->ordre != $i) { $tab_ids_arbos[$projet->id_arbo] = $projet->id_arbo; } $projet->ordre = $i; $projet->UPD(); $i++; } $data_out['message_ok'] = $MSG['fr']['%%arbo_UPD%%']; // On remet à 0 le fichier contenant le "cache" de l'arborescence Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers // Arbo_zipDocuments('arbo_docs', $tab_ids_arbos); ExecActions('Accueil'); break; case "Element_DEL": /*=============*/ Lib_myLog("Recuperation de l'element"); if ($data_in['id_arbo_pere'] != 0) { /*=============*/ Lib_myLog("Suppression de de l'objet de type arbo"); $obj_element_initial = Arbo_recuperer($data_in['id_arbo']); $data_out['message_ok'] = $MSG['fr']['%%arbo_DEL%%']; } if ($data_in['id_arbo_pere'] == 0) { /*=============*/ Lib_myLog("Suppression des taches dans toutes les langues"); $obj_element_initial = Arbo_recuperer_par_element($data_in['id_pere'], $data_in['type_pere'], $data_in['code_arbo']); // Le même tache peut être en pluisieurs langues. On les regroupe grâce au code tache $args_taches['code'] = 'tache-' . $obj_element_initial->id_pere; $liste_taches = Taches_chercher($args_taches); foreach ($liste_taches as $art) { $tache = Tache_recuperer($art['id_tache']); $tache->DEL(); } $data_out['message_ok'] = $MSG['fr']['%%page_DEL%%']; } /*=============*/ Lib_myLog("Retablissement de l'ordre sans coupure"); $args_elements['famille'] = $obj_element_initial->famille; $args_elements['sup_ordre'] = $obj_element_initial->ordre; $args_elements['code_arbo'] = $data_in['code_arbo']; $elements = Arbos_chercher($args_elements); foreach ($elements as $element) { $obj_element = Arbo_recuperer($element['id_arbo']); $obj_element->ordre--; $obj_element->UPD(); } $obj_element_initial->DEL(); // On remet à 0 le fichier contenant le "cache" de l'arborescence Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers $tab_ids_arbos = array($data_in['id_arbo'] => $data_in['id_arbo']); // Arbo_zipDocuments('arbo_docs',$tab_ids_arbos); ExecActions('Accueil'); break; case "Categorie_ADD": $args_arbos['code_arbo'] = $data_in['code_arbo']; $args_arbos['famille'] = ''; if ($data_in['id_arbo_pere'] != '') { /*=============*/ Lib_myLog("Il s'agit d'un ajout de sous-element !"); $arbo_pere = Arbo_recuperer($data_in['id_arbo_pere']); $args_arbos['famille'] = $arbo_pere->famille . $arbo_pere->id_arbo . '-'; } /*=============*/ Lib_myLog("On determine le nouvel ordre a attribuer au nouvel element"); $arbos = Arbos_chercher($args_arbos); $ordre = count($arbos); $ordre++; /*=============*/ Lib_myLog("Rajout d'un nouvel element"); $arbo = new Arbo(); if ($data_in['id_arbo_pere'] != '') { $arbo->famille .= $arbo_pere->famille . $arbo_pere->id_arbo . '-'; } $arbo->code_arbo = $data_in['code_arbo']; $arbo->type_pere = 'arbo'; $arbo->ordre = $ordre; $arbo->etat = 'inactif'; $arbo->intitule = $data_in['intitule']; $id_arbo = $arbo->ADD(); $data_out['message_ok'] = $MSG['fr']['%%arbo_ADD%%']; $arbo->id_arbo_pere = $data_in['id_arbo_pere'] != '' ? $data_in['id_arbo_pere'] : $id_arbo; /*=============*/ Lib_myLog("Creation du nouvel tache associe a la categorie"); $tache = new Tache(); $tache->titre_page = $data_in['intitule']; $tache->titre = $data_in['intitule']; $tache->lang = 'fr'; $tache->etat = 'actif'; $id_tache = $tache->ADD(); $tache = Tache_recuperer($id_tache); // On définit un code pour pouvoir retrouver le même tache en plusieurs langues $tache->code = 'tache-' . $id_tache; $tache->UPD(); foreach ($GLOBALS['LANGUES'] as $langue) { /*=============*/ Lib_myLog("Ajout de l'tache en {$langue}"); $tache->lang = $langue; $tache->ADD(); } $arbo->id_pere = $id_tache; $arbo->type_pere = 'tache'; $arbo->UPD(); // On remet à 0 le fichier contenant le "cache" de l'arborescence Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers $tab_ids_arbos = array($id_arbo => $id_arbo); // Arbo_zipDocuments('arbo_docs', $tab_ids_arbos); ExecActions('Accueil'); break; case "Categorie_UPD": /*=============*/ Lib_myLog("Modification de l'intitule d'un element"); $arbo = Arbo_recuperer($data_in['id_arbo']); $arbo->intitule = $data_in['intitule']; $arbo->UPD(); /*=============*/ Lib_myLog("Modification de l'tache lie a l'element"); if ($arbo->id_pere) { $tache = Tache_recuperer($arbo->id_pere); $tache->titre = $data_in['intitule']; $tache->UPD(); } // On remet à 0 le fichier contenant le "cache" de l'arborescence Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers $tab_ids_arbos = array($data_in['id_arbo'] => $data_in['id_arbo']); // Arbo_zipDocuments('arbo_docs',$tab_ids_arbos); $data_out['message_ok'] = $MSG['fr']['%%arbo_UPD%%']; ExecActions('Accueil'); break; case "SELECT_SsCategories": $data_out['liste_sous_categories'] = array(); /*=============*/ Lib_myLog("Recuperation du pere"); $arbo_pere = Arbo_recuperer($data_in['id_arbo']); $args_sous['not_id_arbo_pere'] = 0; $args_sous['famille'] = $arbo_pere->famille . $arbo_pere->id_arbo . '-'; $data_out['liste_sous_categories'] = Arbos_chercher($args_sous); $cle = 'ordre'; $val = usort($data_out['liste_sous_categories'], "Lib_compareUp"); $data_out['page'] = 'arbo_select_ss_categories.php'; break; case "SELECT_SsSsCategories": $data_out['liste_sous_categories'] = array(); /*=============*/ Lib_myLog("Recuperation du pere"); $arbo_pere = Arbo_recuperer($data_in['id_arbo']); $args_sous['not_id_arbo_pere'] = 0; $args_sous['famille'] = $arbo_pere->famille . $arbo_pere->id_arbo . '-'; $data_out['liste_sous_categories'] = Arbos_chercher($args_sous); $cle = 'ordre'; $val = usort($data_out['liste_sous_categories'], "Lib_compareUp"); $data_out['page'] = 'arbo_select_ss_ss_categories.php'; break; case "AJAX_ArboUPD": $tab_arbo = json_decode($data_in['arbo_json'], true); /*=============*/ Lib_myLog("Arbo recuperee"); Arbo_recalcul($tab_arbo); break; case "Tache_ADD": $F5 = Lib_checkF5($session, $data_in['timestamp']); $continue = $F5 ? false : true; if ($continue) { $args_arbos['code_arbo'] = $data_in['code_arbo']; $args_arbos['famille'] = ''; if ($data_in['id_arbo_pere'] != 0) { $arbo = Arbo_recuperer($data_in['id_arbo_pere']); $args_arbos['famille'] = $arbo->famille . $arbo->id_arbo . '-'; $args_arbo['id_arbo'] = $data_in['id_arbo_pere']; $id_categorie = $data_in['id_arbo_pere']; } // Si un id_arbo_fils est positionné, il "surclasse" l'id_pere! if (isset($data_in['id_arbo_fils']) && $data_in['id_arbo_fils'] != 0) { $arbo = Arbo_recuperer($data_in['id_arbo_fils']); $args_arbos['famille'] = $arbo->famille . $arbo->id_arbo . '-'; $args_arbo['id_arbo'] = $data_in['id_arbo_fils']; } if (isset($data_in['id_arbo_petit_fils']) && $data_in['id_arbo_petit_fils'] != 0) { $arbo = Arbo_recuperer($data_in['id_arbo_petit_fils']); $args_arbos['famille'] = $arbo->famille . $arbo->id_arbo . '-'; $args_arbo['id_arbo'] = $data_in['id_arbo_petit_fils']; } /*=============*/ Lib_myLog("On determine le nouvel ordre a attribuer au nouvel element dans l'arbo"); $arbos = Arbos_chercher($args_arbos); $ordre = count($arbos); $ordre++; /*=============*/ Lib_myLog("On recupere la categorie dont va dependre l'tache"); $arbo = Arbos_chercher($args_arbo); /*=============*/ Lib_myLog("Creation du nouvel tache"); $tache = new Tache(); $tache->categorie = $data_in['categorie']; $tache->titre_page = $data_in['titre_page']; // On met dans le titre le titre_page par défaut. Celui-ci sera changé à l'édition de l'tache de toutes façons... $tache->titre = $data_in['titre_page']; for ($i = 1; $i <= 20; $i++) { $tache->{'data' . $i} = $data_in['data' . $i]; } $tache->date = $data_in['date']; $tache->texte = $data_in['texte']; $tache->lang = 'fr'; $tache->etat = 'inactif'; $id_tache = $tache->ADD(); $tache = Tache_recuperer($id_tache); for ($i = 1; $i <= 5; $i++) { if ($_FILES["fichier" . $i]["name"] != '') { if ($_FILES["fichier" . $i]['error'] == 1) { /*=============*/ Lib_myLog("Taille trop elevee"); $val = ini_get('upload_max_filesize'); $data_out['message_ko'] = $MSG['fr']['%%Erreur_Taille%%'] . " ({$val})"; $tache->{'fichier' . $i} = ''; } else { if ($valid == 1) { /*=============*/ Lib_myLog("Fichier non autorise"); $data_out['message_ko'] = $MSG['fr']['%%Fichier_non_autorise%%']; } else { /*=============*/ Lib_myLog("Telechargement du fichier"); $fichier = Lib_nettoie($_FILES["fichier" . $i]["name"]); $fichier = $tache->id_tache . '_' . $fichier; if (file_exists('../file_ftp/documents_suivi/' . $fichier)) { unlink('../file_ftp/documents_suivi/' . $fichier); } if (is_uploaded_file($_FILES["fichier" . $i]["tmp_name"])) { $tmp_fichier = $_FILES["fichier" . $i]["tmp_name"]; rename($tmp_fichier, '../file_ftp/documents_suivi/' . $fichier); chmod("../file_ftp/documents_suivi/{$fichier}", 0644); } $tache->{'fichier' . $i} = $fichier; } } } } // On définit un code pour pouvoir retrouver le même tache en plusieurs langues $tache->code = 'tache-' . $id_tache; $tache->UPD(); foreach ($GLOBALS['LANGUES'] as $langue) { /*=============*/ Lib_myLog("Ajout de l'tache en {$langue}"); $tache->lang = $langue; $tache->ADD(); } /*=============*/ Lib_myLog("Rajout du nouvel tache dans l'arbo"); $new_arbo = new Arbo(); $new_arbo->code_arbo = $data_in['code_arbo']; $new_arbo->id_pere = $id_tache; $new_arbo->famille .= $arbo['famille'] . $arbo['id_arbo'] . '-'; $new_arbo->type_pere = 'tache'; $new_arbo->ordre = $ordre; $new_arbo->intitule = $data_in['titre_page']; $new_arbo->etat = 'inactif'; $id_arbo = $new_arbo->ADD(); // On remet à 0 le fichier contenant le "cache" des taches pour l'affichage des blocs Lib_writeData('', "TACHES"); // On remet à 0 le fichier contenant le "cache" de l'arborescence Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers $tab_ids_arbos = array($id_arbo => $id_arbo); // Arbo_zipDocuments('arbo_docs',$tab_ids_arbos); } if ($continue) { $data_in['id_tache'] = $id_tache; if (isset($data_in['code_arbo'])) { header("Location: http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/actions.php?action=Accueil&code_arbo={$data_in['code_arbo']}"); } else { ExecActions('Site_Apercu'); } } else { if ($F5) { /*=============*/ Lib_myLog("Tentative de F5!"); $data_out['message_ko'] = $MSG[$lang]['%%Erreur_Revalidation%%']; ExecActions('Site_Apercu'); } else { ExecActions('Site_Apercu'); } } break; case "POPUP_TacheUPD": $data_out['tache'] = Taches_chercher(array('id_tache' => $data_in['id_tache'])); $data_out['code_arbo'] = $data_in['code_arbo']; $data_out['page'] = 'popup_tache_upd.php'; break; case "POPUP_CategorieUPD": $data_out = Arbos_chercher(array('id_arbo' => $data_in['id_arbo'])); $data_out['code_arbo'] = $data_in['code_arbo']; $data_out['page'] = 'popup_arbo_categorie_upd.php'; break; case "Tache_UPD": /*=============*/ Lib_myLog("Modification de l'tache"); $tache = Tache_recuperer($data_in['id_tache']); $tache->categorie = $data_in['categorie']; $tache->titre_page = $data_in['titre_page']; // On met dans le titre le titre_page par défaut. Celui-ci sera changé à l'édition de l'tache de toutes façons... $tache->titre = $data_in['titre_page']; for ($i = 1; $i <= 20; $i++) { $tache->{'data' . $i} = $data_in['data' . $i]; } $tache->date = $data_in['date']; $tache->texte = $data_in['texte']; $tache->lang = 'fr'; $tache->etat = 'inactif'; //Si la date de mise en production est positionnee, alors la tâche est terminée if ($tache->data4 != '') { $tache->etat = 'actif'; } for ($i = 1; $i <= 5; $i++) { if ($data_in['sup_fichier' . $i] == 1) { if (file_exists('../file_ftp/documents_suivi/' . $tache->{'fichier' . $i})) { unlink('../file_ftp/documents_suivi/' . $tache->{'fichier' . $i}); } $tache->{'fichier' . $i} = ''; } if ($_FILES["fichier" . $i]["name"] != '') { if ($_FILES["fichier" . $i]['error'] == 1) { /*=============*/ Lib_myLog("Taille trop elevee"); $val = ini_get('upload_max_filesize'); $data_out['message_ko'] = $MSG['fr']['%%Erreur_Taille%%'] . " ({$val})"; $tache->{'fichier' . $i} = ''; } else { if ($valid == 1) { /*=============*/ Lib_myLog("Fichier non autorise"); $data_out['message_ko'] = $MSG['fr']['%%Fichier_non_autorise%%']; } else { /*=============*/ Lib_myLog("Telechargement du fichier"); $fichier = Lib_nettoie($_FILES["fichier" . $i]["name"]); $fichier = $tache->id_tache . '_' . $fichier; if (file_exists('../file_ftp/documents_suivi/' . $fichier)) { unlink('../file_ftp/documents_suivi/' . $fichier); } if (is_uploaded_file($_FILES["fichier" . $i]["tmp_name"])) { $tmp_fichier = $_FILES["fichier" . $i]["tmp_name"]; rename($tmp_fichier, '../file_ftp/documents_suivi/' . $fichier); chmod("../file_ftp/documents_suivi/{$fichier}", 0644); } $tache->{'fichier' . $i} = $fichier; } } } } $tache->UPD(); // On remet à 0 le fichier contenant le "cache" des taches pour l'affichage des blocs Lib_writeData('', "TACHES"); // On remet à 0 le fichier contenant le "cache" de l'arborescence Lib_writeData('', "ARBO"); //Enregistrement d'un zip par dossier racine contenant les fichiers $arbo = Arbo_recuperer_par_element($data_in['id_tache'], 'tache', 'arbo_docs'); $tab_ids_arbos = array($arbo->id_arbo => $arbo->id_arbo); // Arbo_zipDocuments('arbo_docs',$tab_ids_arbos); if (isset($data_in['code_arbo'])) { header("Location: http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/actions.php?action=Accueil&code_arbo={$data_in['code_arbo']}"); } break; default: ExecActions('Accueil'); break; } }