event templates
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 29 Jul 2014 14:57:16 +0000 (10:57 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 29 Jul 2014 14:57:16 +0000 (10:57 -0400)
add template for search form

Toolkit/Events/views/eventSearchForm.html [new file with mode: 0644]

diff --git a/Toolkit/Events/views/eventSearchForm.html b/Toolkit/Events/views/eventSearchForm.html
new file mode 100644 (file)
index 0000000..88fa02e
--- /dev/null
@@ -0,0 +1,143 @@
+<style>
+    .eventSearrchForm input[type="search"],
+    #startMonth,
+    #endMonth
+    {
+        margin: 0;
+        padding: 2px;
+        height: 18px;
+        width: 95%;
+        font-size: large;
+    }
+    #eventCategorySearch {
+        height: 20px;
+    }
+    .ui-autocomplete-loading {
+        background: white url('<?php echo $t->glmBaseUrl;?>libjs/jqueryui/1.8.13/development-bundle/demos/autocomplete/images/ui-anim_basic_16x16.gif') right center no-repeat;
+    }
+    .ui-autocomplete {z-index: 10 !important;}
+</style>
+<div id="event-search">
+    <h3>{front.search.title}</h3>
+    {if:options.hasNameSearch}
+    <div id="eventNameSearchWrapper">
+        <form class="eventSearrchForm" name="event-search-form" action="{eventPageUrl:h}">
+            <input type="hidden" name="catid" value="{_REQUEST[catid]}">
+            <input type="hidden" name="search" value="1">
+            <span>{front.search.eventName}</span>
+            <input
+                type="search"
+                id="eventNameSearch"
+                name="eventName"
+                placeholder="Search for events"
+                value="{_REQUEST[eventName]}">
+            <div id="submitNameWrapper">
+                <input
+                    type="image"
+                    src="{commonAppUrl:h}assets/go.png"
+                    alt="Search Events">
+            </div>
+        </form>
+    </div>
+    {end:}
+    <form class="eventSearrchForm" name="event-search-form" action="{eventPageUrl:h}">
+        <input type="hidden" name="catid" value="{_REQUEST[catid]}">
+        <input type="hidden" name="search" value="1">
+        <span>{front.search.from}</span>
+        <div id="startMonthWrapper">
+          <input
+              name="startMonth"
+              id="startMonth"
+              size="10"
+              value="{_REQUEST[startMonth]}">
+        </div>
+        <span>{front.search.to}</span>
+        <div id="endMonthWrapper">
+          <input
+              name="endMonth"
+              id="endMonth"
+              size="10"
+              value="{_REQUEST[endMonth]}">
+        </div>
+        <span>{front.search.type}</span>
+        <select name="category" id="eventCategorySearch">
+          <option value="">-Select-</option>
+        <?php
+        if (!empty($t->categories)) {
+            foreach ($t->categories as $category) {
+                echo '<option value="'
+                    . $category->id . '"'
+                    . (($category->id == $_REQUEST['category'])
+                        ?' selected'
+                        :'')
+                    . '>'.$category->name.'</option>';
+            }
+        }
+        ?>
+        </select>
+        {if:hasRegions}
+            <span>{front.search.region}</span>
+            <select name="region" id="eventRegionSearch">
+              <option value="">-Select-</option>
+            <?php
+            if (!empty($t->regions)) {
+                foreach ($t->regions as $region) {
+                    echo '<option value="'
+                        . $region['id'] . '"'
+                        . (($region['id'] == $_REQUEST['region'])
+                            ?' selected'
+                            :'')
+                        . '>'.$region['name'].'</option>';
+                }
+            }
+            ?>
+            </select>
+        {end:}
+        <div id="submitWrapper">
+          <input
+            type="image"
+            src="{commonAppUrl:h}assets/go.png"
+            alt="Search Events">
+        </div>
+    </form>
+</div>
+{if:options.hasNameSearch}
+<script>
+    $(function() {
+        var cache = {};
+        $("#eventNameSearch").autocomplete({
+            minLength: 2,
+            source: function(request, response) {
+                var term = request.term;
+                if (term in cache) {
+                    response(cache[ term ]);
+                    return;
+                }
+                var startDate = $('#startMonth').val();
+                var endDate = $('#endMonth').val();
+                var category = $('#eventCategorySearch').val();
+                var region = $('#eventRegionSearch').val();
+                var url = '<?php echo BASE_URL?>index.php?catid=<?php echo $t->eventPageId;?>';
+                url += '&ac=eventSearch';
+                if (startDate) {
+                    url += '&startMonth=' + startDate;
+                }
+                if (endDate) {
+                    url += '&endMonth=' + endDate;
+                }
+                if (category) {
+                    url += '&category=' + category;
+                }
+                if (region) {
+                    url += '&region=' + region;
+                }
+
+                $.getJSON(url, request, function(data, status, xhr) {
+                    //cache[ term ] = data;
+                    response(data);
+                });
+            }
+        });
+    });
+</script>
+{end:}