]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_forced_campaigns.php
Code style changed, ext-user continued:
[mailer.git] / inc / modules / admin / what-list_forced_campaigns.php
index 4656edd2a174a446dac6b8e4d61ef2a40fe07b3c..50949df58064c9ee8751777f67ea860d956cbaf5 100644 (file)
@@ -6,9 +6,9 @@
  * -------------------------------------------------------------------- *
  * File              : what-list_forced_campaigns.php                   *
  * -------------------------------------------------------------------- *
- * Short description : List/add Forced-Ads                              *
+ * Short description : List/add forced campaigns                        *
  * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Auflisten/Hinzufuegen von Forced-Werbemitteln    *
+ * Kurzbeschreibung  : Auflisten/Hinzufuegen von Forced-Kampagnen       *
  * -------------------------------------------------------------------- *
  * $Revision::                                                        $ *
  * $Date::                                                            $ *
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -44,10 +44,10 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 addYouAreHereLink('admin', __FILE__);
 
 // By default show the list...
-$show = true;
+$show = TRUE;
 
 // Check for 'url_id' element
-if ((countRequestPost() > 0) && ((!isPostRequestElementSet('forced_campaigns_id')) || (!is_array(postRequestElement('forced_campaigns_id'))) || (count(postRequestElement('forced_campaigns_id')) == 0))) {
+if ((!isFormSent('add')) && (countRequestPost() > 0) && (!ifPostContainsSelections('forced_campaign_id'))) {
        // Not found so output message
        displayMessage('{--ADMIN_FORCED_CAMPAIGNS_NO_SELECTIONS--}');
 
@@ -64,7 +64,7 @@ if (isFormSent('add')) {
        showEntriesByXmlCallback('admin_edit_show_forced_campaigns');
 
        // Do not show the list of URLs after this template
-       $show = false;
+       $show = FALSE;
 } elseif (isFormSent('do_edit')) {
        // Change data of entries
        showEntriesByXmlCallback('admin_edit_do_forced_campaigns');
@@ -73,23 +73,46 @@ if (isFormSent('add')) {
        showEntriesByXmlCallback('admin_delete_show_forced_campaigns');
 
        // Do not show the list of URLs after this template
-       $show = false;
+       $show = FALSE;
 } elseif (isFormSent('do_delete')) {
        // Remove entries from database
        showEntriesByXmlCallback('admin_delete_do_forced_campaigns');
+} elseif (isFormSent('lock')) {
+       // Un-/lock selected campaigns. This does not work for pending campaigns
+       showEntriesByXmlCallback('admin_lock_show_forced_campaigns');
+
+       // Do not show the list of URLs after this template
+       $show = FALSE;
+} elseif (isFormSent('do_lock')) {
+       // Un-/lock selected campaigns. This does not work for pending campaigns
+       showEntriesByXmlCallback('admin_lock_do_forced_campaigns');
+} elseif (isFormSent('activate')) {
+       // List activation of selected campaigns. This does not work for locked campaigns
+       if (doForcedAdminActivateCampaigns()) {
+               // Has all worked
+               displayMessage('{--ADMIN_FORCED_CAMPAIGNS_ACTIVATED_DONE--}');
+       } else {
+               // Something went wrong
+               displayMessage('{--ADMIN_FORCED_CAMPAIGNS_ACTIVATED_FAILED--}');
+       }
 }
 
 // Show entries?
-if ($show === false) {
+if ($show === FALSE) {
        // No, a form has already been show
-       return false;
+       return FALSE;
 } // END - if
 
-// List all URLs
+// List all campaigns
 showEntriesByXmlCallback('admin_list_forced_campaigns');
 
+// Init array
+$content = array(
+       'reload' => createTimeSelections(0, 'forced_campaign_reload_lock', 'Dhms')
+);
+
 // Display form for adding a forced-ad
-loadTemplate('admin_add_forced_campaign');
+loadTemplate('admin_add_forced_campaign', FALSE, $content);
 
 // [EOF]
 ?>