aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/feed_reader/edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/widgets/feed_reader/edit.php')
-rw-r--r--views/default/widgets/feed_reader/edit.php119
1 files changed, 56 insertions, 63 deletions
diff --git a/views/default/widgets/feed_reader/edit.php b/views/default/widgets/feed_reader/edit.php
index a721f0e8a..83218dcbb 100644
--- a/views/default/widgets/feed_reader/edit.php
+++ b/views/default/widgets/feed_reader/edit.php
@@ -1,69 +1,62 @@
<?php
- $num_items = $vars['entity']->num_items;
- if (!isset($num_items)) {
- $num_items = 10;
- }
+/**
+ * Simplepie feed reader widget settings
+ */
- $excerpt = $vars['entity']->excerpt;
- if (!isset($excerpt)) {
- $excerpt = 0;
- }
-
- $post_date = $vars['entity']->post_date;
- if (!isset($post_date)) {
- $post_date = 0;
- }
-?>
-
-<p>
- <?php echo elgg_echo("simplepie:feed_url"); ?>
- <input type="text" onclick="this.select();" name="params[feed_url]" value="<?php echo htmlentities($vars['entity']->feed_url); ?>" />
-</p>
-
-<p>
-<?php echo elgg_echo('simplepie:num_items'); ?>
-
-<?php
- echo elgg_view('input/pulldown', array(
- 'internalname' => 'params[num_items]',
- 'options_values' => array( '3' => '3',
- '5' => '5',
- '8' => '8',
- '10' => '10',
- '12' => '12',
- '15' => '15',
- '20' => '20',
- ),
- 'value' => $num_items
- ));
-?>
-</p>
+// set default value
+if (!isset($vars['entity']->num_items)) {
+ $vars['entity']->num_items = 10;
+}
-<p>
-<?php
-// used a hidden input field so that something is always sent unlike a checkbox
-echo elgg_view('input/hidden', array('internalname' => 'params[excerpt]',
- 'js' => 'id="params[excerpt]"',
- 'value' => $excerpt ));
-echo "<input class='input-checkboxes' type='checkbox' value='' name='excerptcheckbox' onclick=\"document.getElementById('params[excerpt]').value = 1 - document.getElementById('params[excerpt]').value;\" ";
-if ($excerpt) {
- echo "checked='yes'";
+if (!isset($vars['entity']->excerpt)) {
+ $vars['entity']->excerpt = false;
}
-echo " />";
-echo ' ' . elgg_echo('simplepie:excerpt');
-?>
-</p>
-<p>
-<?php
-echo elgg_view('input/hidden', array('internalname' => 'params[post_date]',
- 'js' => 'id="params[post_date]"',
- 'value' => $post_date ));
-echo "<input class='input-checkboxes' type='checkbox' value='' name='post_datecheckbox' onclick=\"document.getElementById('params[post_date]').value = 1 - document.getElementById('params[post_date]').value;\" ";
-if ($post_date) {
- echo "checked='yes'";
+if (!isset($vars['entity']->post_date)) {
+ $vars['entity']->post_date = false;
}
-echo " />";
-echo ' ' . elgg_echo('simplepie:post_date');
-?>
-</p>
+
+$url_label = elgg_echo("simplepie:feed_url");
+$url_textbox = elgg_view('input/text', array(
+ 'name' => 'params[feed_url]',
+ 'value' => $vars['entity']->feed_url,
+ 'onclick' => 'this.select();',
+));
+
+$num_items_label = elgg_echo('simplepie:num_items');
+$num_items_select = elgg_view('input/dropdown', array(
+ 'name' => 'params[num_items]',
+ 'value' => $vars['entity']->num_items,
+ 'options' => array(3, 5, 8, 10, 12, 15, 20),
+));
+
+$excerpt_label = elgg_echo('simplepie:excerpt');
+$excerpt_checkbox = elgg_view('input/checkbox', array(
+ 'name' => 'params[excerpt]',
+ 'value' => true,
+ 'checked' => $vars['entity']->excerpt ? 'checked' : '',
+));
+
+$post_date_label = elgg_echo('simplepie:post_date');
+$post_date_checkbox = elgg_view('input/checkbox', array(
+ 'name' => 'params[post_date]',
+ 'value' => true,
+ 'checked' => $vars['entity']->post_date ? 'checked' : '',
+));
+
+echo <<<HTML
+<div>
+ $url_label
+ $url_textbox
+</div>
+<div>
+ $num_items_label
+ $num_items_select
+</div>
+<div>
+ $excerpt_checkbox $excerpt_label
+</div>
+<div>
+ $post_date_checkbox $post_date_label
+</div>
+HTML;