Beispiel #1
0
    function tk($args)
    {
        list($lvl, $name) = $args;
        //$lvl = $_GET['lvl'];
        if ($lvl == "") {
            $lvl = 1;
        }
        if ($lvl == 0) {
            header("Location:" . _SPPATH . "rank/dari_untuk_indonesia");
            exit;
        }
        $l = new QuizLevel();
        $l->getByID($lvl);
        if ($l->level_name == "" || $l->level_aktif != 1) {
            Redirect::p404();
        }
        $actual_link = _BPATH . "kl/tk/" . $lvl;
        $point = QuizPoints::myPoints();
        $kurang = "";
        $lebih = "";
        $arrLevelsBig = $l->getWhere("level_limit > {$l->level_limit} AND level_aktif = 1 ORDER BY level_limit ASC LIMIT 0,1");
        $lebih = $arrLevelsBig[0];
        $arrLevelsSmall = $l->getWhere("level_limit < {$l->level_limit} AND level_aktif = 1 ORDER BY level_limit DESC LIMIT 0,1");
        $kurang = $arrLevelsSmall[0];
        //pr($arrLevels);
        $boleh = 0;
        if ($point >= $l->level_limit) {
            $boleh = 1;
        }
        $arrLevel = $l->getWhere(" level_aktif = 1 ORDER BY level_limit ASC ");
        ?>

<div class="col-md-10 col-sm-12 col-xs-12 kelas col-md-offset-1">    
    <div id="fbgroup" style="height: 20px; line-height: 20px; margin-bottom: 20px;float: none; ">
        <div style="float:left;width: 200px; text-align: left;">
            Pilih Kelas : <select id="kelassel"  onchange="document.location='<?php 
        echo _SPPATH;
        ?>
kl/tk/'+$('#kelassel').val();">
                <?php 
        foreach ($arrLevel as $level) {
            ?>
                <option <?php 
            if ($level->level_id == $lvl) {
                echo "selected";
            }
            ?>
 value="<?php 
            echo $level->level_id;
            ?>
"><?php 
            echo $level->level_name;
            ?>
</option>
                <?php 
        }
        ?>
            </select>
        </div>
     <div class="fb-like" data-href="<?php 
        echo $actual_link;
        ?>
" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>
    </div>
    <div class="kelas_container">
    <h1 class="text-center judulkl">
    <?php 
        if ($kurang->level_id != "") {
            ?>
    <i onclick="document.location='<?php 
            echo _SPPATH;
            ?>
kl/tk/<?php 
            echo $kurang->level_id;
            ?>
';" class="glyphicon glyphicon-chevron-left"></i>
    <?php 
        }
        ?>
    <?php 
        echo $l->level_name;
        ?>
        <?php 
        if ($lebih->level_id != "") {
            ?>
    <i onclick="document.location='<?php 
            echo _SPPATH;
            ?>
kl/tk/<?php 
            echo $lebih->level_id;
            ?>
';" class="glyphicon glyphicon-chevron-right"></i>
<?php 
        }
        ?>
    </h1>
    <div class="kelas_isi">
    <?php 
        //echo "<h1 class='text-center'>".$l->level_name."</h1>";
        //get ulangan dlm level
        $ul = new QuizUlangan();
        $arrUl = $ul->getWhere("ulangan_level_id = '" . $l->level_id . "' AND ulangan_aktif = 1");
        //pr($arrUl);
        foreach ($arrUl as $num => $ul) {
            ?>
    <div class="col-md-4 text-center kelas_dalam">
        <div class="kelas_dalam_image">
            <a href="<?php 
            echo _SPPATH;
            ?>
ul/id/<?php 
            echo $ul->ulangan_id;
            ?>
/<?php 
            echo urlencode($ul->ulangan_name);
            ?>
">
            <img class="wow bounceIn" <?php 
            if (!$boleh) {
                ?>
style="opacity:0.5;"<?php 
            }
            ?>
 width="100%" src="<?php 
            echo _SPPATH . _PHOTOURL . "thumbnail/" . $ul->ulangan_image;
            ?>
">
            </a>
        </div>
        <div class="kelas_dalam_text">
        <a href="<?php 
            echo _SPPATH;
            ?>
ul/id/<?php 
            echo $ul->ulangan_id;
            ?>
/<?php 
            echo urlencode($ul->ulangan_name);
            ?>
"><?php 
            echo $ul->ulangan_name;
            ?>
</a>
        </div>
    </div>    
        <?php 
            if ($num % 3 == 2) {
                echo '<div class="clearfix"></div>';
            }
        }
        ?>
        <div class="clearfix"></div>
    </div>
    </div>
<div id="comment">
<div class="fb-comments" data-href="<?php 
        echo $actual_link;
        ?>
" data-width="100%" data-numposts="5" data-colorscheme="light"></div>    
</div>
</div>


<div class="clearfix"></div>
<style>
    h1.judulkl{
        font-family: verdana;
        margin-top: 0px;
    }
    .kelas_dalam_text a{
        color:#db031b;
    }
    .judulkl i{
        font-size: 20px;
        position: absolute;
        margin-top: 80px;
        margin-left: 20px;
        font-style: normal;
        cursor: pointer;
        
        //color:maroon;
    }
    .judulkl i.glyphicon-chevron-left{
        margin-left: -40px;
        //margin-right:  20px;
    }
    .kelas_container{
        padding-top: 30px;
       // background-color: #efefef;
    }
</style>
<?php 
        global $template;
        $template->title = $l->level_name . " | Seberapa Indonesiakah Anda";
        $template->metades = $l->level_descr . " #Seberapa Indonesiakah Anda | How Indonesia Are You";
        $template->metakey = 'How Indonesia Are You, Seberapa Indonesiakah Anda';
        $fb_opengraph = '<meta property="og:title" content="' . $l->level_name . '" />';
        $template->headText[] = $fb_opengraph;
        //image
        $fb_opengraph = '<meta property="og:image"  content="' . _BPATH . _PHOTOURL . $l->level_fb_image . '" /> ';
        $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="' . $l->level_descr . '" />';
        $template->headText[] = $fb_opengraph;
    }
