Changeset 1162710
- Timestamp:
- 05/18/2015 02:00:59 PM (11 years ago)
- Location:
- questions
- Files:
-
- 97 added
- 4 edited
-
tags/1.0.0 beta 12 (added)
-
tags/1.0.0 beta 12/.project (added)
-
tags/1.0.0 beta 12/README.txt (added)
-
tags/1.0.0 beta 12/assets (added)
-
tags/1.0.0 beta 12/assets/.DS_Store (added)
-
tags/1.0.0 beta 12/assets/banner-772x250.png (added)
-
tags/1.0.0 beta 12/assets/icon-128x128.png (added)
-
tags/1.0.0 beta 12/assets/icon-256x256.png (added)
-
tags/1.0.0 beta 12/assets/images (added)
-
tags/1.0.0 beta 12/assets/images/icon-dropdown.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-multiplechoice.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-onechoice.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-separator.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-split-form.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-text.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-textarea.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-textfield.png (added)
-
tags/1.0.0 beta 12/assets/images/icon-updown.png (added)
-
tags/1.0.0 beta 12/assets/images/loading-blue.gif (added)
-
tags/1.0.0 beta 12/assets/images/loading.gif (added)
-
tags/1.0.0 beta 12/assets/screenshot-1.png (added)
-
tags/1.0.0 beta 12/assets/screenshot-2.png (added)
-
tags/1.0.0 beta 12/assets/screenshot-3.png (added)
-
tags/1.0.0 beta 12/assets/screenshot-4.png (added)
-
tags/1.0.0 beta 12/assets/screenshot-5.png (added)
-
tags/1.0.0 beta 12/assets/screenshot-6.png (added)
-
tags/1.0.0 beta 12/assets/screenshot-7.png (added)
-
tags/1.0.0 beta 12/components (added)
-
tags/1.0.0 beta 12/components/admin (added)
-
tags/1.0.0 beta 12/components/admin/admin.php (added)
-
tags/1.0.0 beta 12/components/admin/includes (added)
-
tags/1.0.0 beta 12/components/admin/includes/js (added)
-
tags/1.0.0 beta 12/components/admin/includes/js/admin-questions-post-type.js (added)
-
tags/1.0.0 beta 12/components/admin/pages (added)
-
tags/1.0.0 beta 12/components/admin/pages/settings.php (added)
-
tags/1.0.0 beta 12/components/charts (added)
-
tags/1.0.0 beta 12/components/charts/chart-creator-c3.php (added)
-
tags/1.0.0 beta 12/components/charts/chart-creator-dimple.php (added)
-
tags/1.0.0 beta 12/components/charts/chart-creator.php (added)
-
tags/1.0.0 beta 12/components/charts/charts.php (added)
-
tags/1.0.0 beta 12/components/charts/data-abstraction.php (added)
-
tags/1.0.0 beta 12/components/charts/includes (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty/d3 (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty/d3/LICENSE (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty/d3/d3.js (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty/d3/d3.min.js (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty/dimple (added)
-
tags/1.0.0 beta 12/components/charts/includes/3rdparty/dimple/dimple.v2.1.2.min.js (added)
-
tags/1.0.0 beta 12/components/charts/shortcodes.php (added)
-
tags/1.0.0 beta 12/components/component.php (added)
-
tags/1.0.0 beta 12/components/core (added)
-
tags/1.0.0 beta 12/components/core/core.php (added)
-
tags/1.0.0 beta 12/components/core/export.php (added)
-
tags/1.0.0 beta 12/components/core/process-response.php (added)
-
tags/1.0.0 beta 12/components/core/questions.php (added)
-
tags/1.0.0 beta 12/components/core/shortcodes.php (added)
-
tags/1.0.0 beta 12/components/core/tools (added)
-
tags/1.0.0 beta 12/components/core/tools/post.php (added)
-
tags/1.0.0 beta 12/components/core/tools/survey.php (added)
-
tags/1.0.0 beta 12/components/element.php (added)
-
tags/1.0.0 beta 12/components/elements (added)
-
tags/1.0.0 beta 12/components/elements/description.php (added)
-
tags/1.0.0 beta 12/components/elements/dropdown.php (added)
-
tags/1.0.0 beta 12/components/elements/elements.php (added)
-
tags/1.0.0 beta 12/components/elements/multiplechoice.php (added)
-
tags/1.0.0 beta 12/components/elements/onechoice.php (added)
-
tags/1.0.0 beta 12/components/elements/separator.php (added)
-
tags/1.0.0 beta 12/components/elements/splitter.php (added)
-
tags/1.0.0 beta 12/components/elements/text.php (added)
-
tags/1.0.0 beta 12/components/elements/textarea.php (added)
-
tags/1.0.0 beta 12/components/survey.php (added)
-
tags/1.0.0 beta 12/functions.php (added)
-
tags/1.0.0 beta 12/includes (added)
-
tags/1.0.0 beta 12/includes/css (added)
-
tags/1.0.0 beta 12/includes/css/admin.css (added)
-
tags/1.0.0 beta 12/includes/css/display.css (added)
-
tags/1.0.0 beta 12/includes/css/fonts (added)
-
tags/1.0.0 beta 12/includes/css/fonts.css (added)
-
tags/1.0.0 beta 12/includes/css/fonts/questions.eot (added)
-
tags/1.0.0 beta 12/includes/css/fonts/questions.svg (added)
-
tags/1.0.0 beta 12/includes/css/fonts/questions.ttf (added)
-
tags/1.0.0 beta 12/includes/css/fonts/questions.woff (added)
-
tags/1.0.0 beta 12/init.php (added)
-
tags/1.0.0 beta 12/languages (added)
-
tags/1.0.0 beta 12/languages/plugin.po (added)
-
tags/1.0.0 beta 12/languages/questions-locale-de_DE.mo (added)
-
tags/1.0.0 beta 12/languages/questions-locale-de_DE.po (added)
-
tags/1.0.0 beta 12/languages/questions-locale-fa_IR.mo (added)
-
tags/1.0.0 beta 12/languages/questions-locale-fa_IR.po (added)
-
tags/1.0.0 beta 12/languages/questions-locale-nl_NL.mo (added)
-
tags/1.0.0 beta 12/languages/questions-locale-nl_NL.po (added)
-
tags/1.0.0 beta 12/languages/questions-locale-sv_SE.mo (added)
-
tags/1.0.0 beta 12/languages/questions-locale-sv_SE.po (added)
-
tags/1.0.0 beta 12/license.txt (added)
-
tags/1.0.0 beta 12/testing (added)
-
tags/1.0.0 beta 12/testing/main.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/components/charts/data-abstraction.php (modified) (9 diffs)
-
trunk/components/core/export.php (modified) (6 diffs)
-
trunk/init.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
questions/trunk/README.txt
r1162557 r1162710 69 69 == Changelog == 70 70 71 = 1.0.0 beta 12 = 72 * Fixed exporting bug on exporting multiple choice fields results 73 * Enhanced code structure 74 71 75 = 1.0.0 beta 11 = 72 76 * Added message on reaching PHP max_num_fields -
questions/trunk/components/charts/data-abstraction.php
r1162557 r1162710 31 31 32 32 class Questions_AbstractData{ 33 /**34 * Initializes the Component.35 * @since 1.0.036 */37 public function __construct() {38 } // end constructor39 40 33 41 34 /** … … 43 36 * @param array $response_array 44 37 * @return array $ordered_data 38 * @since 1.0.0 45 39 */ 46 40 public static function order_for_charting( $response_array ){ 41 47 42 global $wpdb, $questions_global; 48 43 … … 100 95 } 101 96 102 103 public static function lines( $response_array ){ 97 /** 98 * Prepare data for printing content in lines (e.g. for CSV export) 99 * @param array $response_array Response array of a survey 100 * @return array $lines Ordered data prepared to be used in lines 101 * @since 1.0.0 102 */ 103 public static function order_in_lines( $response_array ){ 104 105 // Only starting if there is any data 104 106 if( is_array( $response_array ) ): 105 107 106 // Getting Headlines 108 /** 109 * Getting Headlines by running each element 110 */ 107 111 foreach( $response_array AS $question_id => $question ): 108 112 109 if( $question[ 'sections' ] ): 113 // If element uses sections 114 if( array_key_exists( 'sections', $question ) && TRUE == $question[ 'sections' ]): 110 115 foreach( $question[ 'responses' ] AS $response ): 111 116 $i = 0; … … 123 128 endforeach; 124 129 125 break; 126 endforeach; 127 128 elseif( $question[ 'array' ] ): 130 break; 131 endforeach; 132 133 // If there are more answers than one posssible (e.g. Multiple Choice) 134 elseif( array_key_exists( 'array', $question ) && TRUE == $question[ 'array' ] ): 135 129 136 foreach( $question[ 'responses' ] AS $response ): 130 137 $i = 0; … … 133 140 $lines[ 0 ][ $question_id . '-' . $i++ ] = self::filter_string( $column ); 134 141 endforeach; 135 break; 136 endforeach; 142 break; 143 endforeach; 144 145 // If there is only one value for one element possible 137 146 else: 138 147 $lines[ 0 ][ $question_id ] = self::filter_string( $question[ 'question' ] ); … … 140 149 endforeach; 141 150 142 // Getting Content 151 /** 152 * Getting content by running each element 153 */ 143 154 foreach( $response_array AS $question_id => $question ): 144 155 145 if( $question[ 'sections' ] ): 156 // If element uses sections 157 if( array_key_exists( 'sections', $question ) && TRUE == $question[ 'sections' ] ): 158 146 159 foreach( $question[ 'responses' ] AS $response_id => $response ): 147 160 $i = 0; … … 158 171 159 172 endforeach; 160 elseif( $question[ 'array' ] ): 161 foreach( $question[ 'responses' ] AS $response ): 162 $i = 0; 173 174 // If there are more answers than one posssible (e.g. Multiple Choice) 175 elseif( array_key_exists( 'array', $question ) && TRUE == $question[ 'array' ] ): 176 177 // Running response of each user 178 foreach( $question[ 'responses' ] AS $response_id => $response ): 179 $i = 0; 180 181 // Running each answer of response 163 182 foreach( $response AS $key => $value ): 164 183 $lines[ $response_id ][ $question_id . '-' . $i++ ] = self::filter_string( $value ); 165 184 endforeach; 166 endforeach; 185 186 endforeach; 187 188 // If there is only one value for one element possible 167 189 else: 190 168 191 foreach( $question[ 'responses' ] AS $response_id => $value ): 169 192 $lines[ $response_id ][ $question_id ] = self::filter_string( $value ); 170 193 endforeach; 194 171 195 endif; 172 196 … … 179 203 } 180 204 205 /** 206 * Filtering not wanted chars 207 * @param string $string The string to filter 208 * @return string $string The filtered string 209 * @since 1.0.0 210 */ 181 211 public static function filter_string( $string ){ 182 212 $string = utf8_decode( $string ); … … 190 220 } 191 221 222 /** 223 * Removing new lines 224 * @param string $string The string to filter 225 * @return string $string The filtered string 226 * @since 1.0.0 227 */ 192 228 public static function remove_new_lines( $string ){ 193 229 return trim( preg_replace( '/\s\s+/', ' ', $string ) ); -
questions/trunk/components/core/export.php
r1128186 r1162710 31 31 32 32 class Questions_Export{ 33 33 34 /** 34 35 * Initializes the Component. … … 40 41 } // end constructor 41 42 43 /** 44 * Add export link to the overview page 45 * @param array $actions Actions links in an array 46 * @param object $post Post object 47 * @since 1.0.0 48 */ 42 49 function add_export_link( $actions, $post ){ 43 50 if( 'questions' != $post->post_type ) … … 49 56 } 50 57 58 /** 59 * Start exporting by evaluating $_GET variables 60 * @since 1.0.0 61 */ 51 62 function export(){ 52 63 global $wpdb, $questions_global; … … 58 69 $survey = new Questions_Survey( $survey_id ); 59 70 $export_filename = sanitize_title( $survey->title ); 71 $export_data = $survey->get_responses(); 60 72 61 73 header( "Pragma: public" ); … … 66 78 switch( $export_type ){ 67 79 case 'CSV': 68 $content = $this->get_csv( $ survey->get_responses());80 $content = $this->get_csv( $export_data ); 69 81 $bytes = strlen( $content ); 70 82 $charset = 'UTF-8'; … … 85 97 endif; 86 98 } 87 99 100 /** 101 * Getting CSV content 102 * @param array $response_array Response array of a survey 103 * @return string $output CSV content 104 */ 88 105 public function get_csv( $response_array ){ 89 $lines = Questions_AbstractData:: lines( $response_array );106 $lines = Questions_AbstractData::order_in_lines( $response_array ); 90 107 91 108 // Running each question (element without separators etc) -
questions/trunk/init.php
r1162557 r1162710 4 4 * Plugin URI: http://www.awesome.ug 5 5 * Description: Drag & drop your survey/poll with the WordPress Questions plugin. 6 * Version: 1.0.0 beta 1 16 * Version: 1.0.0 beta 12 7 7 * Author: awesome.ug 8 8 * Author URI: http://www.awesome.ug … … 22 22 /** 23 23 * Initializes the plugin. 24 *25 24 * @since 1.0.0 26 25 */
Note: See TracChangeset
for help on using the changeset viewer.