/** * parseOffersSelect */ protected function parseOffersSelect($selected_id) { require_once 'models/ecommerce/ecommerce_offer_group.php'; $Group = new ecommerce_offer_group(); $groups = $Group->listing("schedule_start > NOW()", "id DESC"); $this->parseOffersSelectGroup($groups, 'Future', $selected_id); $groups = $Group->listing("schedule_start <= NOW() AND (schedule_end IS NULL OR schedule_end >= NOW())", "id DESC"); $this->parseOffersSelectGroup($groups, 'Current', $selected_id); $groups = $Group->listing("(schedule_start < NOW() OR schedule_start IS NULL) AND schedule_end IS NOT NULL AND schedule_end < NOW()", "id DESC"); $this->parseOffersSelectGroup($groups, 'Past', $selected_id); }
/** * post action */ function post() { parent::post(); //dropdowns $Offer_Group = new ecommerce_offer_group(); $Taxonomy = new common_taxonomy(); $conf = ecommerce_offer::initConfiguration(); $groups_in_progress = $Offer_Group->listing("schedule_start <= NOW() AND (schedule_end IS NULL OR schedule_end >= NOW())", "id DESC"); $groups_scheduled = $Offer_Group->listing("schedule_start > NOW()", "id DESC"); $groups_past = $Offer_Group->listing("(schedule_start < NOW() OR schedule_start IS NULL) AND schedule_end IS NOT NULL AND schedule_end < NOW()", "id DESC"); $campaign_categories = $Taxonomy->getChildren($conf['campaign_category_parent_id']); $roundel_categories = $Taxonomy->getChildren($conf['roundel_category_parent_id']); $this->parseOffersSelectGroup($groups_in_progress, 'In Progress', $this->node_data['component']['offer_group_id']); $this->parseOffersSelectGroup($groups_scheduled, 'Scheduled', $this->node_data['component']['offer_group_id']); $this->parseOffersSelectGroup($groups_past, 'Past', $this->node_data['component']['offer_group_id']); $this->parseCategorySelect($campaign_categories, $this->node_data['component']['campaign_category_id'], 'campaign_category_item'); $this->parseCategorySelect($roundel_categories, $this->node_data['component']['roundel_category_id'], 'roundel_category_item'); $this->parseTemplatesSelect($this->node_data['component']['template']); }