当前位置: 首页>>代码示例>>PHP>>正文


PHP RGFormsModel::get_lead_table_name方法代码示例

本文整理汇总了PHP中RGFormsModel::get_lead_table_name方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_lead_table_name方法的具体用法?PHP RGFormsModel::get_lead_table_name怎么用?PHP RGFormsModel::get_lead_table_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::get_lead_table_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_transaction_totals

 public static function get_transaction_totals($form_id)
 {
     global $wpdb;
     $lead_table_name = RGFormsModel::get_lead_table_name();
     $transaction_table_name = self::get_transaction_table_name();
     $sql = $wpdb->prepare(" SELECT t.transaction_type, sum(t.amount) revenue, count(t.id) transactions\n                                 FROM {$transaction_table_name} t\n                                 INNER JOIN {$lead_table_name} l ON l.id = t.entry_id\n                                 WHERE l.form_id={$form_id}\n                                 GROUP BY t.transaction_type", $form_id);
     $results = $wpdb->get_results($sql, ARRAY_A);
     $totals = array();
     if (is_array($results)) {
         foreach ($results as $result) {
             $totals[$result["transaction_type"]] = array("revenue" => empty($result["revenue"]) ? 0 : $result["revenue"], "transactions" => empty($result["transactions"]) ? 0 : $result["transactions"]);
         }
     }
     return $totals;
 }
开发者ID:Paytm-Payments,项目名称:Paytm_GravityForm_v3.5.x_Kit,代码行数:15,代码来源:data.php

示例2: get_transaction_totals

 public static function get_transaction_totals($config)
 {
     global $wpdb;
     $lead_table_name = RGFormsModel::get_lead_table_name();
     $transaction_table_name = self::get_transaction_table_name();
     $orders = $config["meta"]["type"] == "subscription" ? "t.transaction_type='signup'" : "is_renewal=0";
     $sql = $wpdb->prepare("SELECT sum(t.amount) revenue, count({$orders}) as orders\r\n                                 FROM {$transaction_table_name} t\r\n                                 INNER JOIN {$lead_table_name} l ON l.id = t.entry_id\r\n                                 INNER JOIN {$wpdb->prefix}rg_lead_meta m ON meta_key='paypalpro_feed_id' AND m.lead_id = l.id\r\n                                 WHERE m.meta_value=%s", $config["id"]);
     $results = $wpdb->get_results($sql, ARRAY_A);
     $totals = array();
     if (is_array($results)) {
         $result = $results[0];
         $totals = array("revenue" => empty($result["revenue"]) ? 0 : $result["revenue"], "orders" => empty($result["orders"]) ? 0 : $result["orders"]);
     }
     return $totals;
 }
开发者ID:wp-premium,项目名称:gravityformspaypalpro,代码行数:15,代码来源:data.php

示例3: RGFormsModel

 /**
  *
  * @global type $wpdb
  */
 function entries_import()
 {
     $wform = $_REQUEST['form'];
     $gform = $_REQUEST['gform'];
     $entry_index = $_REQUEST['entry_index'];
     $this->init();
     $field_map = maybe_unserialize(get_site_option('rt_wufoo_' . $wform . '_field_map'));
     $f = new RGFormsModel();
     $c = new GFCommon();
     $gform_meta = RGFormsModel::get_form_meta($gform);
     try {
         $entries = $this->wufoo->getEntries($wform, 'forms', 'pageStart=' . $entry_index . '&pageSize=' . RT_WUFOO_IMPORT_PAGE_SIZE);
     } catch (Exception $rt_importer_e) {
         $this->error($rt_importer_e);
     }
     $this->op = array();
     foreach ($entries as $index => $entry) {
         $lead_exists_id = $this->is_imported($entry->EntryId);
         print_r($lead_exists_id);
         if (!$lead_exists_id) {
             foreach ($field_map as $g_id => $w_id) {
                 if (isset($w_id) && $w_id != '') {
                     $this->op[$g_id] = '';
                     $field_meta = RGFormsModel::get_field($gform_meta, $g_id);
                     if ($field_meta['type'] == 'fileupload') {
                         $this->op[$g_id] = $this->import_file_upload($entry, $w_id);
                     } else {
                         $this->import_regular_field($wform, $entry, $g_id, $w_id, $field_meta);
                     }
                 }
             }
             $currency = $c->get_currency();
             $ip = $f->get_ip();
             $page = $f->get_current_page_url();
             $lead_table = $f->get_lead_table_name();
             $lead_id = $this->insert_lead($entry, $lead_table, $ip, $currency, $page, $wform, $gform);
         }
         if ($lead_id) {
             foreach ($this->op as $inputid => $value) {
                 $this->insert_fields($lead_id, $gform, $inputid, $value);
             }
             //Insert comments as notes for the corresponding user map
             $comments = $this->get_comments_by_entry($wform, $entry->EntryId);
             if (isset($comments) && !empty($comments)) {
                 foreach ($comments as $comment) {
                     $this->move_comments_for_entry($comment, $f->get_lead_notes_table_name(), $lead_id, $wform);
                 }
             }
         } else {
             $lead_id = $lead_exists_id;
         }
         gform_update_meta($lead_id, 'rt_wufoo_entry_id', $entry->EntryId);
     }
     //update_site_option('rt_wufoo_' . $wform . '_entry_complete_count','0');
     echo count($entries) + $entry_index;
     die;
 }
