Example #1
0
 public function getPermalink()
 {
     /*$query = get_permalink(Qdmvc_Helper::getPageIdByTemplate('page-templates/service.php'));
       $query = add_query_arg(array('id' => $this->id, 'title' => $this->name), $query);*/
     $query = site_url(sprintf('%s/%s-%s.html', Qdmvc_Helper::sanitize_title_with_dashes($this->getPostCatObj()->title), Qdmvc_Helper::sanitize_title_with_dashes($this->title), $this->id));
     return $query;
 }
Example #2
0
 public function fn_removecache()
 {
     //xoa het file trong qdmvc_caches
     if (Qdmvc_Helper::cacheRemoveAll()) {
         $this->pushValidateError('', 'Remove All Cache files done!', 'info');
     }
 }
Example #3
0
 public static function buildJSONTree($lang = 'en-US')
 {
     $u = Qdmvc_Helper::getCurrentUser();
     $debug_mode = isset($_GET['debugmode']) ? $_GET['debugmode'] : 0;
     $re = array();
     foreach (static::getIndex() as $key => $config) {
         if (!$u->hasPermission(null, null, $key)) {
             continue;
         }
         //quocdunginfo, performance
         $tmp = array();
         $active = isset($config['Active']) ? $config['Active'] : true;
         $p_id = isset($config['ParentId']) ? $config['ParentId'] : -1;
         if (!$active) {
             continue;
         }
         $text = isset($config['Caption']) && isset($config['Caption'][$lang]) ? $config['Caption'][$lang] : $key;
         $tmp['title'] = $debug_mode == 1 ? $key : $text;
         $tmp['key'] = $key;
         $tmp['parentid'] = $p_id;
         if (!Qdmvc_Helper::isNullOrEmpty($config['PageType']) && $config['PageType'] == 'Folder') {
             $tmp['title'] = '[' . $tmp['title'] . ']';
             $tmp['value'] = '';
             $tmp['folder'] = true;
         } else {
             $tmp['value'] = Qdmvc_Helper::getCompactPageListLink($key);
         }
         array_push($re, $tmp);
     }
     return json_encode($re);
 }
Example #4
0
 public function getPermalink()
 {
     //$query = get_permalink(Qdmvc_Helper::getPageIdByTemplate('page-templates/bds-detail.php'));
     //$query = add_query_arg(array('id' => $this->id), $query);
     //$query = site_url(sprintf('%s/%s.html', Qdmvc_Helper::sanitize_title_with_dashes($this->name), $this->id));
     //return $query;
     $tmp = site_url(sprintf('%s/%s.html', Qdmvc_Helper::sanitize_title_with_dashes($this->name), $this->id));
     return $tmp;
 }
Example #5
0
 public function getPermalink()
 {
     $query = get_permalink(Qdmvc_Helper::getPageIdByTemplate('page-templates/product-search.php'));
     $query = add_query_arg(array('size-id' => $this->id), $query);
     return $query;
     /*
             $query =  get_site_url();
             $query .= sprintf('/loaisp/%s/%s', $this->id, Qdmvc_Helper::sanitize_title_with_dashes($this->name));
             return $query;*/
 }
    public function render()
    {
        ?>
        <div id="cardLoadingImg"
             style="width: 100%; height: 200px; text-align: center; background: url(<?php 
        echo Qdmvc_Helper::getImgURL("ajax-loader_blue.gif");
        ?>
) no-repeat center center transparent">
            <h4>Loading...</h4>
        </div>
    <?php 
    }
Example #7
0
 protected static function getFieldsConfig($f_name, $meta_name, $lang = 'en-US')
 {
     //check in Layout first
     $tmp_config = static::initFields();
     if (!Qdmvc_Helper::isNullOrEmpty($tmp_config[$f_name][$meta_name])) {
         return $tmp_config[$f_name][$meta_name];
     }
     //check in Model
     $c = static::getModel();
     $tmp = $c::getSingleFieldConfig($f_name, $meta_name, $lang);
     if (Qdmvc_Helper::isNullOrEmpty($tmp) && $meta_name == 'SourceExpr') {
         $tmp = $f_name;
     }
     return $tmp;
 }
