--- /dev/null
+.coupon-row {
+ display: block;
+ width: 100%;
+}
+.coupon-item {
+ display: inline-table;
+ width: 30%;
+ padding: 0;
+ margin: 5px;
+ border: 1px dashed lightgrey;
+}
+.coupon-item-wrap {
+ padding: 20px;
+}
+.coupon-item-wrap h3 {
+ text-align: center;
+}
+.coupon-row h2 {
+ font-size: 1.45rem;
+}
+.coupon-row h3 {
+ font-size: 1.3rem;
+}
+.coupon-expires {
+ margin: 20px 5px 5px 0;
+ float: right;
+ font-size: .8rem;
+}
+.coupon-descr {
+ font-size: .9rem;
+}
+.coupon-url {
+ float: left;
+ font-size: .8rem;
+ margin: 20px 0 5px 5px;
+}
+.coupon-select {
+ background-color: lightgrey;
+ width: 100%;
+ height: 40px;
+ padding: 10px;
+}
+.glm_coupon_search_select, .glm_coupon_search_submit {
+ width: 45%;
+ margin-left: 0 !important;;
+}
+.glm_coupon_print {
+ width: 25%;
+ float: left;
+ margin-left: 20px !important;
+}
+/* small */
+@media screen and (max-width: 40em) {
+ .coupon-item {
+ width: 100%;
+ }
+ .glm_coupon_search_select, .glm_coupon_search_submit {
+ width: 100%;
+ margin-left: 0 !important;;
+ }
+ .glm_coupon_print {
+ width: 100%;
+ float: none;
+ margin-left: 0 !important;;
+ }
+}
+/* medium */
+@media screen and (min-width: 40.63em) and (max-width: 64em) {
+ .coupon-item {
+ width: 45%;
+ }
+ .glm_coupon_print {
+ width: 45%;
+ float: none;
+ margin-left: 0 !important;;
+ }
+}
--- /dev/null
+<?php
+/**
+ * list.php
+ *
+ * This is the Members Coupon Plugin model for the front list shortcode.
+ * Handles the default and searching of the events. Then calls appropriate view
+ * files.
+ */
+
+require_once GLM_MEMBERS_COUPONS_PLUGIN_CLASS_PATH . '/data/dataCoupons.php';
+
+/**
+ * GlmMembersFront_events_list
+ *
+ * @uses GlmDataCoupons
+ * @package GlmMemberCoupons
+ * @version 0.0.1
+ * @copyright Copyright (c) 2010 All rights reserved.
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
+ */
+class GlmMembersFront_coupons_list extends GlmDataCoupons
+{
+
+ public $wpdb;
+ public $config;
+
+ /**
+ * __construct
+ *
+ * @param mixed $wpdb The main Word Press DB Object
+ * @param mixed $config The main Config
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct($wpdb, $config)
+ {
+ $this->wpdb = $wpdb;
+ $this->config = $config;
+
+ parent::__construct(false, false);
+ }
+
+ /**
+ * modelAction
+ *
+ * @param bool $actionData Action Data passed to the modelAction
+ *
+ * @access public
+ * @return void
+ */
+ public function modelAction( $actionData = false )
+ {
+ $action = '';
+ $view = 'list.html';
+ $coupons = $categories = array();
+
+ // Need to only pull in active coupons that have the start_date and
+ // end_date within the current_date
+ $where = "current_date BETWEEN T.start_date AND T.end_date AND T.status = 10";
+
+ $coupons = $this->getList( $where );
+
+ // Arrange the $coupons so they're grouped by the categories.
+ if ( is_array( $coupons ) && !empty( $coupons ) ) {
+ foreach ( $coupons as $coupon ) {
+ if ( is_array( $coupon['categories'] ) && !empty( $coupon['categories'] ) ) {
+ foreach ( $coupon['categories'] as $category ) {
+ $categories[$category['name']][] = $coupon;
+ }
+ }
+ }
+ }
+
+
+ // Compile template data
+ $templateData = array(
+ 'coupons' => $coupons,
+ 'categories' => $categories,
+ 'imgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/',
+ );
+ error_reporting(E_ALL ^ E_NOTICE);
+ return array(
+ 'status' => $status,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/coupons/' . $view,
+ 'data' => $templateData,
+ 'settings' => $settings,
+ );
+ }
+
+}
--- /dev/null
+<div>
+ <h1>List Coupons</h1>
+ <form action="{$formAction}?glm-coupon-pdf=true" method="post">
+ <input type="submit" value="Print All" name="printAll" class="button success glm_coupon_print">
+ <input type="submit" value="Print Selected" name="printSel" class="button success glm_coupon_print">
+ {if $categories}
+ {foreach $categories as $catName => $coupons}
+ <h2>{$catName}</h2>
+ <div class="coupon-row">
+ {if $coupons}
+ {foreach $coupons as $coupon}
+ <div class="{if $coupon.end}end {/if}coupon-item">
+ <div class="coupon-select"><label><input type="checkbox" name="coupon-id-{$coupon.id}"> Select this coupon</label></div>
+ <div class="coupon-item-wrap">
+ {if $coupon.glm_coupons_member}<h3>{$coupon.glm_coupons_member}</h3>{/if}
+ <h3>{$coupon.name}</h3>
+ {if $coupon.image}<img src="{$imgUrl}{$coupon.image}">{/if}
+ <div class="coupon-descr">{$coupon.descr}</div>
+ {if $coupon.url}<div class="coupon-url"><a target="_blank" href="http://{$coupon.url}">Web Site</a></div>{/if}
+ <div class="coupon-expires">Expires: {$coupon.expire.timestamp|date_format:"%m/%d/%Y"}</div>
+ </div>
+ </div>
+ {/foreach}
+ {/if}
+ {/foreach}
+ </div>
+ {/if}
+ </form>
+</div>