开发者ID:rtCamp,项目名称:migrate-wufoo-to-gravity-forms,代码行数:61,代码来源:rtWufoo.php

示例4: get_all_gravity_lead

 /**
  *
  * get all gravity lead
  *
  * @param $form_id
  *
  * @since
  */
 public function get_all_gravity_lead($form_id)
 {
     $gravityLeadTableName = RGFormsModel::get_lead_table_name();
     global $wpdb;
     $sql = $wpdb->prepare("SELECT id FROM {$gravityLeadTableName} WHERE form_id=%d AND status='active'", $form_id);
     echo json_encode($wpdb->get_results($sql, ARRAY_A));
 }
开发者ID:chandra-patel,项目名称:rtbiz,代码行数:15,代码来源:class-rt-importer.php

示例5: detachFormEntry

 public function detachFormEntry($lead_id)
 {
     $entries = $this->getFormEntryIds();
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Start to detach gravity forms: " . print_r($entries, true));
     if (in_array($lead_id, $entries)) {
         Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Lead id is in the list of entries: " . $lead_id);
         if (class_exists('RGForms')) {
             if (!class_exists('RGFormsModel')) {
                 RGForms::init();
             }
             if (class_exists('RGFormsModel')) {
                 global $wpdb;
                 $lead_table = RGFormsModel::get_lead_table_name();
                 $lead_notes_table = RGFormsModel::get_lead_notes_table_name();
                 $lead_detail_table = RGFormsModel::get_lead_details_table_name();
                 $lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();
                 //Delete from detail long
                 $sql = $wpdb->prepare(" DELETE FROM {$lead_detail_long_table}\n                                  WHERE lead_detail_id IN(\n                                      SELECT id FROM {$lead_detail_table} WHERE lead_id=%d\n                                  )", $lead_id);
                 $wpdb->query($sql);
                 //Delete from lead details
                 $sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id=%d", $lead_id);
                 $wpdb->query($sql);
                 //Delete from lead notes
                 $sql = $wpdb->prepare("DELETE FROM {$lead_notes_table} WHERE lead_id=%d", $lead_id);
                 $wpdb->query($sql);
                 //Delete from lead
                 $sql = $wpdb->prepare("DELETE FROM {$lead_table} WHERE id=%d", $lead_id);
                 $wpdb->query($sql);
                 // Remove entry from array
                 $entries = array_values(array_diff($entries, array($lead_id)));
                 $this->_formEntryIds = $entries;
                 $qty = $this->getQuantity();
                 $this->setQuantity($qty - 1);
             }
         }
     }
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:37,代码来源:Cart66CartItem.php

示例6: gform_post_submission

 public function gform_post_submission($entry, $form)
 {
     global $wpdb;
     $this->options['entries'] = apply_filters($this->name . '_entries', $this->options['entries'], $form);
     if (!$this->options['entries'] || $this->is_delete()) {
         $tables = (object) array('lead_table' => RGFormsModel::get_lead_table_name(), 'lead_notes_table' => RGFormsModel::get_lead_notes_table_name(), 'lead_detail_table' => RGFormsModel::get_lead_details_table_name(), 'lead_detail_long_table' => RGFormsModel::get_lead_details_long_table_name());
         $queries = array($wpdb->prepare("DELETE FROM {$tables->lead_detail_long_table} WHERE lead_detail_id IN (SELECT id FROM {$tables->lead_detail_table} WHERE lead_id = %d)", $entry['id']), $wpdb->prepare("DELETE FROM {$tables->lead_detail_table} WHERE lead_id = %d", $entry['id']), $wpdb->prepare("DELETE FROM {$tables->lead_notes_table} WHERE lead_id = %d", $entry['id']), $wpdb->prepare("DELETE FROM {$tables->lead_table} WHERE id = %d", $entry['id']));
         foreach ($queries as $query) {
             $wpdb->query($query);
         }
     }
     if ($this->is_delete()) {
         wp_delete_post($this->post['ID']);
     }
     // If a custom field is unique, get all the rows and combine them into one
     foreach ($form['fields'] as $field) {
         if ($field['type'] == 'post_custom_field' && isset($field['postCustomFieldUnique'])) {
             $meta = get_post_meta($this->post['ID'], $field['postCustomFieldName']);
             delete_post_meta($this->post['ID'], $field['postCustomFieldName']);
             add_post_meta($this->post['ID'], $field['postCustomFieldName'], is_array($meta) && count($meta) == 1 ? $meta[0] : $meta, true);
         }
     }
 }
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:23,代码来源:gravityforms-update-post.php

示例7: save_lead

 public static function save_lead($form, &$lead)
 {
     global $wpdb;
     if (IS_ADMIN && !GFCommon::current_user_can_any("gravityforms_edit_entries")) {
         die(__("You don't have adequate permission to edit entries.", "gravityforms"));
     }
     $lead_detail_table = self::get_lead_details_table_name();
     //Inserting lead if null
     if ($lead == null) {
         global $current_user;
         $user_id = $current_user && $current_user->ID ? $current_user->ID : 'NULL';
         $lead_table = RGFormsModel::get_lead_table_name();
         $user_agent = strlen($_SERVER["HTTP_USER_AGENT"]) > 250 ? substr($_SERVER["HTTP_USER_AGENT"], 0, 250) : $_SERVER["HTTP_USER_AGENT"];
         $currency = GFCommon::get_currency();
         $wpdb->query($wpdb->prepare("INSERT INTO {$lead_table}(form_id, ip, source_url, date_created, user_agent, currency, created_by) VALUES(%d, %s, %s, utc_timestamp(), %s, %s, {$user_id})", $form["id"], self::get_ip(), self::get_current_page_url(), $user_agent, $currency));
         //reading newly created lead id
         $lead_id = $wpdb->insert_id;
         $lead = array("id" => $lead_id);
     }
     $current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead["id"]));
     $original_post_id = $lead["post_id"];
     foreach ($form["fields"] as $field) {
         //Ignore fields that are marked as display only
         if ($field["displayOnly"] && $field["type"] != "password") {
             continue;
         }
         //ignore pricing fields in the entry detail
         if (RG_CURRENT_VIEW == "entry" && GFCommon::is_pricing_field($field["type"])) {
             continue;
         }
         //only save fields that are not hidden (except on entry screen)
         if (RG_CURRENT_VIEW == "entry" || !RGFormsModel::is_field_hidden($form, $field, array())) {
             if (is_array($field["inputs"])) {
                 foreach ($field["inputs"] as $input) {
                     self::save_input($form, $field, $lead, $current_fields, $input["id"]);
                 }
             } else {
                 self::save_input($form, $field, $lead, $current_fields, $field["id"]);
             }
         }
     }
 }
