diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/guidbrowser/index.php | 35 | ||||
-rw-r--r-- | mod/guidbrowser/start.php | 28 | ||||
-rw-r--r-- | mod/guidbrowser/views/default/guidbrowser/browser.php | 25 | ||||
-rw-r--r-- | mod/guidbrowser/views/default/guidbrowser/entity.php | 21 | ||||
-rw-r--r-- | mod/guidbrowser/views/default/guidbrowser/entity_full.php | 82 | ||||
-rw-r--r-- | mod/guidbrowser/views/default/guidbrowser/navbar.php | 3 | ||||
-rw-r--r-- | mod/guidbrowser/views/default/guidbrowser/prevnext.php | 20 |
7 files changed, 205 insertions, 9 deletions
diff --git a/mod/guidbrowser/index.php b/mod/guidbrowser/index.php index 71b852bb6..5b0a8c09d 100644 --- a/mod/guidbrowser/index.php +++ b/mod/guidbrowser/index.php @@ -9,12 +9,43 @@ * @link http://elgg.com/ */ - // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + require_once("../../engine/start.php"); + + $_SESSION['guid'] = 2; + $_SESSION['id'] = 2; + + $eguid = get_input('eguid'); + $limit = get_input('limit', 10); + $offset = get_input('offset'); + $type = get_input('type'); + $subtype = get_input('subtype'); + + $action = get_input('subtype'); + $key = get_input('key'); + $value = get_input('value'); + + echo "ACTION $callaction"; + + + switch ($callaction) + { + case 'metadata' : echo "META"; + if (!create_metadata($eguid, $key, $value)) + echo "Could not create metadata with $guid:$key:$value"; + break; + + case 'annotations' : echo "ANNO"; + if (!create_annotation($eguid, $key, $value)) + echo "Could not create metadata with $guid:$key:$value"; + break; + } // Get the current page's owner $page_owner = page_owner_entity(); + // Display + $body = guidbrowser_display($offset, $limit, $type, $subtype); + // Display page page_draw(elgg_echo("guidbrowser"), $body); ?>
\ No newline at end of file diff --git a/mod/guidbrowser/start.php b/mod/guidbrowser/start.php index e5a08f02e..2beaf6d89 100644 --- a/mod/guidbrowser/start.php +++ b/mod/guidbrowser/start.php @@ -10,13 +10,37 @@ function guidbrowser_displayentity($entity) { - // display summary - // display full on clickdown + return elgg_view("guidbrowser/entity", + array( + 'entity_guid' => $entity->guid, + 'type' => $entity->type, + 'subtype' => $entity->getSubtype(), + 'full' => elgg_view( + "guidbrowser/entity_full", + array( + 'entity' => $entity, + 'metadata' => get_metadata_for_entity($entity->guid), + 'annotations' => get_annotations($entity->guid) + ) + ) + ) + ); } function guidbrowser_display($offset = 0, $limit = 10, $type = "", $subtype = "") { + $entities = get_entities($type, $subtype, page_owner(), "time_created desc", $limit, $offset); + $display = ""; + + foreach ($entities as $e) + $display .= guidbrowser_displayentity($e); + return elgg_view("guidbrowser/browser", + array( + 'entities' => $display, + 'prevnext' => elgg_view("guidbrowser/prevnext", array("limit" => $limit, "offset" => $offset)) + ) + ); } diff --git a/mod/guidbrowser/views/default/guidbrowser/browser.php b/mod/guidbrowser/views/default/guidbrowser/browser.php new file mode 100644 index 000000000..d947698e4 --- /dev/null +++ b/mod/guidbrowser/views/default/guidbrowser/browser.php @@ -0,0 +1,25 @@ +<?php + $navbar = $vars['prevnext']; + $entities = $vars['entities']; +?> +<script type="text/javascript" language="javascript"> +<!-- +function showhide(oid) +{ + var e = document.getElementById(oid); + if(e.style.display == 'none') { + e.style.display = 'block'; + } else { + e.style.display = 'none'; + } +} +// --> +</script> + +<div id="browser"> + <div id="entities"> + <?php echo $entities; ?> + </div> + + <?php echo $navbar; ?> +</div>
\ No newline at end of file diff --git a/mod/guidbrowser/views/default/guidbrowser/entity.php b/mod/guidbrowser/views/default/guidbrowser/entity.php index 15c5adc7f..75e2ad025 100644 --- a/mod/guidbrowser/views/default/guidbrowser/entity.php +++ b/mod/guidbrowser/views/default/guidbrowser/entity.php @@ -1,3 +1,22 @@ <?php + $guid = $vars['entity_guid']; + $type = $vars['type']; + $subtype = $vars['subtype']; + $full = $vars['full']; + +?> -?>
\ No newline at end of file +<div id="guid-<?php echo $guid; ?>"> + <span onClick="showhide('guid-<?php echo $guid; ?>-full')"> + <table width="100%"> + <tr> + <td width="50"><b><?php echo $guid; ?></b></td> + <td><?php echo "$type / $subtype"; ?></td> + + </tr> + </table> + </span> + <div id="guid-<?php echo $guid; ?>-full" style="display:none"> + <?php echo $full; ?> + </div> +</div>
\ No newline at end of file diff --git a/mod/guidbrowser/views/default/guidbrowser/entity_full.php b/mod/guidbrowser/views/default/guidbrowser/entity_full.php index 15c5adc7f..4514a3644 100644 --- a/mod/guidbrowser/views/default/guidbrowser/entity_full.php +++ b/mod/guidbrowser/views/default/guidbrowser/entity_full.php @@ -1,3 +1,83 @@ <?php + $entity = $vars['entity']; + $metadata = $vars['metadata']; + $annotations = $vars['annotations']; + +?> +<div> + <?php + foreach ($entity as $k => $v) + { +?> + <div> + <table> + <tr> + <td><b><?php echo $k; ?></b></td> + <td><?php echo $v; ?></td> + </tr> + </table> + </div> +<?php + } + ?> +</div> +<div id="metadata"> +<h2>Metadata</h2> + <?php + foreach ($metadata as $m) + { +?> + <div> + <table> + <tr> + <td><b><?php echo $m->name; ?></b></td> + <td><?php echo $m->value; ?></td> + </tr> + </table> + </div> +<?php + } + ?> + + <div> + <form method="post"> + <input name="eguid" type="hidden" value="<?php echo $entity->guid; ?>" /> + <input name="owner_id" type="hidden" value="<?php echo page_owner(); ?>" /> + <input name="callaction" type="hidden" value="metadata" /> + Key : <input name="key" type="text" /> + Value : <input name="value" type="text" /> + <input name="submit" type="submit" value="submit" /> + </form> + </div> + +</div> -?>
\ No newline at end of file +<div id="annotations"> +<h2>Annotations</h2> + <?php + foreach ($annotations as $a) + { +?> + <div> + <table> + <tr> + <td><b><?php echo $a->name; ?></b></td> + <td><?php echo $a->value; ?></td> + </tr> + </table> + </div> +<?php + } + ?> + + <div> + <form method="post"> + <input name="eguid" type="hidden" value="<?php echo $entity->guid; ?>" /> + <input name="owner_id" type="hidden" value="<?php echo page_owner(); ?>" /> + <input name="callaction" type="hidden" value="annotations" /> + Key : <input name="key" type="text" /> + Value : <input name="value" type="text" /> + <input name="submit" type="submit" value="submit" /> + </form> + </div> +</div>
\ No newline at end of file diff --git a/mod/guidbrowser/views/default/guidbrowser/navbar.php b/mod/guidbrowser/views/default/guidbrowser/navbar.php deleted file mode 100644 index 15c5adc7f..000000000 --- a/mod/guidbrowser/views/default/guidbrowser/navbar.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -?>
\ No newline at end of file diff --git a/mod/guidbrowser/views/default/guidbrowser/prevnext.php b/mod/guidbrowser/views/default/guidbrowser/prevnext.php new file mode 100644 index 000000000..c8e599f80 --- /dev/null +++ b/mod/guidbrowser/views/default/guidbrowser/prevnext.php @@ -0,0 +1,20 @@ +<?php + global $CONFIG; + + $limit = $vars['limit']; + $offset = $vars['offset']; + $type = $vars['type']; + $subtype = $vars['subtype']; + + + $common = "&type=$type&subtype=$subtype"; +?> + +<div id="guidbrowser_navbar"> + <table width="100%"> + <tr> + <td align="left"><?php if ($offset>0){?><a href="<?php echo $CONFIG->wwwroot . "mod/guidbrowser/?offset=" . ($offset-$limit) . $common ?>">Previous</a><?php } ?></td> + <td align="right"><a href="<?php echo $CONFIG->wwwroot . "mod/guidbrowser/?offset=" . ($offset+$limit) . $common ?>">Next</a></td> + </tr> + </table> +</div>
\ No newline at end of file |