Beispiel #2
0
    function id($args)
    {
        list($id, $name, $res, $res_id) = $args;
        $fb_page = "https://www.facebook.com/pages/Stage-City/1076705655676385";
        if ($id == 0) {
            //$ul = new QuizUlangan();
            //$arrUl = $ul->getWhere("")
            header("Location:" . _SPPATH . "Kl/tk");
            exit;
        }
        $ul = new QuizUlangan();
        $ul->getByID($id);
        //tambahan buat user created
        $acc = new Account();
        $ucreate = 0;
        if ($ul->ulangan_creator_id != 0) {
            //TODO cek untuk preview
            $acc->getByID($ul->ulangan_creator_id);
            $ucreate = 1;
        }
        if ($ul->ulangan_aktif != 1 || $ul->ulangan_id == "") {
            Redirect::p404();
        }
        $l = new QuizLevel();
        $l->getByID($ul->ulangan_level_id);
        $point = QuizPoints::myPoints();
        $boleh = 0;
        if ($point >= $l->level_limit) {
            $boleh = 1;
        }
        $actual_link = _BPATH . "ul/id/" . $id . "/" . urlencode($name);
        //pr($ul);
        //ambil next ulangan
        $arrUl = $ul->getWhere("ulangan_level_id = '{$ul->ulangan_level_id}' AND ulangan_aktif =1 AND ulangan_id > {$ul->ulangan_id} LIMIT 0,1");
        $next = $arrUl[0];
        ?>
<style>
    #calc,#resultcontainer{
        background-color: #efefef;
        padding: 20px;
    }
    #detail{
        text-align: center;
        
    }
    .quiz_des{
        text-align: center;
        font-size: 15px;
        padding-bottom: 20px;
    }
    #comment{
        padding-top: 50px;
    }
    #fbgroup{
        padding-bottom: 20px;
    }
    .subtext{
        font-size: 14px;
        text-align: center;
    }
    .aftersales{
        text-align: center;
        padding: 30px;
    }
    #resultcontainer{
        text-align: center;
    }
    .subtextres{
        font-size:18px;
        padding: 20px;
    }
    .moremenu{
        padding-bottom: 40px;
        padding-top: 40px;
    }
    .moremenua{
        text-align: center;
        padding-bottom: 20px;
    }
    .fb-like2 {
    transform: scale(1.8);
    -ms-transform: scale(1.8);
    -webkit-transform: scale(1.8);
    -o-transform: scale(1.8);
    -moz-transform: scale(1.8);
}
.question{
    
}
#nilaiku{
    font-size: 80px;
}
.iklan{
    position: fixed;
    z-index: 10;
    text-align: center;
    width: 100%;
    height: 100%;
    left: 0px;
    top:0px;
    padding-top: 80px;
    background-color: rgba(0,0,0,0.5);
}
.iklan button{
    margin-top: 20px;
}
</style>

