Update code with documentation.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 26 Jul 2016 18:14:15 +0000 (14:14 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 26 Jul 2016 18:14:15 +0000 (14:14 -0400)
Documenting the GlmMembersAdmin_management_leads class methods.

models/admin/management/leads.php

index df7d52a..2ef4086 100644 (file)
@@ -110,6 +110,7 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
      * modelAction
      *
      * @param bool $actionData
+     *
      * @access public
      * @return void
      */
@@ -263,10 +264,23 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
             'view'             => 'admin/management/leads.html',
             'data'             => $templateData
         );
-
-
     }
 
+    /**
+     * addInterestGroup
+     *
+     * Helper function to add the interests groups, and interests.
+     * Runs through the $form array and checks for the setting given for the
+     * group name. It adds the groups then the interests for the group from the
+     * form.
+     *
+     * @param mixed $form
+     * @param mixed $field_id
+     * @param mixed $group_name
+     *
+     * @access public
+     * @return void
+     */
     public function addInterestGroup( $form, $field_id, $group_name ) {
         $interests = array();
         // go through the $form array and get all the inputs for the group_name field
@@ -308,7 +322,7 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
      * If the group is found it simply returns the group id.
      * If the group is not found it will add the group and return the new id.
      *
-     * @param mixed $name
+     * @param mixed $name Name of the Group
      *
      * @access public
      * @return int The id of the group
@@ -427,8 +441,8 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
     /**
      * addEntry
      *
-     * @param mixed $entry
-     * @param mixed $import_fields
+     * @param mixed $entry         Entry array from Gravity Form
+     * @param mixed $import_fields Array of the import_fields
      *
      * @access public
      * @return boolean True if added false if not
@@ -501,6 +515,17 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
             return $this->wpdb->insert_id;
         }
     }
+    /**
+     * getSourceId
+     *
+     * From the form id get this forms source id. If it's not found then
+     * create and entry and return the source id.
+     *
+     * @param mixed $form_id The id for the form.
+     *
+     * @access public
+     * @return int
+     */
     public function getSourceId( $form_id ) {
         $source_id = $this->wpdb->get_var(
             $this->wpdb->prepare(
@@ -528,12 +553,17 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
     /**
      * addMemberLeadEntry
      *
+     * Adds the entry to the leads entry table.
+     * Checks first to see if it has a match comparing the gf_entry_id field.
+     * If found it will update the entry and return the id.
+     * If not found it will insert the entry and return the id.
+     *
      * @param mixed $lead_id Id from the leads table
      * @param mixed $lead    Lead array
      * @param mixed $entry   Entry array
      *
      * @access public
-     * @return void
+     * @return int Entry id
      */
     public function addMemberLeadEntry( $lead_id, $lead, $entry ) {
         if ( !isset( $lead_id ) || !filter_var( $lead_id, FILTER_VALIDATE_INT ) ) {
@@ -542,12 +572,6 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
         if ( !isset( $lead ) || !is_array( $lead ) ) {
             return false;
         }
-        /*
-        echo '<pre>$lead_id: ' . print_r( $lead_id, true ) . '</pre>';
-        echo '<pre>$lead: ' . print_r( $lead, true ) . '</pre>';
-        echo '<pre>$entry: ' . print_r( $entry, true ) . '</pre>';
-        exit;
-         */
         // see if the gf_entry_id is already in
         $entry_id = $this->wpdb->get_var(
             $this->wpdb->prepare(
@@ -612,6 +636,16 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
             return $this->wpdb->insert_id;
         }
     }
+    /**
+     * getMembersInterests
+     *
+     * Returns the interests records with the gravity form field id's.
+     *
+     * @param mixed $form_id The id of the gravity form.
+     *
+     * @access public
+     * @return mixed
+     */
     public function getMembersInterests( $form_id ) {
         static $interest = array();
         if ( empty( $interest ) ) {
@@ -634,6 +668,17 @@ class GlmMembersAdmin_management_leads // extends GlmDataLeadsManagement
         }
         return $interest;
     }
+    /**
+     * addMemberLeadInterests
+     *
+     * Add the Lead interests for the entry.
+     *
+     * @param mixed $entry_id Id for the enty
+     * @param mixed $entry    Entry array from gravity forms.
+     *
+     * @access public
+     * @return mixed
+     */
     public function addMemberLeadInterests( $entry_id, $entry ) {
         if ( !filter_var( $entry_id, FILTER_VALIDATE_INT ) ) {
             return false;