Forum Replies Created

Viewing 15 replies - 16 through 30 (of 60 total)
  • Plugin Author tnomi

    (@tnomi)

    Hello,
    Thank you for trying my plug-in.

    I do not see the option ‘open’ but just a ‘-‘.

    First , the “Teacher” user must edit their schedule .
    “Scheduler” page:
    https://olbsys.com/en/setup/special-pages/#edit_schedule

    His schedule is displayed as “Open” on the following pages .
    1) “Daily schedule” page:
    https://olbsys.com/en/setup/teachers/#daily_schedule

    2) “Weekly schedule” on the post “Teacher information”:
    https://olbsys.com/en/setup/teachers/#teacher_profile_page

    “Reservation” page is accessed with the URL parameter from links (“Open”) in these pages .

    when I go to the ‘reservation’ page as a logged in member, I get the error saying ‘Parameter is insuffcient’.

    “Reservation” page should not be accessed directly.
    Because parameter will be insufficient.

    Plugin Author tnomi

    (@tnomi)

    Version 0.7.5 was released.

    Plugin Author tnomi

    (@tnomi)

    Thank you for your feedback.
    I will correct it in the next version.

    Plugin Author tnomi

    (@tnomi)

    Sorry. No can do.

    Plugin Author tnomi

    (@tnomi)

    Insert this script into the “<head>” of your theme.
    Or , you may insert it into the page there is a short code “[attmgr_weekly_all]”.
    For example,

    <script>
        ...
    </script>
    [attmgr_weekly_all]

    Plugin Author tnomi

    (@tnomi)

    Sorry. No can do.

    Plugin Author tnomi

    (@tnomi)

    Try to insert the following code to the “<head>” of your theme.

    <script>
    jQuery( document ).ready( function($) {
        $('table.attmgr_weekly_all td.working').each( function(){
            var work = $( this ).text().split(' ~ ');
            var start = work[0].split(':');
            var end = work[1].split(':');
            var stime = Number(start[0])*60 + Number(start[1]);
            var etime = Number(end[0])*60 + Number(end[1]);
            var total = ( etime - stime )/60;
            $( this ).append('<br>'+total.toFixed(1)+' hours');
        })
    })
    </script>

    Plugin Author tnomi

    (@tnomi)

    I’m sorry.
    “backticks” was included in the cord.
    It was corrected.

    ...
        $query = "INSERT INTO $table "
            ."( staff_id, date, starttime, endtime ) "
        ...

    Plugin Author tnomi

    (@tnomi)

    1. Your plugin already has a function/database for scheduling service?

    Nothing.

    2. You have a plan to add that service in this plugin near future?

    I haven’t thought about that yet.

    3. You have any advice about the service I am looking for?

    May the following cord be useful for anything?
    This code is the way to insert the schedule in a lump into DB.

    Insert this cord in “functions.php” of the theme you use.
    Maybe this function does not always have to be used.
    If you don’t update the schedule, do comment out this “add_action()”.

    add_action( 'init', 'set_pre_defined_schedule' );
    
    function set_pre_defined_schedule() {
        global $wpdb;
        $pre_defined_schedule = array(
        //  staff_id => array(
        //      'date starttime endtime',
        //      'date',        <- If 'starttime' and 'endtime' were omitted, it will be deleted.
        //      ...
        //  ),
            2 => array(
                '2015-12-19 08:30 17:30',
                '2015-12-20',    // It will be deleted.
            ),
            3 => array(
                '2015-12-19 09:00 14:00',
                '2015-12-20 14:00 20:00',
            )
        );
        $table = apply_filters( 'attmgr_schedule_table_name', $table );
        $query = "INSERT INTO $table "
            ."( <code>staff_id</code>, <code>date</code>, <code>starttime</code>, <code>endtime</code> ) "
            ."VALUES "
            ."%VALUES% "
            ."ON DUPLICATE KEY UPDATE "
            ."starttime = VALUES( starttime ), endtime = VALUES( endtime ) ";
    
        foreach ( $pre_defined_schedule as $staff_id => $schedule ) {
            $values = array();
            foreach ( $schedule as $string ) {
                list( $date, $starttime, $endtime ) = explode( ' ', $string );
                if ( empty( $starttime ) || empty( $endtime ) ) {
                    $ret = $wpdb->query( $wpdb->prepare( "DELETE FROM $table WHERE staff_id=%d AND date=%s", array( $staff_id, $date ) ) );
                }
                else {
                    $values[] = $wpdb->prepare( "( %d, %s, %s, %s )", array( $staff_id, $date, $starttime, $endtime ) );
                }
            }
            $sql = str_replace( '%VALUES%', implode( ',', $values ), $query );
            $ret = $wpdb->query( $sql );
        }
    }
    Plugin Author tnomi

    (@tnomi)

    Is it possible for me to add such functions without DB modification?

    “without DB modification”…?

    I am not good at English.
    Does it mean that “without inserting schedule data into DB” ?

    Or, “without changing the structure of DB”, the way to insert the pre-defined schedule in a lump into DB?

    Plugin Author tnomi

    (@tnomi)

    Thank you, too.

    Plugin Author tnomi

    (@tnomi)

    Okay.
    I would add a filter hook “attmgr_schedule_table_name” in the next version.
    When it is so, you can rewrite that in “functions.php” of the theme you use.
    For example,

    if ( class_exists( 'ATTMGR' ) ) {
        remove_filter( 'attmgr_schedule_table_name', array( 'ATTMGR_Activation', 'schedule_table' ) );
        add_filter( 'attmgr_schedule_table_name', 'your_schedule_table' );
    }
    function your_schedule_table( $table ) {
        global $wpdb;
        return $wpdb->base_prefix.'attmgr_schedule';
    }

    And, I would not change a short cord “[attmgr_weekly]”.
    Because you can rewrite that freely.
    For example,

    remove_shortcode( 'attmgr_weekly', array( 'ATTMGR_Shortcode', 'weekly' ) );
    add_shortcode( 'attmgr_weekly', 'your_weekly' );
    function your_weekly( ... ) {
        ...
    }

    And, I would not also change a function “save_staff_url”.
    Because you can also rewrite that freely.
    For example,

    remove_action( 'publish_post', array( 'ATTMGR_User', 'save_staff_url' ) );
    add_action( 'publish_post', 'your_save_staff_url' );
    function your_save_staff_url( $post_id ){
        ...
    }

    By the way,

    It will be almost impossible for me to follow your updates if I will need to add this code each time. There are too many places.

    Should not you fork this plugin for your purpose?
    My update would not be always able to please you.

    Plugin Author tnomi

    (@tnomi)

    * There are individual staff each site.

    In that cace, I did the following procedure.

    1. Add a 2nd site.
    2. Copy a table “wp_attmgr_schedule” as “wp_2_attmgr_schedule”.
      SQL:
      CREATE TABLE wp_2_attmgr_schedule LIKE wp_attmgr_schedule;
    3. Export the “pages” of main site. (“Tools > Export > pages”)
      * daily
      * weekly
      * monthly
      * staff_scheduler
      * admin_scheduler
    4. Import these “pages” into 2nd site.
    5. Add new user to 2nd site.
    6. Add new post to for that user.
      (Insert a short code [attmgr_weekly id=”xx”] to that post.)
    7. Edit the schedule of that user.
    Plugin Author tnomi

    (@tnomi)

    Your solution is wonderful !
    A person with the same needs in the multisite should refer to this topic.

    * One common schedule
    * Different pages for same USER

    That seems similar to “Pre-Domain Mode (uses https://en.yoursite.com)” of a “qTranslate X” plug-in in the single site which is not a multisite.

    * There are individual staff each site.

    I feel the multisite may be suitable in that case.

    By the way, I don’t hope that “Attendance Manager” is being equipped with everything.

    I hope that it is customized originally according to the respective needs.
    Just like your original solution.

    But I feel that your idea about the “name” attribute in [attmgr_weekly] is good.
    I will think about that.

    Thank you!

    Plugin Author tnomi

    (@tnomi)

    Thank you very much!
    Please send to me your translation.

    https://olbsys.com/contact/
    You can attach a file temporarily.

Viewing 15 replies - 16 through 30 (of 60 total)