<div class="col-md-8 col-md-offset-2">
    
    <div id="fbgroup" style="margin-top: 30px;">
        kembali ke <a href="<?php 
        echo _SPPATH;
        ?>
kl/tk/<?php 
        echo $l->level_id;
        ?>
"><?php 
        echo $l->level_name;
        ?>
</a>
        <div style="float: right;">
        <div class="fb-like" data-href="<?php 
        echo $actual_link;
        ?>
" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>
        </div>
    </div>
    
    <div id="detail">
        <?php 
        if (!$boleh && Auth::isLogged()) {
            ?>
        <h3 style="padding-bottom: 20px;">
            Total Nilai Anda belum cukup untuk mengerjakan ujian ini. <br>
            Harap kerjakan ujian pada level sebelumnya.
        </h3>
        <?php 
        }
        ?>
        <?php 
        if (!$boleh && !Auth::isLogged()) {
            ?>
        <h3 style="padding-bottom: 20px;">Harap Login untuk dapat mengerjakan ujian</h3> 
        <button onclick="document.location='<?php 
            echo _SPPATH;
            ?>
register';" style="min-width: 250px; background-color: #f0373c; border-color: #f0373c; margin-bottom: 30px;" class="btn btn-primary btn-lg">Masuk</button>
        <?php 
        }
        ?>
        
        <img class="wow tada"  <?php 
        if ($boleh) {
            ?>
style="cursor:pointer;" onclick="$('#detail').hide();$('#calc').show();$('#question_0').show();"<?php 
        }
        ?>
 <?php 
        if ($ucreate) {
            ?>
width="100%"<?php 
        } else {
            ?>
width="100%"<?php 
        }
        ?>
 src="<?php 
        echo _SPPATH . _PHOTOURL . $ul->ulangan_image;
        ?>
">
        
        <div style="display:none;">
        <h1><?php 
        echo $ul->ulangan_name;
        ?>
</h1>
        <div class="quiz_des"><?php 
        echo $ul->ulangan_descr;
        ?>
