예제 #1
0
    public static function notification_list_page($form_id)
    {
        // handle form actions
        self::maybe_process_notification_list_action();
        $form = RGFormsModel::get_form_meta($form_id);
        GFFormSettings::page_header(__('Notifications', 'gravityforms'));
        $add_new_url = add_query_arg(array("nid" => 0));
        ?>

        <h3><span><i class="fa fa-envelope-o"></i> <?php 
        _e("Notifications", "gravityforms");
        ?>
<a id="add-new-confirmation" class="add-new-h2" href="<?php 
        echo $add_new_url;
        ?>
"><?php 
        _e("Add New", "gravityforms");
        ?>
</a></span></h3>

        <script type="text/javascript">
        function ToggleActive(img, notification_id){
            var is_active = img.src.indexOf("active1.png") >=0
            if(is_active){
            img.src = img.src.replace("active1.png", "active0.png");
            jQuery(img).attr('title','<?php 
        _e("Inactive", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Inactive", "gravityforms");
        ?>
');
            }
            else{
            img.src = img.src.replace("active0.png", "active1.png");
            jQuery(img).attr('title','<?php 
        _e("Active", "gravityforms");
        ?>
').attr('alt', '<?php 
        _e("Active", "gravityforms");
        ?>
');
            }

            var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
" );
            mysack.execute = 1;
            mysack.method = 'POST';
            mysack.setVar( "action", "rg_update_notification_active" );
            mysack.setVar( "rg_update_notification_active", "<?php 
        echo wp_create_nonce("rg_update_notification_active");
        ?>
" );
            mysack.setVar( "form_id", <?php 
        echo intval($form_id);
        ?>
);
            mysack.setVar( "notification_id", notification_id);
            mysack.setVar( "is_active", is_active ? 0 : 1);
            mysack.onError = function() { alert('<?php 
        echo esc_js(__("Ajax error while updating notification", "gravityforms"));
        ?>
' )};
            mysack.runAJAX();

            return true;
        }
        </script>
    <?php 
        $notification_table = new GFNotificationTable($form);
        $notification_table->prepare_items();
        ?>

    <form id="notification_list_form" method="post">

        <?php 
        $notification_table->display();
        ?>

        <input id="action_argument" name="action_argument" type="hidden" />
        <input id="action" name="action" type="hidden" />

        <?php 
        wp_nonce_field('gform_notification_list_action', 'gform_notification_list_action');
        ?>

    </form>

    <?php 
        GFFormSettings::page_footer();
    }
예제 #2
0
    public static function notification_list_page($form_id)
    {
        // handle form actions
        self::maybe_process_notification_list_action();
        $form = RGFormsModel::get_form_meta($form_id);
        GFFormSettings::page_header(__('Notifications', 'gravityforms'));
        $add_new_url = add_query_arg(array("nid" => 0));
        ?>
    <h3><span>
            <?php 
        _e("Notifications", "gravityforms");
        ?>
        <a id="add-new-confirmation" class="add-new-h2" href="<?php 
        echo $add_new_url;
        ?>
"><?php 
        _e("Add New", "gravityforms");
        ?>
</a>
        </span></h3>

    <?php 
        $notification_table = new GFNotificationTable($form);
        $notification_table->prepare_items();
        ?>

    <form id="notification_list_form" method="post">

        <?php 
        $notification_table->display();
        ?>

        <input id="action_argument" name="action_argument" type="hidden" />
        <input id="action" name="action" type="hidden" />

        <?php 
        wp_nonce_field('gform_notification_list_action', 'gform_notification_list_action');
        ?>

    </form>

    <?php 
        GFFormSettings::page_footer();
    }