Adding code documentation
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 18 Mar 2016 14:02:42 +0000 (10:02 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 18 Mar 2016 14:02:42 +0000 (10:02 -0400)
Using PHPDocs format

models/admin/management/events.php

index fcc3850..c77b1fa 100644 (file)
@@ -109,6 +109,13 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
 
     }
 
+    /**
+     * modelAction
+     *
+     * @param bool $actionData
+     * @access public
+     * @return void
+     */
     public function modelAction($actionData = false)
     {
 
@@ -164,10 +171,10 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
                         $this->settings = filter_var_array(
                             $_REQUEST,
                             array(
-                                'schema' => FILTER_SANITIZE_STRING,
+                                'schema'       => FILTER_SANITIZE_STRING,
                                 'cattablename' => FILTER_SANITIZE_STRING,
-                                'tablename' => FILTER_SANITIZE_STRING,
-                                'sdate'   => array(
+                                'tablename'    => FILTER_SANITIZE_STRING,
+                                'sdate'        => array(
                                     'filter'  => FILTER_VALIDATE_REGEXP,
                                     'options' => array(
                                         'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%'
@@ -199,11 +206,11 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
                 // Determine if current user can edit configurations
                 if (!current_user_can('glm_members_management')) {
                     return array(
-                        'status' => false,
+                        'status'           => false,
                         'menuItemRedirect' => 'error',
-                        'modelRedirect' => 'index',
-                        'view' => 'admin/error/index.html',
-                        'data' => array(
+                        'modelRedirect'    => 'index',
+                        'view'             => 'admin/error/index.html',
+                        'data'             => array(
                             'reason' => 'User does not have rights to make configuration changes.'
                         )
                     );
@@ -274,6 +281,19 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
 
     }
 
+    /**
+     * connectPostgresDb
+     *
+     * Make a connection to the given database for the site. (postgres)
+     * Sets the $this->dbh with the postgers database connection
+     *
+     * @param mixed $db_host
+     * @param mixed $db_name
+     * @param mixed $db_user
+     * @param mixed $db_password
+     * @access public
+     * @return void
+     */
     public function connectPostgresDb($db_host, $db_name, $db_user, $db_password)
     {
         $connStr      = "pgsql:";
@@ -390,6 +410,19 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
 
     }
 
+    /**
+     * addCategories
+     *
+     * Checks to see if there's an Event Category already in the database.
+     * If not it will create the entry.
+     * Sets up the class variables
+     * $this->categories (contains all the categories that get added keyed with
+     * category id)
+     * $this->oldCatMap (map of the old category id to new category ids)
+     *
+     * @access public
+     * @return void
+     */
     public function addCategories()
     {
         $return = '';
@@ -437,6 +470,18 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
         return $return;
     }
 
+    /**
+     * getTime
+     *
+     * Given a time string return the the following format of time
+     * H:i
+     * hour and minute
+     *
+     * @param mixed $time String with any time format
+     *
+     * @access public
+     * @return void
+     */
     public function getTime($time)
     {
         if (!$time) {
@@ -455,6 +500,17 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
         return $dateTime->format('H:i');
     }
 
+    /**
+     * getCityId
+     *
+     * Given a city name find and return the id of the city.
+     * If a city cannot be found then create city with that name.
+     *
+     * @param mixed $cityName Name of the city
+     *
+     * @access public
+     * @return id of city
+     */
     public function getCityId($cityName)
     {
         $sql = "
@@ -475,6 +531,16 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
         }
     }
 
+    /**
+     * addEvents
+     *
+     * Start with a clean set of event tables. ( delete all event data )
+     * Grab all events starting with the given start date.
+     * Enter them into the new event plugin tables.
+     *
+     * @access public
+     * @return void
+     */
     public function addEvents()
     {
         // clear the events tables first