</div>
        
        <?php 
        if ($boleh) {
            ?>
        <button onclick="$('#detail').hide();$('#calc').show();$('#question_0').show();" style="min-width: 250px;" class="btn btn-primary btn-lg">Start</button>
        <?php 
        } else {
            ?>
        <h1>Total Nilai kamu tidak cukup untuk mengerjakan ujian ini. 
            Harap kerjakan ujian pada level sebelumnya.</h1>
        <?php 
            if (!Auth::isLogged()) {
                ?>
        <h1>Tolong Log-In</h1> 
         <button onclick="document.location='<?php 
                echo _SPPATH;
                ?>
register';" style="min-width: 250px;" class="btn btn-primary btn-lg">Masuk</button>
       
                <?php 
            }
        }
        ?>
        </div>
    </div>
    <?php 
        $q = new QuizQuestion();
        $arrQ = $q->getWhere("q_ulangan_id = '{$ul->ulangan_id}' AND q_aktif = 1");
        shuffle($arrQ);
        //pr($arrQ);
        $jumlah_question = $ul->ulangan_jumlah_soal;
        $jumlah_question_arr = $jumlah_question - 1;
        if (count($arrQ) < $jumlah_question) {
            echo "<h1>Tambah Jumlah Soal</h1>";
            die('err qty not enough');
        }
        ?>
    <div id="calc" style="display: none;">
        
        <?php 
        $selected_questions = array();
        //echo $jumlah_question;
        for ($x = 0; $x < $jumlah_question; $x++) {
            /*$ct = rand(0,count($arrQ)-1);
              //echo $ct;
              $selected_questions[] = $arrQ[$ct];
              unset($arrQ[$ct]);
              $arrQ = array_values($arrQ);*/
            $pop = array_pop($arrQ);
            //echo $pop->qid."<br>";
            $selected_questions[] = $pop;
        }
        //pr($selected_questions);
        foreach ($selected_questions as $nm => $q) {
            $ans = new QuizAnswer();
            $arrAns = $ans->getWhere("answer_qid = '{$q->qid}'");
            shuffle($arrAns);
            if ($nm == 5) {
                //pasang iklan
                $iklan = new QuizIklan();
                $arriklan = $iklan->getWhere("iklan_aktif = 1");
                $random = rand(0, count($arriklan) - 1);
                $pilihan = $arriklan[$random];
                ?>
        <div class="iklan" style="display:none;" id="iklanku">
            <div class="container">
                <div class="col-md-8 col-md-offset-2">
                    <div style="background-color: white; padding: 20px;">
                        <?php 
                echo stripslashes($pilihan->iklan_text);
                ?>
                        <button onclick="$('#iklanku').hide();" class="btn btn-default">lanjutkan</button>
                    </div>
                </div>
            </div>
        </div>  
                    
                <?php 
            }
            ?>
        <div class="question" id="question_<?php 
            echo $nm;
            ?>
" style="display:none;">
            <?php 
            if ($q->q_title != "") {
                ?>
            <div class="text-center">
                <h3 class="wow"><?php 
                echo $q->q_title;
                ?>
</h3>
            </div>
            <?php 
            }
            ?>
            <?php 
            if ($q->q_image != "") {
                ?>
            <div class="col-md-6 col-md-offset-3">
            <img src="<?php 
                echo _SPPATH . _PHOTOURL . $q->q_image;
                ?>
" width="100%">
            </div>
            <div class="clearfix"></div>
            <?php 
            }
            ?>
            <div class="answer" style="margin-top: 20px;">
                <div class="col-md-6 col-md-offset-3">
                <?php 
            foreach ($arrAns as $ans) {
                ?>
                <div class=" text-center">
                    <div style="padding:5px; padding-left: 0px; padding-right: 0px;">
                    <button onclick="saveAnser('<?php 
                echo $q->qid;
                ?>
','<?php 
                echo $ans->answer_id;
                ?>
',<?php 
                echo $nm;
                ?>
);<?php 
                if ($nm == 5) {
                    ?>
$('#iklanku').show();<?php 
                }
                ?>
" style="width: 100%; padding-top: 20px; padding-bottom: 20px;" class="btn btn-default"><?php 
                echo $ans->answer_text;
                ?>
</button>
                    <?php 
                /* if($q->q_correct_answer_id == $ans->answer_id){?>x<?}*/
                ?>
                    </div>
                <!--<input type="radio" name="radio_<?php 
                echo $q->qid;
                ?>
"> <?php 
                echo $ans->answer_text;
                ?>
-->
                </div>
                <?php 
            }
            ?>
                </div>
            </div>
            <div class="clearfix"></div>
            <!-- <button onclick="$('#question_<?php 
            echo $nm;
            ?>
').hide();<?php 
            if ($nm < $jumlah_question_arr) {
                ?>
$('#question_<?php 
                echo $nm + 1;
                ?>
').show();<?php 
            } else {
                ?>
hitungRes();<?php 
            }
            ?>
" style="min-width: 250px;" class="btn btn-primary btn-lg">Next</button>
 -->
        </div>
        <?php 
        }
        ?>
        <div class="clearfix"></div>
    </div>    
    <div id="resultcontainer" style="display:none; padding-top: 20px !important;"> 
        <div class="wow tada" id="naikLevel" style="display: none;text-align: center; background-color: red; color:white;">
            <h1 style="padding: 30px;color:white;" >Selamat!! Kamu naik kelas!!</h1>
        </div>
        <div id="resulting" style="display:none;"></div>
        
        <div id="saved"></div>
        
        <div id="moremenu" style="display:none;">
            <div class="moremenu">
                <div class="moremenua col-md-3"><a href="#more">take other test</a></div>
                <div class="moremenua col-md-3">
                    <div class="fb-like" data-href="<?php 
        echo $fb_page;
        ?>
" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div>
                </div>
                <div class="moremenua col-md-3"><a target="_blank" href="<?php 
        echo _SPPATH;
        ?>
how_we_do_it">how we do it</a></div>
                <div class="moremenua col-md-3"><a href="#comment">leave a comment</a></div>
            </div>
        </div>
    </div>
    
    <div id="ulnext" style="text-align: right; padding-top: 20px;display: none;">
        <?php 
        if (isset($next->ulangan_id) && $next->ulangan_id != "") {
            $nurl = _SPPATH . "ul/id/" . $next->ulangan_id . "/" . $next->ulangan_name;
            $ntext = "lanjut ke ulangan berikutnya";
        } else {
            $nurl = _SPPATH . "kl/tk/" . $l->level_id;
            $ntext = "kembali ke kelas";
        }
        ?>
        <button onclick="document.location='<?php 
        echo $nurl;
        ?>
