re_once('theme.inc'); require_once('includes/custom_design_form.inc'); require_once('includes/belleville_form.inc'); require_once('includes/ondulee_form.inc'); require_once('includes/ondufil_form.inc'); require_once('includes/anneau_elastique_form.inc'); require_once('includes/360_form.inc'); require_once('includes/rob_form.inc'); require_once('includes/diaphragme_form.inc'); use Mpdf\Mpdf; if ($_SERVER['DOCUMENT_ROOT']) { require_once $_SERVER['DOCUMENT_ROOT'] . '/sites/all/libraries/mpdf8/vendor/autoload.php'; } /** * Implements hook_menu(). */ function borrelly_form_menu() { $items = array(); $items['form/custom-design'] = array( 'title' => 'Custom design', //page title 'description' => t('Donwload the PDF'), 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_custom_design_form'), // the name of the form 'access callback' => TRUE ); $items['form/belleville'] = array( 'title' => t('Borrelly Belleville
Disc Spring'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_belleville_form'), // the name of the form 'access callback' => TRUE ); $items['form/rob'] = array( 'title' => t('Borrelly ROB'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_rob_form'), // the name of the form 'access callback' => TRUE ); $items['form/diaphragme'] = array( 'title' => t('Borrelly diaphragm washers'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_diaphragme_form'), // the name of the form 'access callback' => TRUE ); $items['form/ondulee'] = array( 'title' => t('Borrelly Spring Washers'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_ondulee_form'), // the name of the form 'access callback' => TRUE ); $items['form/ondufil'] = array( 'title' => t('Borrelly Ondufil
Wave spring'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_ondufil_form'), // the name of the form 'access callback' => TRUE ); $items['form/anneau-elastique'] = array( 'title' => t('Borrelly ribbon spring'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_anneau_elastique_form'), // the name of the form 'access callback' => TRUE ); $items['form/360'] = array( 'title' => t('Borrelly 360'), //page title 'page callback' => 'drupal_get_form', 'page arguments' => array('borrelly_360_form'), // the name of the form 'access callback' => TRUE ); return $items; } /** * Generates a PDF, saves datas, sends emails notifications, newsletter inscription */ function _submit_form($html = '', $styles = '', $templateName = 'Feuillets_Ang_Custom_Design.pdf', $generatedFileName = null, $generatedFileDirectory = null, $email = '', $formName = '', $newsletterSubscription = FALSE, $values = array()) { if (_generatePdf($html, $styles, $templateName, $generatedFileName, $generatedFileDirectory)) { //création et enregistrement du fichier sur le serveur global $language; $directory = drupal_get_path('module', 'borrelly_form') . '/pdf/'; if ($generatedFileDirectory) $directory .= $generatedFileDirectory; $fileFullPath = DRUPAL_ROOT . '/' . $directory . $generatedFileName; //notifications par email _sendEmailNotification($email, $formName, $fileFullPath, $generatedFileName, $language->language); //enregistre le fichier DPF généré sous forme de "File" géré par drupal $fid = _savePDFasDrupalFile($fileFullPath, $generatedFileName); $values['fid'] = $fid; //sauvegarde des données d'identification dans le webform "Formulaires" _saveFormDatas($values, $language->language); //inscription au la newsletter if ($newsletterSubscription) { _newsletterSubscription($email, $language->language); } drupal_set_message(t('The form was submitted successfully. You will receive the pre-filled PDF document by email. Thank you.'), 'status'); } else { drupal_set_message(t('An error occurred while sending the form. Please try again later.'), 'status'); } } /** * Generates a PDF from Html and Css */ function _generatePdf($html = '', $styles = '', $templateName = 'Feuillets_Ang_Custom_Design.pdf', $generatedFileName = null, $generatedFileDirectory = null) { $mpdf = new Mpdf(['tempDir' => '/tmp']); $mpdf->curlAllowUnsafeSslRequests = true; //fix le probleme "Mpdf\MpdfImageException : Could not find image file Image/ImageProcessor.php" //$mpdf->SetImportUse(); $templatePath = dirname(__FILE__) . '/pdf/' . $templateName; $pagecount = $mpdf->SetSourceFile($templatePath); $tplId = $mpdf->ImportPage($pagecount); $mpdf->SetPageTemplate($tplId); // Do not add page until page template set, as it is inserted at the start of each page $mpdf->AddPage(); //adds common styles $styles = ' .field{background:none;color:#000000;height:19px;display:block;position:fixed;width:78px;text-align:right;overflow:hidden;font-size:14px;} .cross{width:10px;color:#000000;} .txtleft{text-align:left;} .lines-2{height:40px;line-height:21px;} .lines-3{height:60px;line-height:21px;}' . $styles; $mpdf->WriteHTML($styles, 1); $mpdf->WriteHTML($html, 2); //$generatedFileName = null;//DEBUG PDF if ($generatedFileName != null) $windowOutpout = FALSE; else { $windowOutpout = TRUE; $generatedFileName = 'temp_form_submission.pdf'; } $directory = dirname(__FILE__) . '/pdf/'; if (!is_dir($directory)) mkdir($directory, 0755, TRUE); if ($generatedFileDirectory) { $directory .= $generatedFileDirectory; if (!is_dir($directory)) mkdir($directory, 0755, TRUE); } $filename = $directory . $generatedFileName; if ($windowOutpout) { // Outpout content on browser window $mpdf->Output($filename, 'I'); exit; } else { // Generating PDF File. $mpdf->Output($filename, 'F'); return TRUE; } } /** * Implements hook_mail(). */ function borrelly_form_mail($key, &$message, $params) { $message['subject'] = $params['subject']; $message['body'][] = $params['body']; // Add attachment when available. if (isset($params['attachment'])) { $message['params']['attachments'][] = $params['attachment']; } } /** * Implements hook_form_alter(). */ function borrelly_form_form_alter(&$form, &$form_state, $form_id) { //dsm($form); } /** * Saves datas in webform */ function _saveFormDatas($values = array(), $language = '') { $webformId = 60; module_load_include('inc', 'webform', 'webform.module'); module_load_include('inc', 'webform', 'includes/webform.submissions'); $data = array(); $data[1] = array('value' => array(0 => $values['first_name'])); $data[2] = array('value' => array(0 => $values['last_name'])); $data[3] = array('value' => array(0 => $values['company'])); $data[4] = array('value' => array(0 => $values['function'])); $data[5] = array('value' => array(0 => $values['full_address'])); $data[6] = array('value' => array(0 => $values['email'])); $data[7] = array('value' => array(0 => $values['phone'])); $data[8] = array('value' => array(0 => $language)); $data[9] = array('value' => array(0 => $values['form_name'])); if ($values['fid'] != 0) $data[10] = array('value' => array(0 => $values['fid'])); $submission = (object) array( 'nid' => $webformId, 'uid' => $user->uid, 'sid' => NULL, 'submitted' => REQUEST_TIME, 'completed' => REQUEST_TIME, 'remote_addr' => ip_address(), 'is_draft' => FALSE, 'data' => $data, ); $node = node_load($webformId); $sid = webform_submission_insert($node, $submission); } /** * Newsletter subscription for $email if not yet subscribe */ function _newsletterSubscription($email = null, $language = null) { $webformId = 0; switch ($language) { case 'fr': $webformId = 4; break; case 'de': $webformId = 6; break; default: $webformId = 5; break; } if ($webformId) { //checks if $email is not yet subscribed $result = db_select('webform_submitted_data', 'w') ->fields('w', array('nid', 'data')) ->condition('data', $email, '=') ->condition('nid', $webformId, '=') ->execute() ->fetchAssoc(); if (empty($result)) { //if not yet subscribed global $user; $data = array(); $data[1] = array('value' => array(0 => $email)); $submission = (object) array( 'nid' => $webformId, 'uid' => $user->uid, 'sid' => NULL, 'submitted' => REQUEST_TIME, 'completed' => REQUEST_TIME, 'remote_addr' => ip_address(), 'is_draft' => FALSE, 'data' => $data, ); $node = node_load($webformId); $sid = webform_submission_insert($node, $submission); } } } /** * Enregistre le fichier DPF généré sous forme de "File" géré par drupal */ function _savePDFasDrupalFile($fileFullPath = '', $fileName = '') { if (!empty($fileFullPath) && !empty($fileName)) { $directory = 'private://webform/forms/pdf/'; //copy PDF into Drupal table "file_managed" file_prepare_directory($directory, FILE_CREATE_DIRECTORY); $file_temp = file_get_contents($fileFullPath); $file = file_save_data($file_temp, $directory . $fileName, FILE_EXISTS_RENAME); //delete temporary PDF file drupal_unlink($fileFullPath); return $file->fid; } return 0; } /** * Notifie par email après soumission du formulaire */ function _sendEmailNotification($email = '', $formName = '', $fileFullPath = '', $generatedFileName = '', $language = 'en') { $to = "$email,contact@borrelly.com"; $attachment = array( 'filename' => $generatedFileName, 'filemime' => 'application/pdf', 'filepath' => $fileFullPath, ); var_dump($attachment); exit; $params = array( 'headers' => array('Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes'), 'key' => 'borrelly_form', 'subject' => '[Borrelly] Formulaire de conception - ' . $formName, 'body' => "Bonjour, \n\nVeuillez trouvez en pièce jointe le document PDF que vous venez de générer sur notre site.\n\nBien cordialement,\nL'équipe Borrelly", 'attachment' => $attachment ); watchdog('borrelly_form', "mail to : $to"); drupal_mail('borrelly_form', 'borrelly_form_notification', $to, $language, $params, variable_get('site_mail', '')); } function _cutString($string, $length) { $text = wordwrap($string, $length, "***", true); // insertion de marqueurs *** $tcut = explode("***", $text); // on créé un tableau à partir des marqueurs *** $part1 = $tcut[0]; // la partie à mettre en exergue $part2 = ''; for ($i = 1; $i < count($tcut); $i++) { $part2 .= $tcut[$i] . ' '; } $part2 = trim($part2); //suppression du dernier espace dans la partie de texte restante return array($part1, $part2); } function _cleanText($string) { $string = str_replace("\r\n", ' - ', $string); return $string; } Borrelly Ondufil® - Ressort ondulé OU55S | Borrelly Spring Washers
  • Bords ouverts Gamme Standard en Acier Inox 17-7Ph pour précharge roulement

Borrelly Ondufil® - Ressort ondulé OU55S

Gamme : GAMME STANDARD BORDS OUVERTS EN INOX 17-7PH POUR ROULEMENT

Famille : Borrelly Ondufil®

Les valeurs sont données à titre indicatif et peuvent être amenées à être mises à jour sans préavis.

Télécharger la fiche technique
Afficher
Pré-commander
Afficher

Quantité :

Prix estimatif : disponible prochainement

Stock : selon les quantités disponibles

Details de la référence

Afficher

Demande de conception

Nos ingénieurs vous apportent tout leur savoir faire en étudiant au cas par cas vos problématiques, et proposent des solutions sur-mesure !

Demande de conception

Conformité

99,8 %

Ponctualité

95,9 %

Service

48 H