Changeset 504350
- Timestamp:
- 02/13/2012 03:33:19 PM (14 years ago)
- Location:
- surveypress
- Files:
-
- 6 edited
-
tags/1.0.9/survey-press.php (modified) (2 diffs)
-
tags/1.0.9/view/config-menu.php (modified) (4 diffs)
-
tags/1.0.9/view/option-menu.php (modified) (4 diffs)
-
trunk/survey-press.php (modified) (2 diffs)
-
trunk/view/config-menu.php (modified) (4 diffs)
-
trunk/view/option-menu.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
surveypress/tags/1.0.9/survey-press.php
r484436 r504350 66 66 $show_option_survey_notification = 'show_survey_notification'; 67 67 $show_option_import_users = 'import_users'; 68 $same_option_password = 'same_password'; 68 $same_option_password = 'same_password'; 69 $list_option_public_surveys = 'list_public_survey_only'; 69 70 // respective values from database. 70 71 // Read in existing option value from database … … 105 106 } 106 107 108 if ( get_option( $list_option_public_surveys ) == '' ) 109 { 110 $list_value_public_surveys = 1; 111 } 112 else 113 { 114 $list_value_public_surveys = (int) get_option( $list_option_public_surveys ); 115 } 107 116 108 117 /** -
surveypress/tags/1.0.9/view/config-menu.php
r484436 r504350 10 10 global $db_value_host,$db_value_name,$db_value_pwd,$db_value_user,$db_value_prefix,$db_value_url; 11 11 12 global $ show_value_survey_notification,$db_connection_error_name,$db_connection_error;12 global $list_value_public_surveys,$show_value_survey_notification,$db_connection_error_name,$db_connection_error; 13 13 14 14 … … 179 179 global $lsdb; 180 180 //$lsdb = new wpdb( $db_value_user, $db_value_pwd, $db_value_name, $db_value_host ); 181 182 $public_surveys = $lsdb->get_results( "SELECT a.sid, b.surveyls_title, a.publicstatistics183 FROM ".$db_value_prefix."surveys AS a184 INNER JOIN ".$db_value_prefix."surveys_languagesettings AS b185 ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language )186 WHERE surveyls_survey_id=a.sid187 AND surveyls_language=a.language188 AND a.active='Y'189 AND a.listpublic='Y'190 AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null))191 AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null))192 ORDER BY surveyls_title");181 $query = "SELECT a.sid, b.surveyls_title, a.listpublic 182 FROM ".$db_value_prefix."surveys AS a 183 INNER JOIN ".$db_value_prefix."surveys_languagesettings AS b 184 ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language ) 185 WHERE surveyls_survey_id=a.sid 186 AND surveyls_language=a.language 187 AND a.active='Y' 188 AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null)) 189 AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null)) 190 ORDER BY surveyls_title"; 191 192 $public_surveys = $lsdb->get_results( $query ); 193 193 194 194 //number of surveys active and public 195 $count = 0; 195 $publiccount = 0; 196 //number of surveys active and private 197 $privatecount = 0; 196 198 //public active surveys information 197 $survey = array(); 199 $publicsurvey = array(); 200 //private active surveys information 201 $privatesurvey = array(); 198 202 199 203 if ( $public_surveys ) … … 201 205 foreach ( $public_surveys as $surveyinfo ) 202 206 { 203 $survey[$count]['sid'] = $surveyinfo->sid; 204 $survey[$count]['title'] = $surveyinfo->surveyls_title; 205 206 $count = $count + 1; 207 if ( $surveyinfo->listpublic == 'Y' ) 208 { 209 $publicsurvey[$publiccount]['sid'] = $surveyinfo->sid; 210 $publicsurvey[$publiccount]['title'] = $surveyinfo->surveyls_title; 211 212 $publiccount++; 213 } 214 else 215 { 216 $privatesurvey[$privatecount]['sid'] = $surveyinfo->sid; 217 $privatesurvey[$privatecount]['title'] = $surveyinfo->surveyls_title; 218 219 $privatecount++; 220 } 207 221 } 208 222 } … … 214 228 <br/> 215 229 <?php 216 if ( $count ) //there exist some public and active surveys. 217 { 218 printf(__("You can take following %d public survey(s), if you haven't already. Take them now :"), $count); 219 220 $temp = 0; 221 while ( $temp < $count ) 222 { 223 if ( $temp == 0) 224 { 225 echo "<ul type='disc'>"; 226 } 227 printf(__("<li> <a href='".$db_value_url."/index.php?sid=".$survey[$temp]['sid']."' target='_blank'><strong> %s </strong></a> </li>"), $survey[$temp]['title']); 228 229 if ( $temp == ( $count - 1 ) ) 230 { 231 echo "</ul>"; 232 } 233 $temp = $temp + 1; 234 } //end while 230 231 $count = $publiccount; //public surveys will always be displayed! 232 if ( ((int)$list_value_public_surveys == 1 ) ) 233 { 234 $count += $privatecount; //private surveys should be shown,hence add the count 235 } 236 237 if ( $count > 0 ) //there exist some active surveys which should be shown. 238 { 239 240 printf(__("You can take following %d survey(s), if you haven't already. Take them now :"), $count ); 241 ?> 242 <br /><br /> 243 <?php 244 if ( $publiccount > 0 ) //show public surveys 245 { 246 echo "<b>".__("Public Survey(s)")."</b> :"; 247 248 249 $temp = 0; 250 while ( $temp < $publiccount ) 251 { 252 if ( $temp == 0) 253 { 254 echo "<ul type='disc'>"; 255 } 256 printf(__("<li> <a href='".$db_value_url."/index.php?sid=".$publicsurvey[$temp]['sid']."' target='_blank'><strong> %s </strong></a> </li>"), $publicsurvey[$temp]['title']); 257 258 if ( $temp == ( $publiccount - 1 ) ) 259 { 260 echo "</ul>"; 261 } 262 $temp = $temp + 1; 263 } //end while 264 } 265 266 if ( $privatecount > 0 && ((int)$list_value_public_surveys == 1 ) ) //shwo private surveys if (they exist and should be shown) 267 { 268 echo "<b>".__("Private Survey(s)")."</b> :"; 269 270 271 $temp = 0; 272 while ( $temp < $privatecount ) 273 { 274 if ( $temp == 0) 275 { 276 echo "<ul type='disc'>"; 277 } 278 printf(__("<li> <a href='".$db_value_url."/index.php?sid=".$privatesurvey[$temp]['sid']."' target='_blank'><strong> %s </strong></a> </li>"), $privatesurvey[$temp]['title']); 279 280 if ( $temp == ( $privatecount - 1 ) ) 281 { 282 echo "</ul>"; 283 } 284 $temp = $temp + 1; 285 } //end while 286 } 235 287 } 236 288 else 237 289 { 238 echo _e("No publicsurvey(s) to take at the moment.");290 echo _e("No survey(s) to take at the moment."); 239 291 } 240 292 -
surveypress/tags/1.0.9/view/option-menu.php
r484436 r504350 7 7 8 8 //global variables 9 global $apply_option_default_permissions,$show_option_survey_notification,$show_option_import_users,$same_option_password ;10 global $apply_value_default_permissions,$show_value_survey_notification,$show_value_import_users,$same_value_password ;9 global $apply_option_default_permissions,$show_option_survey_notification,$show_option_import_users,$same_option_password,$list_option_public_surveys; 10 global $apply_value_default_permissions,$show_value_survey_notification,$show_value_import_users,$same_value_password,$list_value_public_surveys; 11 11 12 12 //output the heading. … … 36 36 $show_value_import_users = (int) $_POST[ $show_option_import_users ]; 37 37 $same_value_password = (int) $_POST[ $same_option_password ]; 38 38 $list_value_public_surveys = (int) $_POST[ $list_option_public_surveys ]; 39 39 40 40 // Save the posted values in the database … … 43 43 update_option( $show_option_import_users, $show_value_import_users ); 44 44 update_option( $same_option_password, $same_value_password ); 45 update_option( $list_option_public_surveys, $list_value_public_surveys ); 45 46 46 47 // Put an settings updated message on the screen … … 117 118 <tr valign="top"> 118 119 <th scope="row"> 120 <?php _e("List private active surveys in user dashboard?", 'menu-test' ); ?> 121 </th> 122 <td> 123 <p> 124 <label> 125 <input type="radio" name="<?php echo $list_option_public_surveys; ?>" value="1" <?php if((int)$list_value_public_surveys) { ?> checked="checked" <?php } ?> /> 126 <?php _e("Yes"); ?> 127 </label> 128 129 <label> 130 <input type="radio" name="<?php echo $list_option_public_surveys; ?>" value="0" <?php if(!((int)$list_value_public_surveys)) { ?> checked="checked" <?php } ?> /> 131 <?php _e("No"); ?> 132 </label> 133 <br /><span class="description">( If set to "Yes", users will see all active surveys(public+private) else only 'Public' surveys will be displayed. Effective only if 'Show user survey(s) to be taken' is set to 'Show'. )</span> 134 135 </p> 136 </td> 137 </tr> 138 139 <tr valign="top"> 140 <th scope="row"> 119 141 <?php _e("Import users from Wordpress to LimeSurvey?", 'menu-test' ); ?> 120 142 </th> -
surveypress/trunk/survey-press.php
r484436 r504350 66 66 $show_option_survey_notification = 'show_survey_notification'; 67 67 $show_option_import_users = 'import_users'; 68 $same_option_password = 'same_password'; 68 $same_option_password = 'same_password'; 69 $list_option_public_surveys = 'list_public_survey_only'; 69 70 // respective values from database. 70 71 // Read in existing option value from database … … 105 106 } 106 107 108 if ( get_option( $list_option_public_surveys ) == '' ) 109 { 110 $list_value_public_surveys = 1; 111 } 112 else 113 { 114 $list_value_public_surveys = (int) get_option( $list_option_public_surveys ); 115 } 107 116 108 117 /** -
surveypress/trunk/view/config-menu.php
r484436 r504350 10 10 global $db_value_host,$db_value_name,$db_value_pwd,$db_value_user,$db_value_prefix,$db_value_url; 11 11 12 global $ show_value_survey_notification,$db_connection_error_name,$db_connection_error;12 global $list_value_public_surveys,$show_value_survey_notification,$db_connection_error_name,$db_connection_error; 13 13 14 14 … … 179 179 global $lsdb; 180 180 //$lsdb = new wpdb( $db_value_user, $db_value_pwd, $db_value_name, $db_value_host ); 181 182 $public_surveys = $lsdb->get_results( "SELECT a.sid, b.surveyls_title, a.publicstatistics183 FROM ".$db_value_prefix."surveys AS a184 INNER JOIN ".$db_value_prefix."surveys_languagesettings AS b185 ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language )186 WHERE surveyls_survey_id=a.sid187 AND surveyls_language=a.language188 AND a.active='Y'189 AND a.listpublic='Y'190 AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null))191 AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null))192 ORDER BY surveyls_title");181 $query = "SELECT a.sid, b.surveyls_title, a.listpublic 182 FROM ".$db_value_prefix."surveys AS a 183 INNER JOIN ".$db_value_prefix."surveys_languagesettings AS b 184 ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language ) 185 WHERE surveyls_survey_id=a.sid 186 AND surveyls_language=a.language 187 AND a.active='Y' 188 AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null)) 189 AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null)) 190 ORDER BY surveyls_title"; 191 192 $public_surveys = $lsdb->get_results( $query ); 193 193 194 194 //number of surveys active and public 195 $count = 0; 195 $publiccount = 0; 196 //number of surveys active and private 197 $privatecount = 0; 196 198 //public active surveys information 197 $survey = array(); 199 $publicsurvey = array(); 200 //private active surveys information 201 $privatesurvey = array(); 198 202 199 203 if ( $public_surveys ) … … 201 205 foreach ( $public_surveys as $surveyinfo ) 202 206 { 203 $survey[$count]['sid'] = $surveyinfo->sid; 204 $survey[$count]['title'] = $surveyinfo->surveyls_title; 205 206 $count = $count + 1; 207 if ( $surveyinfo->listpublic == 'Y' ) 208 { 209 $publicsurvey[$publiccount]['sid'] = $surveyinfo->sid; 210 $publicsurvey[$publiccount]['title'] = $surveyinfo->surveyls_title; 211 212 $publiccount++; 213 } 214 else 215 { 216 $privatesurvey[$privatecount]['sid'] = $surveyinfo->sid; 217 $privatesurvey[$privatecount]['title'] = $surveyinfo->surveyls_title; 218 219 $privatecount++; 220 } 207 221 } 208 222 } … … 214 228 <br/> 215 229 <?php 216 if ( $count ) //there exist some public and active surveys. 217 { 218 printf(__("You can take following %d public survey(s), if you haven't already. Take them now :"), $count); 219 220 $temp = 0; 221 while ( $temp < $count ) 222 { 223 if ( $temp == 0) 224 { 225 echo "<ul type='disc'>"; 226 } 227 printf(__("<li> <a href='".$db_value_url."/index.php?sid=".$survey[$temp]['sid']."' target='_blank'><strong> %s </strong></a> </li>"), $survey[$temp]['title']); 228 229 if ( $temp == ( $count - 1 ) ) 230 { 231 echo "</ul>"; 232 } 233 $temp = $temp + 1; 234 } //end while 230 231 $count = $publiccount; //public surveys will always be displayed! 232 if ( ((int)$list_value_public_surveys == 1 ) ) 233 { 234 $count += $privatecount; //private surveys should be shown,hence add the count 235 } 236 237 if ( $count > 0 ) //there exist some active surveys which should be shown. 238 { 239 240 printf(__("You can take following %d survey(s), if you haven't already. Take them now :"), $count ); 241 ?> 242 <br /><br /> 243 <?php 244 if ( $publiccount > 0 ) //show public surveys 245 { 246 echo "<b>".__("Public Survey(s)")."</b> :"; 247 248 249 $temp = 0; 250 while ( $temp < $publiccount ) 251 { 252 if ( $temp == 0) 253 { 254 echo "<ul type='disc'>"; 255 } 256 printf(__("<li> <a href='".$db_value_url."/index.php?sid=".$publicsurvey[$temp]['sid']."' target='_blank'><strong> %s </strong></a> </li>"), $publicsurvey[$temp]['title']); 257 258 if ( $temp == ( $publiccount - 1 ) ) 259 { 260 echo "</ul>"; 261 } 262 $temp = $temp + 1; 263 } //end while 264 } 265 266 if ( $privatecount > 0 && ((int)$list_value_public_surveys == 1 ) ) //shwo private surveys if (they exist and should be shown) 267 { 268 echo "<b>".__("Private Survey(s)")."</b> :"; 269 270 271 $temp = 0; 272 while ( $temp < $privatecount ) 273 { 274 if ( $temp == 0) 275 { 276 echo "<ul type='disc'>"; 277 } 278 printf(__("<li> <a href='".$db_value_url."/index.php?sid=".$privatesurvey[$temp]['sid']."' target='_blank'><strong> %s </strong></a> </li>"), $privatesurvey[$temp]['title']); 279 280 if ( $temp == ( $privatecount - 1 ) ) 281 { 282 echo "</ul>"; 283 } 284 $temp = $temp + 1; 285 } //end while 286 } 235 287 } 236 288 else 237 289 { 238 echo _e("No publicsurvey(s) to take at the moment.");290 echo _e("No survey(s) to take at the moment."); 239 291 } 240 292 -
surveypress/trunk/view/option-menu.php
r484436 r504350 7 7 8 8 //global variables 9 global $apply_option_default_permissions,$show_option_survey_notification,$show_option_import_users,$same_option_password ;10 global $apply_value_default_permissions,$show_value_survey_notification,$show_value_import_users,$same_value_password ;9 global $apply_option_default_permissions,$show_option_survey_notification,$show_option_import_users,$same_option_password,$list_option_public_surveys; 10 global $apply_value_default_permissions,$show_value_survey_notification,$show_value_import_users,$same_value_password,$list_value_public_surveys; 11 11 12 12 //output the heading. … … 36 36 $show_value_import_users = (int) $_POST[ $show_option_import_users ]; 37 37 $same_value_password = (int) $_POST[ $same_option_password ]; 38 38 $list_value_public_surveys = (int) $_POST[ $list_option_public_surveys ]; 39 39 40 40 // Save the posted values in the database … … 43 43 update_option( $show_option_import_users, $show_value_import_users ); 44 44 update_option( $same_option_password, $same_value_password ); 45 update_option( $list_option_public_surveys, $list_value_public_surveys ); 45 46 46 47 // Put an settings updated message on the screen … … 117 118 <tr valign="top"> 118 119 <th scope="row"> 120 <?php _e("List private active surveys in user dashboard?", 'menu-test' ); ?> 121 </th> 122 <td> 123 <p> 124 <label> 125 <input type="radio" name="<?php echo $list_option_public_surveys; ?>" value="1" <?php if((int)$list_value_public_surveys) { ?> checked="checked" <?php } ?> /> 126 <?php _e("Yes"); ?> 127 </label> 128 129 <label> 130 <input type="radio" name="<?php echo $list_option_public_surveys; ?>" value="0" <?php if(!((int)$list_value_public_surveys)) { ?> checked="checked" <?php } ?> /> 131 <?php _e("No"); ?> 132 </label> 133 <br /><span class="description">( If set to "Yes", users will see all active surveys(public+private) else only 'Public' surveys will be displayed. Effective only if 'Show user survey(s) to be taken' is set to 'Show'. )</span> 134 135 </p> 136 </td> 137 </tr> 138 139 <tr valign="top"> 140 <th scope="row"> 119 141 <?php _e("Import users from Wordpress to LimeSurvey?", 'menu-test' ); ?> 120 142 </th>
Note: See TracChangeset
for help on using the changeset viewer.