';" class="btn btn-default btn-sm"><?php 
        echo $ntext;
        ?>
</button>
    </div>
    
    <?php 
        if ($ucreate) {
            ?>
    <div class="ucreate" style="text-align: center; background-color: #efefef; margin-top: 10px; padding: 10px; ">
    <h1 onclick="$('#detail').hide();$('#calc').show();$('#question_0').show();"><?php 
            echo $ul->ulangan_name;
            ?>
</h1>
        <div onclick="$('#detail').hide();$('#calc').show();$('#question_0').show();" class="quiz_des" style="font-style: italic;"><?php 
            echo $ul->ulangan_descr;
            ?>
</div>
        <div class="oleh" >disunting oleh<br><br>
            <img src="//graph.facebook.com/<?php 
            echo $acc->admin_fb_id;
            ?>
/picture?type=small">
            <br><a href="<?php 
            echo _SPPATH;
            ?>
p/user/<?php 
            echo $acc->admin_id;
            ?>
"><?php 
            echo $acc->admin_name;
            ?>
</a>
            <br>untuk <b>INDONESIA</b>
        </div>
    </div>
        <?php 
        }
        ?>
        <div class="clearfix" style="padding: 20px;"></div>
    <script>
        var jml = <?php 
        echo $jumlah_question_arr;
        ?>
;
        var arrJwb = [];
        function saveAnser(qid,aid,nr){
            var com = {qid : qid,aid : aid};
            arrJwb.push(com);
            $('#question_'+nr).hide();
            if(nr<jml){
                var nex = nr+1;
                $('#question_'+nex).show();
            }
            else{
                hitungRes();
            }
        }
        function hitungRes(){
            $('#resultcontainer').show();
            //$('#moremenu').show();
            $('#resulting').show();
            $('#calc').hide();
            
            console.log(arrJwb);
            $.post('<?php 
        echo _SPPATH;
        ?>
Ul/hitung',{jwb : arrJwb,qid:'<?php 
        echo $id;
        ?>
'},function(data){
              //alert(data);  
              //$('#nilaiku').html(data.points);
                var badge = data.badge;
                var poin = data.points;
                // modify history
                var obj = {'lid': '<?php 
        echo $id;
        ?>
', 'url': '<?php 
        echo $actual_link;
        ?>
'};
                var title = '<?php 
        echo $id;
        ?>
';
                var url = '<?php 
        echo _SPPATH . "ul/id/" . $id . "/" . urlencode($name);
        ?>
/result/'+data.points;
                history.pushState(obj, title, url);
            
                var text1 = "<img class='wow tada' width='100%' src='"+badge+"'>";
                var text2 = "<h3 class='wow tada'>Kamu dapat "+poin+"!!</h3>";
                $('#resulting').append(text1);
                $('#resulting').append(text2);
                //var u=window.btoa(location.href);
                var aftersales ='<div class="aftersales"><button class="btn btn-primary btn-lg btn-fb wow flipInY" onclick="return fbs_click(\''+badge+'\');">Bagi ke Facebook</button></div>';
                $('#resulting').append(aftersales);
                //$('#moremenu').fadeIn( 1000 );
                $('#modalbody2').html(text1+text2);
                $('#modalbody2').append(aftersales);
                if(data.total_point != -1){
                    $('#resulting').append('<b>Total Nilai Kamu Sekarang : '+data.total_point+'</b>');
                    $('#modalbody2').append('<b>Total Nilai Kamu Sekarang : '+data.total_point+'</b>');
                }
                setTimeout(function() {
                    $('#afterSalesModal').modal('show');
                }, 3000); // milliseconds
                
                if(data.naik_level){
                    $('#naikLevel').show();
                    $('#naikLevelModal').show();
                }
                //next ul
                $('#ulnext').show();
                
                if(poin>9 || data.naik_level){
                    confetti();
                }
                
                if(!data.saved){
                    $('#saved').html('<h3>Nilai kamu belum disimpan..<br>Harap login untuk menyimpan.<br><br><button onclick="document.location=\'<?php 
        echo _SPPATH;
        ?>
register\';" style="min-width: 250px; padding-top: 20px; padding-bottom: 20px; background-color: #f0373c; border-color: #f0373c; " class="btn btn-primary btn-lg">Masuk</button>');
                }
            },'json');
            
        }
        </script>