开发者ID:novuscory,项目名称:ACH,代码行数:42,代码来源:forms_model.php

示例8: save_lead

 public static function save_lead($form, &$lead)
 {
     global $wpdb;
     GFCommon::log_debug(__METHOD__ . '(): Saving entry.');
     $is_form_editor = GFCommon::is_form_editor();
     $is_entry_detail = GFCommon::is_entry_detail();
     $is_admin = $is_form_editor || $is_entry_detail;
     if ($is_admin && !GFCommon::current_user_can_any('gravityforms_edit_entries')) {
         die(esc_html__("You don't have adequate permission to edit entries.", 'gravityforms'));
     }
     $lead_detail_table = self::get_lead_details_table_name();
     $is_new_lead = $lead == null;
     //Inserting lead if null
     if ($is_new_lead) {
         global $current_user;
         $user_id = $current_user && $current_user->ID ? $current_user->ID : 'NULL';
         $lead_table = RGFormsModel::get_lead_table_name();
         $user_agent = self::truncate($_SERVER['HTTP_USER_AGENT'], 250);
         $currency = GFCommon::get_currency();
         $source_url = self::truncate(self::get_current_page_url(), 200);
         $wpdb->query($wpdb->prepare("INSERT INTO {$lead_table}(form_id, ip, source_url, date_created, user_agent, currency, created_by) VALUES(%d, %s, %s, utc_timestamp(), %s, %s, {$user_id})", $form['id'], self::get_ip(), $source_url, $user_agent, $currency));
         //reading newly created lead id
         $lead_id = $wpdb->insert_id;
         $lead = array('id' => $lead_id);
         GFCommon::log_debug(__METHOD__ . "(): Entry record created in the database. ID: {$lead_id}.");
     }
     $current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead['id']));
     $total_fields = array();
     /* @var $calculation_fields GF_Field[] */
     $calculation_fields = array();
     $recalculate_total = false;
     GFCommon::log_debug(__METHOD__ . '(): Saving entry fields.');
     foreach ($form['fields'] as $field) {
         /* @var $field GF_Field */
         // ignore the honeypot field
         if ($field->type == 'honeypot') {
             continue;
         }
         //Ignore fields that are marked as display only
         if ($field->displayOnly && $field->type != 'password') {
             continue;
         }
         //ignore pricing fields in the entry detail
         if (RG_CURRENT_VIEW == 'entry' && GFCommon::is_pricing_field($field->type)) {
             continue;
         }
         //process total field after all fields have been saved
         if ($field->type == 'total') {
             $total_fields[] = $field;
             continue;
         }
         $is_entry_update = RG_CURRENT_VIEW == 'entry' || !$is_new_lead;
         $read_value_from_post = $is_new_lead || !isset($lead['date_created']);
         //only save fields that are not hidden (except when updating an entry)
         if ($is_entry_update || !GFFormsModel::is_field_hidden($form, $field, array(), $read_value_from_post ? null : $lead)) {
             // process calculation fields after all fields have been saved (moved after the is hidden check)
             if ($field->has_calculation()) {
                 $calculation_fields[] = $field;
                 continue;
             }
             if ($field->type == 'post_category') {
                 $field = GFCommon::add_categories_as_choices($field, '');
             }
             $inputs = $field->get_entry_inputs();
             if (is_array($inputs)) {
                 foreach ($inputs as $input) {
                     self::save_input($form, $field, $lead, $current_fields, $input['id']);
                 }
             } else {
                 self::save_input($form, $field, $lead, $current_fields, $field->id);
             }
         }
     }
     if (!empty($calculation_fields)) {
         foreach ($calculation_fields as $calculation_field) {
             $inputs = $calculation_field->get_entry_inputs();
             if (is_array($inputs)) {
                 foreach ($inputs as $input) {
                     self::save_input($form, $calculation_field, $lead, $current_fields, $input['id']);
                     self::refresh_lead_field_value($lead['id'], $input['id']);
                 }
             } else {
                 self::save_input($form, $calculation_field, $lead, $current_fields, $calculation_field->id);
                 self::refresh_lead_field_value($lead['id'], $calculation_field->id);
             }
         }
         self::refresh_product_cache($form, $lead = RGFormsModel::get_lead($lead['id']));
     }
     //saving total field as the last field of the form.
     if (!empty($total_fields)) {
         foreach ($total_fields as $total_field) {
             self::save_input($form, $total_field, $lead, $current_fields, $total_field->id);
             self::refresh_lead_field_value($lead['id'], $total_field['id']);
         }
     }
     GFCommon::log_debug(__METHOD__ . '(): Finished saving entry fields.');
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:97,代码来源:forms_model.php

