adding contact_type
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 9 Feb 2010 16:02:23 +0000 (16:02 +0000)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 9 Feb 2010 16:02:23 +0000 (16:02 +0000)
admin/Contact/contact_setup.inc
admin/Contact/edit_contact.phtml
admin/Contact/index.phtml
admin/Contact/query_contact.phtml

index 2a79eea..bf131cc 100755 (executable)
@@ -248,12 +248,21 @@ else
        $DB_fields[] =  array( name => "interest",  title => "Interest", type=> "interest");
        $DB_fields[] =  array( name => "questions", title => "Additional Questions",type => "desc");
        $DB_fields[] =  array( name => "mail_ok",       title => "Mail Ok?",    type => "radio");
+    $cType = array(
+        ''=>'',
+        1 => 'Reservation Request',
+        2 => 'E-News'
+    );
+    $DB_fields[] = array("name" => "contact_type",     "title" => "Contact Type", "type" => "drop", "drop" => $cType);
        //$DB_fields[] =        array( name => "contestant",title => "Contestant?",     type => "radio");
 
        // $fields are used for building the query page
        foreach($DB_fields as $key=>$value){
-               if($value['type'] == "text" || $value['type'] == "array_drop")
+        if ($value['type'] == "text" || $value['type'] == "array_drop") {
                        $fields[$value['name']] = $value['title'];
+        } elseif ( $value['type'] == "drop") {
+            $dropdowns[$value['name']] = array('title' => $value['title'], 'drop' => $value['drop']);
+        }
        }
        $fields["questions"] = "Questions";
        $p_date_from = contact_date_entry("","","","fp_month","fp_day","fp_year");
index 1a94398..fd77c21 100755 (executable)
@@ -152,6 +152,16 @@ foreach($DB_fields as $key=>$value) {
                echo ">No</td>";
                echo "</tr>";
        }
+       elseif ( $value['type'] == 'drop' )
+       {
+               echo '<tr><td class="'.$label.'" align="right">'.$value[title].'</td>';
+               echo '<td class="'.$field.'">';
+        unset($value['drop']['']);
+               $val = explode(":",ereg_replace("^:|:$","",trim($row[$value['name']])));
+               $date_entry = GLM_TOOLBOX::build_picklist($value['name'].'[]',$value['drop'],$val, 'multiple', 0, null, 5);
+               echo $date_entry.'</td>';
+               echo '</tr>';
+       }
        elseif($value[type] == "array_drop"){
                echo "<tr><td class=\"navtd\" align=\"right\" nowrap>$value[title]:</td>";
                echo "<td>";
index 7f9f4ad..df11aad 100755 (executable)
@@ -202,6 +202,8 @@ else
       <option value="ON" <?=($case == "ON")?"selected":""?>>On
       <option value="OFF" <?=(!isset($case) || $case == "OFF")?"selected":""?>>Off
       </select><br>
+      <?php
+?>
       </td>
        </tr>
   <tr>
@@ -218,7 +220,21 @@ if(is_array($interest2))
        }
 ?>
   </td>
-  <td colspan=2>
+  <td>
+       <?php
+       if (is_array($dropdowns)) {
+               foreach ($dropdowns as $drop_key => $drop_row) {
+                       echo '<br>
+                               <b>'.$drop_row['title'].'</b>';
+                       echo '<br>';
+                       if( is_array( $drop_row['drop'] ) ) {
+                               echo GLM_TOOLBOX::build_picklist( $drop_key.'[]', $drop_row['drop'], ${$drop_key}, 'multiple', 0, null, 5 );
+                       }
+               }
+       }
+?>
+  </td>
+  <td>
        <?php
        if(is_array($unit_size2)){
                echo '<b>Unit Size</b><br><select name="unit[]" multiple size="5">';
index 9a4872d..6d5b2ff 100755 (executable)
@@ -165,6 +165,24 @@ if(!isset($query_no)) {
        else {
                $query_string .= "\nFROM\t".TABLE." \nWHERE\t".WHERE."\n";
        }
+       if( is_array( $dropdowns ) ) {
+               foreach( $dropdowns as $drop_key => $drop_val ) {
+                       if( is_array( $_POST[$drop_key] ) ) {
+                               foreach( $_POST[$drop_key] as $mdrop_key => $mdrop_val ){
+                                       if( $mdrop_val != '' ){
+                                               $dstring[] = " $drop_key $operator ':".$mdrop_val.":'";
+                                       }
+                               }
+                       }elseif( !is_array( $_POST[$drop_key] ) ) {
+                               if( $_POST[$drop_key] != '' ){
+                                       $dstring[] = " $drop_key = '".$_POST[$drop_key]."'";
+                               }
+                       }
+               }
+               if( is_array($dstring) ) {
+                       $query_string .= ' and ('.implode(" $compare ",$dstring).' ) ';
+               }
+       }
        if($mail_ok == "1") {
                $query_string .= " AND mail_ok = 't'";
        }