function generateJs($aopData = [], $postId = '') { /// animate forward and backward $forward = $backward = ''; foreach ($aopData as $k => $v) { $bf = $v['af']; $width = calcPercent($bf['sizeX'], 'width'); $height = calcPercent($bf['sizeY'], 'height'); $left = calcPercent($bf['moveLeft'], 'left'); $top = calcPercent($bf['moveTop'], 'top'); $deg = $bf['rotCount'] * 360; $rotateDirection = $bf['rotDirect'] == 'left' ? '-' : ''; $duration = $bf['animTime'] * 1000; $forward .= "jQuery('.aopObs{$postId} .aopOb{$postId}{$k}').fadeIn(300).animate({\n\t\t\twidth:'{$width}%',\n\t\t\theight:'{$height}%',\n\t\t\tleft:'{$left}%',\n\t\t\ttop:'{$top}%',\n\t\t\topacity:'{$bf['opacity']}',\n\t\t\tdeg: {$rotateDirection}{$deg},\n\t\t}, { duration: {$duration},\n\t\t complete: function(){\n\t\t\t //jQuery( this ).fadeOut(100);\n\t\t\t }\n\t\t }); "; } foreach ($aopData as $k => $v) { $bf = $v['bf']; $width = calcPercent($bf['sizeX'], 'width'); $height = calcPercent($bf['sizeY'], 'height'); $left = calcPercent($bf['moveLeft'], 'left'); $top = calcPercent($bf['moveTop'], 'top'); $deg = $bf['rotCount'] * 360; $rotateDirection = $bf['rotDirect'] == 'left' ? '-' : ''; $duration = $bf['animTime'] * 300; $backward .= "jQuery('.aopObs{$postId} .aopOb{$postId}{$k}').stop().animate({\n\t\t\twidth:'{$width}%',\n\t\t\theight:'{$height}%',\n\t\t\tleft:'{$left}%',\n\t\t\ttop:'{$top}%',\n\t\t\topacity:'{$bf['opacity']}',\n\t\t\tdeg: {$rotateDirection}{$deg},\n\t\t}, { duration: {$duration},\n\t\t complete: function(){\n\t\t\t jQuery( this ).fadeOut(100);\n\t\t\t }\n\t\t}); "; } return "\n\tfunction animateObsForward{$postId}(){\n\t\t{$forward}\n\t}\n\n\tfunction animateObsBackward{$postId}(){\n\t\t{$backward}\n\n\t} "; }
<?php get_header(); ?> <?php if (have_posts()) { ?> <?php while (have_posts()) { the_post(); ?> <?php $postMeta = get_post_meta(get_the_ID()); $angariadoPercent = calcPercent($postMeta); $closeIn = daysUntil($postMeta["proj_data_fecho"][0]); $date1 = new DateTime($postMeta["proj_data_fecho"][0]); $date2 = new DateTime(date('Y-m-d h:m:s')); $diff = $date1->diff($date2); $hours = $diff->format('%hh %im'); ?> <div class="container container-ficha"> <div class="row"> <div class="col-md-12"> <h1 class="container-ficha-title"><?php the_title(); ?> </h1> <div class="pull-right">
<div class="backupsGraph"> <?php function calcPercent($maxVal, $val) { return round($val / $maxVal * 100); } $count = 0; foreach ($backUpsUsage as $key => $val) { $count++; if ($count > 30) { break; } ?> <div class="graphRow"> <div class="graphIndicator" style="width: <?php echo calcPercent($maxUsage, $val['value']); ?> %;"></div> <div class="graphIndicatorValue"><?php echo memoryFormat($val['value']); ?> </div> <div class="graphLabel"><?php echo $val['label']; ?> </div> <div class="graphLabel"><?php echo $val['label']; ?> </div> <div class="graphLabel"><?php