public static function checkOwnership($app)
 {
     //        echo Account::getMyID()."<br>";
     //        echo $app->app_client_id;
     if ($app->app_client_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
         die("Not your App");
     }
 }
Example #2
0
 function edit()
 {
     //cek ID
     if (isset($_GET['id'])) {
         $id = addslashes($_GET['id']);
         $appAcc = new AppAccount();
         $appAcc->getByID($id);
         if ($appAcc->app_client_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
             die("Owner's ID Mismatch");
         } else {
             //                ZAppFeature::clearSession();
             //load
             //                session_id($appAcc->app_keywords);
             FeatureSessionLayer::loadJSON($appAcc->app_keywords, $appAcc->app_id);
             //                sleep(1);
             //                pr($_SESSION);
             header("Location:" . _SPPATH . "apps/make?id=" . $id);
             die;
         }
     } else {
         header("Location:" . _SPPATH . "apps/makenew");
         die;
     }
 }
    function impersonate()
    {
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new Account();
            $arr = $acc->getWhere("admin_type = 1 ORDER BY admin_nama_depan ASC");
            //            pr($arr);
            ?>
            <select id="clientselector">
                <option value=""></option>
                <?php 
            foreach ($arr as $user) {
                ?>
                    <option value="<?php 
                echo $user->admin_id;
                ?>
"><?php 
                echo $user->admin_nama_depan;
                ?>
</option>
                <?php 
            }
            ?>
            </select>
            <script>
//                $("#clientselector").change(function(){
//                    var slc = $("#clientselector").val();
////                    alert(slc);
//                    $('#clientdata').load("<?php 
            //=_SPPATH;
            ?>
//AppStats/loadDataApp?clientID="+slc);
//                });
            </script>
        <?php 
        }
    }
    function receipt()
    {
        $order_id = addslashes($_GET['order_id']);
        $order = new VpTransaction();
        $order->getByID($order_id);
        //        pr($order);
        //TODO : harus dibikin
        if ($order->order_acc_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
            die("hacking attempt");
        }
        $app = new AppAccount();
        $app->getByID($order->order_app_id);
        if ($app->app_active == 0) {
            die("App not active");
        }
        $acc = new Account();
        $acc->getByID($app->app_client_id);
        $paket = new Paket();
        $paket->getByID($order->order_paket_id);
        $vpData = new VpData();
        $arr = $vpData->getWhere("order_id = '{$order_id}' LIMIT 0,1");
        if (count($arr) > 0) {
            $data = $arr[0];
        } else {
            $data = new VpData();
        }
        if ($acc->admin_marketer != "") {
            $arrAg = $acc->getWhere("admin_username = '******' LIMIT 0,1");
            if (count($arrAg) > 0) {
                $agent = $arrAg[0];
            }
        }
        //        pr($arr);
        ?>
        <style>
            h1{
                font-size: 25px;
                padding-top: 30px;
            }
            h3{
                font-size: 20px;
                font-style: italic;
            }
            h4{
                font-size: 17px;
                margin-top: 20px;
                margin-bottom: 30px;
            }
            .billings td{
                padding-right: 20px;
                padding-bottom: 10px;
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                h1{
                    font-size: 20px;
                }
                h3{
                    font-size: 17px;
                    font-style: italic;
                }
                h4{
                    font-size: 14px;
                    margin-bottom: 30px;
                }
                .billings td{
                    padding-bottom: 10px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }



            }
            @media print {
                .pure-toggle-label[data-toggle-label='left']{
                    display: none;
                }
                #printme{
                    display: none;
                }
                body{
                    background-color: #ffffff;
                }
            }
        </style>
        <div class="container attop"  >
                <div class="col-md-8 col-md-offset-2">


                    <div style="text-align: center; background-color: #ffffff; padding: 20px; min-height: 800px;  margin-top: 20px; padding-top: 20px; padding-bottom: 20px; ">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/header_appear.jpg" width="100%">

                        <h1>PAYMENT RECEIPT</h1>
                        <h3>Your payment has been completed successfully</h3>
                        <div class="receipt" style=" margin-top: 30px;">
                        <h4>TRANSACTION DETAILS</h4>
                        <table class="billings" align="center" style="text-align: left;">
                            <tr>
                                <td>ORDER ID</td>
                                <td><?php 
        echo $order_id;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PAYMENT DATE / TIME</td>
                                <td><?php 
        echo date("F j, Y, g:i a", strtotime($order->order_date));
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PACKAGE NAME</td>
                                <td><?php 
        echo $paket->paket_name;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>APP ID</td>
                                <td><?php 
        echo $app->app_id;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>ACCOUNT ID</td>
                                <td><?php 
        echo $acc->admin_nama_depan;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>AMOUNT</td>
                                <td>IDR <?php 
        echo idr($paket->paket_price);
        ?>
