+ Post New Thread
Page 4 of 8 FirstFirst 12345678 LastLast
Results 46 to 60 of 106
Scripts Thread, SIMS to MRBS: Script Available in Coding and Web Development; Hi everyone, Just noticed a bug with the script. If your CSV has the same class on two consecutive rows ...
  1. #46

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    324
    Thank Post
    51
    Thanked 49 Times in 43 Posts
    Rep Power
    21
    Hi everyone,

    Just noticed a bug with the script.

    If your CSV has the same class on two consecutive rows and there isn't a break/lunch between them, the script assumes it is a double-period and extends the duration accordingly.

    Unfortunately it doesn't check the DAY - so you could have the following situation, where the Thursday session is doubled and Tuesday's session doesn't get entered:
    Room,Day name,Period,Class,Staff Code,Subject code,Students
    17,BFri,BFri:4,10V2/Eg1,KS ,Eg,14
    17,BFri,BFri:6,11D/Eg2,MDA ,Eg,21
    17,BMon,BMon:3,11D/Eg1,AJB ,Eg,22
    17,BThu,BThu:3,8x/Te5,CH ,Te,19
    17,BThu,BThu:3,8x/Te5,KS ,Te,19
    17,BThu,BThu:5,10B/Eg1,STH ,Eg,23
    17,BTue,BTue:4,10B/Eg1,STH ,Eg,23
    17,BWed,BWed:3,10B/Eg1,STH ,Eg,23
    17,BWed,BWed:5,8x/Te5,CH ,Te,19
    17,BWed,BWed:5,8x/Te5,KS ,Te,19
    To resolve it, go to somewhere around line 94 where you have your version of the following:

    if($duration[$listof[$i]] != 0){
    while($class[$listof[$i]] == $class[$listof[$i+$j]] && substr($listof[$i+$j],4,3) != "RgA" && substr($listof[$i+$j],4,3) != "RgP" && substr($listof[$i+$j],4,2) != "03" && substr($listof[$i+$j],4,2) != "05"){
    $duration[$listof[$i+$j]] = 0; // Set the following class to have a duration of zero - will be ignored
    $duration[$listof[$i]]++; // Increment the length of this class
    $j++; // Now check the next class after that
    This says 'while the current class is the same as the next class, and....(checks your own break/lunch periods)'.

    Add in the following:
    && $day[$listof[$i]] == $day[$listof[$i+$j]]
    so it now says 'while the current class is the same as the next class, and the day is the same, and....(checks your own break/lunch periods)'.
    if($duration[$listof[$i]] != 0){
    while($class[$listof[$i]] == $class[$listof[$i+$j]] && $day[$listof[$i]] == $day[$listof[$i+$j]] && substr($listof[$i+$j],4,3) != "RgA" && substr($listof[$i+$j],4,3) != "RgP" && substr($listof[$i+$j],4,2) != "03" && substr($listof[$i+$j],4,2) != "05"){
    $duration[$listof[$i+$j]] = 0; // Set the following class to have a duration of zero - will be ignored
    $duration[$listof[$i]]++; // Increment the length of this class
    $j++; // Now check the next class after that
    Hope this helps.

    Peter

  2. #47

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 16 Times in 14 Posts
    Rep Power
    21
    Thanks for the bug report Peter. When we do our import this year I'll make the change to our copy and upload a new version.

    Kind regards,
    Chris

  3. #48
    wesleyw's Avatar
    Join Date
    Dec 2005
    Location
    Kingswinford
    Posts
    2,205
    Thank Post
    223
    Thanked 50 Times in 44 Posts
    Blog Entries
    1
    Rep Power
    30
    When would this be uploaded?

    Wes

  4. #49
    wesleyw's Avatar
    Join Date
    Dec 2005
    Location
    Kingswinford
    Posts
    2,205
    Thank Post
    223
    Thanked 50 Times in 44 Posts
    Blog Entries
    1
    Rep Power
    30
    How would I change this to cope with two week timetables?

  5. #50

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 16 Times in 14 Posts
    Rep Power
    21

    Lightbulb

    Dear all,

    Version 1.2 of the script is now available, with a minor bug fix spotted by howartp - thank you very much!

    This is the only change to the script - if version 1.1 worked OK for you, just wait until next year before updating.

    To install:

    1. Extract bulkYearMake.php and copy it to your main MRBS folder
    2. Extract Room Timetables.RptDef and import it into SIMS.Net


    Edit bulkYearMake.php according to your own school's needs:

    • Default entry type for booking, and an alternative type for certain subjects if you want - see first few lines of the script.
    • MRBS period setup - search for 'PERIOD EXPLANATION' inside the source for more details. You need to tell it how the periods in the SIMS export file match up to the periods in MRBS. If you're not sure, you could just run it against your MRBS as-is, but make a back up first!
    • (You don't need to map room names to numbers in the script any more - see below).


    To use:

    1. Run the 'Room Timetables' report under SIMS.Net, select a single room, and save the file it generates
    2. EDIT the file that SIMS.Net generated - replace the name of the room (e.g. "Z") with the internal MRBS 'room' ID (e.g. "1"). To find the MRBS 'room' ID, open a room in MRBS, and look in the address bar for 'room=#'. It should look something like this when you are done:
      Code:
      "Room","Day name","Period","Class","Initials","Subject code","Students"
      "3","Fri","Fri:1","9cr/Gr2","RS  ","Gr",22
      "3","Fri","Fri:10","8C/Ma","HO  ","Ma",32
      "3","Fri","Fri:2","9cr/Gr2","RS  ","Gr",22
      ...
    3. Navigate to bulkYearMake.php in your Web browser, change the 'Start of Term' and 'End of Term' fields if you want to, select the file you edited earlier, and click 'Go'. (You only need to change the edit_entry_handler.php field if you put bulkYearMake.php into a different area of the website to your main MRBS install).
    4. The script should load & create a series of frames within itself, each of which represents an attempt to book a period into MRBS. It may take some time to load - be patient! If it all works OK, you should see each of these displaying the MRBS calendar, and the necessary entries created. If not, you may see an MRBS error message or a Scheduling Conflict. If you get an error message, try importing again, just in case this helps. If you get a scheduling conflict, and you are running MRBS 1.4.8 or above, you should be able to tell it to ignore the conflict if you want to.
    5. Make sure you get rid of bulkYearMake.php from your MRBS directory when you're done. It's not insecure in the way it accesses the MRBS database, but it was hacked together & is probably full of XSS vulnerabilities.


    The script was tested with the latest version of MRBS (1.4.8), and let me encourage you to upgrade to this if you haven't done so already, as it supports the ability to ignore scheduling conflicts for repeat entries and create as many entries as it can, which is great if you already have bookings in your database.

    It's released under the GPL as before, so if you do make any changes that others might find helpful (one idea would be to modify the script so that it can handle more than one room at once), please post them back here so that we can all benefit.
    Attached Files Attached Files

  6. Thanks to Minkus from:

    sonic1485 (22nd May 2014)

  7. #51

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 16 Times in 14 Posts
    Rep Power
    21
    Quote Originally Posted by wesleyw View Post
    How would I change this to cope with two week timetables?
    See howartp's post #38 above

  8. #52

    Join Date
    Oct 2012
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    n-weekly timetable

    Hi there,

    Just experimenting with this right now but looking good. Any suggestions on how I'd get i to work with an "n-weekly" timetable?

    Chris

  9. #53

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    324
    Thank Post
    51
    Thanked 49 Times in 43 Posts
    Rep Power
    21
    Quote Originally Posted by turtonc01 View Post
    Hi there,

    Just experimenting with this right now but looking good. Any suggestions on how I'd get i to work with an "n-weekly" timetable?

    Chris
    Hi Chris,

    I presume you've tried my post from #38 above?

    Can you post a snippet of your CSV output, and a list of your sessions and non-sessions in order? (Reg, S2, Break, S3, S4, Lunch.... etc)

    I'll see if I get chance to look through it for you.

    Peter

  10. #54

    Join Date
    Oct 2012
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    If I'm honest I haven't got that far yet. I'm still trying to figure out what changes need to be made for room names to ID #'s and slots etc. Php is not something I'm all too familiar with. Your post #38 should hopefully be useful though, thanks for that I'd overlooked it.

  11. #55

    Join Date
    Jan 2013
    Posts
    7
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hello,

    I'm currently playing about with this script and I have got a small problem that I’m hoping someone will be able to help me with.
    I have got it setup so it’s working with our period structure and with a two week timetable.
    However all bookings are being booked as tentative with a seemingly random mix between internal and external bookings.
    Does anyone know how to get all bookings as confirmed and all as either internal or external?

    Thank you.
    Last edited by mfincher; 6th February 2013 at 09:54 AM.

  12. #56

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    324
    Thank Post
    51
    Thanked 49 Times in 43 Posts
    Rep Power
    21
    Quote Originally Posted by mfincher View Post
    Hello,

    I'm currently playing about with this script and I have got a small problem that I’m hoping someone will be able to help me with.
    I have got it setup so it’s working with our period structure and with a two week timetable.
    However all bookings are being booked as tentative with a seemingly random mix between internal and external bookings.
    Does anyone know how to get all bookings as confirmed and all as either internal or external?

    Thank you.
    Hi,

    At the top of the script around line 28 are three lines:

    Code:
    $defaultEntryType = "E";	// Default Type for each Entry
    $alternateEntryType = "J";
    $alternateEntrySubCodes = "Rg|ICT|It|Co";
    If any of your lessons match the codes in line three (Rg, ICT, It or Co) then they will be marked with entry type J (line 2) otherwise they will be entry type E (line 1).

    If you want them all Internal, then set both lines 1 and 2 to entry type E (or whatever type you are using for Internal - see your config.inc.php for this if you're not sure)

    I'm not sure about tentativeness to be honest - unless you have some of your types to require confirmation? (I don't use confirmation so I don't know if/how it affects anything)

    Peter

  13. Thanks to howartp from:

    mfincher (7th February 2013)

  14. #57

    Join Date
    Oct 2012
    Posts
    7
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hey Peter,

    Is there any chance you could send me a copy of your script? I could maybe then revers engineer it to suit our set up.

    All the very best

    Quote Originally Posted by howartp View Post
    Hi Chris,

    I presume you've tried my post from #38 above?

    Can you post a snippet of your CSV output, and a list of your sessions and non-sessions in order? (Reg, S2, Break, S3, S4, Lunch.... etc)

    I'll see if I get chance to look through it for you.

    Peter

  15. #58

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    324
    Thank Post
    51
    Thanked 49 Times in 43 Posts
    Rep Power
    21
    Quote Originally Posted by turtonc01 View Post
    Hey Peter,

    Is there any chance you could send me a copy of your script? I could maybe then revers engineer it to suit our set up.

    All the very best
    Ok, see attached - it shouldn't be much different other than a few lines may have been unwrapped so I can follow loops and if()'s more easily.

    Peter
    Attached Files Attached Files

  16. #59

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 16 Times in 14 Posts
    Rep Power
    21
    Re the 'confirmed' thing, try adding the following lines near the bottom of the script, just after $postData[20][1] = "series";

    Code:
    $postData[21][0] = "confirmed";
    $postData[21][1] = "1";
    This should tell the script to create all confirmed entries. We don't use confirmation here - hence why this has been missed out.

    Let me know if this works, and if so I'll add it to the script next year.
    Last edited by Minkus; 7th February 2013 at 10:23 AM.

  17. #60

    Join Date
    Jan 2013
    Posts
    7
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks for the quick replies. I really appreciate it.

    All booking are now showing as external.

    I tried;

    $postData[21][0] = "confirmed";
    $postData[21][1] = "1";
    All bookings are still coming back as tentative.

    As far as I’m aware I’ve not setup anything up in Config.inc.php with regards to confirmation. As when I manual input a booking it defaults to being confirmed.

SHARE:
+ Post New Thread
Page 4 of 8 FirstFirst 12345678 LastLast

Similar Threads

  1. Exporting SIMS timetable into MRBS
    By amvc in forum MIS Systems
    Replies: 2
    Last Post: 29th July 2009, 04:25 PM
  2. Changing passwords for SIMS users by script
    By academic_mwnci in forum MIS Systems
    Replies: 2
    Last Post: 3rd September 2008, 12:02 AM
  3. SIMs backup script after SQL 2005 migration failing...
    By mullet_man in forum MIS Systems
    Replies: 13
    Last Post: 23rd November 2007, 06:03 PM
  4. MRBS help
    By niknik in forum Web Development
    Replies: 0
    Last Post: 29th August 2007, 03:00 PM
  5. SIMS update script
    By nicholab in forum MIS Systems
    Replies: 1
    Last Post: 27th April 2007, 08:17 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •