Subject: Mdigest; admin link blinking

Posted on: 25/09/2012 08:00am
By: ::Ben

With Mdigest plugin, need to have an admin link blinking as a reminder when a digest is ready to send to users:

PHP Formatted Code
function plugin_getadminoption_mdigest()
{
    global $_CONF, $LANG_MDIGEST, $_TABLES,$_SCRIPTS;

    if (SEC_hasRights('user.mail')) {
        if ($_CONF['emailstories'] == 1) {
            $lastrun = DB_getItem ($_TABLES['vars'], 'value', "name = 'lastemailedstories'");
            $storysql = "SELECT sid FROM {$_TABLES['stories']} WHERE draft_flag = 0 AND date <= NOW() AND date >= '{$lastrun}'";
            $result = DB_query ($storysql);
            $count = DB_numRows ($result);
        } else {
            $count = 0;
        }

        if ($count == 0) {
            return array ($LANG_MDIGEST['mdigest'],
                      $_CONF['site_admin_url'] . '/plugins/mdigest/index.php',
                      $count);
        } else {
            $js = " $('.blink').each(function() {
                var elem = $(this);
                setInterval(function() {
                    if (elem.css('visibility') == 'hidden') {
                        elem.css('visibility', 'visible');
                    } else {
                        elem.css('visibility', 'hidden');
                    }    
                }, 500);
            });
            "
;
           
            $_SCRIPTS->setJavaScriptLibrary('jquery');
            $_SCRIPTS->setJavaScript($js, true);
           
            return array ('<strong><span class="blink">' . $LANG_MDIGEST['mdigest'] . '</span></strong>',
                      $_CONF['site_admin_url'] . '/plugins/mdigest/index.php',
                      '<strong>' .  $count . '</strong>');
        }
    }  
}


Cool Ben

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=94347