</td>
                            </tr>
                            <tr>
                                <td>STATUS</td>
                                <td><?php 
        echo $data->transaction_status;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PAYMENT TYPE</td>
                                <td><?php 
        echo $data->payment_type;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>BANK NAME</td>
                                <td><?php 
        echo $data->bank;
        ?>
</td>
                            </tr>
                            <?php 
        if (count($arrAg) > 0) {
            ?>
                            <tr>
                                <td>AGENT ID</td>
                                <td><?php 
            echo $agent->admin_username;
            ?>
</td>
                            </tr>
                            <?php 
        }
        ?>
                        </table>
                        </div>


                    </div>
                    <div id="printme" style="text-align: right; margin-top: 5px; margin-bottom: 100px;" >
                         <a href="#" onclick="window.print();"><i class="glyphicon glyphicon-print"></i> print</a> |
                        <a href="<?php 
        echo _SPPATH;
        ?>
myOrders">back to my transactions</a>
                    </div>
                </div>
            </div>
        <?php 
    }
 function setID()
 {
     if (in_array("master_admin", Account::getMyRoles())) {
         $acc = new AppAccount();
         $apps = $acc->getAll();
         //
     } else {
         $acc = new App2Acc();
         $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND app_active = 1", array("AppAccount"));
     }
     $arrApp = array();
     foreach ($apps as $ap) {
         $semua[] = $ap->app_id;
         $arrApp[$ap->app_id] = $ap;
     }
     if (in_array($_GET['app_id'], $semua)) {
         //ok
         $_SESSION['app_active'] = $arrApp[$_GET['app_id']];
         $_SESSION['app_id'] = addslashes($_GET['app_id']);
         header("Location:" . _SPPATH . "PushHome/home?st=Balance");
         die;
     } else {
         //not ok
         die("hacking attempt");
     }
 }
                    <?php 
}
?>
                    <?php 
if (Auth::isLogged()) {
    ?>
                        <li><a href="<?php 
    echo _SPPATH;
    ?>
logout">Logout</a></li>
                    <?php 
}
?>

                    <?php 
if (in_array("master_admin", Account::getMyRoles())) {
    ?>
                        <li><a href="<?php 
    echo _SPPATH;
    ?>
PushHome/home">Administration</a></li>
                   <?php 
}
?>
                </ul>

    </nav>

    <div class="pure-pusher-container">
        <div class="pure-pusher">
<?php

/*$leap = new EfiHome();
$arrTabs =$leap->loadedDomains4Role[Account::getMyRole()];
$arrDomain = $leap->domains;
*/
//pr(Registor::getRoles());
//global $template;
//pr($template);
//pr($template->adminMenu);
//pr($template->domainMenu);
$arrR = Registor::getAllAdminMenuByRoles(Account::getMyRoles());
//pr($arrR);
/*
 * list of icons
 * fa fa-dashboard
 * fa fa-files-o
 * fa fa-th
 * fa fa-pie-chart
 * fa fa-laptop
 * fa fa-edit
 * fa fa-table
 * fa fa-calendar
 * fa fa-envelope
 * fa fa-envelope
 * fa fa-share
 * fa fa-book
 * fa fa-bar-chart-o
 * fa-wrench
 */
