diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-07-15 17:59:57 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-07-15 17:59:57 +0000 |
commit | bcfbbf1b7cf2a0c96af1dfe55c919c09eceac916 (patch) | |
tree | e22653836d685eedbe81df5f4b1c118e6324c86d /mod/pages/views/default/pages/sidebar | |
parent | ff5846ea6cb4e5edc84c99c6eda7b37dccce8bf5 (diff) | |
download | elgg-bcfbbf1b7cf2a0c96af1dfe55c919c09eceac916.tar.gz elgg-bcfbbf1b7cf2a0c96af1dfe55c919c09eceac916.tar.bz2 |
First pass at standardizing pages.
git-svn-id: http://code.elgg.org/elgg/trunk@6716 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages/views/default/pages/sidebar')
-rw-r--r-- | mod/pages/views/default/pages/sidebar/sidebarthis.php | 166 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/starter.php | 16 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/tree.php | 8 | ||||
-rw-r--r-- | mod/pages/views/default/pages/sidebar/wrapper.php | 13 |
4 files changed, 102 insertions, 101 deletions
diff --git a/mod/pages/views/default/pages/sidebar/sidebarthis.php b/mod/pages/views/default/pages/sidebar/sidebarthis.php index 1c8b77848..173ddb91a 100644 --- a/mod/pages/views/default/pages/sidebar/sidebarthis.php +++ b/mod/pages/views/default/pages/sidebar/sidebarthis.php @@ -1,92 +1,88 @@ [<?php - /** - * Elgg Pages - * - * @package ElggPages - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - global $CONFIG; - $entity = $vars['entity']; - $parent = $vars['entity']->parent_guid; - - $currentpage = (int) get_input('currentpage'); - if ($currentpage) { - - $path = pages_get_path($currentpage); - $pathstring = implode(',',$path); - - } else { - $path = array(); - } - - function pages_draw_child($childentity, $path) { - - $child = "\n\t\t{\n"; - $child .= "\t\t\t\"text\": \"<a href=\\\"{$childentity->getURL()}\\\">" . addslashes($childentity->title) . "</a>\"\n"; - - $extras = ""; - $haschild = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $childentity->guid, 'limit' => 9999)); - if ($haschild) { - if (in_array($childentity->guid,$path)) { - $extras .= "\t\t\t,\"expanded\": true"; - $extras .= "\t\t\t,\"children\": [\n"; - - $childstring = ""; - foreach($haschild as $subchild) { - $childstringtemp = pages_draw_child($subchild,$path); - if (!empty($childstringtemp)) { - if (!empty($childstring)) $childstring .= ", "; - $childstring .= $childstringtemp; - } +/** + * Side bar page tree. + * + * @package ElggPages + */ + +global $CONFIG; +$entity = $vars['entity']; +$parent = $vars['entity']->parent_guid; + +$currentpage = (int) get_input('currentpage'); +if ($currentpage) { + + $path = pages_get_path($currentpage); + $pathstring = implode(',',$path); + +} else { + $path = array(); +} + +function pages_draw_child($childentity, $path) { + + $child = "\n\t\t{\n"; + $child .= "\t\t\t\"text\": \"<a href=\\\"{$childentity->getURL()}\\\">" . addslashes($childentity->title) . "</a>\"\n"; + + $extras = ""; + $haschild = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $childentity->guid, 'limit' => 9999)); + if ($haschild) { + if (in_array($childentity->guid,$path)) { + $extras .= "\t\t\t,\"expanded\": true"; + $extras .= "\t\t\t,\"children\": [\n"; + + $childstring = ""; + foreach($haschild as $subchild) { + $childstringtemp = pages_draw_child($subchild,$path); + if (!empty($childstringtemp)) { + if (!empty($childstring)) $childstring .= ", "; + $childstring .= $childstringtemp; } - - $extras .= $childstring . "\n\t\t\t]\n"; - } else { - $extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n"; } - - } - $child .= $extras . "\t\t}"; - return $child; - } - - if (!$parent) { - echo "{\n"; - echo "\t\"text\": \"<a href=\\\"{$vars['entity']->getURL()}\\\">" . addslashes($vars['entity']->title) . "</a>\"\n"; - } - - $children = ""; - $temp = ""; - if (isset($vars['children']) && is_array($vars['children']) && (!isset($vars['fulltree']) || $vars['fulltree'] == 0)) { - if (!$parent) $temp .= "\t" . '"expanded": true,' . "\n"; - if (!$parent) $temp .= "\t" . '"children": [' . "\n"; - foreach($vars['children'] as $child) { - $childrentemp = pages_draw_child($child,$path); - if (!empty($childrentemp)) { - if (!empty($children)) $children .= ", \n"; - $children .= $childrentemp; + + $extras .= $childstring . "\n\t\t\t]\n"; + } else { + $extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n"; } - /* - $children .= "\n\t\t{\n"; - $children .= "\t\t\t\"text\": \"<a href=\\\"{$child->getURL()}\\\">{$child->title}</a>\",\n"; - - $haschild = get_entities_from_metadata('parent_guid',$child->guid,'','',0,10,0,'',0,true); - if ($haschild) { - $children .= "\t\t\t\"id\": \"{$child->getGUID()}\",\n\t\t\t\"hasChildren\": true\n"; - } - $children .= "\t\t}"; - */ + + } + $child .= $extras . "\t\t}"; + return $child; +} + +if (!$parent) { + echo "{\n"; + echo "\t\"text\": \"<a href=\\\"{$vars['entity']->getURL()}\\\">" . addslashes($vars['entity']->title) . "</a>\"\n"; +} + + $children = ""; + $temp = ""; + if (isset($vars['children']) && is_array($vars['children']) && (!isset($vars['fulltree']) || $vars['fulltree'] == 0)) { + if (!$parent) $temp .= "\t" . '"expanded": true,' . "\n"; + if (!$parent) $temp .= "\t" . '"children": [' . "\n"; + foreach($vars['children'] as $child) { + $childrentemp = pages_draw_child($child,$path); + if (!empty($childrentemp)) { + if (!empty($children)) $children .= ", \n"; + $children .= $childrentemp; } - if (!empty($temp)) echo ',' . $temp; - echo $children; - if (!$parent) echo "\t\t" . ']' . "\n"; - + /* + $children .= "\n\t\t{\n"; + $children .= "\t\t\t\"text\": \"<a href=\\\"{$child->getURL()}\\\">{$child->title}</a>\",\n"; + + $haschild = get_entities_from_metadata('parent_guid',$child->guid,'','',0,10,0,'',0,true); + if ($haschild) { + $children .= "\t\t\t\"id\": \"{$child->getGUID()}\",\n\t\t\t\"hasChildren\": true\n"; + } + $children .= "\t\t}"; + */ } - - if (!$parent) echo "}"; + if (!empty($temp)) echo ',' . $temp; + echo $children; + if (!$parent) echo "\t\t" . ']' . "\n"; + + } + +if (!$parent) echo "}"; -?>] +?>]
\ No newline at end of file diff --git a/mod/pages/views/default/pages/sidebar/starter.php b/mod/pages/views/default/pages/sidebar/starter.php index edc66e499..f533356b3 100644 --- a/mod/pages/views/default/pages/sidebar/starter.php +++ b/mod/pages/views/default/pages/sidebar/starter.php @@ -1,21 +1,19 @@ <?php +/** + * Start Pages page output + * + * @package ElggPages + */ - if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) { +if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) { ?> <script type="text/javascript"> - $(document).ready( function() { - $("#pagetree<?php echo $vars['entity']->getGUID(); ?>").click(); - }); - </script> <?php - - } - -?> +}
\ No newline at end of file diff --git a/mod/pages/views/default/pages/sidebar/tree.php b/mod/pages/views/default/pages/sidebar/tree.php index 07de1beb5..399caf108 100644 --- a/mod/pages/views/default/pages/sidebar/tree.php +++ b/mod/pages/views/default/pages/sidebar/tree.php @@ -1,8 +1,12 @@ <?php - +/** + * Side bar tree wrapper. + * + * @package ElggPages + */ ?> <div id="sidebar_page_tree"> - <h3><?php echo elgg_echo("pages:navigation"); ?></h3> + <h3><?php echo elgg_echo("pages:navigation"); ?></h3> <div id="pagesTree" class="pagesTreeContainer"></div> </div> <br class="clearfloat" /> diff --git a/mod/pages/views/default/pages/sidebar/wrapper.php b/mod/pages/views/default/pages/sidebar/wrapper.php index 2109188cf..93b746eb0 100644 --- a/mod/pages/views/default/pages/sidebar/wrapper.php +++ b/mod/pages/views/default/pages/sidebar/wrapper.php @@ -1,7 +1,10 @@ <?php +/** + * Pages page wrapper + * + * @package ElggPages + */ - echo "["; - echo $vars['body']; - echo "]"; - -?> +echo "["; +echo $vars['body']; +echo "]";
\ No newline at end of file |