</div>
<script>
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">&times;</span></button>
        <div class="modal-title" id="myModalLabel">Bagi ke teman</div>
      </div>
        <div class="modal-body" id="modalbody">
            <div class="wow tada" id="naikLevelModal" style="display: none;text-align: center; background-color: red; color:white;">
                <h1 style="padding: 30px;color:white;" >Selamat!! Kamu naik kelas!!</h1>
            </div>
            <div id="modalbody2" style="text-align: center;">
                
            </div>
            <div class="likeus" style="text-align: center; padding: 20px;">
                Kalau kamu menyukai ujian 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 
        //update view
        $ul->ulangan_view = $ul->ulangan_view + 1;
        $ul->save();
        global $template;
        $ucreate_text = "Seberapa Indonesiakah Anda";
        //campur badge
        if ($ucreate) {
            $ul->ulangan_badge_1 = $ul->ulangan_image;
            $ul->ulangan_badge_2 = $ul->ulangan_image;
            $ul->ulangan_badge_3 = $ul->ulangan_image;
            $ul->ulangan_badge_4 = $ul->ulangan_image;
            $ul->ulangan_badge_5 = $ul->ulangan_image;
            $ucreate_text_title = $ul->ulangan_name;
            $ucreate_text = $acc->admin_name . " membuat ujian '" . $ul->ulangan_name . "' untuk INDONESIA. Berani terima tantangan dia?!?";
            $ul->ulangan_desc_1 = $ucreate_text;
            $ul->ulangan_desc_2 = $ucreate_text;
            $ul->ulangan_desc_3 = $ucreate_text;
            $ul->ulangan_desc_4 = $ucreate_text;
            $ul->ulangan_desc_5 = $ucreate_text;
            $ul->ulangan_descr = $ucreate_text;
        }
        if ($res_id != "") {
            $template->title = "Aku dapat {$res_id} !! | " . $ul->ulangan_name . " | " . $ucreate_text;
            $fb_opengraph = '<meta property="og:title" content="Aku dapat ' . $res_id . '!!" />';
            $template->headText[] = $fb_opengraph;
            $point = (int) $res_id;
            //pilah poin ke badge
            $urut = "ulangan_desc_1";
            if ($point == 0) {
                $urut = "ulangan_desc_1";
                $badge = _BPATH . _PHOTOURL . $ul->ulangan_badge_1;
            }
            if ($point > 0 && $point < 6) {
                $urut = "ulangan_desc_2";
                $badge = _BPATH . _PHOTOURL . $ul->ulangan_badge_2;
            }
            if ($point > 5 && $point < 8) {
                $urut = "ulangan_desc_3";
                $badge = _BPATH . _PHOTOURL . $ul->ulangan_badge_3;
            }
            if ($point > 7 && $point < 10) {
                $urut = "ulangan_desc_4";
                $badge = _BPATH . _PHOTOURL . $ul->ulangan_badge_4;
            }
            if ($point == 10) {
                $urut = "ulangan_desc_5";
                $badge = _BPATH . _PHOTOURL . $ul->ulangan_badge_5;
            }
            //image
            $fb_opengraph = '<meta property="og:image"  content="' . $badge . '" /> ';
            $template->headText[] = $fb_opengraph;
            //description
            $fb_opengraph = '<meta property="og:description" content="' . $ul->{$urut} . '" />';
            $template->headText[] = $fb_opengraph;
        } else {
            $template->title = $ul->ulangan_name . " | " . $ucreate_text;
            $fb_opengraph = '<meta property="og:title" content="' . $ul->ulangan_name . '" />';
            $template->headText[] = $fb_opengraph;
            //image
            $fb_opengraph = '<meta property="og:image"  content="' . _BPATH . _PHOTOURL . $ul->ulangan_fb_image . '" /> ';
            $template->headText[] = $fb_opengraph;
            //description
            $fb_opengraph = '<meta property="og:description" content="' . $ul->ulangan_descr . '" />';
            $template->headText[] = $fb_opengraph;
        }
        $template->metades = $ul->ulangan_descr . " #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;
    }
Beispiel #3
0
    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> &nbsp; <b>#<?php 
        echo $acc->game_ranking;
        ?>