$arrDomainName2Icon = array("Appear" => "fa fa-eye", "Appearance" => "fa fa-tint", "Capsule" => "fa fa-bullhorn", "Content" => "fa fa-bookmark", "Developer" => "fa fa-tasks", "Email" => "fa fa-envelope-o", "Finance" => "fa fa-money", "Komisi" => "fa fa-dollar", "PageCategories" => "fa fa-university", "PaketManagement" => "fa fa-dribbble", "Payment" => "fa fa-diamond", "PushNot" => "fa fa-share", "Setting" => "fa fa-edit", "UserAndRoles" => "fa fa-users");
    function appView()
    {
        $id = addslashes($_GET['id']);
        if (in_array("master_admin", Account::getMyRoles())) {
            //            $acc = new AppAccount();
            //            $apps = $acc->getAll();
            //
            $app = new AppAccount();
            $app->getByID($id);
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
            //            pr($apps);
            if (count($apps) < 1) {
                die("hacking attempt");
            } else {
                $app = $apps[0];
            }
        }
        $paket = new Paket();
        $paket->getByID($app->app_paket_id);
        if (!$app->app_active) {
            header("Location:" . _SPPATH . "PaymentWeb/payfor?app_id=" . $app->app_id);
            die;
        }
        ?>
        <div class="container attop" >
        <div class="col-md-8 col-md-offset-2">
        <small><a href="<?php 
        echo _SPPATH;
        ?>
mydashboard">back to dashboard</a> </small>
        <h1><?php 
        echo $app->app_name;
        ?>
 <small><a href="">edit app</a></small></h1>

        <div class="paket">Paket : <b style="font-size: 18px;"><?php 
        echo $paket->paket_name;
        ?>
</b> &nbsp; <i>[<a href="">Edit Paket</a>]</i> </div>
        <div style="padding: 10px;">
            <?php 
        if (!$app->app_active) {
            ?>

                <a class="btn btn-success btn-lg" href="<?php 
            echo _SPPATH;
            ?>
PaymentWeb/payfor?app_id=<?php 
            echo $app->app_id;
            ?>
">Payment</a>
            <?php 
        } else {
            ?>
                <a class="btn btn-success btn-lg" href="<?php 
            echo _SPPATH;
            ?>
PushHome/setID?app_id=<?php 
            echo $app->app_id;
            ?>
">Admin Panel</a>
            <?php 
        }
        ?>
            </div>
        </div>

        </div>
        <?php 
        //        pr($app);
    }
    public function editfolder()
    {
        $tid = isset($_GET['tid']) ? addslashes($_GET['tid']) : die('no tid');
        $t = isset($_GET['t']) ? addslashes($_GET['t']) : die('no t');
        $dc = new DocumentsPortalFolder();
        $dc->getByID($tid);
        //pr($dc);
        $ti = time();
        $_SESSION['mainMoveTID'] = $tid;
        ?>
 <form class="form-inline" id="editfolder_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
">
     <div style="float:left; height: 30px; line-height: 30px; padding: 5px;">
    <label for="editfoldername_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
"><?php 
        echo Lang::t('Folder Name');
        ?>
</label>
  </div>
  <div style="float:left;height: 30px; line-height: 30px; padding: 5px;">   
    <input type="text" class="form-control" id="editfoldername_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
" value="<?php 
        echo $dc->folder_name;
        ?>
">
  </div> 
     <div style="float:left;height: 30px; line-height: 30px; padding: 5px;">
     <button id="editfolderbutton_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
"  class="btn btn-default"><?php 
        echo Lang::t('Update');
        ?>
</button>
     </div>
</form>
    <div class="clearfix" style="padding: 10px;"></div>
    <script>       
        $("#editfolderbutton_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
").click(function(event){
            var slc = $("#editfoldername_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
").val();
            event.preventDefault();
            var decodedUrl = encodeURIComponent(slc);
            $.get("<?php 
        echo _SPPATH;
        ?>
DMWeb/changeFolderName?t=<?php 
        echo $t;
        ?>
&newname="+decodedUrl+"&tid=<?php 
        echo $tid;
        ?>
",function(data){
                //loadfolder_<?php 
        echo $t;
        ?>
(<?php 
        echo $tid;
        ?>
);
                $('#foldernameedit_<?php 
        echo $tid;
        ?>
_<?php 
        echo $t;
        ?>
').empty().html(slc);
                $('#myModal').modal('hide');
            });
        });
        
    </script>
 <?php 
        //kalau master admin
        if (in_array("master_admin", Account::getMyRoles())) {
            //bisa ganti apakah isi dari folder bisa di save...
            /*
             ?>
            <form class="form-inline" id="editfolder_save_<?=$tid;?>_<?=$ti;?>">
                 <div style="float:left; height: 30px; line-height: 30px; padding: 5px;">
                <label for="editfoldername_save_<?=$tid;?>_<?=$ti;?>"><?=Lang::t('Is it saveable');?></label>
              </div>
              <div style="float:left;height: 30px; line-height: 30px; padding: 5px;">   
                  <select id="editfoldername_save_<?=$tid;?>_<?=$ti;?>" class="form-control">
                      <option value="0"><?=Lang::t("No");?></option>
                      <option <? if($dc->folder_saveable==1){?>selected="true"<?}?> value="1"><?=Lang::t("Yes");?></option>
                  </select>
              </div> 
                 <div style="float:left;height: 30px; line-height: 30px; padding: 5px;">
                 <button id="editfolderbutton_save_<?=$tid;?>_<?=$ti;?>"  class="btn btn-default"><?=Lang::t('Update');?></button>
                 </div>
            </form>
                <div class="clearfix" style="padding: 10px;"></div>
                <script>       
                    $("#editfolderbutton_save_<?=$tid;?>_<?=$ti;?>").click(function(event){
                        var slc = $("#editfoldername_save_<?=$tid;?>_<?=$ti;?>").val();
                        event.preventDefault();
                        
                        $.post("<?=_SPPATH;?>DMWeb/changeSaveable?t=<?=$t;?>&tid=<?=$tid;?>",{s:slc},function(data){
                            //loadfolder_<?=$t;?>(<?=$tid;?>);
                            //$('#foldernameedit_<?=$tid;?>_<?=$t;?>').empty().html(slc);
                            //$('#myModal').modal('hide');
                            if(data.bool){
                                alert("<?=Lang::t('Success');?>");
                            }
                            else{
                                alert("<?=Lang::t('Failed');?>");
                            }
                        },'json');
                    });
                    
                </script>
             <?*/
        }
        ?>
    <hr>
    <style>
        .fold{
            margin:3px;
            background-color: #efefef;
            cursor: pointer;
            padding: 3px;
            float:left;
        }
        .selectedMoved{
            /*border:2px solid black;*/
            background-color:#333;
            color:white;
        }
    </style>
    <label><?php 
        echo Lang::t('Move Folder To');
        ?>
 : <span id="moveto"><i class="glyphicon glyphicon-folder-close"></i> /</span><input type="hidden" id="movetoVal" value="0"><input type="hidden" id="movetoValParent" value="0">
        &nbsp; <button id="moveTo_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
" class="btn btn-default"><?php 
        echo Lang::t('Update');
        ?>
</button>
    </label>
    <script>
        $('#moveTo_<?php 
        echo $tid;
        ?>
_<?php 
        echo $ti;
        ?>
').click(function(){
           var x = $('#movetoVal').val();
           
           if(x!=""){
               $.get('<?php 
        echo _SPPATH;
        ?>
DMWeb/moveFolder?tid=<?php 
        echo $tid;
        ?>
&t=<?php 
        echo $t;
        ?>
&to='+x,function(data){
                   var par = $('#movetoValParent').val();
                    loadfolder_<?php 
        echo $t;
        ?>
(par);
                    loadfolder_<?php 
        echo $t;
        ?>
(x);
                    //lwrefresh("UploadDoc");
                    $('#myModal').modal('hide');
               });
           }
        });
    </script>
    <div id="movebox_<?php 
        echo $ti;
        ?>
