Changeset 1787929
- Timestamp:
- 12/16/2017 09:03:37 AM (8 years ago)
- Location:
- eewee-sellsy/trunk
- Files:
-
- 10 added
- 15 edited
-
changelog (modified) (1 diff)
-
controllers/AdminController.php (modified) (1 diff)
-
controllers/InstallController.php (modified) (5 diffs)
-
controllers/ShortcodeController.php (modified) (16 diffs)
-
controllers/ToolsController.php (modified) (1 diff)
-
css/style.css (modified) (2 diffs)
-
forms/FContactFormEdit.php (modified) (1 diff)
-
helpers/FormHelper.php (modified) (3 diffs)
-
index.php (modified) (11 diffs)
-
js/main.js (modified) (1 diff)
-
models/TContactForm.php (modified) (3 diffs)
-
readme.md (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
screenshot-1.jpg (added)
-
screenshot-2.jpg (added)
-
screenshot-3.jpg (added)
-
screenshot-4.jpg (added)
-
screenshot-5.jpg (added)
-
screenshot-6.jpg (added)
-
screenshot-7.jpg (added)
-
screenshot-8.jpg (added)
-
screenshot.jpg (added)
-
todo.txt (added)
-
uninstall.php (modified) (1 diff)
-
view/contactFormEdit.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eewee-sellsy/trunk/changelog
r1652294 r1787929 1 = 1.1 = 2 * Create table version and update version auto 3 4 = 1.0.14 = 5 * Add CF SimpleText 6 7 = 1.0.13 = 8 * Add tracking 9 10 = 1.0.12 = 11 * Url http / https 12 1 13 = 1.0.11 = 2 14 * Wording -
eewee-sellsy/trunk/controllers/AdminController.php
r1610848 r1787929 27 27 28 28 } 29 30 /** 31 * execute during update plugin 32 */ 33 // function eewee_update() 34 // { 35 // 36 // } 29 37 30 38 /** -
eewee-sellsy/trunk/controllers/InstallController.php
r1638551 r1787929 18 18 // - https://codex.wordpress.org/Function_Reference/current_time 19 19 // - echo current_time( 'mysql', 1 ).'<br>'; // 0: GMT+1, 1: GMT+0 20 21 // BO - VERSION 22 $sql[] = " 23 CREATE TABLE `".EEWEE_SELLSY_PREFIXE_BDD."version` ( 24 `version_id` int(11) NOT NULL AUTO_INCREMENT, 25 `version_value` float(11) NOT NULL, 26 PRIMARY KEY (`version_id`) 27 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 28 "; 20 29 21 30 // BO - SETTING … … 106 115 107 116 `contact_form_status` tinyint(1) NOT NULL, 117 118 `contact_form_custom_fields_quantity` int(11) NOT NULL, 119 `contact_form_custom_fields_value` text NOT NULL, 108 120 PRIMARY KEY (`contact_form_id`) 109 121 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; … … 126 138 127 139 $sql[] = " 140 INSERT INTO `".EEWEE_SELLSY_PREFIXE_BDD."version` VALUES (1, '".EEWEE_VERSION."'); 141 "; 142 143 $sql[] = " 128 144 INSERT INTO `".EEWEE_SELLSY_PREFIXE_BDD."setting` VALUES (1, '".current_time('mysql')."', '".current_time('mysql')."', '', '', '', '', '', '', ''); 129 145 "; … … 135 151 for( $i=1; $i<=25; $i++ ){ 136 152 $sql[] = " 137 INSERT INTO `" . EEWEE_SELLSY_PREFIXE_BDD . "contact_form` VALUES (".$i.", '" . current_time('mysql') . "', '" . current_time('mysql') . "', 'Contact ".$i."', '0', 'Website form ".$i."', '0', '0', '0', '" . get_bloginfo('admin_email') . "', '1', '1', '1', '1', '0', '0', '0', '1', '1', '1', '0', '0', '0' );153 INSERT INTO `" . EEWEE_SELLSY_PREFIXE_BDD . "contact_form` VALUES (".$i.", '" . current_time('mysql') . "', '" . current_time('mysql') . "', 'Contact ".$i."', '0', 'Website form ".$i."', '0', '0', '0', '" . get_bloginfo('admin_email') . "', '1', '1', '1', '1', '0', '0', '0', '1', '1', '1', '0', '0', '0', '0', ''); 138 154 "; 139 155 } … … 147 163 */ 148 164 public function delete(){ 149 //echo "DELETE PLUGIN<br>";150 165 global $wpdb; 166 $sql[] = "DROP TABLE `".EEWEE_SELLSY_PREFIXE_BDD."version`"; 151 167 $sql[] = "DROP TABLE `".EEWEE_SELLSY_PREFIXE_BDD."setting`"; 152 168 $sql[] = "DROP TABLE `".EEWEE_SELLSY_PREFIXE_BDD."ticket`"; -
eewee-sellsy/trunk/controllers/ShortcodeController.php
r1652294 r1787929 25 25 $render = ''; 26 26 $error = array(); 27 $styleError = 'style="border:1px solid red;"'; // :( 27 $classError = 'border-error'; 28 $decode = array("success"=>false); 28 29 $messageForm = ''; 29 30 $form_ticket_support_subject = ''; … … 78 79 if (empty($form_ticket_support_email)) { 79 80 $error[] = __('email', PLUGIN_NOM_LANG); 80 $class_ticket_support_email = $ styleError;81 $class_ticket_support_email = $classError; 81 82 } 82 83 if (empty($form_ticket_support_lastname)) { 83 84 $error[] = __('name', PLUGIN_NOM_LANG); 84 $class_ticket_support_name = $ styleError;85 $class_ticket_support_name = $classError; 85 86 } 86 87 if (empty($form_ticket_support_message)) { 87 88 $error[] = __('message', PLUGIN_NOM_LANG); 88 $class_ticket_support_message = $ styleError;89 $class_ticket_support_message = $classError; 89 90 } 90 91 if ($reCaptchaOkOrNot === false && $setting[0]->setting_recaptcha_key_status == 0) { 91 92 $error[] = __('reCAPTCHA', PLUGIN_NOM_LANG); 92 $class_ticket_support_recaptcha = $ styleError;93 $class_ticket_support_recaptcha = $classError; 93 94 } 94 95 … … 182 183 183 184 <label>'.__('Email', PLUGIN_NOM_LANG).' *</label> 184 <input type="email" name="form_ticket_support_email" value="'.$form_ticket_support_email.'" id="form_ticket_support_email" '.$class_ticket_support_email.'> 185 <input type="email" name="form_ticket_support_email" value="'.$form_ticket_support_email.'" id="form_ticket_support_email" class= 186 "'.$class_ticket_support_email.'"> 185 187 186 188 <label>'.__('Name', PLUGIN_NOM_LANG).' *</label> 187 <input type="text" name="form_ticket_support_lastname" value="'.$form_ticket_support_lastname.'" id="form_ticket_support_lastname" '.$class_ticket_support_name.'> 189 <input type="text" name="form_ticket_support_lastname" value="'.$form_ticket_support_lastname.'" id="form_ticket_support_lastname" class= 190 "'.$class_ticket_support_name.'"> 188 191 189 192 <label>'.__('Message', PLUGIN_NOM_LANG).' *</label> 190 <textarea name="form_ticket_support_message" id="form_ticket_support_message" '.$class_ticket_support_message.'>'.$form_ticket_support_message.'</textarea>'; 193 <textarea name="form_ticket_support_message" id="form_ticket_support_message" class= 194 "'.$class_ticket_support_message.'">'.$form_ticket_support_message.'</textarea>'; 191 195 192 196 // reCaptcha : cle du site … … 197 201 ) { 198 202 $render .= ' 199 <div class="g-recaptcha" data-sitekey="'.$setting[0]->setting_recaptcha_key_website.'" '.$class_ticket_support_recaptcha.'></div>'; 203 <div class="g-recaptcha" data-sitekey="'.$setting[0]->setting_recaptcha_key_website.'" class= 204 "'.$class_ticket_support_recaptcha.'"></div>'; 200 205 } 201 206 … … 215 220 */ 216 221 public function contactSellsy( $atts='' ) { 222 217 223 // INIT 218 224 $id = ''; 219 225 $render = ''; 220 226 $error = array(); 221 $ styleError = 'style="border:1px solid red;"'; // :(227 $classError = 'border-error'; 222 228 $messageForm = ''; 223 229 // form … … 322 328 } else { 323 329 $api_third['type'] = 'person'; // corporation/person 324 330 325 331 if (isset($_POST['contact_form_contact_lastname'])) { 326 332 $api_third['name'] = sanitize_text_field($_POST['contact_form_contact_lastname']); … … 366 372 if (empty($api_contact['name'])) { 367 373 $error[] = __('lastname', PLUGIN_NOM_LANG); 368 $tbl_class['class_contact_form_contact_lastname'] = $ styleError.' required';374 $tbl_class['class_contact_form_contact_lastname'] = $classError; 369 375 } 370 376 if (empty($api_contact['email'])) { 371 377 $error[] = __('email', PLUGIN_NOM_LANG); 372 $tbl_class['class_contact_form_contact_email'] = $ styleError.' required';378 $tbl_class['class_contact_form_contact_email'] = $classError; 373 379 } 374 380 if ($reCaptchaOkOrNot === false && $setting[0]->setting_recaptcha_key_status == 0) { 375 381 $error[] = __('reCAPTCHA', PLUGIN_NOM_LANG); 376 $class_ticket_support_recaptcha = $styleError; 377 } 378 382 $class_ticket_support_recaptcha = $classError; 383 } 384 385 386 387 388 // CF 389 if (isset($_POST['form_cf'])) { 390 foreach ($_POST['form_cf'] as $k=>$v) { 391 392 // CF : SIMPLETEXT 393 if (isset($v['simpletext'])) { 394 395 // DATAS 396 $d['api']['id'] = $k; 397 $d['api']['label'] = $v['simpletext']['name']; 398 $d['api']['default'] = $v['simpletext']['default']; 399 $d['api']['min'] = $v['simpletext']['min']; 400 $d['api']['max'] = $v['simpletext']['max']; 401 $d['api']['useOne_prospect'] = $v['simpletext']['useOn_prospect']; 402 $d['api']['useOne_opportunity'] = $v['simpletext']['useOn_opportunity']; 403 $d['form']['value'] = $v['simpletext']['value']; 404 405 // PROCESSING 406 $cf_obj = new SellsyCustomFieldsController(); 407 $checkCf = $cf_obj->checkSimpleText($d); 408 409 if (isset($checkCf[0]) && $checkCf[0] == "error") { 410 $error[] = $d['api']['label'].' ('.$checkCf[1].')'; 411 $tbl_class[$d['api']['id']] = $classError; 412 } 413 } 414 } 415 } 379 416 380 417 … … 410 447 if ($response->status == 'success') { 411 448 449 // INSERT TO SELLSY : CF Prospect 450 $cfSave = new SellsyCustomFieldsController(); 451 $cfSave->dataProcessing($_POST, array("id"=>$linkedid,"type"=>"prospect")); 452 453 454 455 456 // INSERT TO SELLSY : TRACKING 457 // get 458 $c = new CookieController(); 459 $cDatas = $c->datasForTracking(); 460 // save 461 $t = new models\TSellsyTracking(); 462 $t->record(array( 463 'thirdid' => $tbl_contact['linkedid'], 464 'datas' => $cDatas, 465 )); 466 // clean (for next page load). Why : cookie not change in shortcode 467 echo ' 468 <script type="text/javascript"> 469 localStorage.setItem("cookieClean", "y"); 470 </script>'; 471 472 473 474 412 475 // NOTIFICATION EMAIL 413 476 if (isset($contact[0]->contact_form_setting_notification_email)) { … … 427 490 // OPTION SELECTED : prospect and opportunity 428 491 if ($contact[0]->contact_form_setting_add_what == 1 && isset($tbl_contact['linkedid'])) { 429 // CREATEOPPORTUNITY492 // INSERT TO SELLSY : OPPORTUNITY 430 493 $t_sellsyOpportunities = new models\TSellsyOpportunities(); 431 494 $responseOpp = $t_sellsyOpportunities->create(array( … … 440 503 if ($responseOpp->status == 'success') { 441 504 442 // ... 505 // INSERT TO SELLSY : CF Opportunity 506 $cfSave = new SellsyCustomFieldsController(); 507 $cfSave->dataProcessing($_POST, array("id"=>$responseOpp->response,"type"=>"opportunity")); 443 508 444 509 // API : error … … 473 538 ); 474 539 $messageForm = '<div class="eewee-success-message">'.__('Thank you for your message, it has been sent.', PLUGIN_NOM_LANG).'</div>'; 540 //$messageForm = '<div class="eewee-success-message">'.__('Thank you for your message, it has been sent.', PLUGIN_NOM_LANG).' - linkedid:'.$tbl_contact['linkedid'].' - <pre>'.var_export($cDatas, true).'</pre> - '.$responseOpp->status.'</div>'; 475 541 476 542 // API : error … … 491 557 <div class="eewee-error-message eewee-contact eewee-contact-'.$contact[0]->contact_form_id.'"> 492 558 <strong>'; 493 if (sizeof($error) == 1) {494 $render .= __('A field contains an error.', PLUGIN_NOM_LANG).'<br>';495 $render .= __('Please check and try again', PLUGIN_NOM_LANG);496 } else {497 $render .= __('Several fields contain an error.', PLUGIN_NOM_LANG).'<br>';498 $render .= __('Please check and try again', PLUGIN_NOM_LANG);499 }500 $render .= '501 : </strong><br> '.implode(', ', $error).'.559 if (sizeof($error) == 1) { 560 $render .= __('A field contains an error.', PLUGIN_NOM_LANG).'<br>'; 561 $render .= __('Please check and try again', PLUGIN_NOM_LANG); 562 } else { 563 $render .= __('Several fields contain an error.', PLUGIN_NOM_LANG).'<br>'; 564 $render .= __('Please check and try again', PLUGIN_NOM_LANG); 565 } 566 $render .= ' 567 : </strong><br><ul><li>'.implode('</li><li>', $error).'</li></ul> 502 568 </div>'; 503 569 } 504 570 } 571 572 573 505 574 506 575 // FORM (setting = online) … … 519 588 $render .= ' 520 589 <label>'.__('Company name', PLUGIN_NOM_LANG).'</label> 521 <input type="text" name="contact_form_company_name" value="'.$api_third['name'].'" id="contact_form_company_name" >';590 <input type="text" name="contact_form_company_name" value="'.$api_third['name'].'" id="contact_form_company_name" class="'.$tbl_class['class_contact_form_contact_name'].'">'; 522 591 } 523 592 if ($contact[0]->contact_form_company_siren == 0) { 524 593 $render .= ' 525 594 <label>'.__('Siren', PLUGIN_NOM_LANG).'</label> 526 <input type="text" name="contact_form_company_siren" value="'.$api_third['siren'].'" id="contact_form_company_siren" >';595 <input type="text" name="contact_form_company_siren" value="'.$api_third['siren'].'" id="contact_form_company_siren" class="'.$tbl_class['class_contact_form_contact_siren'].'">'; 527 596 } 528 597 if ($contact[0]->contact_form_company_siret == 0) { 529 598 $render .= ' 530 599 <label>'.__('Siret', PLUGIN_NOM_LANG).'</label> 531 <input type="text" name="contact_form_company_siret" value="'.$api_third['siret'].'" id="contact_form_company_siret" >';600 <input type="text" name="contact_form_company_siret" value="'.$api_third['siret'].'" id="contact_form_company_siret" class="'.$tbl_class['class_contact_form_contact_siret'].'">'; 532 601 } 533 602 if ($contact[0]->contact_form_company_rcs == 0) { 534 603 $render .= ' 535 604 <label>'.__('RCS', PLUGIN_NOM_LANG).'</label> 536 <input type="text" name="contact_form_company_rcs" value="'.$api_third['rcs'].'" id="contact_form_company_rcs" >';605 <input type="text" name="contact_form_company_rcs" value="'.$api_third['rcs'].'" id="contact_form_company_rcs" class="'.$tbl_class['class_contact_form_contact_rcs'].'">'; 537 606 } 538 607 … … 541 610 $render .= ' 542 611 <label>'.__('Lastname', PLUGIN_NOM_LANG).' *</label> 543 <input type="text" name="contact_form_contact_lastname" value="'.$api_contact['name'].'" id="contact_form_contact_lastname" '.$tbl_class['class_contact_form_contact_lastname'].'>';612 <input type="text" name="contact_form_contact_lastname" value="'.$api_contact['name'].'" id="contact_form_contact_lastname" class="'.$tbl_class['class_contact_form_contact_lastname'].'" required>'; 544 613 } 545 614 if ($contact[0]->contact_form_contact_firstname == 0) { 546 615 $render .= ' 547 616 <label>'.__('Firstname', PLUGIN_NOM_LANG).'</label> 548 <input type="text" name="contact_form_contact_firstname" value="'.$api_contact['forename'].'" id="contact_form_contact_firstname" >';617 <input type="text" name="contact_form_contact_firstname" value="'.$api_contact['forename'].'" id="contact_form_contact_firstname" class="'.$tbl_class['class_contact_form_contact_firstname'].'">'; 549 618 } 550 619 if ($contact[0]->contact_form_contact_email == 0) { 551 620 $render .= ' 552 621 <label>'.__('Email', PLUGIN_NOM_LANG).' *</label> 553 <input type="email" name="contact_form_contact_email" value="'.$api_contact['email'].'" id="contact_form_contact_email" '.$tbl_class['class_contact_form_contact_email'].'>';622 <input type="email" name="contact_form_contact_email" value="'.$api_contact['email'].'" id="contact_form_contact_email" class="'.$tbl_class['class_contact_form_contact_email'].'" required>'; 554 623 } 555 624 if ($contact[0]->contact_form_contact_phone_1 == 0) { 556 625 $render .= ' 557 626 <label>'.__('Phone', PLUGIN_NOM_LANG).'</label> 558 <input type="text" name="contact_form_contact_phone_1" value="'.$api_contact['tel'].'" id="contact_form_contact_phone_1" >';627 <input type="text" name="contact_form_contact_phone_1" value="'.$api_contact['tel'].'" id="contact_form_contact_phone_1" class="'.$tbl_class['class_contact_form_contact_phone_1'].'">'; 559 628 } 560 629 if ($contact[0]->contact_form_contact_phone_2 == 0) { 561 630 $render .= ' 562 631 <label>'.__('Mobile', PLUGIN_NOM_LANG).'</label> 563 <input type="text" name="contact_form_contact_phone_2" value="'.$api_contact['mobile'].'" id="contact_form_contact_phone_2" >';632 <input type="text" name="contact_form_contact_phone_2" value="'.$api_contact['mobile'].'" id="contact_form_contact_phone_2" class="'.$tbl_class['class_contact_form_contact_phone_2'].'">'; 564 633 } 565 634 if ($contact[0]->contact_form_contact_function == 0) { 566 635 $render .= ' 567 636 <label>'.__('Function', PLUGIN_NOM_LANG).'</label> 568 <input type="text" name="contact_form_contact_function" value="'.$api_contact['position'].'" id="contact_form_contact_function" >';637 <input type="text" name="contact_form_contact_function" value="'.$api_contact['position'].'" id="contact_form_contact_function" class="'.$tbl_class['class_contact_form_contact_function'].'">'; 569 638 } 570 639 … … 573 642 $render .= ' 574 643 <label>'.__('website', PLUGIN_NOM_LANG).'</label> 575 <input type="text" name="contact_form_website" value="'.$api_third['web'].'" id="contact_form_website" >';644 <input type="text" name="contact_form_website" value="'.$api_third['web'].'" id="contact_form_website" class="'.$tbl_class['class_contact_form_website'].'">'; 576 645 } 577 646 if ($contact[0]->contact_form_note == 0) { 647 648 if (isset($api_third['stickyNote']) && !empty($api_third['stickyNote'])) { 649 $contact_form_note = $api_third['stickyNote']; 650 } elseif (isset($api_contact['stickyNote']) && !empty($api_contact['stickyNote'])) { 651 $contact_form_note = $api_contact['stickyNote']; 652 } elseif (isset($api_opportunity['stickyNote']) && !empty($api_opportunity['stickyNote'])) { 653 $contact_form_note = $api_opportunity['stickyNote']; 654 } else { 655 $contact_form_note = ""; 656 } 657 578 658 $render .= ' 579 659 <label>'.__('Message', PLUGIN_NOM_LANG).'</label> 580 <textarea name="contact_form_note" id="contact_form_note">'.$api_third['stickyNote'].'</textarea>'; 581 } 660 <textarea name="contact_form_note" id="contact_form_note" class="'.$tbl_class['class_contact_form_note'].'">'.$contact_form_note.'</textarea>'; 661 } 662 663 // CUSTOM FIELD 664 // models 665 $t_contactForm = new models\TContactForm(); 666 $contact = $t_contactForm->getContactForm($id); 667 $t_customFields = new models\TSellsyCustomFields(); 668 $c_customFields = new SellsyCustomFieldsController(); 669 670 // init 671 $contact_form_custom_fields_value = json_decode($contact[0]->contact_form_custom_fields_value); 672 $cf = ''; 673 674 // cf all 675 foreach ($contact_form_custom_fields_value as $k=>$v) { 676 $cf = $t_customFields->getOne(array('id'=>$v)); 677 if ($cf->response->status == 'ok') { 678 $render .= $c_customFields->getGenerator($cf->response, $tbl_class); 679 } 680 } 681 682 582 683 583 684 // reCaptcha : cle du site … … 588 689 ) { 589 690 $render .= ' 590 <div class="g-recaptcha" data-sitekey="'.$setting[0]->setting_recaptcha_key_website.'" '.$class_ticket_support_recaptcha.'></div>';691 <div class="g-recaptcha" data-sitekey="'.$setting[0]->setting_recaptcha_key_website.'" '.$class_ticket_support_recaptcha.'></div>'; 591 692 } 592 693 -
eewee-sellsy/trunk/controllers/ToolsController.php
r1582936 r1787929 51 51 } 52 52 53 /** 54 * Get current url 55 * @return string current url 56 */ 57 public static function getUrl() { 58 $url = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] : 'https://'.$_SERVER["SERVER_NAME"]; 59 $url .= ( $_SERVER["SERVER_PORT"] != 80 ) ? ":".$_SERVER["SERVER_PORT"] : ""; 60 $url .= $_SERVER["REQUEST_URI"]; 61 return $url; 62 } 63 64 /** 65 * Check string is json 66 * @param $string 67 * @return bool 68 */ 69 public static function isJson($string){ 70 return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false; 71 } 72 53 73 }//fin class 54 74 -
eewee-sellsy/trunk/css/style.css
r1652294 r1787929 1 1 /* BORDER */ 2 2 .title1{ border-bottom:1px solid #333; text-align:left; text-transform:uppercase; padding-bottom:10px; margin:20px 0 10px 0; } 3 .border-error{ border:1px solid red; } 3 4 4 5 /* MARGIN */ … … 37 38 .hndle{ padding: 10px; } 38 39 .eewee-success{ border:1px solid green; } 39 .eewee-error{ border:1px solid red ; }40 .eewee-error{ border:1px solid red !important; } 40 41 .eewee-required{ color:red; } 41 42 .eewee-success-message{ padding:10px; margin-top:5px; margin-bottom:5px; color:#468847; border:1px solid #468847; background-color:#dff0d8; text-transform:uppercase; 42 43 text-align:center; } 43 .eewee-error-message{ padding:10px; margin-top:5px; margin-bottom:5px; color:#c76d6b; border:1px solid #c76d6b; background-color:#f2dede; text-transform:uppercase; text-align:center; } 44 .eewee-error-message{ padding:10px; margin-top:5px; margin-bottom:5px; color:#c76d6b; border:1px solid #c76d6b; background-color:#f2dede; text-transform:uppercase; } 45 .eewee-error-message li{ margin-left:1em; } -
eewee-sellsy/trunk/forms/FContactFormEdit.php
r1638551 r1787929 454 454 </tr> 455 455 456 457 458 459 <?php 460 //------------------------------------------------------------------------------------------ 461 // CUSTOM FIELDS 462 //------------------------------------------------------------------------------------------ 463 ?> 464 <tr> 465 <th colspan="2"> 466 <div class="title1"><?php _e('Custom fields', PLUGIN_NOM_LANG); ?></div> 467 </th> 468 </tr> 469 <tr> 470 <th> 471 <?php _e('Quantity custom fields', PLUGIN_NOM_LANG); ?> : 472 </th> 473 <td> 474 <?php 475 $qtyCf = 0; 476 if (isset($r[0]->contact_form_custom_fields_quantity) && !empty(isset($r[0]->contact_form_custom_fields_quantity))) { 477 $qtyCf = $r[0]->contact_form_custom_fields_quantity; 478 } 479 echo '<input type="text" name="contact_form_custom_fields_quantity" value="'.$qtyCf.'">'; 480 ?> 481 </td> 482 </tr> 483 <tr> 484 <th> 485 486 </th> 487 <td> 488 <?php 489 // Model : get cf 490 $t_customFields = new models\TSellsyCustomFields(); 491 $responseCustomFields = $t_customFields->getCustomFields(); 492 493 // Exist (cf in db) 494 if (isset($r[0]->contact_form_custom_fields_value) && !empty($r[0]->contact_form_custom_fields_value)) { 495 $cfVal = json_decode($r[0]->contact_form_custom_fields_value); // cfid 496 } else { 497 $cfVal = ''; 498 } 499 500 // CF Value 501 foreach ($cfVal as $k=>$v) { 502 $tbl_value[$k] = $v; 503 } 504 505 // Form : select 506 for ($i=0; $i<$qtyCf; $i++) { 507 helpers\FormHelpers::getCustomFields(array( 508 'echo' => true, 509 'form_name' => 'contact_form_custom_fields_value_'.$i, 510 'form_value' => $tbl_value[$i], // cf all 511 'responseCustomFields' => $responseCustomFields, // use for display cf all 512 'useOn_x' => $r[0]->contact_form_setting_add_what, 513 )); 514 } 515 ?> 516 </td> 517 </tr> 518 456 519 </table> 457 520 -
eewee-sellsy/trunk/helpers/FormHelper.php
r1582936 r1787929 1 1 <?php 2 namespace fr\eewee\eewee_sellsy\models; 2 3 namespace fr\eewee\eewee_sellsy\helpers; 3 4 … … 5 6 6 7 if( !class_exists('FormHelpers')){ 7 class FormHelpers { 8 class FormHelpers 9 { 8 10 9 11 /** 12 * BACK (ADMIN) 13 * Render form : custom fields 14 * @param $d 15 * @return mixed 16 */ 17 public static function getCustomFields( $d ) 18 { 19 if (!isset($d['form_name']) /*|| !isset($d['form_value'])*/ || !isset($d['responseCustomFields'])) { return false; } 20 21 // INIT 22 $options = array(); 23 $disabled = 'disabled'; 24 $selected = ''; 25 $isRequired = ''; 26 $echo = $d['echo']; 27 $form_name = $d['form_name']; 28 $form_value = $d['form_value']; 29 $resultsCustomFields = $d['responseCustomFields']->response->result; 30 31 // CF ALL 32 foreach ($resultsCustomFields as $resultCustomFields) { 33 34 if ($resultCustomFields->status == 'ok') { 35 36 // only "simpletext" for the moment 37 if ($resultCustomFields->type == 'simpletext') { 38 $disabled = ''; 39 } else { 40 $disabled = 'disabled'; 41 } 42 43 // required 44 if ($resultCustomFields->isRequired == 'Y') { 45 $isRequired = '*'; 46 } else { 47 $isRequired = ''; 48 } 49 50 // selected 51 if ($form_value == $resultCustomFields->cfid) { 52 $selected = 'selected'; 53 } else { 54 $selected = ''; 55 } 56 57 $options[] = '<option value="'.$resultCustomFields->cfid.'" '.$disabled.' '.$selected .'>'.$resultCustomFields->name.' ('.$resultCustomFields->type.') '.$isRequired.'</option>'; 58 } 59 } 60 61 // SELECT 62 $r = ' 63 <select name="'.$form_name.'"> 64 '.implode("", $options).' 65 </select> 66 <br>'; 67 68 // RENDER 69 if ($echo) { 70 echo $r; 71 } else { 72 return $r; 73 } 74 } 75 76 /** 77 * FRONT 78 * Render form : custom fields 79 * @param $id (cfid) 80 * @return mixed 81 */ 82 public static function getCustomFieldsFront( $id ) 83 { 84 85 } 86 87 88 /** 10 89 * Render form : radio 11 90 * @param $d … … 41 120 return $r; 42 121 } 43 } 122 } 44 123 45 124 }//fin class -
eewee-sellsy/trunk/index.php
r1652294 r1787929 4 4 Plugin URI: http://www.eewee.fr 5 5 Description: Simple form for : add support ticket to Sellsy, add prospect to Sellsy. 6 Version: 1. 0.116 Version: 1.1 7 7 Author: Michael DUMONTET 8 8 Author URI: http://www.eewee.fr/wordpress/ … … 16 16 * Definitions 17 17 * 18 * @since 1.0 .018 * @since 1.0 19 19 */ 20 20 global $wpdb; 21 define( 'EEWEE_VERSION', '1. 0.11' );21 define( 'EEWEE_VERSION', '1.1' ); 22 22 define( 'EEWEE_SELLSY_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) ); 23 23 define( 'EEWEE_SELLSY_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) ); … … 26 26 define( 'EEWEE_SELLSY_DEBUG', false); 27 27 for( $i=1 ; $i<=3 ; $i++ ) { 28 define( 'EEWEE_SELLSY_URL_SOUS_MENU_'.$i, admin_url( 'admin.php?page=idSousMenu'.$i, 'http' ));28 define( 'EEWEE_SELLSY_URL_SOUS_MENU_'.$i, admin_url().'admin.php?page=idSousMenu'.$i); 29 29 define( 'EEWEE_SELLSY_URL_BACK_SOUS_MENU_'.$i, admin_url().'admin.php?page=idSousMenu'.$i); 30 30 } … … 35 35 * Required CSS / JS 36 36 * 37 * @since 1.0 .037 * @since 1.0 38 38 */ 39 39 function ajouterScriptsEeweeSellsy(){ … … 57 57 } 58 58 } 59 wp_enqueue_script( PLUGIN_NOM_LANG.'-js', plugins_url('eewee-sellsy/js/front.js'), array('jquery')); 59 60 } 60 61 add_action( 'init', 'ajouterScriptsEeweeSellsy' ); … … 63 64 * Required Files 64 65 * 65 * @since 1.0 .066 * @since 1.0 66 67 */ 67 68 // LIBS … … 78 79 require_once ( EEWEE_SELLSY_PLUGIN_DIR . '/models/TSellsyStaffs.php' ); 79 80 require_once ( EEWEE_SELLSY_PLUGIN_DIR . '/models/TSellsyOpportunities.php' ); 81 require_once ( EEWEE_SELLSY_PLUGIN_DIR . '/models/TSellsyCustomFields.php' ); 82 require_once ( EEWEE_SELLSY_PLUGIN_DIR . '/models/TSellsyTracking.php' ); 80 83 81 84 // HELPERS 82 85 require_once ( EEWEE_SELLSY_PLUGIN_DIR . '/helpers/FormHelper.php' ); 86 require_once ( EEWEE_SELLSY_PLUGIN_DIR . '/helpers/dbUpdate.php' ); 83 87 84 88 // FORMS … … 89 93 90 94 // CONTROLLERS 95 require_once( EEWEE_SELLSY_PLUGIN_DIR . '/controllers/CookieController.php' ); 91 96 require_once( EEWEE_SELLSY_PLUGIN_DIR . '/controllers/AjaxController.php' ); 92 97 require_once( EEWEE_SELLSY_PLUGIN_DIR . '/controllers/InstallController.php' ); … … 94 99 require_once( EEWEE_SELLSY_PLUGIN_DIR . '/controllers/ShortcodeController.php' ); 95 100 require_once( EEWEE_SELLSY_PLUGIN_DIR . '/controllers/AdminController.php' ); 101 require_once( EEWEE_SELLSY_PLUGIN_DIR . '/controllers/SellsyCustomFieldsController.php' ); 96 102 97 103 use fr\eewee\eewee_sellsy\controllers; 98 99 104 $s = new controllers\ShortcodeController(); 100 105 $a = new controllers\AjaxController(); 101 106 107 // UPDATE DB 108 use fr\eewee\eewee_sellsy\helpers; 109 $dbUpdate = new helpers\DbUpdate(); 110 $dbVersion = $dbUpdate->getVersion(); 111 if (EEWEE_VERSION > $dbVersion) { $dbUpdate->updateDb($dbVersion); } 112 102 113 /** 103 * Instantiate Class e114 * Instantiate Class 104 115 * 105 * @since 1.0 .0116 * @since 1.0 106 117 */ 107 118 $adminController = new controllers\AdminController(); 119 120 /** 121 * Instantiate Class 122 * 123 * @since 1.0 124 */ 125 if (!is_admin()) { 126 $cookieController = new controllers\CookieController(); 127 $cookieController->exec(); 128 } 108 129 109 130 /** … … 114 135 * @uses register_uninstall_hook() 115 136 * 116 * @since 1.0 .0137 * @since 1.0 117 138 */ 118 139 register_activation_hook( __FILE__, array( $adminController, 'eewee_activate' ) ); … … 125 146 * @uses add_action() 126 147 * 127 * @since 1.0 .0148 * @since 1.0 128 149 */ 129 150 add_action( 'admin_menu', array( $adminController, 'eewee_adminMenu' ) ); -
eewee-sellsy/trunk/js/main.js
r1610106 r1787929 60 60 } 61 61 }); 62 */62 */ 63 63 64 64 }); -
eewee-sellsy/trunk/models/TContactForm.php
r1638551 r1787929 78 78 $contact_form_setting_opportunity_pipeline = (int)$p['contact_form_setting_opportunity_pipeline']; 79 79 $contact_form_setting_opportunity_step = (int)$p['contact_form_setting_opportunity_step']; 80 $contact_form_custom_fields_quantity = (int)$p['contact_form_custom_fields_quantity']; 81 $contact_form_custom_fields_value = array(); 82 for ($i=0; $i<$contact_form_custom_fields_quantity; $i++) { 83 $contact_form_custom_fields_value[] = (int)$p['contact_form_custom_fields_value_'.$i]; 84 } 85 $contact_form_custom_fields_value_json = json_encode($contact_form_custom_fields_value, JSON_FORCE_OBJECT); 80 86 81 87 $r = $wpdb->update( … … 107 113 'contact_form_website' => $p['contact_form_website'], 108 114 'contact_form_note' => $p['contact_form_note'], 109 'contact_form_status' => $p['form_status'] 115 'contact_form_status' => $p['form_status'], 116 117 'contact_form_custom_fields_quantity' => $contact_form_custom_fields_quantity, 118 'contact_form_custom_fields_value' => $contact_form_custom_fields_value_json, 110 119 ), 111 120 // WHERE (valeur) … … 140 149 '%d', 141 150 '%d', 151 152 '%d', 153 '%s' 142 154 ), 143 155 // WHERE (type) -
eewee-sellsy/trunk/readme.md
r1636317 r1787929 4 4 2. Add a contact form shortcode (Wordpress > Sellsy prospect). 5 5 3. Add a contact form shortcode (Wordpress > Sellsy prospect and opportunity). 6 4. Tracking page views 7 5. You can use the Sellsy custom fields 6 8 7 9 Form with captcha -
eewee-sellsy/trunk/readme.txt
r1652294 r1787929 15 15 Create a multitude of forms for managing your support tickets. The form contains the following fields: Subject, E-mail, Name and Message. 16 16 17 = Generate simple form (add prospect in Sellsy) = 18 Create a multitude of forms to manage your prospecting. The validation of the form will create a prospect on Sellsy and optionally an opportunity. 17 = Generate simple form (add prospect/opportunity in Sellsy) = 18 Create a multitude of forms to manage your prospecting. 19 The validation of the form will create a prospect on Sellsy and optionally an opportunity. 20 (You can use the Sellsy custom fields, such as "simple text", ...) 21 22 = Tracking = 23 Saves the different pages visited by your prospect. 24 Then when validating the prospecting / opportunity form, you can view these pages on Sellsy. 19 25 20 26 * Question : [eewee.fr](http://www.eewee.fr). … … 47 53 48 54 == Changelog == 55 56 = 1.1 = 57 * Create table version and update version auto 58 59 = 1.0.14 = 60 * Add CF SimpleText 61 62 = 1.0.13 = 63 * Add tracking 64 65 = 1.0.12 = 66 * Url http / https 49 67 50 68 = 1.0.11 = -
eewee-sellsy/trunk/uninstall.php
r1610848 r1787929 6 6 7 7 global $wpdb; 8 $sql[] = "DROP TABLE `".$wpdb->prefix."eewee_sellsy_version`"; 8 9 $sql[] = "DROP TABLE `".$wpdb->prefix."eewee_sellsy_setting`"; 9 10 $sql[] = "DROP TABLE `".$wpdb->prefix."eewee_sellsy_ticket`"; -
eewee-sellsy/trunk/view/contactFormEdit.php
r1636317 r1787929 43 43 $contact_form_setting_opportunity_pipeline = (int)$_POST['contact_form_setting_opportunity_pipeline']; 44 44 $contact_form_setting_opportunity_step = (int)$_POST['contact_form_setting_opportunity_step']; 45 $contact_form_custom_fields_quantity = (int)$_POST['contact_form_custom_fields_quantity']; 45 46 if (empty($contact_form_setting_opportunity_source)) { unset($_POST['contact_form_setting_opportunity_source']); } 46 47 if (empty($contact_form_setting_opportunity_pipeline)) { unset($_POST['contact_form_setting_opportunity_pipeline']); } 47 48 if (empty($contact_form_setting_opportunity_step)) { unset($_POST['contact_form_setting_opportunity_step']); } 49 if (empty($contact_form_custom_fields_quantity)) { unset($_POST['contact_form_custom_fields_quantity']); } 48 50 49 51 // UPDATE
Note: See TracChangeset
for help on using the changeset viewer.