Example #8
0
 public static function getLanguage()
 {
     if (static::$language == null) {
         //check user personalization first
         $username = Qdmvc_Helper::getCurrentUserName();
         if ($username != null) {
             $tmp = new QdUserPersonalization();
             $tmp->SETRANGE('username', $username);
             $tmp->SETRANGE('active', true);
             $tmp = $tmp->GETLIST();
             if (!Qdmvc_Helper::isNullOrEmpty($tmp)) {
                 if ($tmp[0]->language != '') {
                     static::$language = $tmp[0]->language;
                     return static::$language;
                 }
             }
         }
         //check in general setup
         $tmp = QdSetup::GET();
         static::$language = $tmp->df_language;
     }
     return static::$language;
 }
/**
 * Created by PhpStorm.
 * User: mac
 * Date: 19/1/16
 * Time: 9:25 PM
 */
function qdmvc_logout_hook_01()
{
    Qdmvc_Helper::deleteUserCache();
}
    public function render()
    {
        $this->style();
        parent::render();
        $this->onReadyHook();
        ?>
        <div id="qdmvcRootDiv" style="display: none; width: inherit; height: inherit">
            <style>
                #wpbody-content {
                    overflow-y: hidden !important;
                }
            </style>
            <script>
                MYAPP = {};
                MYAPP.openInNewTab = function (url) {
                    if (window == window.parent) {
                        window.open(url, '_blank');
                        return;
                    }
                    window.parent.MYAPP.openInNewTab(url);
                };
                MYAPP.TreeUnflatten = function( array, parent, tree ){

                    tree = typeof tree !== 'undefined' ? tree : [];
                    parent = typeof parent !== 'undefined' ? parent : { key: -1 };

                    var children = _.filter( array, function(child){ return child.parentid == parent.key; });

                    if( !_.isEmpty( children )  ){
                        if( parent.key == -1 ){
                            tree = children;
                        }else{
                            parent['children'] = children
                        }
                        _.each( children, function( child ){ MYAPP.TreeUnflatten( array, child ) } );
                    }

                    return tree;
                };

                (function ($) {
                    $(document).ready(function () {
                        //height = $(window).height()-3;

                        $("#splitter").jqxSplitter({width: '100%', height: '100%', panels: [{size: 230}]});
                        $("#splitter2").jqxSplitter({orientation: 'horizontal', width: '100%', height: '100%', panels: [{size: '90%'}]});

                        // Create jqxTree
                        Array.prototype.insert = function (index, item) {
                            this.splice(index, 0, item);
                        };

                        var data = <?php 
        echo Qdmvc_Page_Index::buildJSONTree($this->data['language']);
        ?>
;
                        data = MYAPP.TreeUnflatten(data);
                        var autoexpand = false;
                        <?php 
        if ($this->data['setup']->autoexpandmenu == true) {
            ?>
                        autoexpand = true;
                        <?php 
        }
        ?>

                        $("#jqxTree").fancytree({
                            extensions: ["filter"],
                            quicksearch: true,
                            checkbox: false,
                            source: data,
                            autoScroll: true,
                            filter: {
                                autoApply: true,  // Re-apply last filter if lazy data is loaded
                                counter: true,  // Show a badge with number of matching child nodes near parent icons
                                fuzzy: false,  // Match single characters in order, e.g. 'fb' will match 'FooBar'
                                hideExpandedCounter: true,  // Hide counter badge, when parent is expanded
                                highlight: true,  // Highlight matches by wrapping inside <mark> tags
                                mode: "hide"  // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
                            },
                            click: function(event, data) {
                                var node = data.node;
                                //add tab
                                var args = event.args;

                                var label = node.title;
                                var url = node.data.value;
                                if (url == '') {
                                    return;//ignore folder
                                }

                                //check existed
                                var totaltab = $('#jqxTabs').jqxTabs('length');
                                var i = 0;
                                for (i = 0; i < totaltab; i++) {
                                    var title = $('#jqxTabs').jqxTabs('getTitleAt', i);
                                    if (title == label) {
                                        $('#jqxTabs').jqxTabs('select', i);//switch to tab
                                        return;//ignore duplicate tab
                                    }
                                }

                                $('#jqxTabs').jqxTabs('addLast', label, '<iframe id="pagepart" src="' + url + '" width="100%" height="99%" scrolling="yes" frameborder="0"><p>Your browser does not support iframes</p> </iframe>');
                            },
                            create: function(event, data){
                                //alert('create done');
                            },
                            init: function(event, data){
                                if(autoexpand!=undefined && autoexpand==true) {
                                    $("#jqxTree").fancytree("getRootNode").visit(function (node) {
                                        node.setExpanded(true);
                                    });
                                }
                            }
                        });

                        //Tabs
                        $('#jqxTabs').jqxTabs({height: '100%', width: '100%', showCloseButtons: true, reorder: true});


                        /*Handle Tab Panel Context Menu
                        var contextMenu = $("#jqxMenu").jqxMenu({ width: '120px', height: '80px', autoOpenPopup: false, mode: 'popup'});
                        $("#jqxMenu").bind('itemclick', function(event)
                        {
                            var item = $(event.args).text();
                            var tabS = $('#jqxTabs');
                            switch (item)
                            {
                                case "Close Others":
                                    var currentIndex = tabS.jqxTabs('selectedItem');
                                    var currentTabTitle = tabS.jqxTabs('getTitleAt', currentIndex);
                                    for(var kk=currentIndex+1;kk<tabS.jqxTabs('length');kk++)
                                    {
                                        tabS.jqxTabs('removeAt', kk);
                                    }
                                    while(tabS.jqxTabs('length') > 1){
                                        tabS.jqxTabs('removeFirst');
                                    }
                                    break;
                                case "Close All":

                                    while(tabS.jqxTabs('length') > 0){
                                        tabS.jqxTabs('removeLast');
                                    }
                                    break;
                            }
                        });
                        */
                        // open the context menu when the user presses the mouse right button.
                        $("#jqxTabs").bind('mousedown', function (event) {
                            var rightClick = isRightClick(event);
                            if (rightClick) {
                                var scrollTop = $(window).scrollTop();
                                var scrollLeft = $(window).scrollLeft();

                                contextMenu.jqxMenu('open', parseInt(event.clientX) + 5 + scrollLeft, parseInt(event.clientY) + 5 + scrollTop);
                                return false;
                            }
                        });
                        /*

                        // disable the default browser's context menu.
                        $(document).bind('contextmenu', function (e) {
                            //return false;
                        });
                        */

                        function isRightClick(event) {
                            var rightclick;
                            if (!event) var event = window.event;
                            if (event.which) rightclick = (event.which == 3);
                            else if (event.button) rightclick = (event.button == 2);
                            return rightclick;
                        }
                        /*Handle Context Menu*/
                        $("#searchbox").keyup(function(e){
                            var match = $(this).val();
                            var tree = $("#jqxTree").fancytree("getTree");
                            if(e && e.which === $.ui.keyCode.ESCAPE || $.trim(match) === ""){
                                //reset filter
                                tree.clearFilter();
                                return;
                            }

                            // Pass text as filter string (will be matched as substring in the node title)
                            var n = tree.filterNodes(match, {autoExpand: true});
                        }).focus();

                    });
                })(jQuery);
            </script>
            <div id="splitter">
                <div>
                    <div id="splitter2">
                        <div>
                            <div style="width: 100%;">
                                <div style="float: left;">Search:</div>
                                <input id="searchbox" style="float: left;" />
                                <div style="clear: both"></div>
                            </div>

                            <div id='jqxTree' style="height: 95%; overflow: auto;">

                            </div>
                        </div>
                        <div>
                            <a target="_blank" href="<?php 
        echo admin_url('profile.php');
        ?>
