Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: First Weekday monday

  1. #1
    eturi is offline Junior Member
    Join Date
    Jun 2005
    Posts
    2

    Default First Weekday monday

    Hi,

    I have a doubt in calendar, how to change my start weekday, so the first day in the 'week view' mode is Monday ?

    Thanx

  2. #2
    wadii is offline Sugar Community Member
    Join Date
    Sep 2004
    Posts
    39

    Default Re: First Weekday monday

    see:

    /** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
    Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
    this._init(firstDayOfWeek, this.date);
    this._displayWeekdays();
    };

    in /jscalendar/calendar.js


    Wadii

  3. #3
    juergen is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    338

    Default Re: First Weekday monday

    Can you give more detalied instructions, please? This confuses me somehow, since there is a definition in the beginning of the file, which might also be reviewd.

    Thanks

    Juergen
    This space is for rent ;-)

  4. #4
    wadii is offline Sugar Community Member
    Join Date
    Sep 2004
    Posts
    39

    Default Re: First Weekday monday

    I'm sorry for the bad answer, the param that you must modify is:

    /jscalendar/ calendar-setup_3.js
    line 80

    param_default("firstDay", 1); // defaults to "Sunday" first 0 to "Monday" first


    Wadii

  5. #5
    juergen is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    338

    Default Re: First Weekday monday

    Hi Wadii,

    not a problem, but unfortunately, this did not work :-(

    Any other idea?

    Thanks

    Juergen
    This space is for rent ;-)

  6. #6
    eturi is offline Junior Member
    Join Date
    Jun 2005
    Posts
    2

    Default Re: First Weekday monday

    No, there's nothing to do with JavaScript........

    I meant in Calendar module, you know you have 4 view modes, Day, Week, Month and Year.

    In Week mode, the week starts on Sunday and ends on Saturday, how to change it so the week is from Monday to Sunday ?
    Last edited by eturi; 2005-06-13 at 09:57 PM.

  7. #7
    alicetee is offline Member
    Join Date
    Aug 2005
    Posts
    8

    Default Re: First Weekday monday

    Hame problem here. I am trying to find out a solution. Will write here if i find one.

  8. #8
    alicetee is offline Member
    Join Date
    Aug 2005
    Posts
    8

    Default Re: First Weekday monday

    OK. I think I found, anyhow it works okay.
    Three things:

    The main - templates_calendar.php line 645 (3.5.0.b release)
    for($i=0;$i<7;$i++) change to for($i=1;$i<8;$i++)

    also line 683 better to change if($j==0 || $j==6) to if($j==5 || $j==6) for coloring the non-work weekdays

    **************************
    WEEK VIEW and SHARED:
    Calendar.php line 178 maybe somewhere

    for($i=0;$i<$days_in_week;$i++) change to for($i=1;$i<8;$i++)

    datetime.php line 508 make as here (before was day_index > 6)

    if ( $day_index < 0 || $day_index > 7 )
    {
    sugar_die("day is outside of week range");
    }


    **************************************
    also in calendar-setup_3.js
    make param_default("firstDay", 1); // defaults to "Sunday" first


    And better to delete in Calendar.php this
    if( substr_count($time, 'H') > 0)
    {
    $this->use_24 = 0;
    }
    Last edited by alicetee; 2005-08-31 at 03:01 PM.

  9. #9
    alicetee is offline Member
    Join Date
    Aug 2005
    Posts
    8

    Default Re: First Weekday monday

    But trying to move the days.. they are moved..
    Solution is not ready to work!!
    Last edited by alicetee; 2005-08-31 at 05:07 PM.

  10. #10
    alicetee is offline Member
    Join Date
    Aug 2005
    Posts
    8

    Default Re: First Weekday monday

    New solution!
    Calendar.php line 165 make $first_day_of_month = $this->date_time->get_day_by_index_this_month(6);
    from $first_day_of_month = $this->date_time->get_day_by_index_this_month(0);

    also line 683 better to change if($j==0 || $j==6) to if($j==5 || $j==6) for coloring the non-work weekdays


    WEEK VIEW and SHARED:
    Calendar.php line 178 maybe somewhere
    for($i=0;$i<$days_in_week;$i++) change to for($i=1;$i<8;$i++)

    datetime.php line 508 make as here (before was day_index > 6)
    if ( $day_index < 0 || $day_index > 7 )
    {
    sugar_die("day is outside of week range");
    }



    templates_calendar.php line 810 make $first_day = $date_time->get_day_by_index_this_week(1);
    Last edited by alicetee; 2005-08-31 at 06:07 PM.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

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