diff --git a/Makefile_prod b/Makefile_prod deleted file mode 100644 index 4397fa0..0000000 --- a/Makefile_prod +++ /dev/null @@ -1,62 +0,0 @@ -########################## -# SCRIPT DE DÉPLOIEMENT -########################## - -include .env_prod -# include .env_dev - -RED=\033[0;31m -GREEN=\033[0;32m -YELLOW=\033[0;33m -NC=\033[0m # No Color - -deploy: pull-media deploy-theme deploy-plugin - -deploy-theme: - @echo "$(GREEN)####Synchronisation des Themes $(NC)" - @rsync -avhp -e 'ssh' ./ $(HOST):$(THEMES_PATH)/$(THEME_FOLDER_NAME) --delete --exclude 'node_modules' --exclude 'Makefile' --exclude 'Makefile_dev' --exclude '.env' --exclude '.env_prod' --exclude '.env_dev' --exclude '.git' - -deploy-plugin: - @echo "$(GREEN)####Synchronisation du plugin $(NC)" - @rsync -avhp -e 'ssh' ../../plugins/$(PLUGIN_FOLDER_NAME) $(HOST):$(PLUGINS_PATH) --delete --exclude 'node_modules' --exclude 'Makefile' --exclude 'Makefile_dev' --exclude '.env' --exclude '.env_prod' --exclude '.env_dev' --exclude '.git' - -deploy-full-content: - @echo "$(GREEN)####Synchronisation de tout le wp-content$(NC)" - @rsync -avhp -e 'ssh' ../../ $(HOST):$(CONTENT_PATH) --delete --exclude 'node_modules' --exclude 'Makefile' --exclude 'Makefile_dev' --exclude '.env' --exclude '.env_prod' --exclude '.env_dev' --exclude '.git' - -pull-media: - @echo "$(GREEN)####Pull des médias $(NC)" - @rsync -avhp -e 'ssh' $(HOST):$(UPLOADS_PATH) ../../uploads --delete - -pull-plugins: - @echo "$(GREEN)####Pull des Plugins $(NC)" - @rsync -avhp -e 'ssh' $(HOST):$(PLUGINS_PATH) ../../plugins --delete - -bundle: - @echo "$(GREEN)####BUNDLE $(NC)" - @rsync -avh ./* ../$(THEME_DIST_NAME) --delete \ - --exclude '.env' \ - --exclude '.env_dev' \ - --exclude '.env_prod' \ - --exclude 'node_modules' \ - --exclude 'Makefile' \ - --exclude 'Makefile_dev' \ - --exclude '.git' \ - --exclude '.gitignore' \ - --exclude 'composer.json' \ - -maintenance-on: - @echo "$(YELLOW)####MISE EN MAINTENANCE $(NC)" - @ssh -p $(PORT) $(HOST) "cd $(CONTENT_PATH); cd ..; echo '> .maintenance " - -maintenance-off: - @echo "$(GREEN)####MISE EN LIGNE / SUPPRESSION DU MAINTENANCE $(NC)" - @ssh -p $(PORT) $(HOST) "cd $(CONTENT_PATH); cd ..; rm .maintenance " - -test-connect: - @echo "$(GREEN)####SIMULATION — TEST DE CONNEXION $(NC)" - @ssh -p $(PORT) $(HOST) "cd $(CONTENT_PATH); pwd" - -test-deploy: - @echo "$(RED)####SIMULATION — Synchronisation RSYNC DES FICHIERS $(NC)" - @rsync -avhpn -e 'ssh' ./ $(HOST):$(THEMES_PATH)/$(THEME_FOLDER_NAME)/test --delete --exclude 'node_modules' --exclude 'Makefile' --exclude 'Makefile_dev' --exclude '.git' --exclude '.env' --exclude '.env_prod' --exclude '.env_dev' \ No newline at end of file diff --git a/includes/forms.php b/includes/forms.php index dfbb79a..78a234b 100644 --- a/includes/forms.php +++ b/includes/forms.php @@ -2,4 +2,5 @@ -require_once(__DIR__ . '/forms/form-OrderPaper.php'); +require_once(__DIR__ . '/forms/field-OrderBrochureList.php'); +require_once(__DIR__ . '/forms/field-OrderDocumentsList.php'); diff --git a/includes/forms/form-OrderPaper.php b/includes/forms/field-OrderBrochureList.php similarity index 90% rename from includes/forms/form-OrderPaper.php rename to includes/forms/field-OrderBrochureList.php index 9756f45..0ed4253 100644 --- a/includes/forms/form-OrderPaper.php +++ b/includes/forms/field-OrderBrochureList.php @@ -1,9 +1,9 @@ posts as $key => $post) { array_push($choices, ['text' => $post->post_title, 'slug' => $post->post_name, 'ID' => $post->ID]); } @@ -40,7 +35,7 @@ if (class_exists('GF_Field')) { public function get_form_editor_field_title() { - return esc_attr__('Commande de publications papier', 'txtdomain'); + return esc_attr__('Listes des brochures commandable', 'txtdomain'); } public function get_form_editor_button() { @@ -84,7 +79,7 @@ if (class_exists('GF_Field')) { $id = $this->id; ob_start(); - include 'template-form-order-paper.php'; + include 'template-field-order-brochures.php'; $table = ob_get_clean(); @@ -168,5 +163,5 @@ if (class_exists('GF_Field')) { return $this->PrettyListBrochureOrder($value); } } - GF_Fields::register(new OrderPaperPublications()); + GF_Fields::register(new OrderBrochureList()); } diff --git a/includes/forms/field-OrderDocumentsList.php b/includes/forms/field-OrderDocumentsList.php new file mode 100644 index 0000000..61e511a --- /dev/null +++ b/includes/forms/field-OrderDocumentsList.php @@ -0,0 +1,178 @@ + 'Synthèse des primes'], + ['text' => 'Publication 2'], + ['text' => 'Publication 3'], + ]; + + // public $choices = [ + // [ + // 'text' => 'Synthèse des primes', + // 'slug' => "the post name", + // 'ID' => 24 + // ], + // [ + // 'text' => 'Document 2', + // 'slug' => "the post name", + // 'ID' => 24 + // ], + + // ]; + + private function buildChoices() + { + + $choices = [ + [ + 'text' => 'La synthèse des primes', + 'description' => __("Ce document informe sur les incitants financiers à l’achat et à la rénovation des logements en Région de Bruxelles-Capitale, dont les primes RENOLUTION, le crédit ECORENO, la subvention petit patrimoine, la prime gaz, les certificats verts...", "homegrade-theme__texte-fonctionnel"), + 'slug' => "the post name", + 'ID' => 24 + ], + [ + 'text' => 'Document 2', + 'slug' => "the post name", + 'ID' => 24 + ], + + ]; + + + $this->choices = $choices; + } + + public function get_form_editor_field_title() + { + return esc_attr__('Listes des documents commandables', 'txtdomain'); + } + public function get_form_editor_button() + { + return [ + 'group' => 'advanced_fields', + 'text' => $this->get_form_editor_field_title(), + ]; + } + public function get_form_editor_field_icon() + { + return 'gform-icon--multi-select'; + } + public function get_form_editor_field_settings() + { + return [ + 'label_setting', + 'choices_setting', + 'description_setting', + 'rules_setting', + 'error_message_setting', + 'css_class_setting', + 'conditional_logic_field_setting' + ]; + } + + + public function is_value_submission_array() + { + return true; + } + + public function get_field_input($form, $value = '', $entry = null) + { + + // $this->buildChoices(); + $form_id = $form['id']; + $id = $this->id; + + ob_start(); + include 'template-field-order-documents.php'; + $table = ob_get_clean(); + + return $table; + } + + private function translateValueArray($value) + { + $this->buildChoices(); + + $table_value = []; + $counter = 0; + + foreach ($this->choices as $document) { + $table_value[$document['text']]['quantity_fr'] = $value[$counter] ?? 0; + $table_value[$document['text']]['quantity_nl'] = $value[$counter + 1] ?? 0; + $counter += 2; + } + return $table_value; + } + + public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead) + { + + if (empty($value)) { + $value = ''; + } else { + $table_value = $this->translateValueArray($value); + + $value = serialize($table_value); + } + + return $value; + } + + + private function PrettyListBrochureOrder($value) + { + $brochureOrderPreviewHtml = '