public static function portalIndex()
    {
        //global $template;
        //$template->addTextToHead("<script src='"._SPPATH."app/BPlugin/Twitter/js/jquery-1.11.1.js'></script>");
        //pr($template);
        /*
         * print breadcrumbs
         */
        $t = time();
        $getID = TextP::getP("id");
        ?>
        
        <style>
            .webapps{
                padding: 10px;
                cursor: pointer;
                border-bottom: 1px solid #dedede;
            }
            .borderless{
                border-bottom: 0px;
            }
            .fullscreen {
                width: 100%;
                height: 100%;
                position: absolute;
                z-index: 10000;
                top:0;
                left: 0;
             }
             .iframeasli{
                 width: 100%;
                 height: 650px;
             }
        </style>
        <script>
            function getwidth(){
                return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
             }
             function getheight(){
                return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
             }
             function callfullscreen() {
                 var heit = $(window).height();
                 var wit = $(window).width(); 
                $('.fullscreen').css({
                        width: getwidth(),
                        height: getheight()
                    });
                   // alert('resize');
             }
            /*$(document).ready(function(){
                callfullscreen();
            });*/
            function kerjakanFullScreen(){
                $('#wepapps_menu').fadeToggle();
                $('#webapps_iframe').toggleClass('col-md-9');
                $('#iframeholder').toggleClass('fullscreen').toggleClass('iframeasli');
            }
            //$('#wepapps_menu').fadeToggle();$('#webapps_iframe').toggleClass('fullscreen').toggleClass('col-md-9');
        </script>
        <?php 
        ?>
        <div onclick="kerjakanFullScreen();" style="position: fixed; padding: 10px; bottom: 0; right: 0; color:white; background-color: rgba(0,0,0,0.3); z-index: 10001;"><i class="glyphicon glyphicon-fullscreen"></i></div>
        <div class="col-md-3" id="wepapps_menu">
            <div style="padding: 10px; background-color: #efefef; border-radius: 5px; margin-right: 10px;">
                <?php 
        $wb = new WebAppsPortal();
        $chan = Account::getMyChannels();
        $all = $wb->getByMyChannels($chan, " AND webapps_tech = 'web' ORDER BY webapps_name ASC");
        //$all = $wb->get
        //pr($chan);
        //pr($all);
        foreach ($all as $num => $wp) {
            $num++;
            ?>
                    <div id="webapps_<?php 
            echo $wp->webapps_id;
            ?>
_<?php 
            echo $t;
            ?>
" class="webapps <?php 
            if ($num >= count($all)) {
                ?>
borderless<?php 
            }
            ?>
"><?php 
            echo $wp->webapps_name;
            ?>
</div>
                    <script>
                        $('#webapps_<?php 
            echo $wp->webapps_id;
            ?>
_<?php 
            echo $t;
            ?>
').click(function(){
                            <?php 
            //if webmail
            if ($wp->webapps_id == 1) {
                ?>
                                    var url = '<?php 
                echo $wp->webapps_url;
                ?>
';
                                    var win = window.open(url, '_blank');
                                    win.focus();
                            <?php 
            } else {
                ?>
                            $("#webapps_iframe").empty().html('<iframe id="iframeholder" class="iframeasli" src="<?php 
                echo $wp->webapps_url;
                ?>
"></iframe> ');
                            <?php 
            }
            ?>
                        });
                    <?php 
            if ($getID == $wp->webapps_id) {
                ?>
   
                    $(document).ready(function(){
                        $("#webapps_iframe").empty().html('<iframe id="iframeholder" class="iframeasli" src="<?php 
                echo $wp->webapps_url;
                ?>
"></iframe> ');                  
                    });
                    <?php 
            }
            ?>
                    </script>
                     <?php 
        }
        ?>
            </div> 
        </div>
        <div class="col-md-9" id="webapps_iframe">
            
            <?php 
        //pr($_SESSION);
        ?>
        </div> 
         <?php 
    }
 public function updater()
 {
     $id = TextP::postP("id", "");
     $name = TextP::postP("name", "");
     $lvl = TextP::postP("lvl", "");
     $org = TextP::postP("org", "");
     $role = TextP::postP("role", "");
     $json = array();
     $json['post'] = $_POST;
     $json['isi'][] = $role;
     $json['isi'][] = $name;
     $json['isi'][] = $lvl;
     $json['isi'][] = $org;
     $json['isi'][] = $id;
     $json['bool'] = 0;
     if ($id == "" || $name == "" || $lvl == "" || $org == "" || $role == "") {
         $json['err'] = Lang::t('Please provide all data');
         die(json_encode($json));
     }
     $acc = new Account();
     $acc->getByID($id);
     $acc->admin_nama_depan = urldecode($name);
     $acc->admin_role = urldecode($role);
     $acc->load = 1;
     $suc = $acc->save();
     $json['isi'][] = $suc;
     //if($suc){
     //update role2acc
     $role2acc = new Role2Account();
     $arrR2c = $role2acc->getWhere("role_admin_id = '{$id}' LIMIT 0,1");
     $role2acc->getByID($arrR2c[0]->rc_id);
     $role2acc->role_id = $role;
     $role2acc->load = 1;
     $suc2 = $role2acc->save();
     $json['isi'][] = $suc2;
     //if($suc2){
     //update lvl dan org
     $am = new AccountMeta();
     $arrMeta = $am->getWhere("account_id = {$id}");
     if (count($arrMeta) < 1) {
         //create new
         $am2 = new AccountMeta();
         $am2->account_id = $id;
         $am2->meta_key = "RoleLevel";
         $am2->meta_value = $lvl;
         $am2->save();
         //create new
         $am2 = new AccountMeta();
         $am2->account_id = $id;
         $am2->meta_key = "RoleOrganization";
         $am2->meta_value = $org;
         $am2->save();
     } else {
         foreach ($arrMeta as $mt) {
             if ($mt->meta_key == "RoleLevel") {
                 $am2 = new AccountMeta();
                 $am2->getByID($mt->meta_id);
                 $am2->meta_value = $lvl;
                 $am2->load = 1;
                 $am2->save();
             }
             if ($mt->meta_key == "RoleOrganization") {
                 $am2 = new AccountMeta();
                 $am2->getByID($mt->meta_id);
                 $am2->meta_value = $org;
                 $am2->load = 1;
                 $am2->save();
             }
         }
     }
     // }
     $json['bool'] = $suc2;
     //}
     die(json_encode($json));
 }