示例9: setup

 public static function setup()
 {
     global $wpdb;
     $version = GFCommon::$version;
     if (get_option("rg_form_version") != $version) {
         require_once ABSPATH . '/wp-admin/includes/upgrade.php';
         if (!empty($wpdb->charset)) {
             $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $charset_collate .= " COLLATE {$wpdb->collate}";
         }
         //------ FORM -----------------------------------------------
         $form_table_name = RGFormsModel::get_form_table_name();
         $sql = "CREATE TABLE " . $form_table_name . " (\n                  id mediumint(8) unsigned not null auto_increment,\n                  title varchar(150) not null,\n                  date_created datetime not null,\n                  is_active tinyint(1) not null default 1,\n                  PRIMARY KEY  (id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ META -----------------------------------------------
         $meta_table_name = RGFormsModel::get_meta_table_name();
         $sql = "CREATE TABLE " . $meta_table_name . " (\n                  form_id mediumint(8) unsigned not null,\n                  display_meta longtext,\n                  entries_grid_meta longtext,\n                  KEY form_id (form_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ FORM VIEW -----------------------------------------------
         $form_view_table_name = RGFormsModel::get_form_view_table_name();
         $sql = "CREATE TABLE " . $form_view_table_name . " (\n                  id bigint(20) unsigned not null auto_increment,\n                  form_id mediumint(8) unsigned not null,\n                  date_created datetime not null,\n                  ip char(15),\n                  count mediumint(8) unsigned not null default 1,\n                  PRIMARY KEY  (id),\n                  KEY form_id (form_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ LEAD -----------------------------------------------
         $lead_table_name = RGFormsModel::get_lead_table_name();
         $sql = "CREATE TABLE " . $lead_table_name . " (\n                  id int(10) unsigned not null auto_increment,\n                  form_id mediumint(8) unsigned not null,\n                  post_id bigint(20) unsigned,\n                  date_created datetime not null,\n                  is_starred tinyint(1) not null default 0,\n                  is_read tinyint(1) not null default 0,\n                  ip char(15) not null,\n                  source_url varchar(200) not null default '',\n                  user_agent varchar(250) not null default '',\n                  PRIMARY KEY  (id),\n                  KEY form_id (form_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ LEAD NOTES ------------------------------------------
         $lead_notes_table_name = RGFormsModel::get_lead_notes_table_name();
         $sql = "CREATE TABLE " . $lead_notes_table_name . " (\n                  id int(10) unsigned not null auto_increment,\n                  lead_id int(10) unsigned not null,\n                  user_name varchar(250),\n                  user_id bigint(20),\n                  date_created datetime not null,\n                  value longtext,\n                  PRIMARY KEY  (id),\n                  KEY lead_id (lead_id),\n                  KEY lead_user_key (lead_id,user_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ LEAD DETAIL -----------------------------------------
         $lead_detail_table_name = RGFormsModel::get_lead_details_table_name();
         $sql = "CREATE TABLE " . $lead_detail_table_name . " (\n                  id bigint(20) unsigned not null auto_increment,\n                  lead_id int(10) unsigned not null,\n                  form_id mediumint(8) unsigned not null,\n                  field_number float not null,\n                  value varchar(" . GFORMS_MAX_FIELD_LENGTH . "),\n                  PRIMARY KEY  (id),\n                  KEY form_id (form_id),\n                  KEY lead_id (lead_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ LEAD DETAIL LONG -----------------------------------
         $lead_detail_long_table_name = RGFormsModel::get_lead_details_long_table_name();
         $sql = "CREATE TABLE " . $lead_detail_long_table_name . " (\n                  lead_detail_id bigint(20) unsigned not null,\n                  value longtext,\n                  KEY lead_detail_key (lead_detail_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //fix checkbox value. needed for version 1.0 and below but won't hurt for higher versions
         self::fix_checkbox_value();
     }
     update_option("rg_form_version", $version);
 }
开发者ID:812studio,项目名称:812studio,代码行数:45,代码来源:gravityforms.php

