X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=app%2Fcontrollers%2Fusers%2Fmorceaux.php;h=75414bcba8004648ce92bc41ddd1451411cfed31;hb=b54e7a0b72982b396436dd47189b3520dd3f0b5e;hp=8c9585681184ca8e32f197fa24eef610a604df70;hpb=39104f779d37b7e4dc361e25326f5b40f011797c;p=mw_sourceml diff --git a/app/controllers/users/morceaux.php b/app/controllers/users/morceaux.php index 8c95856..75414bc 100644 --- a/app/controllers/users/morceaux.php +++ b/app/controllers/users/morceaux.php @@ -145,7 +145,21 @@ $upload_dir = $env->path("content")."uploads/".$this->user["id"]; $_SESSION["upload_dir"] = $web_path.($web_path ? "" : "/").$env->path("content")."uploads/".$this->user["id"]; $users_sources_mod = $env->get_controller("users/sources"); - if($_POST){ + if(isset($_POST["button_derive"])){ + if( + ($origin_source_id = $_POST["button_derive"]) + && ($origin_source_xml_url = $data->source_xml_url($origin_source_id)) + && ($origin_source_xml_content = $data->get_source_xml($origin_source_id)) + ){ + $morceau["derivations"][$origin_source_id] = $users_sources_mod->get_source_from_xml( + $env, + $origin_source_xml_url, + $origin_source_xml_content, + false + ); + } + } + elseif($_POST){ if(!($groupe = $data->groupe($_POST["id_groupe"]))){ $env->erreur("Impossible de lire les informations du groupe"); return; @@ -204,6 +218,8 @@ ); $source_infos["date_creation"] = $_POST["annee_date_creation"]."-".$_POST["mois_date_creation"]."-".$_POST["jour_date_creation"]; $source_infos["description"] = $_POST["description"]; + $morceau["description"] = $source_infos["description"]; + $morceau["date_creation"] = $source_infos["date_creation"]; foreach($_POST as $post_key => $post_value){ if(substr($post_key, 0, 13) == "document_nom_"){ if($id_document = substr($post_key, 13)){ @@ -314,6 +330,10 @@ "date_inscription" => $_POST["date_inscription"], "ordre" => isset($morceau["ordre"]) ? $morceau["ordre"] : 0 ); + $permissions = $morceau["permissions"]; + $image = isset($morceau["image"]) ? $morceau["image"] : null; + $image_uri = isset($morceau["image_uri"]) ? $morceau["image_uri"] : null; + $image_uri = $morceau["image_uri"]; $morceau = $data->empty_source( array( "id" => $morceau["id"], @@ -321,6 +341,10 @@ "image" => isset($morceau["image"]) ? $morceau["image"] : "" ) ); + $morceau["permissions"] = $permissions; + $morceau["date_creation"] = $_POST["annee_date_creation"]."-".$_POST["mois_date_creation"]."-".$_POST["jour_date_creation"]; + $morceau["image"] = $image; + $morceau["image_uri"] = $image_uri; $users_sources_mod = $env->get_controller("users/sources"); if($_POST["album"]){ if($album = $data->source($_POST["album"], true)){ @@ -366,6 +390,7 @@ ), isset($_POST["use_edit_reference_content"]) ? true : false ); + $morceau["licence"]["id"] = 0; } else{ if(!($morceau["titre"] = trim($_POST["titre"]))){ @@ -376,6 +401,7 @@ ); $source_infos["date_creation"] = $_POST["annee_date_creation"]."-".$_POST["mois_date_creation"]."-".$_POST["jour_date_creation"]; $source_infos["description"] = $_POST["description"]; + $morceau["description"] = $source_infos["description"]; foreach($_POST as $post_key => $post_value){ if(substr($post_key, 0, 13) == "document_nom_"){ if($id_document = substr($post_key, 13)){ @@ -447,6 +473,7 @@ } function maj_xml(){ + $env = $this->env(); $data = $env->data(); if(!($morceau = $data->source($_GET[$env->param("id")], true))){ $env->erreur("Impossible de lire les informations du morceau"); @@ -458,9 +485,9 @@ return; } if - ( isset($_GET[$env->param("id")]) - && isset($_GET[$env->param("xml")]) - && ($_GET[$env->param("xml")] == "derviation" ? isset($_GET[$env->param("derivation")]) : true) + ( !isset($_GET[$env->param("id")]) + || !isset($_GET[$env->param("xml")]) + || ($_GET[$env->param("xml")] == "derviation" && !isset($_GET[$env->param("derivation")])) ){ $env->erreur("parametre de fichier xml manquant"); return; @@ -530,6 +557,18 @@ ); } + function groupes(){ + $env = $this->env(); + if( + !($sources_invitations_controller = $env->get_controller("users/sources_invitations")) + || !$sources_invitations_controller->validate() + ){ + $env->erreur("impossible de valider le controleur users/sources_invitations"); + return; + } + $sources_invitations_controller->source_groupes(); + } + } ?> \ No newline at end of file