Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

fiddling with limesurvey tables...

  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 4 months ago #222572 by ritapas
fiddling with limesurvey tables... was created by ritapas
Hello,
in our LS CE installation (v. 3.15) we have many surveys but we need to keep just five of them on top of the survey list. Since we don't want to rename them and sort, I think I could just update the mysql table that lies under the hood as follows:

update lime_surveys set datecreated=("2099-01-01") where  sid in (<SID LIST>);

Do you think there is anything that could go wrong?
I see there is a public representation for the LS5 schema ( manual.limesurvey.org/limesurvey/LimeSur...database-schema.html ) but not for version 3.

Thank you.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #222573 by tpartner
Replied by tpartner on topic fiddling with limesurvey tables...
Which survey list, front end or back end?

It may be easier to sort the list via JavaScript in the theme files.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ritapas
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 4 months ago #222574 by ritapas
Replied by ritapas on topic fiddling with limesurvey tables...
Front-end.
I thought about SQL first because my JavaScript is rather poor!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #222575 by tpartner
Replied by tpartner on topic fiddling with limesurvey tables...
My solution would be to edit layout_survey_list.twig as follows:

Change this line:
Code:
<li class="{{ aSurveyInfo.class.surveylistrowdivbdivulli }} btn-group col-sm-6 col-xs-12" {{ aSurveyInfo.attr.surveylistrowdivbdivulli }}">

To this:
Code:
<li class="{{ aSurveyInfo.class.surveylistrowdivbdivulli }} btn-group col-sm-6 col-xs-12" {{ aSurveyInfo.attr.surveylistrowdivbdivulli }} data-sid="{{ oSurvey.sid }}">

Add this script to the end of the <body> element modifying the survey IDs in the pinnedSurveys array as required:  

Code:
<script type="text/javascript" data-author="Tony Partner">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    var pinnedSurveys = [
      205110,
      205109,
      205108,
      205107
    ];
 
    $.each(pinnedSurveys.reverse(), function(i, sid) {
      $('ul.surveys-list').prepend($('li[data-sid="'+sid+'"]'));
    });
  });
</script>

Sample twig file attached (remove the .txt filename extension): 

File Attachment:

File Name: layout_sur...twig.txt
File Size:11 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ritapas
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 4 months ago #222576 by ritapas
Replied by ritapas on topic fiddling with limesurvey tables...
That's actually a great job, thank you so much!
So, in general, you would avoid changing those values?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 4 months ago #222578 by tpartner
Replied by tpartner on topic fiddling with limesurvey tables...
No, change them as you see fit, it doesn't affect anything except for the view of the survey list. For example, if you want to re-open an old survey, you may want that pinned to the top of the list.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ritapas
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose