예제 #1
0
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: view_template.php,v 1.5 2005/04/03 07:57:14 filetreefrog Exp $
##################################################
if (!defined('PATHOS')) {
    exit('');
}
if ($user && $user->is_acting_admin == 1) {
    $page = null;
    if (isset($_GET['id'])) {
        $page = $db->selectObject('section_template', 'id=' . $_GET['id']);
    }
    if ($page) {
        pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
        $template = new template('navigationmodule', '_view_template', $loc);
        $template->assign('template', $page);
        $template->assign('subs', navigationmodule::getTemplateHierarchyFlat($page->id));
        $template->output();
    } else {
        echo SITE_404_HTML;
    }
} else {
    echo SITE_403_HTML;
}
예제 #2
0
 function getTemplateHierarchyFlat($parent, $depth = 1)
 {
     global $db;
     $arr = array();
     $kids = $db->selectObjects('section_template', 'parent=' . $parent);
     if (!defined('SYS_SORTING')) {
         require_once BASE . 'subsystems/sorting.php';
     }
     usort($kids, 'pathos_sorting_byRankAscending');
     for ($i = 0; $i < count($kids); $i++) {
         $page = $kids[$i];
         $page->depth = $depth;
         $page->first = $i == 0 ? 1 : 0;
         $page->last = $i == count($kids) - 1 ? 1 : 0;
         $arr[] = $page;
         $arr = array_merge($arr, navigationmodule::getTemplateHierarchyFlat($page->id, $depth + 1));
     }
     return $arr;
 }
예제 #3
0
 /**
  * recursively lists the template hierarchy
  *
  * @static
  * @param $parent top level parent id
  * @param int $depth variable to hold level of recursion
  *
  * @return array
  */
 static function getTemplateHierarchyFlat($parent, $depth = 1)
 {
     global $db;
     $arr = array();
     $kids = $db->selectObjects('section_template', 'parent=' . $parent);
     $kids = expSorter::sort(array('array' => $kids, 'sortby' => 'rank', 'order' => 'ASC'));
     for ($i = 0; $i < count($kids); $i++) {
         $page = $kids[$i];
         $page->depth = $depth;
         $page->first = $i == 0 ? 1 : 0;
         $page->last = $i == count($kids) - 1 ? 1 : 0;
         $arr[] = $page;
         $arr = array_merge($arr, navigationmodule::getTemplateHierarchyFlat($page->id, $depth + 1));
     }
     return $arr;
 }