public function getPoints() { $id = Account::getMyID(); $p = new QuizPoints(); $arrP = $p->getWhere("points_acc_id = '{$id}' ORDER BY points_update DESC"); $tp = 0; //hitung poin foreach ($arrP as $p) { $tp += $p->points_nilai; } $_SESSION['game']['mypoints'] = $tp; }
function user($args) { list($id) = $args; if ($id == "") { die("no ID"); } $acc = new Account(); $acc->getByID($id); if ($acc->admin_fb_id == "" || $acc->admin_aktiv != 1 || $acc->admin_fb_id == 0) { Redirect::p404(); } //get points $p = new QuizPoints(); $arrP = $p->getWhere("points_acc_id = '{$id}' ORDER BY points_update DESC"); $tp = 0; $badges = array(); $rapor = array(); //hitung poin foreach ($arrP as $p) { $ul = new QuizUlangan(); $ul->getByID($p->points_ul_id); $lvl = new QuizLevel(); if (!in_array($ul->ulangan_level_id, $rapor)) { $lvl->getByID($ul->ulangan_level_id); $rapor[$lvl->level_id] = $lvl; } $tp += $p->points_nilai; $point = $p->points_nilai; //update badges if ($point > 5 && $point < 8) { $badges[$p->points_ul_id] = $ul->ulangan_badge_1; } if ($point > 7 && $point < 10) { $badges[$p->points_ul_id] = $ul->ulangan_badge_2; } if ($point == 10) { $badges[$p->points_ul_id] = $ul->ulangan_badge_3; } } ksort($rapor); ?> <div style="margin-top: 30px;"> <div class="col-md-8 col-md-offset-2"> <?php if ($id == Account::getMyID()) { $kls_id = 1; if (isset($arrP[0]->points_ul_id)) { $ul = new QuizUlangan(); $ul->getByID($arrP[0]->points_ul_id); $kls_id = $ul->ulangan_level_id; } ?> <div class="mulaitest"> <div class="judul">Lanjutkan Ujian</div> <div class="des">Kamu dapat melanjutkan ujian terakhir yang kamu kerjakan</div> <button onclick="document.location='<?php echo _SPPATH; ?> kl/tk/<?php echo $kls_id; ?> ';" style="min-width: 250px; background-color: #f0373c; border-color: #f0373c;" class="btn btn-primary btn-lg">Start</button> </div> <?php } ?> <div class="col-md-5" style="padding-left: 0px;"> <div class="profilecon"> <div class="profiles"> <div class="col-md-4 col-xs-4 col-sm-4" style="padding-left: 0px;"> <img width="100%" src="//graph.facebook.com/<?php echo $acc->admin_fb_id; ?> /picture?type=large"> </div> <div class="col-md-8 col-sm-8 col-xs-8"> <div class="menuprofile"> <?php echo $acc->admin_name; ?> </div> <div class="menuprofile"> <i class="glyphicon glyphicon-stats"></i> <b>#<?php echo $acc->game_ranking; ?> </b> </div> <div class="menuprofile"> <i class="glyphicon glyphicon-fire"></i> <?php echo $tp; ?> </div> </div> <div class="clearfix"></div> </div> <div class="ranking"> <div class="badges"> <h4>Rapor</h4> <div class="badges_isi"> <?php foreach ($rapor as $lvl) { ?> <div class="rapor"> <i class="glyphicon glyphicon-book"></i> <a href="<?php echo _SPPATH; ?> rapor/user/<?php echo $id; ?> /<?php echo $lvl->level_id; ?> "><?php echo $lvl->level_name; ?> </a> </div> <?php } ?> </div> </div> <div style="margin-top: 15px; text-align: center; padding: 10px; background-color: #f0373c; color:white; "> Ingin tahu kartu pelajar kamu seperti apa ?<br><br> <div class="aftersales"> <button style="width: 100%;" class="btn btn-primary btn-lg btn-fb" onclick="return fbs_click();">Bagi di Facebook</button></div> </div> </div> </div> </div> <div class="col-md-7 fbcom"> <?php if ($id == Account::getMyID()) { ?> <div class="aftersales" style="background-color: #efefef; padding: 20px; text-align: center; margin-bottom: 15px;"> <h4>Ujian dari Indonesia untuk Indonesia dan tentang Indonesia</h4> <button style="width: 100%;" class="btn btn-primary btn-lg btn-danger" onclick="document.location='<?php echo _SPPATH; ?> p/bikin_ujian/';">Bikin Ujianmu</button> <p style="padding-top: 20px;">*untuk menaikkan peringkat ujian kamu, kamu bisa share ujian kamu ke facebook dan biarkan teman-temanmu ikut mengikuti ujian kamu, semakin banyak yang mengikuti, akan semakin populer ujian kamu.</p> <a href="<?php echo _SPPATH; ?> p/manage_ujian">manajemen ujian</a> </div> <?php } ?> <?php /*<div class="mylogs"> <div class="ranking"> <div class="badges"> <h4>Penghargaan</h4> <div class="badges_isi"> <? pr($badges);?> </div> </div> </div> <? pr($_SESSION); pr($arrP); pr($acc);?> </div> */ ?> <div id="comment"> <div class="fb-comments" data-href="<?php echo _BPATH; ?> p/user/<?php echo $id; ?> " data-width="100%" data-numposts="5" data-colorscheme="light"></div> </div> </div> <div class="clearfix" style="margin-bottom: 50px;"></div> </div> </div> <style> .profiles{ color:white; background-color: #f0373c; padding: 10px; } .menuprofile{ padding-left: 10px; padding-bottom: 5px; } .mulaitest{ //background-color: #E6E6E6; border:2px dashed #f0373c; text-align: center; padding: 30px; margin-bottom: 30px; } .mulaitest .judul{ font-size: 30px; padding-bottom: 20px; } .mulaitest .des{ padding-bottom: 20px; } .badges{ background-color: #f0373c; padding: 10px; margin-top: 15px; color:white; } .badges h4{ text-align: center; border-bottom: 1px dashed #ccc; margin: 0; padding-bottom: 10px; } .rapor{ text-align: center; padding-top: 10px; padding-bottom: 10px; font-size: 15px; } .rapor a{ color:white; text-decoration: underline; } </style> <script> function fbs_click(){ u=location.href; //t=document.title; var win = window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&p[images][0]=<?php echo _BPATH . _PHOTOURL . 'images/kartupelajar.jpg'; ?> ','sharer','toolbar=0,status=0,width=626,height=436'); //win.location.reload(); setTimeout(win.location.reload, 1400); return false; } </script> <?php $rand = rand(1, 20); global $template; $template->title = $acc->admin_name . " | Seberapa Indonesiakah Anda"; $fb_opengraph = '<meta property="og:title" content="Kartu Pelajar ' . $acc->admin_name . '" />'; $template->headText[] = $fb_opengraph; $fb_opengraph = '<meta property="og:image" content="' . _BPATH . 'images/kartu/kartupelajar_' . $rand . '.jpg" /> '; $template->headText[] = $fb_opengraph; //url $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $fb_opengraph = '<meta property="og:url" content="' . $actual_link . '" />'; $template->headText[] = $fb_opengraph; //sitename $fb_opengraph = '<meta property="fb:app_id" content="' . Efiwebsetting::getData('fb_app_id') . '" />' . '<meta property="og:type" content="website" />'; $template->headText[] = $fb_opengraph; //sitename $fb_opengraph = '<meta property="og:site_name" content="SeberapaIndonesiakahAnda"/>'; $template->headText[] = $fb_opengraph; //description $fb_opengraph = '<meta property="og:description" content="' . $acc->admin_name . ' sudah mengikuti ujian #SeberapaIndonesiakahAnda. Ayok ikutan !!" />'; $template->headText[] = $fb_opengraph; }
function user($args) { list($uid, $lvl, $res, $res_id) = $args; if ($lvl < 0 || $lvl == "") { die("No lvl"); } if ($uid < 1 || $uid == "") { die("No id"); } $fb_page = "https://www.facebook.com/pages/Stage-City/1076705655676385"; $ql = new QuizLevel(); $ql->getByID($lvl); $sm = new SiteMember(); $sm->getByID($uid); $q = new QuizUlangan(); $arrQ = $q->getWhere("ulangan_level_id = '{$ql->level_id}' AND ulangan_aktif = 1 ORDER BY ulangan_name ASC"); $tn = 0; $nn = array(); foreach ($arrQ as $q) { $nn[] = "points_ul_id = '{$q->ulangan_id}'"; $tn++; } $imp = implode(" OR ", $nn); $p = new QuizPoints(); //echo "$imp AND (points_acc_id = '$uid')"; $arrP = $p->getWhere("({$imp}) AND (points_acc_id = '{$uid}')"); $pid = array(); $tp = 0; foreach ($arrP as $p) { $pid[$p->points_ul_id] = $p; //echo $p->points_ul_id." ".$p->points_nilai." ".$p->points_acc_id."<br>"; $tp += $p->points_nilai; //$tn++; } $rata2 = $tp / $tn; //echo $tp; //echo "<br>"; //echo $tn; $point = ceil($rata2); $pp = ceil($rata2); //pilah poin ke badge if ($point == 0) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_1; $badge_thumb = _BPATH . _PHOTOURL . "thumbnail/" . $ql->level_rapor_1; } if ($point > 0 && $point < 6) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_2; $badge_thumb = _BPATH . _PHOTOURL . "thumbnail/" . $ql->level_rapor_2; } if ($point > 5 && $point < 8) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_3; $badge_thumb = _BPATH . _PHOTOURL . "thumbnail/" . $ql->level_rapor_3; } if ($point > 7 && $point < 10) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_4; $badge_thumb = _BPATH . _PHOTOURL . "thumbnail/" . $ql->level_rapor_4; } if ($point == 10) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_5; $badge_thumb = _BPATH . _PHOTOURL . "thumbnail/" . $ql->level_rapor_5; } $actual_link = _BPATH . "rapor/user/" . $uid . "/" . $lvl; ?> <style> body{ background-color: #efefef; } .table th{ text-align: center; text-transform: uppercase; } .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td{ line-height: 35px; } .table a{ color:#000; text-decoration: underline; } </style> <div class="col-md-8 col-md-offset-2" > <div style="background-color: white; padding: 30px; margin-top: 30px; margin-bottom: 30px;"> <div style="text-align: center;"> <?php if ($point == 10) { ?> <div style="position: absolute;"> <img src="<?php echo _SPPATH; ?> images/10.png" width="100px"> </div> <?php } ?> <?php if ($point == 0) { ?> <div style="position: absolute;"> <img src="<?php echo _SPPATH; ?> images/0.png" width="100px"> </div> <?php } ?> <img src="<?php echo _SPPATH; ?> images/logo-si2.png" width="20%"> <h3 style="text-align: center; padding-bottom: 10px;">LAPORAN HASIL BELAJAR</h3> </div> <hr> <div class="detail" style="padding-bottom: 20px; margin-top: 30px;"> <div class="col-md-6 col-sm-6 col-xs-6"> Murid : <img class="wow bounceInLeft" src="//graph.facebook.com/<?php echo $sm->admin_fb_id; ?> /picture" height="35px"> <b class="wow bounceInLeft"><?php echo $sm->admin_name; ?> </b> </div> <div class="col-md-6 col-sm-6 col-xs-6" style="text-align: right;"> Kelas : <b class="wow bounceInRight"><?php echo $ql->level_name; ?> </b> </div> <div class="clearfix"></div> </div> <div class="table-responsive"> <table class="table table-bordered table-striped"> <thead> <tr> <th>No</th> <th>Mata Pelajaran</th> <!--<th>Deskripsi kemajuan</th>--> <th>Nilai</th> </tr> </thead> <tbody> <?php $cnt = 1; foreach ($arrQ as $q) { ?> <tr> <td style="text-align: center;"><?php echo $cnt; ?> </td> <td><a href="<?php echo _SPPATH; ?> ul/id/<?php echo $q->ulangan_id; ?> /<?php echo urlencode($q->ulangan_name); ?> "><?php echo $q->ulangan_name; ?> </a></td> <?php $nilai = $pid[$q->ulangan_id]->points_nilai; ?> <!--<td style="text-align: center;"> <?php $jml = 0; $point = $nilai; if ($point > 5 && $point < 8) { $jml = 3; } if ($point > 7 && $point < 10) { $jml = 4; } if ($point == 10) { $jml = 5; } for ($x = 1; $x <= $jml; $x++) { ?> <img src="<?php echo _SPPATH; ?> images/bebekmini.png" height="35px"> <?php } ?> </td>--> <td style="text-align: center;"> <?php if (!isset($nilai)) { if (Account::getMyID() == $uid) { ?> <a href="<?php echo _SPPATH; ?> ul/id/<?php echo $q->ulangan_id; ?> /<?php echo urlencode($q->ulangan_name); ?> ">ambil ujian</a> <?php } else { ?> Tidak Tersedia <?php } } else { ?> <b <?php if ($nilai < 6) { ?> style="color:red;"<?php } ?> ><?php echo $nilai; ?> </b><?php } ?> </td> </tr> <?php $cnt++; } ?> </tbody> </table> </div> <div class="el" style="padding-top: 20px; font-size: 18px; text-align: center;"> Nilai rata-rata : <b><?php echo $pp; ?> </b> (<?php echo round($rata2, 2); ?> ) </div> <div style="padding: 30px; text-align: center;"> <div class="aftersales"><button class="btn btn-primary btn-lg btn-fb" onclick="return fbs_click('<?php echo $badge; ?> ');">Bagi di Facebook</button></div> </div> </div> </div> <script> $(document).ready(function(){ var obj = {'lid': '<?php echo $pp; ?> ', 'url': '<?php echo $actual_link; ?> '}; var title = '<?php echo $id; ?> '; var url = '<?php echo _SPPATH . "rapor/user/" . $uid . "/" . $lvl; ?> /result/<?php echo $pp; ?> '; history.pushState(obj, title, url); setTimeout(function() { $('#afterSalesModal').modal('show'); }, 3000); }); function fbs_click(badge){ u=location.href; //t=document.title; var win = window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&p[images][0]='+badge,'sharer','toolbar=0,status=0,width=626,height=436'); //win.location.reload(); setTimeout(win.location.reload, 1400); return false; } </script> <!-- Modal --> <div class="modal fade" id="afterSalesModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <div class="modal-title" id="myModalLabel">Bagi ke teman</div> </div> <div class="modal-body" id="modalbody"> <div id="modalbody2" style="text-align: center;"> <img class="wow tada" src="<?php echo $badge_thumb; ?> " width="100%"> <div class="el" style="padding-top: 20px; font-size: 18px; text-align: center;"> Nilai rata-rata : <b><?php echo $pp; ?> </b> (<?php echo round($rata2, 2); ?> ) </div> <div style="padding: 30px; text-align: center;"> <div class="aftersales"><button class="btn btn-primary btn-lg btn-fb" onclick="return fbs_click('<?php echo $badge; ?> ');">Bagi di Facebook</button></div> </div> </div> <div class="likeus" style="text-align: center; padding: 20px;"> Kalau kamu menyukai situs kami. Tolong like kami. Makaci! <div class="likebut" style="padding:20px;"> <div class="fb-like fb-like2" data-href="<?php echo $fb_page; ?> " data-layout="button_count" data-action="like" data-show-faces="true" data-share="false"></div> </div> </div> </div> <!--<div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div>--> </div> </div> </div> <?php global $template; $template->title = "Rapor {$sm->admin_name} {$ql->level_name} | Seberapa Indonesiakah Anda"; $fb_opengraph = '<meta property="og:title" content="Rapor ' . $ql->level_name . ' ' . $sm->admin_name . '" />'; $template->headText[] = $fb_opengraph; if ($res_id != "") { $point = (int) $res_id; //pilah poin ke badge if ($point == 0) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_1; } if ($point > 0 && $point < 6) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_2; } if ($point > 5 && $point < 8) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_3; } if ($point > 7 && $point < 10) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_4; } if ($point == 10) { $badge = _BPATH . _PHOTOURL . $ql->level_rapor_5; } //image $fb_opengraph = '<meta property="og:image" content="' . $badge . '" /> '; $template->headText[] = $fb_opengraph; //description $fb_opengraph = '<meta property="og:description" content="' . $sm->admin_name . ' mendapatkan nilai rata-rata ' . $res_id . '. Buktikan Seberapa Indonesiakah Anda?!?" />'; $template->headText[] = $fb_opengraph; } else { //image $fb_opengraph = '<meta property="og:image" content="' . $badge . '" /> '; $template->headText[] = $fb_opengraph; //description $fb_opengraph = '<meta property="og:description" content="' . $sm->admin_name . ' mendapatkan nilai rata-rata ' . $pp . '. Buktikan Seberapa Indonesiakah Anda?!?" />'; $template->headText[] = $fb_opengraph; } $template->metades = " Buktikan Seberapa Indonesiakah Anda ?!?! #Seberapa Indonesiakah Anda | How Indonesia Are You"; $template->metakey = 'How Indonesia Are You, Seberapa Indonesiakah Anda'; //url $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $fb_opengraph = '<meta property="og:url" content="' . $actual_link . '" />'; $template->headText[] = $fb_opengraph; //sitename $fb_opengraph = '<meta property="fb:app_id" content="' . Efiwebsetting::getData('fb_app_id') . '" />' . '<meta property="og:type" content="website" />'; $template->headText[] = $fb_opengraph; //sitename $fb_opengraph = '<meta property="og:site_name" content="SeberapaIndonesiakahAnda"/>'; $template->headText[] = $fb_opengraph; }