"><?php 
        $tmp = wp_get_current_user();
        echo $tmp->user_login;
        ?>
 </a> |
                            <a onclick="return confirm('<?php 
        echo Qdmvc_Message::getMsg('msg_confirm');
        ?>
')"
                               href="<?php 
        echo wp_logout_url(Qdmvc_Helper::getCompactPageListLink('navigation'));
        ?>
">
                                <?php 
        echo Qdmvc_Message::getMsg('msg_logout');
        ?>
                            </a>
                        </div>
                    </div>

                </div>
                <div id="ContentPanel">
                    <!--
                    <div id='jqxMenu'>
                        <ul>
                            <li>Close Others</li>
                            <li>Close All</li>
                        </ul>
                    </div>-->
                    <div id='jqxTabs' style="float: left;">
                        <ul style="margin-left: 30px;" id="unorderedList">
                            <li>Home</li>
                        </ul>
                        <div>
                            Home page content
                        </div>
                    </div>
                </div>
            </div>
            <script>
                (function ($) {
                    $(document).ready(function () {
                        $('#panelContentpaneljqxTree li').click(function () {
                            //alert('wtf');
                        });


                    });
                })(jQuery);
            </script>
            <style>
                #hidden {
                    display: none
                }
            </style>
        </div>
    <?php 
    }