示例10: send_notifications

 /** Sends an e-mail out, good stuff */
 public function send_notifications($form_id)
 {
     $form = RGFormsModel::get_form_meta($form_id);
     if (!$form) {
         // TODO: Yet, groups will only be sent out in the next schedule
         // TODO: perhaps add a $now = 'group' flag for instant turnaround?
         $this->reschedule_existing();
         return;
     }
     $digest_group = isset($form['digests']['digest_group']) ? $form['digests']['digest_group'] : false;
     $digest_interval = isset($form['digests']['digest_interval']) ? $form['digests']['digest_interval'] : false;
     $digest_report_always = isset($form['digests']['digest_report_always']) ? $form['digests']['digest_report_always'] : false;
     $digest_export_all_fields = isset($form['digests']['digest_export_all_fields']) ? $form['digests']['digest_export_all_fields'] : true;
     $digest_export_field_list = isset($form['digests']['digest_export_field_list']) ? $form['digests']['digest_export_field_list'] : array();
     $forms = array($form['id'] => $form);
     if ($digest_group) {
         /* We may want to send out a group of forms in one e-mail if possible */
         foreach (RGFormsModel::get_forms(true) as $existing_form) {
             if ($existing_form->id == $form_id) {
                 continue;
             }
             // It is I!
             $existing_form = RGFormsModel::get_form_meta($existing_form->id);
             if (!isset($existing_form['digests']['enable_digest'])) {
                 continue;
             }
             // Meh, not interesting
             if (!isset($existing_form['digests']['digest_group'])) {
                 continue;
             }
             // Meh, not interesting
             if (!isset($existing_form['digests']['digest_interval'])) {
                 continue;
             }
             // Meh, not interesting
             if ($existing_form['digests']['digest_group'] == $digest_group) {
                 if ($existing_form['digests']['digest_interval'] == $digest_interval) {
                     $forms[$existing_form['id']] = $existing_form;
                     // Add them all
                 }
             }
         }
     }
     $emails = array();
     /* Gather all the leads and update the last_sent counters */
     foreach ($forms as $i => $form) {
         $last_sent = isset($form['digests']['digest_last_sent']) ? $form['digests']['digest_last_sent'] : 0;
         /* Retrieve form entries newer than the last sent ID */
         global $wpdb;
         $leads_table = RGFormsModel::get_lead_table_name();
         $leads = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$leads_table} WHERE form_id = %d AND id > %d AND status = 'active';", $form['id'], $last_sent));
         if (!sizeof($leads)) {
             if (!$digest_report_always) {
                 continue;
                 // Nothing to report on
             }
         } else {
             /* Update the reported id counter */
             $form['digests']['digest_last_sent'] = $leads[sizeof($leads) - 1]->id;
         }
         if (version_compare(GFCommon::$version, '1.7') >= 0) {
             /* Seems like 1.7 really messed up the meta structure */
             unset($form['notifications']);
             unset($form['confirmations']);
         }
         RGFormsModel::update_form_meta($form['id'], $form);
         $forms[$i]['leads'] = $leads;
         /* Also make a lookup table of all e-mail addresses to forms */
         foreach ($form['digests']['digest_emails'] as $email) {
             if (!isset($emails[$email])) {
                 $emails[$email] = array();
             }
             $emails[$email][] = $form['id'];
         }
     }
     /* Now, let's try and mail stuff */
     foreach ($emails as $email => $form_ids) {
         /* CSV e-mails */
         $report = 'Report generated at ' . date('Y-m-d H:i:s') . "\n";
         $csv_attachment = tempnam(sys_get_temp_dir(), '');
         $csv = fopen($csv_attachment, 'w');
         $from = null;
         $to = null;
         $names = array();
         foreach ($form_ids as $form_id) {
             $form = $forms[$form_id];
             $names[] = $form['title'];
             fputcsv($csv, array('Form: ' . $form['title'] . ' (#' . $form_id . ')'));
             $headers = array('Date Submitted');
             if ($digest_export_all_fields) {
                 foreach ($form['fields'] as $field) {
                     if ($field['label']) {
                         $headers[] = $field['label'];
                     }
                 }
             } else {
                 foreach ($form['fields'] as $field) {
                     if ($field['label'] && in_array($field['id'], $digest_export_field_list)) {
                         $headers[] = $field['label'];
//.........这里部分代码省略.........
开发者ID:hansstam,项目名称:makerfaire,代码行数:101,代码来源:gravityforms-digest.php

示例11: shortcode_gravitylistcompleted


//.........这里部分代码省略.........
                      */
                     if ($field['spgfle_showinlist']) {
                         $html .= "\t\t\t\t\t<th scope=\"col\">" . esc_html($field['label']);
                         if ($debug == true) {
                             $html .= "\t\t\t\t\t<br />{$field['id']}<br />{$field['type']}";
                         }
                         $html .= "\t\t\t\t\t</th>\n";
                     }
                 }
             }
             /** 
              * Add a blank column if we need to link to an edit, view or delete url
              */
             if ($gfediturl) {
                 $html .= "\t\t\t\t\t<th scope=\"col\">&nbsp;</th>\n";
             }
             $html .= "\t\t\t\t</tr>\n";
             $html .= "\t\t\t</thead>\n";
             $html .= "\t\t\t<tbody>\n";
             /** 
              * Create the LIMIT statement
              */
             if (!empty($rows)) {
                 $sqlLimit = "LIMIT {$rows}";
             }
             /**
              * Support for SpGfMySQL-Connect 
              * If we connected the record to a mysql-table and set 'delete lead' to true
              * we have to retrieve the values from the mysql-table
              */
             if ($form['spgfmc_tablename'] && $form['spgfmc_deletelead']) {
                 $leads = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$form['spgfmc_tablename']} ORDER BY lead_id DESC {$sqlLimit}"), ARRAY_A);
             } else {
                 $lead_table_name = RGFormsModel::get_lead_table_name();
                 if (GFCommon::current_user_can_any('gravityforms_edit_entries') || $showtoall) {
                     $leads = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$lead_table_name} WHERE form_id = {$id} AND status = 'active' AND orderStatus = 'complete' ORDER BY id DESC {$sqlLimit}"), ARRAY_A);
                 } else {
                     $leads = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$lead_table_name} WHERE form_id = {$id} AND created_by = %d AND created_by <> 0 AND status = 'active' AND orderStatus = 'complete' ORDER BY id DESC {$sqlLimit}", wp_get_current_user()->ID), ARRAY_A);
                 }
             }
             //echo print_r($leads, true);
             /** 
              * Loop through the Leads
              */
             foreach ($leads as $lead) {
                 if (is_null($lead['id'])) {
                     $lead['id'] = $lead['lead_id'];
                 }
                 if (is_null($lead['lead_id'])) {
                     $lead['lead_id'] = $lead['id'];
                 }
                 //echo print_r($lead, true);
                 /**
                  * Support for Sp-Gf-MySQL-Connect
                  * If we connected the record to a mysql-table and deleted the data
                  * we have to retrieve the values from the mysql-table
                  */
                 if ($form['spgfmc_tablename'] && $form['spgfmc_deletefield']) {
                     if (!$form['spgfmc_spgfmc_deletelead']) {
                         /**
                          * If the lead was not deleted we use the 'lead_id' to
                          * connect the MySQL record with the GF lead
                          */
                         $data = $wpdb->get_row("SELECT * FROM {$form['spgfmc_tablename']} WHERE {$form['spgfmc_field_leadid']} = {$lead['lead_id']}", ARRAY_A);
                         $lead['gform_edit_id'] = $lead['lead_id'];
                     } elseif ($form['spgfmc_spgfmc_deletelead']) {
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:67,代码来源:sp-gf-list-edit.php

示例12: get_form_values

 public static function get_form_values($form_id)
 {
     global $wpdb;
     $ret = false;
     //$lid = $wpdb->get_var(sprintf("SELECT DISTINCT id FROM %s WHERE form_id = %d AND created_by=%d ORDER BY id DESC LIMIT 1", RGFormsModel::get_lead_table_name(), $form_id, wp_get_current_user()->ID));
     // added by slaven 3/28/13
     // see http://software.troydesign.it/php/wordpress/adminsingle-gravity-forms-add-on.html
     // allows editing of entry by ID
     $rid = (int) $_GET['rid'];
     // Requested ID
     if ($rid) {
         // SLAVEN
         //echo "<h4>RID:".$rid."</h4>";
         $lid = $wpdb->get_var(sprintf("SELECT DISTINCT id FROM %s WHERE form_id = %d AND created_by=%d AND id=%d", RGFormsModel::get_lead_table_name(), $form_id, wp_get_current_user()->ID, $rid));
     } else {
         // SLAVEN
         //echo "<h4>NO RID</h4>";
         $lid = $wpdb->get_var(sprintf("SELECT DISTINCT id FROM %s WHERE form_id = %d AND created_by=%d ORDER BY id DESC LIMIT 1", RGFormsModel::get_lead_table_name(), $form_id, wp_get_current_user()->ID));
     }
     if ($lid) {
         $meta = RGFormsModel::get_form_meta($form_id);
         $lead = RGFormsModel::get_lead($lid);
         $ret = array('lead' => $lead, 'meta' => $meta);
     }
     return $ret;
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:26,代码来源:plugin.php

示例13: save_lead

 public static function save_lead($form, &$lead)
 {
     global $wpdb;
     if (IS_ADMIN && !GFCommon::current_user_can_any("gravityforms_edit_entries")) {
         die(__("You don't have adequate permission to edit entries.", "gravityforms"));
     }
     $lead_detail_table = self::get_lead_details_table_name();
     //Inserting lead if null
     if ($lead == null) {
         $lead_table = RGFormsModel::get_lead_table_name();
         $user_agent = strlen($_SERVER["HTTP_USER_AGENT"]) > 250 ? substr($_SERVER["HTTP_USER_AGENT"], 0, 250) : $_SERVER["HTTP_USER_AGENT"];
         $wpdb->query($wpdb->prepare("INSERT INTO {$lead_table}(form_id, ip, source_url, date_created, user_agent) VALUES(%d, %s, %s, utc_timestamp(), %s)", $form["id"], self::get_ip(), self::get_current_page_url(), $user_agent));
         //reading newly created lead id
         $lead_id = $wpdb->get_var("SELECT LAST_INSERT_ID();");
         $lead = array("id" => $lead_id);
     }
     $current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead["id"]));
     $original_post_id = $lead["post_id"];
     foreach ($form["fields"] as $field) {
         //only save fields that are not hidden (except on entry screen)
         if (RG_CURRENT_VIEW == "entry" || !RGFormsModel::is_field_hidden($form, $field, array())) {
             if (is_array($field["inputs"])) {
                 foreach ($field["inputs"] as $input) {
                     self::save_input($form, $field, $lead, $current_fields, $input["id"]);
                 }
             } else {
                 self::save_input($form, $field, $lead, $current_fields, $field["id"]);
             }
         }
     }
     //update post_id field if a post was created
     if ($lead["post_id"] != $original_post_id) {
         $wpdb->update($lead_table, array("post_id" => $lead["post_id"]), array("id" => $lead["id"]), array("%d"), array("%d"));
     }
 }
开发者ID:812studio,项目名称:812studio,代码行数:35,代码来源:forms_model.php

示例14: setup

    public static function setup($force_setup = false)
    {
        global $wpdb;
        $version = GFCommon::$version;
        if (get_option("rg_form_version") != $version || $force_setup) {
            $error = "";
            if (!self::has_database_permission($error)) {
                ?>
                <div class='error' style="padding:15px;"><?php 
                echo $error;
                ?>
</div>
                <?php 
            }
            require_once ABSPATH . '/wp-admin/includes/upgrade.php';
            if (!empty($wpdb->charset)) {
                $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
            }
            if (!empty($wpdb->collate)) {
                $charset_collate .= " COLLATE {$wpdb->collate}";
            }
            //------ FORM -----------------------------------------------
            $form_table_name = RGFormsModel::get_form_table_name();
            $sql = "CREATE TABLE " . $form_table_name . " (\r\n                  id mediumint(8) unsigned not null auto_increment,\r\n                  title varchar(150) not null,\r\n                  date_created datetime not null,\r\n                  is_active tinyint(1) not null default 1,\r\n                  PRIMARY KEY  (id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ META -----------------------------------------------
            $meta_table_name = RGFormsModel::get_meta_table_name();
            $sql = "CREATE TABLE " . $meta_table_name . " (\r\n                  form_id mediumint(8) unsigned not null,\r\n                  display_meta longtext,\r\n                  entries_grid_meta longtext,\r\n                  PRIMARY KEY  (form_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //droping outdated form_id index (if one exists)
            self::drop_index($meta_table_name, 'form_id');
            //------ FORM VIEW -----------------------------------------------
            $form_view_table_name = RGFormsModel::get_form_view_table_name();
            $sql = "CREATE TABLE " . $form_view_table_name . " (\r\n                  id bigint(20) unsigned not null auto_increment,\r\n                  form_id mediumint(8) unsigned not null,\r\n                  date_created datetime not null,\r\n                  ip char(15),\r\n                  count mediumint(8) unsigned not null default 1,\r\n                  PRIMARY KEY  (id),\r\n                  KEY form_id (form_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD -----------------------------------------------
            $lead_table_name = RGFormsModel::get_lead_table_name();
            $sql = "CREATE TABLE " . $lead_table_name . " (\r\n                  id int(10) unsigned not null auto_increment,\r\n                  form_id mediumint(8) unsigned not null,\r\n                  post_id bigint(20) unsigned,\r\n                  date_created datetime not null,\r\n                  is_starred tinyint(1) not null default 0,\r\n                  is_read tinyint(1) not null default 0,\r\n                  ip varchar(39) not null,\r\n                  source_url varchar(200) not null default '',\r\n                  user_agent varchar(250) not null default '',\r\n                  currency varchar(5),\r\n                  payment_status varchar(15),\r\n                  payment_date datetime,\r\n                  payment_amount decimal(19,2),\r\n                  transaction_id varchar(50),\r\n                  is_fulfilled tinyint(1),\r\n                  created_by bigint(20) unsigned,\r\n                  transaction_type tinyint(1),\r\n                  status varchar(20) not null default 'active',\r\n                  PRIMARY KEY  (id),\r\n                  KEY form_id (form_id),\r\n                  KEY status (status)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD NOTES ------------------------------------------
            $lead_notes_table_name = RGFormsModel::get_lead_notes_table_name();
            $sql = "CREATE TABLE " . $lead_notes_table_name . " (\r\n                  id int(10) unsigned not null auto_increment,\r\n                  lead_id int(10) unsigned not null,\r\n                  user_name varchar(250),\r\n                  user_id bigint(20),\r\n                  date_created datetime not null,\r\n                  value longtext,\r\n                  PRIMARY KEY  (id),\r\n                  KEY lead_id (lead_id),\r\n                  KEY lead_user_key (lead_id,user_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD DETAIL -----------------------------------------
            $lead_detail_table_name = RGFormsModel::get_lead_details_table_name();
            $sql = "CREATE TABLE " . $lead_detail_table_name . " (\r\n                  id bigint(20) unsigned not null auto_increment,\r\n                  lead_id int(10) unsigned not null,\r\n                  form_id mediumint(8) unsigned not null,\r\n                  field_number float not null,\r\n                  value varchar(" . GFORMS_MAX_FIELD_LENGTH . "),\r\n                  PRIMARY KEY  (id),\r\n                  KEY form_id (form_id),\r\n                  KEY lead_id (lead_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD DETAIL LONG -----------------------------------
            $lead_detail_long_table_name = RGFormsModel::get_lead_details_long_table_name();
            $sql = "CREATE TABLE " . $lead_detail_long_table_name . " (\r\n                  lead_detail_id bigint(20) unsigned not null,\r\n                  value longtext,\r\n                  PRIMARY KEY  (lead_detail_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //droping outdated form_id index (if one exists)
            self::drop_index($lead_detail_long_table_name, 'lead_detail_key');
            //------ LEAD META -----------------------------------
            $lead_meta_table_name = RGFormsModel::get_lead_meta_table_name();
            $sql = "CREATE TABLE " . $lead_meta_table_name . " (\r\n                  id bigint(20) unsigned not null auto_increment,\r\n                  lead_id bigint(20) unsigned not null,\r\n                  meta_key varchar(255),\r\n                  meta_value longtext,\r\n                  PRIMARY KEY  (id),\r\n                  KEY meta_key (meta_key),\r\n                  KEY lead_id (lead_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //fix checkbox value. needed for version 1.0 and below but won't hurt for higher versions
            self::fix_checkbox_value();
            //auto-setting license key based on value configured via the GF_LICENSE_KEY constant or the gf_license_key variable
            global $gf_license_key;
            $license_key = defined("GF_LICENSE_KEY") && empty($gf_license_key) ? GF_LICENSE_KEY : $gf_license_key;
            if (!empty($license_key)) {
                update_option("rg_gforms_key", md5($license_key));
            }
            //auto-setting recaptcha keys based on value configured via the constant or global variable
            global $gf_recaptcha_public_key, $gf_recaptcha_private_key;
            $private_key = defined("GF_RECAPTCHA_PRIVATE_KEY") && empty($gf_recaptcha_private_key) ? GF_RECAPTCHA_PRIVATE_KEY : $gf_recaptcha_private_key;
            if (!empty($private_key)) {
                update_option("rg_gforms_captcha_private_key", $private_key);
            }
            $public_key = defined("GF_RECAPTCHA_PUBLIC_KEY") && empty($gf_recaptcha_public_key) ? GF_RECAPTCHA_PUBLIC_KEY : $gf_recaptcha_public_key;
            if (!empty($public_key)) {
                update_option("rg_gforms_captcha_public_key", $public_key);
            }
            //Auto-importing forms based on GF_IMPORT_FILE AND GF_THEME_IMPORT_FILE
            if (defined("GF_IMPORT_FILE") && !get_option("gf_imported_file")) {
                GFExport::import_file(GF_IMPORT_FILE);
                update_option("gf_imported_file", true);
            }
            //adds empty index.php files to upload folders. only for v1.5.2 and below
            if (version_compare(get_option("rg_form_version"), "1.6", "<")) {
                self::add_empty_index_files();
            }
            update_option("rg_form_version", $version);
        }
        //Import theme specific forms if configured. Will only import forms once per theme.
        if (defined("GF_THEME_IMPORT_FILE")) {
            $themes = get_option("gf_imported_theme_file");
            if (!is_array($themes)) {
                $themes = array();
            }
            //if current theme has already imported it's forms, don't import again
            $theme = get_template();
            if (!isset($themes[$theme])) {
                //importing forms
                GFExport::import_file(get_stylesheet_directory() . "/" . GF_THEME_IMPORT_FILE);
                //adding current theme to the list of imported themes. So that forms are not imported again for it.
                $themes[$theme] = true;
                update_option("gf_imported_theme_file", $themes);
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:101,代码来源:gravityforms.php

示例15: get_lead_count

 function get_lead_count($form_id, $search, $star = null, $read = null, $column, $approved = false, $leads = array(), $start_date = null, $end_date = null, $limituser = false)
 {
     global $wpdb, $current_user;
     if (!is_numeric($form_id)) {
         return "";
     }
     $detail_table_name = RGFormsModel::get_lead_details_table_name();
     $lead_table_name = RGFormsModel::get_lead_table_name();
     $star_filter = $star !== null ? $wpdb->prepare("AND is_starred=%d ", $star) : "";
     $read_filter = $read !== null ? $wpdb->prepare("AND is_read=%d ", $read) : "";
     if (function_exists('gform_get_meta')) {
         $status_filter = $wpdb->prepare(" AND status=%s ", 'active');
     } else {
         $status_filter = '';
     }
     $start_date_filter = empty($start_date) ? "" : " AND datediff(date_created, '{$start_date}') >=0";
     $end_date_filter = empty($end_date) ? "" : " AND datediff(date_created, '{$end_date}') <=0";
     $search_term = "%{$search}%";
     $search_filter = empty($search) ? "" : $wpdb->prepare("AND ld.value LIKE %s", $search_term);
     $user_filter = '';
     if ($limituser) {
         get_currentuserinfo();
         if ((int) $current_user->ID !== 0 || $current_user->ID === 0 && apply_filters('kws_gf_show_entries_if_not_logged_in', apply_filters('kws_gf_treat_not_logged_in_as_user', true))) {
             if (!empty($current_user->ID)) {
                 $user_filter = $wpdb->prepare(" AND l.created_by=%d ", $current_user->ID);
             } else {
                 $user_filter = $wpdb->prepare(" AND (created_by IS NULL OR created_by=%d)", $current_user->ID);
             }
         } else {
             return false;
         }
     }
     $in_filter = "";
     if ($approved) {
         $in_filter = $wpdb->prepare("l.id IN (SELECT lead_id from {$detail_table_name} WHERE field_number BETWEEN %f AND %f) AND", $column - 0.001, $column + 0.001);
         // This will work once all the fields are converted to the meta_key after 1.6
         #$search_filter .= $wpdb->prepare(" AND m.meta_key = 'is_approved' AND m.meta_value = %s", 1);
     }
     $sql = "SELECT count(distinct l.id) FROM {$lead_table_name} as l,\n\t\t\t\t{$detail_table_name} as ld";
     #		$sql .= function_exists('gform_get_meta') ? " INNER JOIN wp_rg_lead_meta m ON l.id = m.lead_id " : ""; // After 1.6
     $sql .= "\n\t\t\t\tWHERE {$in_filter}\n\t\t\t\tl.form_id={$form_id}\n\t\t\t\tAND ld.form_id={$form_id}\n\t\t\t\tAND l.id = ld.lead_id\n\t\t\t\t{$star_filter}\n\t\t\t\t{$read_filter}\n\t\t\t\t{$status_filter}\n\t\t\t\t{$user_filter}\n\t\t\t\t{$start_date_filter}\n\t\t\t\t{$end_date_filter}\n\t\t\t\t{$search_filter}";
     return $wpdb->get_var($sql);
 }
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:43,代码来源:gravity-forms-addons.php


注:本文中的RGFormsModel::get_lead_table_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。