show_choose_audience = true; $this->title = $title; $this->content = $content; $this->content_html = $content_html; } function choose_audience() { global $_GET, $db; $products_array = array(); $products = $db->Execute("select pd.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and pd.products_id = p.products_id and p.products_status = '1' order by pd.products_name"); while (!$products->EOF) { $products_array[] = array('id' => $products->fields['products_id'], 'text' => $products->fields['products_name']); $products->MoveNext(); } $choose_audience_string = ''; $global_button = ''; $cancel_button = ''; $choose_audience_string .= '
'; return $choose_audience_string; } function confirm() { global $_GET, $_POST, $db; $audience = array(); if (isset($_GET['global']) && ($_GET['global'] == 'true')) { $products = $db->Execute("select distinct customers_id from " . TABLE_PRODUCTS_NOTIFICATIONS); while (!$products->EOF) { $audience[$products->fields['customers_id']] = '1'; $products->MoveNext(); } $customers = $db->Execute("select customers_info_id from " . TABLE_CUSTOMERS_INFO . " where global_product_notifications = '1'"); while (!$customers->EOF) { $audience[$customers->fields['customers_info_id']] = '1'; $customers->MoveNext(); } } else { $chosen = $_POST['chosen']; $ids = zen_db_input(implode(',', $chosen)); $products = $db->Execute("select distinct customers_id from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id in (" . $ids . ")"); while (!$products->EOF) { $audience[$products->fields['customers_id']] = '1'; $products->MoveNext(); } $customers = $db->Execute("select customers_info_id from " . TABLE_CUSTOMERS_INFO . " where global_product_notifications = '1'"); while (!$customers->EOF) { $audience[$customers->fields['customers_info_id']] = '1'; $customers->MoveNext(); } } $confirm_string = '' . sprintf(TEXT_COUNT_CUSTOMERS, sizeof($audience)) . ' | ' . "\n" . '
' . zen_draw_separator('pixel_trans.gif', '1', '10') . ' | ' . "\n" . '
' . $this->title . ' | ' . "\n" . '
' . zen_draw_separator('pixel_trans.gif', '1', '10') . ' | ' . "\n" .
'
' . nl2br($this->content_html) . ' | ' . "\n" . '
' . zen_draw_separator('pixel_trans.gif', '1', '10') . ' | ' . "\n" .
'
' . nl2br($this->content) . ' | ' . "\n" .
'
' . zen_draw_separator('pixel_trans.gif', '1', '10') . ' | ' . "\n" . '
'; if (sizeof($audience) > 0) { if (isset($_GET['global']) && ($_GET['global'] == 'true')) { $confirm_string .= zen_draw_hidden_field('global', 'true'); } else { for ($i = 0, $n = sizeof($chosen); $i < $n; $i++) { $confirm_string .= zen_draw_hidden_field('chosen[]', $chosen[$i]); } } $confirm_string .= zen_image_submit('button_send.gif', IMAGE_SEND) . ' '; } $confirm_string .= '' . zen_image_button('button_back.gif', IMAGE_BACK) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ' | ' . "\n" . '