Example #11
0
 protected function checkPermission($method_name)
 {
     $class_name = $this->getCalledClassName();
     //get Permissions
     $u = Qdmvc_Helper::getCurrentUser();
     if ($u != null) {
         if (!$u->hasPermission($class_name, $method_name)) {
             $this->pushMsg('You are not allowed to call ' . $class_name . '|' . $method_name, 'error');
             return false;
         }
     }
     return true;
 }
 protected function slug_idOnValidate($field_name)
 {
     if ($this->{$field_name} == '' && $this->name != '') {
         $this->{$field_name} = Qdmvc_Helper::sanitize_title_with_dashes($this->name);
         $this->pushValidateError($field_name, 'Slug ID tự động lấy từ Name', 'info');
     }
 }
    private function render_serverFunctions()
    {
        if (count($this->serverFunctions()) <= 0) {
            return;
        }
        ?>
        <!-- Single button -->
        <div class="btn-group">
            <button type="button" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown"
                    aria-expanded="false">
                <?php 
        echo Qdmvc_Message::getMsg('btn_function');
        ?>
 <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" role="menu">
                <?php 
        foreach ($this->serverFunctions() as $item => $config) {
            $fn_label = isset($config['label'][$this->data['language']]) ? $config['label'][$this->data['language']] : '@' . $item;
            $fn_confirm = !Qdmvc_Helper::isNullOrEmpty($config['confirm']) && $config['confirm'] == true;
            ?>
                    <li><a id="<?php 
            echo $item;
            ?>
"><?php 
            echo $fn_label;
            ?>
</a></li>
                <?php 
            if (!Qdmvc_Helper::isNullOrEmpty($config['fn_name'])) {
                ?>
                    <script>
                        (function ($) {
                            $(document).ready(function () {
                                $('#<?php 
                echo $item;
                ?>
').click(function () {
                                    <?php 
                if ($fn_confirm) {
                    echo sprintf('if(confirm("%s"))', Qdmvc_Message::getMsg('msg_confirm'));
                }
                ?>
                                    MYAPP.callFn('<?php 
                echo $config['fn_name'];
                ?>
');
                                });
                            });
                        })(jQuery);
                    </script>
                <?php 
            }
        }
        ?>
            </ul>
        </div>
    <?php 
    }
Example #14
0
    public function run2()
    {
        Qdmvc_Helper::requestCompact();
        echo 'blank page!';
        ?>
        <link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <script>
            (function ($) {
                $(document).ready(function () {
                    //alert('ddd');
                    $("<div id='qd34' style='width: auto !important; margin: 0 auto; height: auto !important;background-color: #000000;'></div>")
                        .dialog({
                            "title": "Title",
                            "buttons": {
                                "OK": function () {
                                    $(this).dialog("close");
                                }
                            },
                            resizeStop: function( event, ui ) {
                                $('#qd34').width('auto');
                            }

                        })
                        .dialogExtend({
                            "closable": true, // enable/disable close button
                            "maximizable": true, // enable/disable maximize button
                            "minimizable": true, // enable/disable minimize button
                            "collapsable": true, // enable/disable collapse button
                            "dblclick": "collapse", // set action on double click. false, 'maximize', 'minimize', 'collapse'
                            "titlebar": "transparent", // false, 'none', 'transparent'
                            "minimizeLocation": "right", // sets alignment of minimized dialogues
                            "icons": { // jQuery UI icon class
                                "close": "ui-icon-circle-close",
                                "maximize": "ui-icon-circle-plus",
                                "minimize": "ui-icon-circle-minus",
                                "collapse": "ui-icon-triangle-1-s",
                                "restore": "ui-icon-bullet"
                            },
                            "load": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "beforeCollapse": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "beforeMaximize": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "beforeMinimize": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "beforeRestore": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "collapse": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "maximize": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "minimize": function (evt, dlg) {
                                //alert(evt.type);
                            }, // event
                            "restore": function (evt, dlg) {

                            } // event
                        });

                });
            })(jQuery);
        </script>

    <?php 
    }
Example #15
0
 protected function checkPermission()
 {
     //get Permissions
     $u = Qdmvc_Helper::getCurrentUser();
     return $u->hasPermission(null, null, $this->getPage());
 }
Example #16
0
 public function getBreadcrumbs()
 {
     return array(array('name' => $this->title, 'url' => Qdmvc_Helper::getNoneLink()));
 }