</b>
            </div>
            <div class="menuprofile">
                <i class="glyphicon glyphicon-fire"></i> &nbsp; <?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> &nbsp; <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;
    }
 public function id($args)
 {
     //        pr($args);
     /*
      * begin the calculation
      */
     $url = addslashes($_GET['jurusan']);
     //        echo $url;
     global $activeLang;
     //        pr($activeLang);
     $langtext = "";
     if (count($activeLang) > 0) {
         $sl = Lang::getLang();
         $langtext = "AND post_lang = '{$sl}'";
     }
     //        echo $langtext;
     $pg = new Page();
     $arrPage = $pg->getWhere("post_url = '{$url}' AND post_status = 'publish' {$langtext}");
     $pg = $arrPage[0];
     //pr($arrPage);
     if ($pg->post_url == "") {
         $pg = new Page();
         $arrPage = $pg->getWhere("post_url = '{$url}' AND post_status = 'publish'");
         if (count($arrPage) > 0) {
             $pg = $arrPage[0];
             if ($pg->post_link == "" || $pg->post_link == '0') {
                 ?>
                 <div class="alert alert-warning language_disclaimer" role="alert">
                     <?php 
                 echo Efiwebsetting::getData('Language_Disclaimer');
                 ?>
                 </div>
             <?php 
             }
         } else {
             Redirect::p404();
         }
     }
     //            Redirect::p404();
     //die('die');
     //pr($pg);
     $page = $pg;
     // isi semua meta tag dan title
     $this->isiMeta($pg);
     $json = "";
     if ($pg->post_attachments != "") {
         $json = json_decode(stripslashes($pg->post_attachments));
     }
     //pr($json);
     if ($pg->post_attachment_order == "") {
         $pa = \Efiwebsetting::getData('PageAttachment');
     } else {
         $pa = $pg->post_attachment_order;
     }
     $exp = explode(",", $pa);
     $dimatikan_animasi_header = 1;
     foreach ($exp as $p) {
         if ($p == "Page") {
             if ($pg->post_link != "" && $pg->post_link != '0') {
                 $_SESSION['pageObj'] = $page;
                 //kalau ada link
                 $arrSp = Registor::getFeatureStartPage();
                 list($cname, $fname) = $arrSp[$pg->post_link];
                 $new = new $cname();
                 $new->{$fname}();
             } else {
                 $arr['page'] = $page;
                 $arr['dimatikan_animasi_header'] = $dimatikan_animasi_header;
                 $layout_id = "Page_id";
                 $file = Layout::getFile($layout_id);
                 Mold::theme("Pages/" . $layout_id . "/" . $file, $arr);
             }
         } else {
             if (array_key_exists($p, $json) && $json->{$p} > 0) {
                 $paralax = new $p();
                 $paralax->viewme($json->{$p}, "Page", $page->ID);
                 if (contains($p, array("Parallax", "Carousel"))) {
                     $dimatikan_animasi_header = 0;
                 }
             }
         }
     }
     //
     //        //cek Parallax plg atas
     //        if(array_key_exists("ParallaxModel",$json) && $json->ParallaxModel>0){
     //            $paralax = new ParallaxModel();
     //            $paralax->viewme($json->ParallaxModel);
     //            $dimatikan_animasi_header = 0;
     //        }
     //
     //        //cek carousel
     //        if(array_key_exists("GalleryCarousel__view",$json) && $json->GalleryCarousel__view>0){
     //            $cr = new GalleryCarousel();
     //            $cr->viewme($json->GalleryCarousel__view);
     //            $dimatikan_animasi_header = 0;
     //        }
     //
     //
     //
     //        if(array_key_exists("Gallery__view",$json)&&$json->Gallery__view>0){
     //
     //            $cr = new Gallery();
     //            $cr->viewme($json->Gallery__view);
     //
     //        }
     //        if(array_key_exists("CalendarWeb__view",$json)&&$json->CalendarWeb__view>0){
     //
     //            $cr = new CalendarModel();
     //            $cr->viewme($json->CalendarWeb__view);
     //
     //        }
     //        if(array_key_exists("CalendarWeb__viewtype",$json)&&$json->CalendarWeb__viewtype>0){
     //
     //            $cr = new CalendarTypeModel();
     //            $cr->viewme($json->CalendarWeb__viewtype);
     //
     //        }
     //        if(array_key_exists("PageComment__loadcomment",$json)&&$json->PageComment__loadcomment>0){
     //
     //            $cr = new PageComment();
     //            $cr->viewme($json->PageComment__loadcomment,$pg->ID);
     //
     //        }
 }