?
Path : /home/admin/public_html/old/board/modules/mod_counts_up/tmpl/ |
Current File : /home/admin/public_html/old/board/modules/mod_counts_up/tmpl/default.php |
<?php defined( '_JEXEC' ) or die( 'Restricted access' ); $posttext = $params->get('posttext'); $counterchoice = $params->get('counterchoice'); $manualnumber = $params->get('manualnumber'); $db =& JFactory::getDBO(); $result = null; if ($counterchoice == "users") { //$q="select count(*) as count from #__users where usertype='Registered'"; $q="select count(*) as count from #__users where usertype!='Super Administrator'"; $db->setQuery($q); $result = $db->loadObject(); foreach ($result as $count) {$totalNumber=$count;} } elseif ($counterchoice == "manual") { $totalNumber = $manualnumber; } ?> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script> <style type="text/css"> /*counter*/ div.counter {height:46px;overflow:hidden;} span.digitEnd {display:none;} span.digitStart {display:none;} .mp_cnt_d{position:relative;display:inline-block;margin-right:2px;width:32px;height:46px;background:url(<?php echo JURI::base()."modules/mod_counts_up/tmpl/img/userCounter.png";?>) no-repeat 0 0} .mp_cnt_d_dot{margin-top:0px;width:4px;height:46px;overflow:hidden} .mp_cnt_d_0{background-position:0 0}.mp_cnt_d_0_1{background-position:-32px 0}.mp_cnt_d_0_2{background-position:-65px 0} .mp_cnt_d_1{background-position:0 -47px}.mp_cnt_d_1_1{background-position:-32px -47px}.mp_cnt_d_1_2{background-position:-65px -47px} .mp_cnt_d_2{background-position:0 -94px}.mp_cnt_d_2_1{background-position:-32px -94px}.mp_cnt_d_2_2{background-position:-65px -94px} .mp_cnt_d_3{background-position:0 -141px}.mp_cnt_d_3_1{background-position:-32px -141px}.mp_cnt_d_3_2{background-position:-65px -141px} .mp_cnt_d_4{background-position:0 -188px}.mp_cnt_d_4_1{background-position:-32px -188px}.mp_cnt_d_4_2{background-position:-65px -188px} .mp_cnt_d_5{background-position:0 -235px}.mp_cnt_d_5_1{background-position:-32px -235px}.mp_cnt_d_5_2{background-position:-65px -235px} .mp_cnt_d_6{background-position:0 -282px}.mp_cnt_d_6_1{background-position:-32px -282px}.mp_cnt_d_6_2{background-position:-65px -282px} .mp_cnt_d_7{background-position:0 -329px}.mp_cnt_d_7_1{background-position:-32px -329px}.mp_cnt_d_7_2{background-position:-65px -329px} .mp_cnt_d_8{background-position:0 -376px}.mp_cnt_d_8_1{background-position:-32px -376px}.mp_cnt_d_8_2{background-position:-65px -376px} .mp_cnt_d_9{background-position:0 -423px}.mp_cnt_d_9_1{background-position:-32px -423px}.mp_cnt_d_9_2{background-position:-65px -423px} .mp_cnt_d_dot{background-position:-29px -469px} #counts_up_text{font-family: Tahoma, Arial, sans-serif; color: #1f7dc1; font-size: 17px;} </style> <? // english notation with thousands seperator $english_format_number = number_format($totalNumber, 0, '.', '.'); function str_split_php4_utf8($str) { $split=1; $array = array(); for ( $i=0; $i < strlen( $str ); ){ $value = ord($str[$i]); if($value > 127){ if($value >= 192 && $value <= 223) $split=2; elseif($value >= 224 && $value <= 239) $split=3; elseif($value >= 240 && $value <= 247) $split=4; }else{ $split=1; } $key = NULL; for ( $j = 0; $j < $split; $j++, $i++ ) { $key .= $str[$i]; } array_push( $array, $key ); } return $array; } $numbersArray = str_split_php4_utf8($english_format_number); echo "<div id=\"userCounter\" class=\"counter\">"; for ($i=0;$i<count($numbersArray);$i++) { if ($numbersArray[$i] == ".") { echo "<span class=\"mp_cnt_d toincrease mp_cnt_d_dot\">"; } else { echo "<span class=\"mp_cnt_d toincrease mp_cnt_d_0\">"; } echo "<span class=\"digitEnd\">".$numbersArray[$i]."</span><span class=\"digitStart\">0</span></span>"; } echo "</div>"; ?> <?php if ($params->get('posttext')!="") {echo "<div id=\"counts_up_text\">".$params->get('posttext')."</div>";} ?> <script type="text/javascript"> //<![CDATA[ //extend jQuery with random selector jQuery.jQueryRandom = 0; jQuery.extend(jQuery.expr[":"], { random: function(a, i, m, r) { if (i == 0) { jQuery.jQueryRandom = Math.floor(Math.random() * r.length); }; return i == jQuery.jQueryRandom; } }); /* animations */ var ChattaHp = {}; ChattaHp.CurrentDigit = null; ChattaHp.randomHighlight = function() { if( $(".preloader").length>0 ) { p = $(".preloader:random"); url = p.attr("image:url"); p.append('<img src="'+url+'" onload="ChattaHp.fadeInMe(this)">'); p.removeClass("preloader"); setTimeout('ChattaHp.randomHighlight()',50); } }; ChattaHp.fadeInMe = function(o){ $(o).fadeIn("slow"); }; ChattaHp.moveDigit = function() { var o = ChattaHp.CurrentDigit; var digitEnd = parseInt (o.find(".digitEnd").html()); var digitStart = parseInt( o.find(".digitStart").html() ); if (digitEnd == digitStart) { o.removeClass("toincrease"); setTimeout('ChattaHp.getDigitToIncrease()',50); return; } if (o.hasClass("mp_cnt_d_"+digitStart+"_2")) { o.removeClass("mp_cnt_d_"+digitStart+"_2"); o.find(".digitStart").html(digitStart+1); o.addClass("mp_cnt_d_"+(digitStart+1)); setTimeout('ChattaHp.moveDigit()',50); return; } if (o.hasClass("mp_cnt_d_"+digitStart)) { o.removeClass("mp_cnt_d_"+digitStart); o.addClass("mp_cnt_d_"+digitStart+"_1"); setTimeout('ChattaHp.moveDigit()',65); return; } if (o.hasClass("mp_cnt_d_"+digitStart+"_1")) { o.removeClass("mp_cnt_d_"+digitStart+"_1"); o.addClass("mp_cnt_d_"+digitStart+"_2"); setTimeout('ChattaHp.moveDigit()',65); return; } } ChattaHp.getDigitToIncrease=function() { if ($(".toincrease").length>0) { var o = $(".toincrease:first"); var digit = o.find(".digitEnd").html(); if (digit==".") { o.removeClass("toincrease"); ChattaHp.getDigitToIncrease(); return; } ChattaHp.CurrentDigit = o; ChattaHp.moveDigit(); } } //start load image ChattaHp.randomHighlight(); //start counter ChattaHp.getDigitToIncrease(); //]]> </script>