Example #1
0
function showPages($node)
{
    $aryPages = Page::getPages($node, false);
    for ($i = 0; $i < count($aryPages); $i++) {
        $strName = $aryPages[$i]->getName();
        $strEntry = $node . "/" . $strName;
        $strID = "node_" . md5("{$strEntry}");
        $numChildren = count(Page::getPages($strEntry, false));
        //$aryChildren = array();
        echo "<li class=\"";
        if (array_key_exists($strEntry, $_SESSION["nodes"]) && $_SESSION["nodes"][$strEntry] == "open") {
            echo "open";
        } elseif ($numChildren > 0) {
            echo "closed";
        } else {
            echo "empty";
        }
        echo "\">";
        echo "<a href=\"#\" class=\"node\" onclick=\"clickNode(this.parentNode, '{$strEntry}', '#{$strID}');return false;\">&nbsp;</a>";
        echo "<a href=\"../node-edit.php?node={$strEntry}\" target=\"main\" rel=\"{$strEntry}\">{$strName}</a>";
        echo "<ul id=\"{$strID}\" REL=\"{$strEntry}\">";
        if (array_key_exists($strEntry, $_SESSION["nodes"]) && $_SESSION["nodes"][$strEntry] == "open") {
            showPages($strEntry);
        }
        echo "</ul>";
        echo "</li>";
    }
}
Example #2
0
 public static function getDescendants($node, $contentType = "", array $aryPages = array())
 {
     $aryTemp = Page::getPages($node);
     foreach ($aryTemp as $objPage) {
         if ($contentType == "" || $objPage->getContentType() == $contentType) {
             $aryPages[] = $objPage;
             $aryPages = PageHelper::getDescendants($objPage->path, $contentType, $aryPages);
         }
     }
     return $aryPages;
 }
function getNodeList($path, $aryReturn = array())
{
    $aryPages = Page::getPages($path, false);
    for ($i = 0; $i < count($aryPages); $i++) {
        $strEntry = $aryPages[$i]->path;
        $strURL = $aryPages[$i]->getURL();
        $aryReturn[] = "[\"" . $strEntry . "\", \"" . $strURL . "\"]";
        $aryReturn = getNodeList($strEntry, $aryReturn);
    }
    return $aryReturn;
}
Example #4
0
 private function getNodeList($path, $aryReturn = array(""))
 {
     $aryPages = Page::getPages($path, false);
     for ($i = 0; $i < count($aryPages); $i++) {
         $strEntry = $aryPages[$i]->path;
         $strURL = $aryPages[$i]->getURL();
         $aryReturn[] = $strEntry;
         $aryReturn = $this->getNodeList($strEntry, $aryReturn);
     }
     return $aryReturn;
 }
Example #5
0
 public function detailAction()
 {
     $id = $this->getRequest()->getParam('id');
     //     		 echo $id;
     //     		 exit();
     $modelPage = new Page();
     $page = $modelPage->getPage($id);
     $this->view->page = $page;
     //获取其他新闻列表
     $where = "id != " . $id;
     $pages = $modelPage->getPages($where);
     $this->view->pages = $pages->toArray();
 }
Example #6
0
 public function indexAction()
 {
     // 博客列表
     $modelBlog = new Page();
     $where = array('type' => 'now');
     $blogs = $modelBlog->getPages($where);
     $paginator = new Zend_Paginator($blogs);
     $paginator->setItemCountPerPage(5);
     $paginator->setPageRange(5);
     // 获得当前显示的页码
     $page = $this->_request->getParam('page');
     $paginator->setCurrentPageNumber($page);
     // 渲染到视图
     $this->view->blogs = $paginator;
     $this->_helper->cache(array('index', 'view'), array('gook'));
 }
 public function index()
 {
     $pages = Page::getPages($this->paginate, $this->orderBy);
     $backendPages = new \Jamesy\BackendPages($pages);
     $pagesHtml = $backendPages->getPagesHtml();
     $orderBy = 1;
     switch ($this->orderBy) {
         case ['id', 'asc']:
             $orderBy = 1;
             break;
         case ['id', 'desc']:
             $orderBy = 2;
             break;
         case ['title', 'asc']:
             $orderBy = 3;
             break;
         case ['title', 'desc']:
             $orderBy = 4;
             break;
     }
     return View::make('backend.pages.index', ['user' => $this->user, 'isAdmin' => $this->isAdmin, 'configs' => $this->configs, 'pagesHtml' => $pagesHtml, 'logged_in_for' => $this->logged_in_for, 'activeParent' => $this->activeParent, 'active' => 'allpages', 'records' => $this->paginate, 'orderBy' => $orderBy, 'links' => $pages->links('backend.pagination.nifty'), 'type' => 'notdeleted']);
 }
Example #8
0
 public function indexAction()
 {
     // action body
     $modelPage = new Page();
     //实例化模型对象
     $where = array('star' => 4, 'top' => 1);
     // 定义查询条件
     $newsStar = $modelPage->getPage($where);
     //使用模型的getPage方法获取文章
     $this->view->newsStar = $newsStar;
     // 输出到view视图
     // 新闻文章列表
     $where_list = array('star' => 4, 'top' => 0);
     $order = 'createtime DESC';
     $limit = 5;
     $newsList = $modelPage->getPages($where_list, $order, $limit);
     $paginator = new Zend_Paginator($newsList);
     $paginator->setItemCountPerPage('5');
     // 获得当前显示的页码
     $page = $this->_request->getParam('page');
     $paginator->setCurrentPageNumber($page);
     // 渲染到视图
     $this->view->newsList = $paginator;
 }
Example #9
0
 /**
  * Get a list of visible pages
  */
 public function getPages()
 {
     return \Page::getPages();
 }
Example #10
0
        <div style="width:170px;" class="fl_l">
            <h2>Pages</h2>      
            <div style="height:700px;overflow-y:scroll;border-top:1px dashed #AAA">
            <table cellpadding="0" cellspacing="0" border="0" class="tbl_repeat" style="margin-bottom:0px;">
            <?php 
$groups = $objPage->getGroups('', array('order' => 'asc'));
foreach ($groups as $group) {
    ?>
                <tr  class="groupRow" >
                    <td><strong><?php 
    echo $group['name'];
    ?>
</strong></td>
                </tr>
                <?php 
    $actions = $objPage->getPages(array('group_id' => $group['id']), array('everyone' => 'desc', 'order' => 'asc'));
    foreach ($actions as $action) {
        ?>
                        <tr data-id="<?php 
        echo $action['id'];
        ?>
" class="clickable" >
                            <td >
                                <a href="#"><?php 
        echo ucwords($action['name']);
        ?>
</a>
                            </td>
                        </tr>
                        <?php 
    }
Example #11
0
<?php

require_once 'lib/path.php';
if ($down || !isset($_SESSION['user'])) {
    header('Location: index.php');
}
$pages = Page::getPages($_SESSION['user']);
?>
<!DOCTYPE html>
<html>
<head>
    <title>Imperial Republic Information Network</title>
    <link rel="shortcut icon" href="favicon.ico" />
    <link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" />
    <link href="css/style.css" type="text/css" rel="stylesheet" />
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery.cookie.js" type="text/javascript"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <script src="js/script.js" type="text/javascript"></script>
</head>
<body>
    <div class="container">
        <input type="hidden" id="lastactive" name="lastactive" value="<?php 
if (isset($_SESSION['lastactive'])) {
    echo $_SESSION['lastactive'];
}
?>
" />
        <h1>Imperial Republic Information Network</h1>
        <div class="row">
            <div id="sidebar" class="col-md-3">
Example #12
0
<?php

//region 	<Pages>
// Homepage
$app->get('/', function () use($app) {
    doLessFileCached('index');
    $app->render('index.html.twig', array('pages' => Page::getPages()->find_array()));
});
// Memory Use
$app->get('/memoryUse/', function () use($app) {
    echo "Memory Use: " . memory_get_usage() . "<br>";
    echo "Memory Use Real: " . memory_get_usage(true) . "<br><br>";
    $a = str_repeat("Hello", 4242);
    echo "Memory Use: " . memory_get_usage() . "<br>";
    echo "Memory Use Real: " . memory_get_usage(true);
});
//endregion	</Pages>
//region	<AJAXy & RESTful API>
//endregion	</AJAXy & RESTful API>
// PHPInfo
$app->get('/phpinfo/', function () use($app) {
    phpinfo();
});
// Runs if debug = false
$app->error(function (\Exception $e) use($app) {
    debug($e);
});
<?php

require_once '../inc/config.php';
if (isset($_POST['id']) && isset($_POST['everyone'])) {
    $id = $_POST['id'];
    $everyone = $_POST['everyone'];
    $objPage = new Page();
    $action = $objPage->getPages(array('id' => $id));
    if (!empty($action)) {
        switch ($everyone) {
            case 0:
                $mode = 1;
                break;
            case 1:
                $mode = 0;
                break;
            default:
                echo Helper::json(array('success' => false));
        }
        if ($objPage->updateAction(array('everyone' => $mode), $id)) {
            if ($mode == 1) {
                $objPage->removeAllPageAccess($id);
            }
            echo Helper::json(array('success' => true));
        } else {
            echo Helper::json(array('success' => false));
        }
    } else {
        echo Helper::json(array('success' => false));
    }
} else {
Example #14
0
        <?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 #15
0
<?php

require_once "classes/class_page.php";
$pages = new Page();
$allPages = $pages->getPages();
echo json_encode($allPages);
Example #16
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);
         }
     }
 }
Example #17
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>
<?php

if (!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin() || !$config) {
    die('Access Denied');
}
$pages = Page::getPages();
?>
<h2><?php 
echo __('Company Profile');
?>
</h2>
<form action="settings.php?t=pages" method="post" id="save"
    enctype="multipart/form-data">
<?php 
csrf_token();
?>
<input type="hidden" name="t" value="pages" >
<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2">
    <thead><tr>
        <th colspan="2">
            <h4><?php 
echo __('Basic Information');
?>
</h4>
        </th>
    </tr></thead>
    <tbody>
    <?php 
$form = $ost->company->getForm();
$form->addMissingFields();
$form->render();
Example #19
0
 public function getChildren($blnActiveOnly = true)
 {
     return Page::getPages($this->path, $blnActiveOnly);
 }
Example #20
0
<?php

require_once '../inc/config.php';
if (isset($_POST['id'], $_POST['object'], $_POST['field'], $_POST['value'])) {
    $id = $_POST['id'];
    $case = $_POST['object'];
    $field = $_POST['field'];
    $value = $_POST['value'];
    if ($value == 0) {
        $new_value = 1;
        if ($case == 'page' && $field == 'default') {
            $objDbase = new dbase();
            $objPage = new Page();
            $page = $objPage->getPages(array('id' => $id))[0];
            $pages = $objPage->getPages(array('default' => 1, 'group_id' => $page['group_id']));
            foreach ($pages as $page) {
                $objDbase->changeField('page', $page['id'], array('default' => 0));
            }
        }
    }
    if ($value == 1) {
        $new_value = 0;
    }
    $objDbase = new dbase();
    $params = array($field => $new_value);
    if ($objDbase->changeField($case, $id, array($field => $new_value))) {
        echo Helper::json(array('success' => true));
    } else {
        echo Helper::json(array('success' => false));
    }
} else {
Example #21
0
" id="row-<?php 
    echo $group['id'];
    ?>
">
                    <td class="borderRight">
                        +
                    </td>
                    <td class="borderRight showPagesInGroup clickable">                        
                        <span style="font-weight:bold"><?php 
    echo $group['name'];
    ?>
</span>    
                    </td>
                    <td class="clickable showPagesInGroup">
                        <?php 
    echo count($objPage->getPages(array('group_id' => $group['id'])));
    ?>
                    </td>
                    <td>
                        <a href="#" class="confirmRemove">Remove</a>
                    </td>
                </tr>    
                           
            
        <?php 
}
?>
            </tbody>
                <tr class="formRow">
                    <td class="borderRight">
                    </td>