Example #1
0
<?php

$objPage = new Page();
$groups = $objPage->getGroups('', array('order' => 'asc'));
require_once '_header.php';
?>

    <h1><?php 
echo $header;
?>
</h1> 
    <div class="fl_l">
        <h2>Page Groups</h2>
        <div data-plugin="page_groups" class="reloadSection" data-current="1" >
             <?php 
echo Plugin::get('page_groups', array('groups' => $groups));
?>
  
        </div>
        
    </div>
    <div style="margin-left:45%;">
        
        <div data-plugin="pages_in_group" class="reloadSection" style="overflow-y:hidden;">      
            <h1>Group Details</h1>
            Click a group to see the pages in it.
        </div>  
    </div>
    <div style="height:25px;clear:both;"></div>
    
Example #2
0
 public function process()
 {
     $uri = $_SERVER['REQUEST_URI'];
     if (!empty($uri)) {
         //$uriQ = explode('?', $uri);
         //                //cau truc cua link la abc/xyz.php?param=blah&param=blah
         //                //tach ra de tim xem co param nao o tren link, sau dau cham hoi se la tat ca cac param duoc gan bang dau &, nen day la array
         //                $uri = $uriQ[0]; //thanh phan dau tien se la link day du
         //                if(count($uriQ) > 1) { //tren link ngoai link day du con co param
         //                    $this->stringRaw = $uriQ[1];
         //                    $uriRaw = explode('&', $uriQ[1]); //tach ra tung param
         //                    if(count($uriRaw > 1)) { //neu co nhieu hon 1 param
         //                        foreach($uriRaw as $key => $row) {
         //                            $this->splitRaw($row); //dua param va property vao trong array paramsRaw theo cau truc key: param, value: property
         //                        }
         //                    } else {
         //                        $this->splitRaw($uriRaw[0]); //neu co 1 param thi dua param dau tien vao trong array paramsRaw
         //                    }
         //                }
         $firstChar = substr($uri, 0, 1);
         if ($firstChar == '/') {
             $uri = substr($uri, 1);
         }
         $lastChar = substr($uri, -1);
         if ($lastChar == '/') {
             $uri = substr($uri, 0, -1);
         }
         if (!empty($uri)) {
             $uri = explode('/', $uri);
             array_shift($uri);
             $this->cpage = array_shift($uri);
             //$pairs = array();
             //foreach($uri as $key => $value) {
             //                            $pairs[] = $value;
             //                            if(count($pairs) > 1) {
             //                                if(!Helper::isEmpty($pairs[1])) {
             //                                    if($pairs[0] == $this->key_page) {
             //                                        $this->cpage = $pairs[1];
             //                                    } else if ($pairs[0] == 'c') {
             //                                        $this->c = $pairs[1];
             //                                    } else if ($pairs[0] == 'a') {
             //                                        $this->a = $pairs[1];
             //                                    }
             //                                    $this->params[$pairs[0]] = $pairs[1];
             //                                }
             //                                $pairs = array();
             //                            }
             //                        }
             $objPage = new Page();
             $group = $objPage->getGroups(array('name' => $this->cpage));
             if (!empty($group) && count($group) == 1) {
                 //neu cpage la mot trong nhung group da duoc luu trong dbase thi moi xet den params tren url
                 $params = array();
                 if (empty($uri)) {
                     //neu khong co params tren url thi lay params cua default page cho vao
                     $defaultPage = $objPage->getPages(array('default' => 1, 'group_id' => $group[0]['id']));
                     if (!empty($defaultPage) && count($defaultPage) == 1) {
                         $defaultParams = $objPage->getPageParams(array('page_id' => $defaultPage[0]['id']));
                         foreach ($defaultParams as $defaultParam) {
                             if ($defaultParam['required_value'] != '') {
                                 $params[$defaultParam['param']] = $defaultParam['required_value'];
                             } else {
                                 $error = "No record found in database for this page.";
                             }
                         }
                     }
                 } else {
                     if (count($uri) == 1 && is_numeric($uri[0])) {
                         $uri[] = 'view';
                     }
                     $pages = $objPage->getPages(array('group_id' => $group[0]['id']));
                     foreach ($pages as $page) {
                         $params_db = $objPage->getPageParams(array('page_id' => $page['id']), array('order' => 'asc'));
                         if (count($params_db) == count($uri)) {
                             //var_dump($params_db);
                             foreach ($params_db as $key => $param_db) {
                                 //echo 'current key: '.$key.'<br />';
                                 //                                        echo 'param db name: '.$param_db['param'].'<br />';
                                 //                                        echo 'uri at current key: '.$uri[$key].'<br />';
                                 //                                        echo '<br />';
                                 if ($param_db['required_value'] == '') {
                                     $params[$param_db['param']] = $uri[$key];
                                     unset($params_db[$key]);
                                 } else {
                                     if ($uri[$key] == $param_db['required_value']) {
                                         $params[$param_db['param']] = $uri[$key];
                                         unset($params_db[$key]);
                                     }
                                 }
                             }
                             //echo 'result: '.empty($params_db);
                             if (empty($params_db)) {
                                 $this->page_id = $page['id'];
                                 $this->params = $params;
                                 break;
                             }
                         }
                     }
                 }
             }
             //var_dump($this->params);
         }
     }
 }
        <?php 
if (!isset($data['params'])) {
} else {
    $params = $data['params'];
    if (isset($params['id']) && !empty($params['id'])) {
        $id = $params['id'];
        $objPage = new Page();
        $groups = $objPage->getGroups(array('id' => $id));
        if (!empty($groups)) {
            $group = $groups[0];
            $pages = $objPage->getPages(array('group_id' => $id), array('everyone' => 'desc', 'order' => 'asc'));
            ?>
                    
                    <div class="sectionParams" data-params="id=<?php 
            echo $id;
            ?>
"></div>
                        <h2 class="borderBottom">Group :: <?php 
            echo $group['name'];
            ?>
</h2>
                        <br />
                        <strong>Details</strong><br />
                        <table cellpadding="0" cellspacing="0" border="0" class="tbl_repeat" data-object="page_group" style="width:auto;">
                            <tr>
                                <th class="borderRight" style="width:110px;">Group Name</th>
                                <th style="width:90px;">URL cPage</th>
                            </tr>
                            <tr data-id="<?php 
            echo $id;
            ?>
Example #4
0
<?php

$objPage = new Page();
$objTeam = new Team();
$objPosition = new Position();
if (!isset($data['params'])) {
    $page = $data['action'];
} else {
    $params = $data['params'];
    $id = $params['id'];
    $page = $objPage->getPages(array('id' => $id))[0];
    $page_params = $objPage->getPageParams(array('page_id' => $id), array('order' => 'asc'));
}
$group_name = $objPage->getGroups(array('id' => $page['group_id']))[0]['name'];
?>
  
        <div class="sectionParams" data-params="id=<?php 
echo $id;
?>
"></div>
        <h2 class="borderBottom"><?php 
echo ucfirst($group_name);
?>
 :: <?php 
echo ucwords($page['name']);
?>
</h2>
        
        <table  cellpadding="0" cellspacing="0" border="0" style="width:100%;" class="panelTable horizontalTable" data-object="page">
                    
            <tr>