Advertisement
josh401

PHP/HTML Sample

Feb 12th, 2016
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 33.87 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8">
  5.         <title>GISR - Hub</title>
  6.  
  7.         <link rel='stylesheet' id='google.fonts-css'  href='http://fonts.googleapis.com/css?family=PT+Sans%7CPT+Sans%7CPT+Sans%7CPT+Sans%7CPT+Sans%7CPT+Sans&#038;subset=cyrillic%2Clatin&#038;ver=4.1.5' type='text/css' media='all' />
  8.         <link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&#038;subset=latin,latin-ext' type='text/css' media='all' />
  9.  
  10.         <link rel='stylesheet' id='twentytwelve-style-css'  href='http://ratesustainability.org/wp-content/themes/gisr/style.css?ver=4.1.5' type='text/css' media='all' />
  11.        
  12.         <!--[if lt IE 9]>
  13.         <link rel='stylesheet' id='twentytwelve-ie-css'  href='http://ratesustainability.org/wp-content/themes/twentytwelve/css/ie.css?ver=20121010' type='text/css' media='all' />
  14.         <![endif]-->
  15.        
  16.         <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>theme/css/kickstart.css" media="all" />
  17.         <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>theme/css/style.css" media="all" />
  18.        
  19.         <!-- These scripts need to be loaded in header because of file dependencies
  20.         <!-- jQuery -->
  21.         <script type="text/javascript" src="<?php echo base_url(); ?>theme/js/jquery-1.11.3.min.js" type="text/javascript"></script>
  22.         <script src="<?php echo base_url(); ?>theme/js/jquery_ui_min_1.11.4.js" type="text/javascript"></script>
  23.         <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  24.        
  25.         <!-- jQuery Confirm -->
  26.         <script src="<?php echo base_url('theme/js/jquery_confirm/jquery-confirm.min.js'); ?>" type="text/javascript"></script>
  27.         <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>theme/css/jquery_confirm/jquery-confirm.min.css" />
  28.        
  29.         <!-- jQuery BlockUI -->
  30.         <script src="<?php echo base_url('theme/js/jquery_blockui.js'); ?>" type="text/javascript"></script>
  31.        
  32.         <!-- Auto logout -->
  33.         <script type="text/javascript">
  34.             var gisr_index_page = "<?php print base_url() . index_page(); ?>";
  35.         </script>
  36.         <script type="text/javascript" src="<?php echo base_url(); ?>theme/js/logout_timer.js"></script>
  37.        
  38.         <!-- Google Analytics -->
  39.         <script>
  40.             (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  41.             (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  42.             m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  43.             })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  44.            
  45.             ga('create', 'UA-43802807-1', 'ratesustainability.org');
  46.             ga('send', 'pageview');
  47.         </script>
  48.        
  49.        
  50.         <style type="text/css">
  51.             /* jQuery alerts css (bootstrap) */
  52.             .col-md-4 {
  53.                 float:left;
  54.                 width:33.33333333%;
  55.                 position:relative;
  56.                 min-height:1px;
  57.                 padding-right:15px;
  58.                 padding-left:15px;
  59.             }
  60.             .col-md-offset-4 {
  61.                 margin-left:33.33333333%;
  62.             }
  63.             .btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da;}
  64.             .btn-info.focus, .btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85;}
  65.             .btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc;}
  66.            
  67.             .btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a;}
  68.             .btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19;}
  69.             .btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925;}
  70.            
  71.            
  72.             .remove {
  73.                 float: right;
  74.             }
  75.             .remove:hover {
  76.                 color: #F00;
  77.             }
  78.             .member_bm_item:hover {
  79.                 color: #2d9ed8;
  80.             }
  81.         </style>
  82.        
  83.         <?php
  84.         // Load member login script
  85.         $this->load->view('front_member_login');
  86.         ?>
  87.     </head>
  88.    
  89.     <body>
  90.        
  91.         <?php
  92.         // Load header wrapper
  93.         $this->load->view('pages/header_wrapper');
  94.         ?>
  95.        
  96.         <div class="report-body" style="padding: .5em 0;">
  97.             <div style="max-width: 52%; margin: 0 auto;">
  98.                    
  99.                 <div style="text-align:center;">
  100.                     <h4>User Profile Page</h4>
  101.                 </div>
  102.                
  103.            
  104.                 <?php
  105.                 // If this user is logged in
  106.                 if(isset($user['id'])) {
  107.                    
  108.                    
  109.                     echo '<p style="text-align:center;">Welcome, '.$user['first_name'].' '.$user['last_name'].'</p>';
  110.                    
  111.                     ?>
  112.                
  113.                     <div id="user_profile_left_column" style="float:left;width:15%;border-right:1px solid #ccc;">
  114.                         <a id="show_user_profile" href="">Profile</a><br>
  115.                         <a id="show_user_bookmarks" href="">Bookmarks</a><br>
  116.                         <a id="show_user_alerts" href="">Notifications</a>
  117.                         <div style="margin-top:20px;"></div>
  118.                         <button class="member_profile_logout" type="button">Logout</button><br>
  119.                     </div>
  120.                    
  121.                     <div id="user_profile_right_column" style="float:left;width:75%;margin-left:5%;">
  122.                    
  123.                         <div id="user_profile" style="min-height:300px;">
  124.                            
  125.                             <h6 style="margin-top:0px;">Profile Information</h6>
  126.                             <table>
  127.                             <tbody style="display:block;">
  128.                                 <tr>
  129.                                     <td><strong>First Name:</strong></td>
  130.                                     <td><?php echo $user['first_name']; ?></td>
  131.                                 </tr>
  132.                                 <tr>
  133.                                     <td><strong>Last Name:</strong></td>
  134.                                     <td><?php echo $user['last_name']; ?></td>
  135.                                 </tr>
  136.                                 <tr>
  137.                                     <td><strong>Email:</strong></td>
  138.                                     <td><?php echo $user['email']; ?></td>
  139.                                 </tr>
  140.                                 <tr>
  141.                                     <td><strong>Password:</strong></td>
  142.                                     <td><a href="" id="member_change_password">Change Password</a></td>
  143.                                 </tr>
  144.                                 <tr>
  145.                                     <td><strong>Company Name:</strong></td>
  146.                                     <td><?php echo $user['comp_name']; ?></td>
  147.                                 </tr>
  148.                                 <tr>
  149.                                     <td><strong>Job Title:</strong></td>
  150.                                     <td><?php echo $user['job_title']; ?></td>
  151.                                 </tr>
  152.                                 <tr>
  153.                                     <td><strong>Date Joined:</strong></td>
  154.                                     <td><?php echo $user['created_on']; ?></td>
  155.                                 </tr>
  156.                             </tbody>
  157.                             </table>
  158.                         </div>
  159.                            
  160.                         <div id="user_bookmarks" style="display:none;min-height:300px;">
  161.                        
  162.                             <?php
  163.                             // Get user table
  164.                             $user_id = $user['id'];
  165.                             $user_sql = "SELECT * FROM admin_table WHERE user_id = '$user_id'";
  166.                             $user_query = $this->Comman_crud->custom_query($user_sql);
  167.                             $user_table = $user_query[0];
  168.                             ?>
  169.                            
  170.                             <h6 style="margin-top:0px;">Saved Bookmarks</h6>
  171.                            
  172.                             <div id="accordion">
  173.                        
  174.                                 <h3>Bookmarked Company Profiles</h3>
  175.                                 <div>
  176.                                     <?php
  177.                                     // Check bookmarks from user table
  178.                                     if(isset($user_table->bm_comps) && !empty($user_table->bm_comps)) {
  179.                                        
  180.                                         // Unserialize array
  181.                                         $array = unserialize($user_table->bm_comps);
  182.                                        
  183.                                         // Loop array to show each company
  184.                                         if(is_array($array) && !empty($array)) {
  185.                                             echo '<table><tbody>';
  186.                                             foreach ($array as $k => $v) {
  187.                                                
  188.                                                 $sql = "SELECT * FROM company_profile WHERE company_id = '$v'";
  189.                                                 $query = $this->Comman_crud->custom_query($sql);
  190.                                                 $result = $query[0];
  191.                                                
  192.                                                 echo '<tr>';
  193.                                                     echo '<td><a href="'.base_url().index_page().'search/at-a-glance-company/'.$result->company_id.'" class="member_bm_item">'.$result->firm_name.'</a></td>';
  194.                                                     echo '<td><a href="" class="remove_bm_comp remove" id="'.$result->company_id.'">Remove</a></td>';
  195.                                                 echo '</tr>';
  196.                                             }
  197.                                             echo '</tbody></table>';
  198.                                         }
  199.                                         else {
  200.                                             echo 'No bookmarks found.';
  201.                                         }
  202.                                     }
  203.                                     else {
  204.                                         echo 'No bookmarks found.';
  205.                                     }
  206.                                     ?>
  207.                                 </div>
  208.                                
  209.                                 <h3>Bookmarked Product Profiles</h3>
  210.                                 <div>
  211.                                     <?php
  212.                                     // Check bookmarks from user table
  213.                                     if(isset($user_table->bm_prods) && !empty($user_table->bm_prods)) {
  214.                                        
  215.                                         // Unserialize array
  216.                                         $array = unserialize($user_table->bm_prods);
  217.                                        
  218.                                         // Loop array to show each company
  219.                                         if(is_array($array) && !empty($array)) {
  220.                                             echo '<table><tbody>';
  221.                                             foreach ($array as $k => $v) {
  222.                                                
  223.                                                 // Split company id / product id
  224.                                                 $split = explode('/', $v);
  225.                                                 $comp_id = $split[0];
  226.                                                 $prod_id = $split[1];
  227.                                                
  228.                                                 $sql = "SELECT * FROM product_profile WHERE company_id = '$comp_id' AND product_id = '$prod_id'";
  229.                                                 $query = $this->Comman_crud->custom_query($sql);
  230.                                                 $result = $query[0];
  231.                                                
  232.                                                 echo '<tr>';
  233.                                                     echo '<td><a href="'.base_url().index_page().'search/at-a-glance-product/'.$result->company_id.'/'.$result->product_id.'" class="member_bm_item">'.$result->product_name.'</a></td>';
  234.                                                     echo '<td><a href="" class="remove_bm_prod remove" id="'.$result->company_id.'/'.$result->product_id.'">Remove</a></td>';
  235.                                                 echo '</tr>';
  236.                                             }
  237.                                             echo '</tbody></table>';
  238.                                         }
  239.                                         else {
  240.                                             echo 'No bookmarks found.';
  241.                                         }
  242.                                     }
  243.                                     else {
  244.                                         echo 'No bookmarks found.';
  245.                                     }
  246.                                     ?>
  247.                                 </div>
  248.                                
  249.                                 <h3>Bookmarked Company Comparisons</h3>
  250.                                 <div>
  251.                                     <?php
  252.                                     // Check bookmarks from user table
  253.                                     if(isset($user_table->bm_comps_compare) && !empty($user_table->bm_comps_compare)) {
  254.                                        
  255.                                         // Unserialize array
  256.                                         $array = unserialize($user_table->bm_comps_compare);
  257.                                        
  258.                                         // Loop array to show each company
  259.                                         if(is_array($array) && !empty($array)) {
  260.                                            
  261.                                             echo '<table><tbody>';
  262.                                             foreach ($array as $k => $v) {
  263.                                                
  264.                                                 // Remove brackets from string
  265.                                                 $strip_v = str_replace('[', '', str_replace(']', '', $v));
  266.                                                 $explode = explode(',', $strip_v);
  267.                                                 $comps = '';
  268.                                                
  269.                                                 foreach ($explode as $key => $value) {
  270.                                                
  271.                                                     $sql_comp = "SELECT * FROM company_profile WHERE company_id = '$value'";
  272.                                                     $query_comp = $this->Comman_crud->custom_query($sql_comp);
  273.                                                     $comp = $query_comp[0];
  274.                                                    
  275.                                                     $comps .= $comp->firm_name.'<br />';
  276.                                                 }
  277.                                                
  278.                                                 $comps = trim($comps);
  279.                                                
  280.                                                 echo '<tr>';
  281.                                                     echo '<td><a href="'.base_url().index_page().'search/advanced_search_compare/owners/'.$v.'" class="member_bm_item">'.$comps.'</a></td>';
  282.                                                     echo '<td><a href="" class="remove_bm_comp_compare remove" id="'.$v.'">Remove</a></td>';
  283.                                                 echo '</tr>';
  284.                                             }
  285.                                             echo '</tbody></table>';
  286.                                         }
  287.                                         else {
  288.                                             echo 'No bookmarks found.';
  289.                                         }
  290.                                     }
  291.                                     else {
  292.                                         echo 'No bookmarks found.';
  293.                                     }
  294.                                     ?>
  295.                                 </div>
  296.                                
  297.                                 <h3>Bookmarked Product Comparisons</h3>
  298.                                 <div>
  299.                                     <?php
  300.                                     // Check bookmarks from user table
  301.                                     if(isset($user_table->bm_prods_compare) && !empty($user_table->bm_prods_compare)) {
  302.                                        
  303.                                         // Unserialize array
  304.                                         $array = unserialize($user_table->bm_prods_compare);
  305.                                        
  306.                                         // Loop array to show each company
  307.                                         if(is_array($array) && !empty($array)) {
  308.                                             echo '<table><tbody>';
  309.                                             foreach ($array as $k => $v) {
  310.                                                
  311.                                                 // Remove brackets from string
  312.                                                 $strip_v = str_replace('[', '', str_replace(']', '', $v));
  313.                                                 $explode = explode(',', $strip_v);
  314.                                                 $prods = '';
  315.                                                
  316.                                                 foreach ($explode as $key => $value) {
  317.                                                    
  318.                                                     $ex_val = explode('-', $value);
  319.                                                     $comp_id = $ex_val[0];
  320.                                                     $prod_id = $ex_val[1];
  321.                                                
  322.                                                     $sql_prod = "SELECT * FROM product_profile WHERE product_id = '$prod_id' AND company_id = '$comp_id'";
  323.                                                     $query_prod = $this->Comman_crud->custom_query($sql_prod);
  324.                                                     $prod = $query_prod[0];
  325.                                                    
  326.                                                     $prods .= $prod->product_name.'<br />';
  327.                                                 }
  328.                                                
  329.                                                 $prods = trim($prods);
  330.                                                
  331.                                                 echo '<tr>';
  332.                                                     echo '<td><a href="'.base_url().index_page().'search/advanced_search_compare/products/'.$v.'" class="member_bm_item">'.$prods.'</a></td>';
  333.                                                     echo '<td><a href="" class="remove_bm_prod_compare remove" id="'.$v.'">Remove</a></td>';
  334.                                                 echo '</tr>';
  335.                                             }
  336.                                             echo '</tbody></table>';
  337.                                         }
  338.                                         else {
  339.                                             echo 'No bookmarks found.';
  340.                                         }
  341.                                     }
  342.                                     else {
  343.                                         echo 'No bookmarks found.';
  344.                                     }
  345.                                     ?>
  346.                                 </div>
  347.                                
  348.                                 <h3>Bookmarked Advanced Searches</h3>
  349.                                 <div>
  350.                                     <?php
  351.                                     // Check bookmarks from user table
  352.                                     if(isset($user_table->bm_adv_search) && !empty($user_table->bm_adv_search)) {
  353.                                        
  354.                                         // Unserialize array
  355.                                         $array = unserialize($user_table->bm_adv_search);
  356.                                        
  357.                                         // Loop array to show each company
  358.                                         if(is_array($array) && !empty($array)) {
  359.                                             echo '<table><tbody>';
  360.                                             foreach ($array as $k => $v) {
  361.                                                
  362.                                                 $search_name = isset($v['search_name']) ? $v['search_name'] : '<em>[no search name exists]</em>';
  363.                                                
  364.                                                 echo '<tr>';
  365.                                                     echo '<td><a href="'.base_url() . index_page().'search/advanced_search?filter='.htmlentities(serialize($v)).'" class="member_bm_item">'.$search_name.'</a></td>';
  366.                                                     echo '<td><a href="" class="remove_adv_search remove" id="'.htmlentities(serialize($v)).'">Remove</a></td>';
  367.                                                 echo '</tr>';
  368.                                             }
  369.                                             echo '</tbody></table>';
  370.                                         }
  371.                                         else {
  372.                                             echo 'No bookmarks found.';
  373.                                         }
  374.                                     }
  375.                                     else {
  376.                                         echo 'No bookmarks found.';
  377.                                     }
  378.                                     ?>
  379.                                 </div>
  380.                             </div>
  381.                         </div>
  382.                        
  383.                         <div id="user_alerts" style="display:none;min-height:300px;">
  384.                        
  385.                             <?php
  386.                             // Get user alerts
  387.                             $alerts = @unserialize($user_table->user_alerts);
  388.                             $alert_comps = isset($alerts['comp_alerts']) && $alerts['comp_alerts'] == 'Y' ? 'checked="checked"' : '';
  389.                             $alert_prods = isset($alerts['prod_alerts']) && $alerts['prod_alerts'] == 'Y' ? 'checked="checked"' : '';
  390.                             $alert_adv_search = isset($alerts['adv_search_alerts']) && $alerts['adv_search_alerts'] == 'Y' ? 'checked="checked"' : '';
  391.                             ?>
  392.                        
  393.                             <h6 style="margin-top:0px;">Notifications</h6>
  394.                            
  395.                             <p>Subscribe to new companies, products and advanced searchs.</p><br>
  396.                            
  397.                             <table style="display:block;">
  398.                             <tbody>
  399.                             <tr>
  400.                                 <td><input type="checkbox" id="subscribe_new_comps" <?php echo $alert_comps; ?> /></td>
  401.                                 <td>New Company Additions</td>
  402.                             </tr>
  403.                             <tr>
  404.                                 <td><input type="checkbox" id="subscribe_new_prods" <?php echo $alert_prods; ?> /></td>
  405.                                 <td>New Product Additions</td>
  406.                             </tr>
  407.                             <tr>
  408.                                 <td><input type="checkbox" id="subscribe_new_adv_search" <?php echo $alert_adv_search; ?> /></td>
  409.                                 <td>New Advanced Search Matches</td>
  410.                             </tr>
  411.                             </tbody>
  412.                             </table>
  413.                             <br>
  414.                             <button type="button" id="submit_user_alerts">Save</button>
  415.                         </div>
  416.                     </div>
  417.                     <div style="clear:both;margin-bottom:20px;"></div>
  418.                    
  419.                     <?php
  420.                 }
  421.                 else {
  422.                    
  423.                     echo 'This page is reserved for members only. Please login to continue.';
  424.                 }
  425.                 ?>
  426.             </div>
  427.         </div>
  428.        
  429.         <div class="report-footer">
  430.             <table>
  431.                 <tr>
  432.                     <td valign="top" style="text-align: center; border-bottom: 0;"><img src="http://ratesustainability.org/wp-content/uploads/2015/03/GISRfooter.jpg" width="1034" height="75"></td>
  433.                 </tr>
  434.                 <tr>
  435.                     <td style="text-align: center; width: 100%;" valign="top" class="footer">All content ©2014 GISR. All Rights Reserved.</td>
  436.                 </tr>
  437.             </table>
  438.         </div>
  439.        
  440.         <script type="text/javascript">
  441.        
  442.             jQuery(document).ready(function($) {
  443.                
  444.                 var confirm_change_pass = '';
  445.                
  446.                 // Profile page logout button
  447.                 $('.member_profile_logout').click(function() {
  448.                    
  449.                     window.location = "<?php echo base_url() . index_page() ?>login/logout/front";
  450.                 });
  451.                
  452.                 // Click user info boxes
  453.                 $('#show_user_profile').click(function(e) {
  454.                    
  455.                     e.preventDefault();
  456.                    
  457.                     $('#user_bookmarks').hide();
  458.                     $('#user_alerts').hide();
  459.                     $('#user_profile').show();
  460.                    
  461.                     resize_div_height();
  462.                 });
  463.                 $('#show_user_bookmarks').click(function(e) {
  464.                    
  465.                     e.preventDefault();
  466.                    
  467.                     $('#user_profile').hide();
  468.                     $('#user_alerts').hide();
  469.                     $('#user_bookmarks').show();
  470.                    
  471.                     // Set accordian bookmarks
  472.                     $( "#accordion" ).accordion();
  473.                    
  474.                     resize_div_height();
  475.                 });
  476.                 $('#show_user_alerts').click(function(e) {
  477.                    
  478.                     e.preventDefault();
  479.                    
  480.                     $('#user_profile').hide();
  481.                     $('#user_bookmarks').hide();
  482.                     $('#user_alerts').show();
  483.                    
  484.                     resize_div_height();
  485.                 });
  486.                
  487.                 // Resize column heights
  488.                 resize_div_height();
  489.                 function resize_div_height() {
  490.                    
  491.                     // Get right column height
  492.                     right_height = $('#user_profile_right_column').height();
  493.                     // Set left column height
  494.                     $('#user_profile_left_column').height(right_height);
  495.                 }
  496.                
  497.                
  498.                 // Change password
  499.                 $('#member_change_password').click(function(e) {
  500.                    
  501.                     e.preventDefault();
  502.                    
  503.                     // Set form data
  504.                     $content =
  505.                         '<div id="change_pass_div">' +
  506.                             '<p>Please use the form below to change the account password. Once completed; the account will be logged out automatically. Please login again with the new password to continue.</p>' +
  507.                             'Original Password:<br>' +
  508.                             '<input type="password" id="change_pass_orig" /><br><br>' +
  509.                             'New Password:<br>' +
  510.                             '<input type="password" id="change_pass_new" /><br><br>' +
  511.                             'Confirm New Password:<br>' +
  512.                             '<input type="password" id="change_pass_new_confirm" /><br><br>' +
  513.                         '</div>'
  514.                     ;
  515.                    
  516.                     // Show confirm form
  517.                     confirm_change_pass = $.confirm({
  518.                         title: 'Change Password',
  519.                         content: $content,
  520.                         columnClass: 'col-md-4 col-md-offset-4',
  521.                         confirmButtonClass: 'btn-info',
  522.                         confirmButton: 'Change',
  523.                         cancelButtonClass: 'btn-danger',
  524.                         confirm: function() {
  525.                            
  526.                             // Get form password values
  527.                             pass_orig = this.$b.find('#change_pass_orig').val();
  528.                             pass_new = this.$b.find('#change_pass_new').val();
  529.                             pass_new_confirm = this.$b.find('#change_pass_new_confirm').val();
  530.                            
  531.                             // Check if any fields are blank
  532.                             if(pass_orig == '') {
  533.                                
  534.                                 $.alert({
  535.                                     title: 'Original Password Blank',
  536.                                     content: 'The Original Password field is required.',
  537.                                     columnClass: 'col-md-4 col-md-offset-4',
  538.                                     confirmButtonClass: 'btn-danger'
  539.                                 });
  540.                                 return false;
  541.                             }
  542.                             if(pass_new == '') {
  543.                                
  544.                                 $.alert({
  545.                                     title: 'New Password Blank',
  546.                                     content: 'The New Password field is required.',
  547.                                     columnClass: 'col-md-4 col-md-offset-4',
  548.                                     confirmButtonClass: 'btn-danger'
  549.                                 });
  550.                                 return false;
  551.                             }
  552.                             if(pass_new_confirm == '') {
  553.                                
  554.                                 $.alert({
  555.                                     title: 'Confirm New Password Blank',
  556.                                     content: 'The Confirm New Password field is required.',
  557.                                     columnClass: 'col-md-4 col-md-offset-4',
  558.                                     confirmButtonClass: 'btn-danger'
  559.                                 });
  560.                                 return false;
  561.                             }
  562.                            
  563.                             // Ensure new password and confirm new password match
  564.                             if(pass_new !== pass_new_confirm) {
  565.                                
  566.                                 $.alert({
  567.                                     title: 'Password Mismatch',
  568.                                     content: 'The New Password and Confirm New Password fields must match.',
  569.                                     columnClass: 'col-md-4 col-md-offset-4',
  570.                                     confirmButtonClass: 'btn-danger'
  571.                                 });
  572.                                 return false;
  573.                             }
  574.                            
  575.                             // Run ajax to check old password
  576.                             $.ajax({
  577.                                 type: "POST",
  578.                                 url: '<?php echo base_url() . index_page(); ?>member_profile/user_change_password',
  579.                                 data: {pass_orig: pass_orig, pass_new: pass_new},
  580.                                 success: function(data){
  581.                                    
  582.                                     // If orig passwords is incorrect
  583.                                     if(data.status == 'incorrect_orig_pass') {
  584.                                        
  585.                                         $.alert({
  586.                                             title: 'Incorrect Password',
  587.                                             content: 'The Original Password does not match this user account. Please try again; or logout and request a password reset.',
  588.                                             columnClass: 'col-md-4 col-md-offset-4',
  589.                                             confirmButtonClass: 'btn-danger'
  590.                                         });
  591.                                     }
  592.                                    
  593.                                     // If this password was changed successfully
  594.                                     if(data.status == 'success') {
  595.                                        
  596.                                         // Close password change dialog
  597.                                         confirm_change_pass.close();
  598.                                        
  599.                                         // Redirect user to logout
  600.                                         window.location.href = '<?php echo base_url() . index_page(); ?>login/logout/front';
  601.                                     }
  602.                                 }
  603.                             });
  604.                            
  605.                             return false;
  606.                         }
  607.                     });
  608.                 });
  609.                
  610.                
  611.                 // Remove bookmarked company
  612.                 $('.remove_bm_comp').click(function(e) {
  613.                    
  614.                     e.preventDefault();
  615.                     var $this = $(this);
  616.                    
  617.                     // Get company id
  618.                     comp_id = $(this).attr('id');
  619.                    
  620.                     $.ajax({
  621.                         type: "POST",
  622.                         url: '<?php echo base_url() . index_page(); ?>ajax/bookmark_company_remove',
  623.                         data: {comp_id: comp_id},
  624.                         success: function(data){
  625.                            
  626.                             if(data.remove_message == 'success') {
  627.                                
  628.                                 // Remove table row from results
  629.                                 $($this).parent().parent().remove();
  630.                             }
  631.                         }
  632.                     });
  633.                 });
  634.                
  635.                 // Remove bookmarked product
  636.                 $('.remove_bm_prod').click(function(e) {
  637.                    
  638.                     e.preventDefault();
  639.                     var $this = $(this);
  640.                    
  641.                     // Get company id
  642.                     this_id = $(this).attr('id');
  643.                     split_id = this_id.split('/');
  644.                    
  645.                     comp_id = split_id[0];
  646.                     prod_id = split_id[1];
  647.                    
  648.                     $.ajax({
  649.                         type: "POST",
  650.                         url: '<?php echo base_url() . index_page(); ?>ajax/bookmark_product_remove',
  651.                         data: {comp_id: comp_id, prod_id: prod_id},
  652.                         success: function(data){
  653.                            
  654.                             if(data.remove_message == 'success') {
  655.                                
  656.                                 // Remove table row from results
  657.                                 $($this).parent().parent().remove();
  658.                             }
  659.                         }
  660.                     });
  661.                 });
  662.                
  663.                 // Remove bookmarked company comparison
  664.                 $('.remove_bm_comp_compare').click(function(e) {
  665.                    
  666.                     e.preventDefault();
  667.                     var $this = $(this);
  668.                    
  669.                     // Get company id
  670.                     comp_array = $(this).attr('id');
  671.                    
  672.                     $.ajax({
  673.                         type: "POST",
  674.                         url: '<?php echo base_url() . index_page(); ?>ajax/bookmark_company_compare_remove',
  675.                         data: {comp_array: comp_array},
  676.                         success: function(data){
  677.                            
  678.                             if(data.remove_message == 'success') {
  679.                                
  680.                                 // Remove table row from results
  681.                                 $($this).parent().parent().remove();
  682.                             }
  683.                         }
  684.                     });
  685.                 });
  686.                
  687.                 // Remove bookmarked product comparison
  688.                 $('.remove_bm_prod_compare').click(function(e) {
  689.                    
  690.                     e.preventDefault();
  691.                     var $this = $(this);
  692.                    
  693.                     // Get company id
  694.                     prod_array = $(this).attr('id');
  695.                    
  696.                     $.ajax({
  697.                         type: "POST",
  698.                         url: '<?php echo base_url() . index_page(); ?>ajax/bookmark_product_compare_remove',
  699.                         data: {prod_array: prod_array},
  700.                         success: function(data){
  701.                            
  702.                             if(data.remove_message == 'success') {
  703.                                
  704.                                 // Remove table row from results
  705.                                 $($this).parent().parent().remove();
  706.                             }
  707.                         }
  708.                     });
  709.                 });
  710.                
  711.                 // Remove bookmarked advanced search
  712.                 $('.remove_adv_search').click(function(e) {
  713.                    
  714.                     e.preventDefault();
  715.                     var $this = $(this);
  716.                    
  717.                     // Get search id
  718.                     search_array = $(this).attr('id');
  719.                    
  720.                     $.ajax({
  721.                         type: "POST",
  722.                         url: '<?php echo base_url() . index_page(); ?>ajax/bookmark_adv_search_remove',
  723.                         data: {search_array: search_array},
  724.                         success: function(data){
  725.                            
  726.                             if(data.remove_message == 'success') {
  727.                                
  728.                                 // Remove table row from results
  729.                                 $($this).parent().parent().remove();
  730.                             }
  731.                         }
  732.                     });
  733.                 });
  734.                
  735.                 // Submit user alerts
  736.                 $('#submit_user_alerts').click(function() {
  737.                    
  738.                     // Get form checkbox values
  739.                     comp_alerts = ($('#subscribe_new_comps').is(':checked')) ? 'Y' : 'N';
  740.                     prod_alerts = ($('#subscribe_new_prods').is(':checked')) ? 'Y' : 'N';
  741.                     adv_search_alerts = ($('#subscribe_new_adv_search').is(':checked')) ? 'Y' : 'N';
  742.                    
  743.                     $.ajax({
  744.                         type: "POST",
  745.                         url: '<?php echo base_url() . index_page(); ?>member_profile/save_alerts',
  746.                         data: {comp_alerts: comp_alerts, prod_alerts: prod_alerts, adv_search_alerts: adv_search_alerts},
  747.                         success: function(data){
  748.                            
  749.                             if(data.message == 'success') {
  750.                                
  751.                                 $.alert({
  752.                                     title: 'Alerts Saved',
  753.                                     content: 'The alerts have been saved successfully.',
  754.                                     columnClass: 'col-md-4 col-md-offset-4',
  755.                                     confirmButtonClass: 'btn-info'
  756.                                 });
  757.                                
  758.                                 return false;
  759.                             }
  760.                         }
  761.                     });
  762.                 });
  763.             });
  764.         </script>
  765.        
  766.     </body>
  767. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement