public function constraints_old()
 {
     //err id => err msg
     $err = array();
     if (!isset($this->prod_pic)) {
         $err['prod_pic'] = Lang::t('Picture must be provided');
     } else {
         //            $src = _PHOTOPATH.$this->camp_pic;
         //            list($iWidth,$iHeight,$type)    = getimagesize($src);
         //            if(round($iWidth/$iHeight,1) != round($this->ratio_weight/$this->ratio_height,1)){
         //                $err['camp_pic'] = Lang::t('Proportion is not right, please crop using our tool');
         //            }
     }
     if (!isset($this->prod_name)) {
         $err['prod_name'] = Lang::t('Please provide Name');
     }
     if (!isset($this->prod_des)) {
         $err['prod_des'] = Lang::t('Description cannot be empty');
     }
     if (!isset($this->prod_price)) {
         $err['prod_price'] = Lang::t('Price cannot be empty');
     }
     if (!isset($this->prod_cat_id)) {
         $err['prod_cat_id'] = Lang::t('Category cannot be empty');
     }
     if (!isset($this->prod_stock)) {
         $err['prod_stock'] = Lang::t('Stock cannot be empty');
     }
     if (!isset($this->prod_attribute_array)) {
         $err['prod_attribute_array'] = Lang::t('Attribute cannot be empty');
     }
     $this->prod_app_id = AppAccount::getAppID();
     //cek apakah paket sesuai dengan yg diperbolehkan
     $app = AppAccount::getActiveAppObject();
     //carousel 1_5
     $carousel_id = $app->app_paket_id . "_8";
     $mm = new PaketMatrix();
     $mm->getByID($carousel_id);
     $limit = $mm->ps_isi;
     //get all campaign dengan app_id dan type yg diperbolehkan
     $nr = $this->getJumlah("prod_app_id = '{$this->prod_app_id}' AND prod_active = 1");
     if ($this->prod_active) {
         if ($nr >= $limit) {
             $err['prod_active'] = Lang::t('Too many products active!! Please deactivate the others. Limit is ' . $limit);
         }
     }
     //        $err['prod_active'] = Lang::t($nr.' Too many products active!! Please deactivate the others. Limit is '.$limit);
     //        $this->camp_updatedate = leap_mysqldate();
     return $err;
 }
 function saveTree($object, $webClass)
 {
     $tree = $_POST['tags'];
     $arr = json_decode($tree);
     $json = array();
     //get active knoten
     $nrActive = $this->hitungAnakActive($arr[0][1]);
     //        echo "<h1>".$nrActive."</h1>";
     //        pr($arr);
     //cek apakah paket sesuai dengan yg diperbolehkan
     $app = AppAccount::getActiveAppObject();
     //category 1_7
     $cat_id = $app->app_paket_id . "_7";
     //
     $mm = new PaketMatrix();
     $mm->getByID($cat_id);
     //
     $limit = (int) $mm->ps_isi;
     //
     //        //get all campaign dengan app_id dan type yg diperbolehkan
     //        $nr = $object->getJumlah("cat_parent_id != '-1' AND cat_app_id = '".$app->app_id."'");
     //
     //
     //        echo "nr = ".$nr." limit : ".$limit;
     if ($nrActive > $limit) {
         $json['bool'] = 0;
         $json['err'] = "<h1>Too Many Categories!! Limit is {$limit} </h1>";
         echo json_encode($json);
         die;
     }
     //pr($arr);
     foreach ($arr as $n => $obj) {
         //cek apakah array
         if (is_array($obj)) {
             //if yes
             //get the first col as name and the res as children
             $id = $obj[0];
             //echo "adalah array dengan element pertama adalah $id <br>";
             //pr($obj);
             $this->saveTreeRecursive($obj[1], $id, $object, $webClass);
         } else {
             $id = $obj;
             //di skip aja krn tidak disave juga
         }
     }
     $json['bool'] = 1;
     $json['err'] = "<h1>Success</h1>";
     echo json_encode($json);
     die;
     //        exit();
 }
Exemplo n.º 3
0
    public function createPaketTableCustomer()
    {
        $paket = new Paket();
        $arrPaket = $paket->getWhere("paket_active = 1");
        $syarat = new PaketSyarat();
        $arrSyarat = $syarat->getWhere("syarat_active = 1");
        ?>
        <style>
            body{
                background-color: #24e0ba;
            }
            label {
                /* display: inline-block; */
                /* max-width: 100%; */
                margin-bottom: 0px;
                /* font-weight: 700; */
            }
        </style>
        <div class="pricing-container">
            <div class="pricing-switcher">
                <p class="fieldset">
                    <input type="radio" name="duration-1" value="monthly" id="monthly-1" checked>
                    <label for="monthly-1">Monthly</label>
                    <input type="radio" name="duration-1" value="yearly" id="yearly-1">
                    <label for="yearly-1">Yearly</label>
                    <span class="switch"></span>
                </p>
            </div>
            <ul class="pricing-list bounce-invert">
                <?php 
        foreach ($arrPaket as $num => $pak) {
            ?>
                <li <?php 
            if ($num == 1) {
                echo 'class="exclusive"';
            }
            ?>
>
                    <ul class="pricing-wrapper">
                        <li data-type="monthly" class="is-visible">
                            <header class="pricing-header">
                                <h2><?php 
            echo $pak->paket_name;
            ?>
</h2>
                                <div class="price">
                                    <span class="currency">IDR</span>
                                    <span class="value"><?php 
            echo idrK($pak->paket_price);
            ?>
</span>
                                    <span class="duration">mo</span>
                                </div>
                            </header>
                            <div class="pricing-body">
                                <ul class="pricing-features">
                                    <?php 
            foreach ($arrSyarat as $sya) {
                $mm = new PaketMatrix();
                $mmid = $pak->paket_id . "_" . $sya->syarat_id;
                $mm->getByID($mmid);
                $val = $mm->ps_isi;
                if ($sya->syarat_rumus == "bool") {
                    if ($val == "1") {
                        ?>
                        <li><?php 
                        echo $sya->syarat_name;
                        ?>
</li>
                        <?php 
                    } else {
                        ?>
                        <li>-</li>
                    <?php 
                    }
                } else {
                    $exp = explode(",", $sya->syarat_rumus);
                    $jenis = $exp[0];
                    $check = $exp[1];
                    if ($val == "") {
                        $val = 0;
                    }
                    if ($jenis == "int" && $check == "=") {
                        //                        echo $val;
                        if ($val > 0) {
                            ?>
                            <li><em><?php 
                            echo $val;
                            ?>
</em> <?php 
                            echo $sya->syarat_name;
                            ?>
</li>
                            <?php 
                        }
                    }
                }
                ?>

                                    <?php 
            }
            ?>
<!--                                    <li><em>1</em> Template Style</li>-->
<!--                                    <li><em>25</em> Products Loaded</li>-->
<!--                                    <li><em>1</em> Image per Product</li>-->
<!--                                    <li><em>Unlimited</em> Bandwidth</li>-->
<!--                                    <li><em>24/7</em> Support</li>-->
                                </ul>
                            </div>
                            <footer class="pricing-footer">
                                <a class="select" href="#">Sign Up</a>
                            </footer>
                        </li>
                        <li data-type="yearly" class="is-hidden">
                            <header class="pricing-header">
                                <h2>Basic</h2>
                                <div class="price">
                                    <span class="currency">IDR</span>
                                    <span class="value"><?php 
            echo idrK($pak->paket_price * 12);
            ?>
</span>
                                    <span class="duration">yr</span>
                                </div>
                            </header>
                            <div class="pricing-body">
                                <ul class="pricing-features">
                                    <?php 
            foreach ($arrSyarat as $sya) {
                $mm = new PaketMatrix();
                $mmid = $pak->paket_id . "_" . $sya->syarat_id;
                $mm->getByID($mmid);
                $val = $mm->ps_isi;
                if ($sya->syarat_rumus == "bool") {
                    if ($val == "1") {
                        ?>
                                                <li><?php 
                        echo $sya->syarat_name;
                        ?>
</li>
                                            <?php 
                    } else {
                        ?>
                                                <li>-</li>
                                            <?php 
                    }
                } else {
                    $exp = explode(",", $sya->syarat_rumus);
                    $jenis = $exp[0];
                    $check = $exp[1];
                    if ($val == "") {
                        $val = 0;
                    }
                    if ($jenis == "int" && $check == "=") {
                        //                        echo $val;
                        if ($val > 0) {
                            ?>
                                                    <li><em><?php 
                            echo $val;
                            ?>
</em> <?php 
                            echo $sya->syarat_name;
                            ?>
</li>
                                                <?php 
                        }
                    }
                }
                ?>

                                    <?php 
            }
            ?>
                                </ul>
                            </div>
                            <footer class="pricing-footer">
                                <a class="select" href="#">Sign Up</a>
                            </footer>
                        </li>
                    </ul>
                </li>
            <?php 
        }
        ?>

            </ul>
        </div>

        <style>
            ul,li{
                margin: 0;
                padding: 0;
                border: 0;
                font-size: 100%;
                font: inherit;
                vertical-align: baseline;
            }
            /* HTML5 display-role reset for older browsers */
            article, aside, details, figcaption, figure,
            footer, header, hgroup, menu, nav, section, main {
                display: block;
            }
            body {
                line-height: 1;
            }
            ol, ul {
                list-style: none;
            }
            blockquote, q {
                quotes: none;
            }
            blockquote:before, blockquote:after,
            q:before, q:after {
                content: '';
                content: none;
            }
            table {
                border-collapse: collapse;
                border-spacing: 0;
            }
            *,
            *::after,
            *::before {
                -webkit-box-sizing: border-box;
                -moz-box-sizing: border-box;
                box-sizing: border-box;
            }

            html {
                font-size: 62.5%;
            }

            html * {
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
            }

            body {
                font-size: 1.6rem;
                font-family: "Open Sans", sans-serif;
                color: #2d3d4f;
                background-color: #1bbc9d;
            }

            a {
                text-decoration: none;
            }

        </style>
    <?php 
    }
 public function constraints()
 {
     //err id => err msg
     $err = array();
     if (!isset($this->camp_pic)) {
         $err['camp_pic'] = Lang::t('Picture must be provided');
     } else {
         $src = _PHOTOPATH . $this->camp_pic;
         list($iWidth, $iHeight, $type) = getimagesize($src);
         if (round($iWidth / $iHeight, 1) != round($this->ratio_weight / $this->ratio_height, 1)) {
             $err['camp_pic'] = Lang::t('Proportion is not right, please crop using our tool');
         }
     }
     if (!isset($this->camp_name)) {
         $err['camp_name'] = Lang::t('Please provide carousel photo');
     }
     if (!isset($this->camp_descr)) {
         $err['camp_descr'] = Lang::t('Description cannot be empty');
     }
     if (!isset($this->camp_begin)) {
         $err['camp_begin'] = Lang::t('Validity cannot be empty');
     }
     if (!isset($this->camp_end)) {
         $err['camp_end'] = Lang::t('Validity cannot be empty');
     }
     $this->camp_app_id = AppAccount::getAppID();
     $this->camp_updatedate = leap_mysqldate();
     //cek apakah paket sesuai dengan yg diperbolehkan
     $app = AppAccount::getActiveAppObject();
     //basic
     $type = $this->arrtype[$this->camp_type];
     //carousel 1_5
     $carousel_id = $app->app_paket_id . "_5";
     $banner_id = $app->app_paket_id . "_6";
     $mm = new PaketMatrix();
     if ($type == "Carousel") {
         $mm->getByID($carousel_id);
     }
     if ($type == "Campaign") {
         $mm->getByID($banner_id);
     }
     $limit = $mm->ps_isi;
     //get all campaign dengan app_id dan type yg diperbolehkan
     $nr = $this->getJumlah("camp_app_id = '{$this->camp_app_id}' AND camp_active = 1 AND camp_type = '{$this->camp_type}'");
     if ($this->camp_active) {
         if ($nr >= $limit) {
             $err['camp_active'] = Lang::t('Too many campaign active for ' . $type . ', please deactivate the others. Limit is ' . $limit);
         }
     }
     return $err;
 }