">
        <?php 
        $arrFolder = $dc->getWhere("folder_parent_id = 0 ORDER BY folder_name ASC");
        foreach ($arrFolder as $fold) {
            if ($fold->folder_id == $_SESSION['mainMoveTID']) {
                continue;
            }
            ?>
        <div class="folderatas" id="foldertop_<?php 
            echo $ti;
            ?>
_<?php 
            echo $fold->folder_id;
            ?>
">
            <div onclick="browseMovedFolder_<?php 
            echo $ti;
            ?>
('<?php 
            echo $fold->folder_id;
            ?>
');" class="fold">
                <i class="glyphicon glyphicon-expand"></i>
            </div>
            <div id="folder_<?php 
            echo $ti;
            ?>
_<?php 
            echo $fold->folder_id;
            ?>
"  onclick="selectMovedFolder_<?php 
            echo $ti;
            ?>
('<?php 
            echo $fold->folder_id;
            ?>
','<?php 
            echo $fold->folder_parent_id;
            ?>
',event);" class="fold"><i class="glyphicon glyphicon-folder-close"></i> <?php 
            echo $fold->folder_name;
            ?>
</div>   
            <div class="clearfix"></div>
            <div id="movefolder_<?php 
            echo $fold->folder_id;
            ?>
"></div>
        </div>
        
                 <?php 
        }
        ?>
    </div>
    <script>
    function selectMovedFolder_<?php 
        echo $ti;
        ?>
(id,par,e){
        e.preventDefault();
        $(".fold").removeClass('selectedMoved');
        $("#folder_<?php 
        echo $ti;
        ?>
_"+id).addClass('selectedMoved');
        $('#moveto').html($("#folder_<?php 
        echo $ti;
        ?>
_"+id).html());
        $('#movetoVal').val(id);
        $('#movetoValParent').val(par);
    }  
    function browseMovedFolder_<?php 
        echo $ti;
        ?>
(id){
        $('#movefolder_'+id).load('<?php 
        echo _SPPATH;
        ?>
DMWeb/loadfolderMove?ti=<?php 
        echo $ti;
        ?>
&tid='+id);
    }  
    </script>
    <?php 
    }
Example #10
0
    function mydashboard()
    {
        $acc = Account::getAccountObject();
        ?>
        <style>
            #attratas{
                text-align: right;
            }
        </style>
        <div class="container attop"  >
            <div class="col-md-10 col-md-offset-1">
                <h1>Dashboard</h1>
                <div id="attratas">
                   <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
MyApp/newApp';" class="btn btn-success" style="margin: 0px;">Create New Apps</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
editAcc';" class="btn btn-info" style=" margin: 0px;">Edit Account</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
myOrders';" class="btn btn-warning" style=" margin: 0px;">Order History</button>
                </div>

<?php 
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new AppAccount();
            $apps = $acc->getAll();
            //
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount"));
        }
        if (count($apps) > 0) {
            ?>

            <div class="table-responsive" style="margin-top: 20px;">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>
                            No.
                        </th>
                        <th>App Name</th>
                        <th>Package</th>
                        <th>Status</th>
                        <th>Expired Date</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            foreach ($apps as $num => $ap) {
                $paket = new Paket();
                $paket->getByID($ap->app_paket_id);
                ?>
                        <tr>
                            <td><?php 
                echo $num + 1;
                ?>
</td>
                            <td><?php 
                echo $ap->app_name;
                ?>
</td>
                            <td><?php 
                echo $paket->paket_name;
                ?>
</td>
                            <td><?php 
                echo $ap->app_active;
                ?>
</td>
                            <td><?php 
                if ($ap->app_active == 1) {
                    echo indonesian_date($ap->app_contract_end);
                }
                ?>
</td>
                            <td>
<!--                                <a href='--><?php 
                //=_SPPATH;
                ?>
<!--MyApp/appView?id=--><?php 
                //=$ap->app_id;
                ?>
<!--'  class="btn btn-info">Edit</a>-->
                                <?php 
                if ($ap->app_active == 1) {
                    ?>

                                    <a href='<?php 
                    echo _SPPATH;
                    ?>
PushHome/setID?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success">Admin</a>
                                <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
MyApp/appView?id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>


                                <?php 
                    } else {
                        ?>
                                    <button class="btn btn-info">Waiting for Approval</button>
                                <?php 
                    }
                }
                ?>
                            </td>
                        </tr>
                        <?php 
            }
            ?>
                    </tbody>
                </table>
            </div>



    <?php 
        } else {
            ?>
            <h5 class="hype">You do not have any App yet..</h5>
            <button onclick="document.location='<?php 
            echo _SPPATH;
            ?>
MyApp/newApp';" class="btn btn-success"
                    style="width: 100%; margin: 5px;">Create My Own App
            </button>

<?php 
        }
        ?>
            </div>
            <div class="clearfix"></div>

            </div>
        <?php 
    }
    function search()
    {
        $q = addslashes($_GET['q']);
        ?>
        <div class="row">
            <div class="col-md-12">
        <h1>Search Results for "<?php 
        echo $q;
        ?>
"</h1>
        <?php 
        $allowed = Registor::getAllAdminMenuByRoles(Account::getMyRoles());
        //        pr($allowed);
        $allows = array();
        foreach ($allowed as $alls) {
            foreach ($alls as $key => $c) {
                $allows[] = $key;
            }
        }
        //        echo $q;
        //        pr(Registor::getAllAdminMenuFromSession());
        $allAdmin = Registor::getAllAdminMenuSearch();
        //        pr($allAdmin);
        foreach ($allAdmin as $all) {
            foreach ($all as $key => $value) {
                $save[$key] = $value;
            }
        }
        $stored = $save;
        foreach ($stored as $key => $store) {
            if (stripos($store, $q) !== false) {
                //                echo "Key: " . $key . "<br />Found: " . $q . "<br />";
                $keys[] = $key;
            }
        }
        $regs = Registor::getAllAdminMenu();
        //        pr($regs);
        $cnt = 0;
        foreach ($regs as $domain => $arre) {
            foreach ($arre as $key => $re) {
                if (in_array($key, $keys)) {
                    if (in_array($key, $allows)) {
                        $cnt++;
                        ?>
                        <div class="menuicon" style="background: white; padding: 10px; margin: 10px; margin-left: 0px;">
                            <h3 style="margin: 0; padding: 0; margin-bottom: 10px;">
                                <a href="javascript:openLw('<?php 
                        echo $key;
                        ?>
','<?php 
                        echo _SPPATH . $re;
                        ?>
','fade');activkanMenuKiri('<?php 
                        echo $key;
                        ?>
');"><?php 
                        echo Lang::t($key);
                        ?>
</a>
                            </h3>

                            <p>
                                <?php 
                        echo $save[$key];
                        ?>
                            </p>
                        </div>
                    <?php 
                    }
                }
            }
        }
        if ($cnt < 1) {
            ?>
            <h3>
                <?php 
            echo Lang::t('Cannot Find Any Matching Features');
            ?>
            </h3>
            <?php 
        }
        //        pr(Registor::getAllAdminMenuSearch());
        ?>
</div>
        </div><?php 
    }
Example #12
0
    static function getMyApps()
    {
        $acc = Account::getAccountObject();
        ?>
        <style>
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
                    padding-left: 0px;
                    padding-right: 0px;

                }
                .container {
                    padding-right: 0px;
                    padding-left: 0px;
                }
                .attop{
                    /*padding-top: 50px;*/
                }
                #session{
                    margin-left: 15px; margin-right: 15px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }
                #attratas{
                    margin-top: 30px;
                }
                #agentbanner{
                    padding-right: 0px;
                }
                .stats{
                    /*min-height: 250px;*/
                }
                .stats_text{
                    /*padding-top: 30px;*/
                }
                .stats_number_big{
                    /*font-size: 40px;*/
                }
                .stats_money{
                    font-weight: bold;
                    /*font-size: 30px;*/
                }
                .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
                    padding-left: 0px;
                    padding-right: 0px;

                }
            }
        </style>
        <div class="container attop"  >
        <div class="col-md-12">
        <div class="appear_logo_pages">
            <a href="<?php 
        echo _SPPATH;
        ?>
