+ Post New Thread
Page 3 of 8 FirstFirst 1234567 ... LastLast
Results 31 to 45 of 106
Scripts Thread, SIMS to MRBS: Script Available in Coding and Web Development; Hi, Try changing the last few lines to the following: $this_period = (int)substr($period[$item],4,2); // Get the period number into an ...
  1. #31

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

    Try changing the last few lines to the following:

    $this_period = (int)substr($period[$item],4,2); // Get the period number into an integer
    $start_secs = (60 * $this_period); // Convert the period number into seconds for MRBS
    This should mean the first period goes into Slot 1, and there are no breaks.

  2. #32
    mikeglover's Avatar
    Join Date
    Mar 2009
    Location
    Northampton
    Posts
    147
    Thank Post
    33
    Thanked 30 Times in 9 Posts
    Rep Power
    16
    Quote Originally Posted by Minkus View Post
    Hi,

    Try changing the last few lines to the following:



    This should mean the first period goes into Slot 1, and there are no breaks.
    Hi, thanks for your reply but I'm afriad that doesn't work. So my code now look like this now:

    if(substr($period[$item],4,3) == "RgA"){ // If this is an AM registration period
    $start_secs = 12*60*60;
    } elseif(substr($period[$item],4,3) == "RgP"){ // If this is a PM registration period
    $start_secs = 12*60*60 + (60 * 9);
    } else { // If this is an ordinary period
    $this_period = (int)substr($period[$item],4,2); // Get the period number into an integer
    $start_secs = (60 * $this_period); // Convert the period number into seconds for MRBS
    }
    When i run the script there are no errors but nothing is added into the timetable now. I double checked the Room ID.

  3. #33

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 14 Times in 12 Posts
    Rep Power
    19
    Sorry. Not thinking.

    Try:

    $this_period = (int)substr($period[$item],4,2); // Get the period number into an integer
    $start_secs = 12*60*60 + (60 * ($this_period - 1)); // Convert the period number into seconds for MRBS

    EDIT - Changed the formula - make sure you use this one!

  4. #34
    mikeglover's Avatar
    Join Date
    Mar 2009
    Location
    Northampton
    Posts
    147
    Thank Post
    33
    Thanked 30 Times in 9 Posts
    Rep Power
    16
    Quote Originally Posted by Minkus View Post
    Sorry. Not thinking.

    Try:

    $this_period = (int)substr($period[$item],4,2); // Get the period number into an integer
    $start_secs = 12*60*60 + (60 * ($this_period - 1)); // Convert the period number into seconds for MRBS

    EDIT - Changed the formula - make sure you use this one!
    Thanks Chris this works a treat now
    One step closer to the finish line

  5. #35

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,714
    Thank Post
    269
    Thanked 1,116 Times in 1,012 Posts
    Rep Power
    345
    Does anybody have the Sims2MRBS report which includes registration periods?

  6. #36

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

    The one included in the script should export registration periods - so long as they are available in SIMS.Net?

    Maybe check with your timetabler to make sure this is the case?

  7. #37

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,714
    Thank Post
    269
    Thanked 1,116 Times in 1,012 Posts
    Rep Power
    345
    Possibly they are done differently here! I will investigate more!

  8. #38

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    274
    Thank Post
    38
    Thanked 43 Times in 37 Posts
    Rep Power
    20
    Fantastic script!

    I've just modified ours for a two-week timetable.

    Firstly around line 233 change:
    $postData[12][1] = 2;
    to
    $postData[12][1] = 6;
    Then change
    $postData[16][1] = "";
    to
    $postData[16][1] = 2;
    (This sets the repeat_type to "N-weekly" and the "N" to 2, so in other words all entries repeat bi-weekly.)

    Then you need to split your CSV into each half of the schedule. We have a week 'A' and week 'B', so our days show as 'AMon:1' and 'BMon:1' etc. Split the CSV into two files, one with all of the 'A' week bookings and another for the 'B' weeks.

    Now you need to modify the code around line 64 from:
    if(strlen($entry[2]) == 5){ $entry[2] = substr($entry[2],0,4)."0".substr($entry[2],4,1); }
    to
    if(strlen($entry[2]) == 6){ $entry[2] = substr($entry[2],1,4)."0".substr($entry[2],5,1); }
    This ignores the 'A' or 'B' on the front of the session. The result of AMon:1 should now be Mon:01, etc.

    Now you just run the routine as it's designed, except when it asks you for the start of term, make sure you add 7 days to it when you're doing week 'B'. (So if term starts on 3rd September with week A, run this normally with your week A csv, then do the same from 10th September with your week B csv)

    (The code line numbers might be slightly out because I messed about a bit before getting it right, but look for the code snippets)

    Hope this helps someone.

    Peter

  9. 2 Thanks to howartp:

    PICNIC (24th July 2012), vikpaw (1st July 2012)

  10. #39

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 14 Times in 12 Posts
    Rep Power
    19
    Hi Peter,

    Great post, and thanks for sharing your changes with the rest of the forum!

    Kind regards,

  11. #40

    PICNIC's Avatar
    Join Date
    Oct 2010
    Location
    Zooniverse
    Posts
    286
    Thank Post
    179
    Thanked 84 Times in 45 Posts
    Rep Power
    109
    I wonder if you could help me with a problem - I think I have totally FUBARED the script trying to get it round our timetable. I can get it to run, but it ignores the term start date and tries to enter from the day I run the script and it also tries to input all the classes into the 'Before School' Period, we have 9 slots a day, Before School, 1, 2, break, 3, 4, lunch, 5 and 6.

    I have applied howartp changes for a 2 week timetable and altered the periods how I thought they should be.

    If you have a chance to look at it that would be great, if not no worries I like a challenge

    import.zip

  12. #41

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    274
    Thank Post
    38
    Thanked 43 Times in 37 Posts
    Rep Power
    20
    Quote Originally Posted by PICNIC View Post
    I wonder if you could help me with a problem - I think I have totally FUBARED the script trying to get it round our timetable. I can get it to run, but it ignores the term start date and tries to enter from the day I run the script and it also tries to input all the classes into the 'Before School' Period, we have 9 slots a day, Before School, 1, 2, break, 3, 4, lunch, 5 and 6.

    I have applied howartp changes for a 2 week timetable and altered the periods how I thought they should be.

    If you have a chance to look at it that would be great, if not no worries I like a challenge
    Interesting, at a glance (using my Text Compare software) I can't see that anything you've changed should cause this behaviour.

    You have only changed the lines that I would expect you to change, and they look 'sensible' whether they are correct or not.

    Can you attach a copy of the SIMS export as it comes out of SIMS, before you strip it down?

    Which of your periods are Registrations, and/or are they extra? (I see you've changed some RgA and RgP entries to 0, which I need to understand why so I can get my head around it for you)

    For example, our timetable is Session1(Reg_AM), Session2, Break, Session3, Session4, Lunch, Session5, Session6. All Session5 marks are automagically entered into Reg_PM, but it is physically a seperate session in SIMS. In the morning however, session 1 IS the Reg session. (Session 1 is 20 minutes, as Reg would be, whereas session 5 is full hour taught lesson)

    Peter

  13. #42

    PICNIC's Avatar
    Join Date
    Oct 2010
    Location
    Zooniverse
    Posts
    286
    Thank Post
    179
    Thanked 84 Times in 45 Posts
    Rep Power
    109
    Thanks Peter

    The above attached csv is exactly as sims exports, but i have stripped off the week 2 entries (bi weekly timetable) as I thought these would need to go in separately?. Sims does not contain any reg periods, just periods 1-6, maybe this is where I am misunderstanding?

    The MRBS setup contains

    Code:
    $periods[] = "<b><font size=3 color=black>Before School</font></b>";
    $periods[] = "<b><font size=3>1&nbsp;-&nbsp;09:00&nbsp;-&nbsp;09:50</font></b>";
    $periods[] = "<b><font size=3>2&nbsp;-&nbsp;09:50&nbsp;-&nbsp;10:40</font></b>";
    $periods[] = "<b><font size=3 color=black>Morning Break</font></b>";
    $periods[] = "<b><font size=3>3&nbsp;-&nbsp;10:55&nbsp;-&nbsp;11:45</font></b>";
    $periods[] = "<b><font size=3>4&nbsp;-&nbsp;11:45&nbsp;-&nbsp;12:35</font></b>";
    $periods[] = "<b><font size=3 color=black>Lunch</font></b>";
    $periods[] = "<b><font size=3>5&nbsp;-&nbsp;13:25&nbsp;-&nbsp;14:15</font></b>";
    $periods[] = "<b><font size=3>6&nbsp;-&nbsp;14:15&nbsp;-&nbsp;15:05</font></b>";
    Messy but does the job
    Last edited by PICNIC; 27th July 2012 at 10:57 PM.

  14. #43

    Join Date
    Apr 2008
    Location
    Keighley, West Yorks
    Posts
    274
    Thank Post
    38
    Thanked 43 Times in 37 Posts
    Rep Power
    20
    Quote Originally Posted by PICNIC View Post
    Thanks Peter

    The above attached csv is exactly as sims exports, but i have stripped off the week 2 entries (bi weekly timetable) as I thought these would need to go in separately?. Sims does not contain any reg periods, just periods 1-6, maybe this is where I am misunderstanding?

    The MRBS setup contains

    Code:
    <snip>
    Messy but does the job
    Ah, right.

    Firstly then, line 93 you've got periods 3 and 6 - this should be periods 3 (after break) and 5 (after lunch). This is checking the input from the SIMS file, so we use the period numbers as exported (ie 1-6)

    ACTUALLY, IGNORE THE FOLLOWING BLOCK - I'VE JUST REALISED MRBS STARTS AT ZERO SO THIS ENTIRE BLOCK IS WRONG FOR YOUR PERIODS - I'LL LEAVE IT AS IT MAY HELP OTHERS WITH DIFFERENT PERIOD COMBINATIONS:
    Secondly, around lines 192-200 (after the 'PERIOD EXPLANATION' comment section) the else section needs a minor modification. You are currently reading the period from SIMS, then if it's after break you are adding ONE to make it match MRBS's periods - but you have a period before school which you need to account for. So the lines need changing as follows:

    Code:
    if(substr($period[$item],4,3) == "0"){ // If this is an AM registration period
    $start_secs = 12*60*60;
    } elseif(substr($period[$item],4,3) == "RgP"){ // If this is a PM registration period
    $start_secs = 12*60*60 + (60 * 9);
    } else { // If this is an ordinary period
    $this_period = (int)substr($period[$item],4,2); // Get the period number into an integer
    if($this_period == 3 or $this_period == 4){$this_period += 1;} // If we are Periods 3 and 4, add one (to skip break)
    elseif($this_period >= 5){$this_period += 2;} // If we are Period 5 or beyond, add two (to skip break and lunch)
    $start_secs = 12*60*60 + (60 * $this_period); // Convert the period number into seconds for MRBS
    }
    Code:
    if(substr($period[$item],4,3) == "0"){ // If this is an AM registration period
    $start_secs = 12*60*60;
    } elseif(substr($period[$item],4,3) == "RgP"){ // If this is a PM registration period
    $start_secs = 12*60*60 + (60 * 9);
    } else { // If this is an ordinary period
    $this_period = (int)substr($period[$item],4,2); // Get the period number into an integer
    if($this_period == 3 or $this_period == 4){$this_period += 2;} // If we are Periods 3 and 4, add two (to skip pre-school and break)
    elseif($this_period >= 5){$this_period += 3;} // If we are Period 5 or beyond, add three (to skip pre-school, break and lunch)
    $start_secs = 12*60*60 + (60 * $this_period); // Convert the period number into seconds for MRBS
    }
    Finally, can you check that your MRBS periods are in consecutive order - for example, you haven't added 'Before School' as an afterthought; if you have then its ID will be out of sync and the script won't work. To check, go to the booking page (eg Day.php) and hover over one of the free booking slots - the URL will show ....period=#..... - make sure the periods are consecutive starting from zero.

    Peter

  15. Thanks to howartp from:

    PICNIC (30th July 2012)

  16. #44

    PICNIC's Avatar
    Join Date
    Oct 2010
    Location
    Zooniverse
    Posts
    286
    Thank Post
    179
    Thanked 84 Times in 45 Posts
    Rep Power
    109
    Thanks Peter, no time to look at this today, but I will report back once I do.

  17. #45

    Join Date
    Jun 2007
    Location
    Colchester, Essex, UK
    Posts
    56
    Thank Post
    2
    Thanked 14 Times in 12 Posts
    Rep Power
    19
    Also make sure you've got a recent version of MRBS installed. The most recent version of the script is designed to work with MRBS 1.4.7 (not quite the latest), and they did change the booking form a few versions ago, which might account for the problems you're having.

    If you're already using 1.4.7+, then that's probably not the problem!

  18. Thanks to Minkus from:

    PICNIC (30th July 2012)

SHARE:
+ Post New Thread
Page 3 of 8 FirstFirst 1234567 ... 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
  •