Changeset 1318315
- Timestamp:
- 12/30/2015 05:42:05 AM (10 years ago)
- Location:
- keeping-points/trunk
- Files:
-
- 2 edited
-
keeping-points.php (modified) (8 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
keeping-points/trunk/keeping-points.php
r1286247 r1318315 5 5 Plugin URI: http://www.dlaugh.com/plugins/keeping-points.php/ 6 6 Description: A great plugin to assist in keeping points for a church program or for employees in a rewards system. 7 Version: 0.9 7 Version: 0.9.7 8 8 Author: David Laughlin 9 9 Author URI: http://www.dlaugh.com … … 297 297 </td> 298 298 </tr> 299 <!-- Select Drop-Down for button color --> 300 <tr> 301 <th scope="row">Select button color</th> 302 <td> 303 <select name='keeping_points_options[button_color]'> 304 <option value='primary' <?php selected('primary', $options['button_color']); ?>><?php _e( 'primary', 'keeping-points' ); ?></option> 305 <option value='success' <?php selected('success', $options['button_color']); ?>><?php _e( 'success', 'keeping-points' ); ?></option> 306 <option value='info' <?php selected('info', $options['button_color']); ?>><?php _e( 'info', 'keeping-points' ); ?></option> 307 <option value='warning' <?php selected('warning', $options['button_color']); ?>><?php _e( 'warning', 'keeping-points' ); ?></option> 308 <option value='danger' <?php selected('danger', $options['button_color']); ?>><?php _e( 'danger', 'keeping-points' ); ?></option> 309 </select> 310 <span style="color:#666666;margin-left:2px;">Add a comment here to explain more about how to use the option above</span> 311 </td> 312 </tr> 313 299 314 <?php 300 315 $button_amount = $options["button_amount"]; … … 379 394 function shortpoints_process_ajax() { 380 395 $options = get_option('keeping_points_options'); 396 $btn_color = $options['button_color']; 397 $btn_color_build = 'btn btn-' . $btn_color . ' '; 381 398 $btnId = $_POST['name']; 382 399 $btnName = $_POST['btnName']; 383 400 $btnClass = $_POST['btnClass']; 384 $changed_class = str_replace( 'btn btn-info ', '', $btnClass);401 $changed_class = str_replace( $btn_color_build, '', $btnClass); 385 402 $changed_name = str_replace('_', ' ', $btnName); 386 403 $num_start = $changed_class . "_points"; … … 409 426 function dlaugh_keeping_points_plugin() 410 427 { 428 429 if ( is_user_logged_in() ) { 411 430 wp_enqueue_script( 'shortpoints-ajax' , plugin_dir_url(__FILE__) . 'js/shortpoints-ajax.js', array('jquery'), '', true ); 412 431 … … 416 435 417 436 )); 437 418 438 //add bootstrap last 419 439 wp_enqueue_style( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css' ); 420 440 $output = '<div class="container"><div class="row">'; 421 441 $options = get_option('keeping_points_options'); 442 $btn_color = $options['button_color']; 443 $btn_color_build = 'btn btn-' . $btn_color . ' '; 422 444 $number = $options['button_amount']; 423 445 $ppl_num = $options['ppl_amount']; … … 436 458 $output.= '<div style="display:inline-block; margin:5px;">'; 437 459 $output.= '<button name="' . $changed_id . '"'; 438 $output.= 'type="button" class=" btn btn-info '. $point . '" id = "' . ($for_margin . $changed_id) . '">';460 $output.= 'type="button" class="' . $btn_color_build . $point . '" id = "' . ($for_margin . $changed_id) . '">'; 439 461 $output.= $options[$point] . '</button></div>'; 440 462 } … … 445 467 $changed_id = str_replace(' ', '_', $name_call); 446 468 $point_total = "point_total_" . $changed_id; 469 if (!$options[$point_total]) { 470 $options[$point_total] = 0; 471 } 447 472 $output.= '<div style="display:inline-block; margin:5px; width:50px;">'; 448 $output.= '<button name="' . $changed_id . '" type="button" class=" btn btn-info '. $point . '"';473 $output.= '<button name="' . $changed_id . '" type="button" class="' . $btn_color_build . $point . '"'; 449 474 $output.= 'id = "' . ($changed_id . "_neg") . '">-</button></div>'; 450 475 $output.= '<br /><div id ="' . ($changed_id . "result") . '">'; … … 455 480 456 481 return $output; 482 483 } else { 484 echo('<h3 style="color:red;">You must be a logged in user to enable point system</h3>'); 485 486 //add bootstrap last 487 wp_enqueue_style( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css' ); 488 $output = '<div class="container"><div class="row">'; 489 $options = get_option('keeping_points_options'); 490 $btn_color = $options['button_color']; 491 $btn_color_build = 'btn btn-' . $btn_color . ' '; 492 $number = $options['button_amount']; 493 $ppl_num = $options['ppl_amount']; 494 for($j=0;$j < $ppl_num; $j++) { 495 $point = "txt_" . $j; 496 $name_id = "txt_" . $j . '_name'; 497 if ($options[$name_id]) { 498 $output .= '<section>'; 499 for($i=0;$i < $number; $i++) { 500 $point = "txt_" . $i; 501 $for_margin = $options[$point]; 502 $name_id = "txt_" . $j . '_name'; 503 $name_call = $options[$name_id]; 504 $changed_id = str_replace(' ', '_', $name_call); 505 if ($options[$point] !== "") { 506 $output.= '<div style="display:inline-block; margin:5px;">'; 507 $output.= '<button name="' . $changed_id . '"'; 508 $output.= 'type="button" class="' . $btn_color_build . $point . '" id = "' . ($for_margin . $changed_id) . '">'; 509 $output.= $options[$point] . '</button></div>'; 510 } 511 } 512 513 $name_id = "txt_" . $j . "_name"; 514 $name_call = $options[$name_id]; 515 $changed_id = str_replace(' ', '_', $name_call); 516 $point_total = "point_total_" . $changed_id; 517 if (!$options[$point_total]) { 518 $options[$point_total] = 0; 519 } 520 $output.= '<div style="display:inline-block; margin:5px; width:50px;">'; 521 $output.= '<button name="' . $changed_id . '" type="button" class="' . $btn_color_build . $point . '"'; 522 $output.= 'id = "' . ($changed_id . "_neg") . '">-</button></div>'; 523 $output.= '<br /><div id ="' . ($changed_id . "result") . '">'; 524 $output.= $options[$name_id] . "'s Total Points: " . $options[$point_total] . '</div><br /> </section>'; 525 } 526 } 527 $output.= '</div></div>'; 528 529 return $output; 530 } 457 531 } 458 532 -
keeping-points/trunk/readme.txt
r1286247 r1318315 8 8 Requires at least: 4.3.1 9 9 Tested up to: 4.3.1 10 Stable tag: 0.9. 611 Version: 0.9. 610 Stable tag: 0.9.7 11 Version: 0.9.7 12 12 13 13 Keeping Points is a plugin to help create a points reward or tracking system for each person within a program, church, or company. … … 34 34 In the future I hope to add the following: 35 35 36 * Add options for different button designs.37 36 * Add options to change text in the results area where the points are displayed. 38 37 * Change the user interface to have the options to exclude buttons and just display points and accomplishments in table format.
Note: See TracChangeset
for help on using the changeset viewer.