">
                <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-apps.png" >
            </a>
        </div>

        <div id="attratas">
            <button id="list" onclick="$('#list').hide();$('#icons').show();$('#app_icons').hide();$('#app_lists').show();" class="btn btn-success btn-abu" style="margin: 0px;display: none;"><i class="glyphicon glyphicon-th-list"></i></button>
            <button id="icons" onclick="$('#list').show();$('#icons').hide();$('#app_icons').show();$('#app_lists').hide();" class="btn btn-success btn-abu" style="margin: 0px;"><i class="glyphicon glyphicon-th"></i></button>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
mydashboard';" class="btn btn-success btn-abu" style="margin: 0px;">Dashboard</button>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
apps/makenew';" class="btn btn-success btn-abu" style="margin: 0px;">Create New Apps</button>
        </div>
        <?php 
        if (ZAppFeature::checkRemainingSession()) {
            $link = _SPPATH . "apps/make";
            if ($_SESSION['ZAppFeature']['app_id'] > 0) {
                $link = _SPPATH . "apps/make?id=" . $_SESSION['ZAppFeature']['app_id'];
            }
            ?>

    <div id="session" class="alert alert-warning" role="alert" >
        You have unsaved edit Sessions. Click <a href="<?php 
            echo $link;
            ?>
">here</a> to continue work on your app
        </div>



        <?php 
        }
        ?>
        <?php 
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new AppAccount();
            $apps = $acc->getAll();
            //http://localhost:8888/appear/PushHome/home?st=Balance
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount"));
        }
        if (count($apps) > 0) {
            ?>
<div id="app_icons" style="display: none;">
            <?php 
            foreach ($apps as $num => $ap) {
                ?>
                <div class="col-md-3 col-sm-12 col-xs-12 myapp">
                    <div id="detail_<?php 
                echo $num;
                ?>
" class="app_detail" style="display: none;" onclick="openDetails('<?php 
                echo $num;
                ?>
');">
                        <div style="padding: 20px;">
                            <h3><?php 
                echo $ap->app_name;
                ?>
</h3>
                            <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo '<div class="app_paket">' . $paket->paket_name . '</div>';
                }
                ?>
                            <?php 
                $status = $ap->app_active;
                echo '<div class="app_status">';
                if ($status == 0) {
                    echo "Not active";
                }
                if ($status == 1) {
                    if ($ap->app_type == 1) {
                        echo "pending approval";
                    } else {
                        echo "App is being created";
                    }
                }
                if ($status == 2) {
                    echo "Up and running";
                }
                echo "</div>";
                ?>
                            <?php 
                if ($ap->app_active > 0 && $ap->app_type == 0) {
                    echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                        <br>
                                        <a  href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                                    <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
<br>
                                            <a  href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                        <?php 
                            }
                        }
                    }
                    echo '</div>';
                }
                ?>

                            <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                                <?php 
                    }
                    ?>

                                <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success btn-abu">Push Notifications</a>
                                <br>
                            <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                                <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                                <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-success btn-abu">Delete</a>

                            <?php 
                    }
                }
                ?>

                            <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Edit</a>
                            <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Preview</a>
                            <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-success btn-abu">JSON</a>

                        </div>
                    </div>
                    <div id="app_<?php 
                echo $num;
                ?>
" class="app_icon" onclick="openDetails('<?php 
                echo $num;
                ?>
');">
                        <img width="100%" src="<?php 
                echo $ap->app_icon;
                ?>
">
                        <div style="display:none;position: absolute; background-color: rgba(0,0,0,0.5); border-radius: 0px; text-align: center; font-size: 18px; padding: 10px; margin-top: -53px; margin-left:10px; z-index:1; color: #ffffff;">
                            <?php 
                echo $ap->app_name;
                ?>
                        </div>
                    </div>
                </div>
            <?php 
            }
            ?>
            <script>
                function openDetails(n){
                    $('#detail_'+n).fadeToggle( "slow", "linear" );
                    console.log($('#app_'+n).width());
                    $('#detail_'+n).css("width",$('#app_'+n).width()+'px');
                    $('#detail_'+n).css("height",$('#app_'+n).height()+'px');
                }
            </script>
            <style>
                .app_detail{
                    position: absolute;
                    background-color: rgba(0,0,0,0.8);
                    width: 100px;
                    height: 200px;
                    color: #ffffff;
                    text-align: center;
                    z-index: 10;
                }
                .myapp{
                    cursor: pointer;
                }
                .app_contract{
                    font-style: italic;
                    font-size: 12px;
                }
                .myapp a{
                    color: #B2DFDB;
                    text-decoration: underline;
                }
                .myapp a.btn{
                    text-decoration: none;
                    margin: 5px;
                    color: #ffffff;
                }
                .entry{
                    padding: 5px;
                    background-color: #F7F7F7;
                    margin: 5px;
                }
                .entry a.btn{
                    text-decoration: none;
                    margin: 2px;
                    color: #ffffff;
                }
            </style>
            </div>
            <div class="clearfix"></div>
            <div id="app_lists" >
            <?php 
            foreach ($apps as $num => $ap) {
                //                        $paket = new Paket();
                //                        $paket->getByID($ap->app_paket_id);
                ?>

                <div class=" col-md-6 col-sm-12 col-xs-12">
                <div class="entry">
                <div class="col-md-6 col-sm-6 col-xs-6">
                    <img width="100%" src="<?php 
                echo $ap->app_icon;
                ?>
">

                </div>
                <div class="col-md-6 col-sm-6 col-xs-6" style="text-align: center;">
                    <h3><?php 
                echo $ap->app_name;
                ?>
</h3>
                    <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo '<div class="app_paket">' . $paket->paket_name . '</div>';
                }
                ?>
                    <?php 
                $status = $ap->app_active;
                echo '<div class="app_status">';
                if ($status == 0) {
                    echo "Not active";
                }
                if ($status == 1) {
                    if ($ap->app_type == 1) {
                        echo "pending approval";
                    } else {
                        echo "App is being created";
                    }
                }
                if ($status == 2) {
                    echo "Up and running";
                }
                echo "</div>";
                ?>
                    <?php 
                if ($ap->app_active > 0 && $ap->app_type == 0) {
                    echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                <br>
                                <a  href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                            <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
                                    <br>
                                    <a  href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                <?php 
                            }
                        }
                    }
                    echo '</div>';
                }
                ?>

                    <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                            <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                        <?php 
                    }
                    ?>

                        <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success btn-abu">Push Notifications</a>
                        <br>
                    <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                        <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                        <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                        <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-success btn-abu">Delete</a>

                    <?php 
                    }
                }
                ?>

                    <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Edit</a>
                    <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Preview</a>
                    <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-success btn-abu">JSON</a>

                </div>

                    <div class="clearfix"></div>
                </div>
                </div>

            <?php 
            }
            ?>
            </div>
            <style>
                .table{
                    background-color: white;
                }
            </style>
            <div id="app_table" class="table-responsive" style="margin-top: 20px; display: none;">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>
                            No.
                        </th>
                        <th>App</th>
                        <th>Action</th>
                        <th>Paket</th>
                        <th>Expired Date</th>
                        <th>Status</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            foreach ($apps as $num => $ap) {
                //                        $paket = new Paket();
                //                        $paket->getByID($ap->app_paket_id);
                ?>
                        <tr>
                            <td><?php 
                echo $num + 1;
                ?>
</td>
                            <td style="text-align: center;">
                                <div class="foto100">
                                    <img width="100px" src="<?php 
                echo $ap->app_icon;
                ?>
">
                                </div>

                                <?php 
                echo $ap->app_name;
                ?>
                            </td>
                            <td>
                                <!--                                <a href='--><?php 
                //=_SPPATH;
                ?>
<!--MyApp/appView?id=--><?php 
                //=$ap->app_id;
                ?>
<!--'  class="btn btn-info">Edit</a>-->
                                <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                                        <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                                    <?php 
                    }
                    ?>

                                    <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success">Push Notifications</a>
                                    <br>
                                <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                    <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-danger">Delete</a>

                                <?php 
                    }
                }
                ?>

                                <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-danger">Edit</a>
                                <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-danger">Preview</a>
                                <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-danger">JSON</a>
                            </td>
                            <td>
                                <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo $paket->paket_name;
                }
                ?>
                            </td>
                            <td>
                                <?php 
                if ($ap->app_active > 0) {
                    echo date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                            <br>
                                            <a class="btn btn-default" href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                                        <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
                                                <br>
                                                <a class="btn btn-default" href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                            <?php 
                            }
                        }
                    }
                }
                ?>
                            </td>

                            <td><?php 
                $status = $ap->app_active;
                if ($status == 0) {
                    echo "Your App is not active";
                }
                if ($status == 1) {
                    echo "Your App is being created.<br>For Android App, it will take up to 2 working days.<br>For iOS, it will take up to 3 weeks.";
                }
                if ($status == 2) {
                    echo "Your App is up and running";
                }
                ?>
</td>

                        </tr>
                    <?php 
            }
            ?>
                    </tbody>
                </table>
            </div>
            </div>
            <div class="clearfix" style="margin-bottom: 100px;"></div>

            </div>
        <?php 
        } else {
            header("Location:" . _SPPATH . "apps/make");
            exit;
        }
    }