Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-07-30-23-34-40
[civicrm-core.git] / CRM / Campaign / Form / Survey.php
index 238a989a54e9486ce34f0917303ba9cd6ecd23af..fbb5de21d3cc57db809ba4f25c4bbd97939bc255 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Campaign_Form_Survey extends CRM_Core_Form {
 
   /**
-   * The id of the object being edited
+   * The id of the object being edited.
    *
    * @var int
    */
   protected $_surveyId;
 
   /**
-   * Action
+   * Action.
    *
    * @var int
    */
   protected $_action;
 
   /**
-   * SurveyTitle
+   * SurveyTitle.
    *
    * @var string
    */
@@ -65,7 +65,7 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
       CRM_Utils_System::permissionDenied();
     }
 
-    $this->_action   = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
+    $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
     $this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
 
     if ($this->_surveyId) {
@@ -90,9 +90,7 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
   }
 
   /**
-   * Build the form object
-   *
-   * @param null
+   * Build the form object.
    *
    * @return void
    */
@@ -122,17 +120,16 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
       $buttons = array(
         array(
           'type' => 'upload',
-          'name' => ts('Continue >>'),
+          'name' => ts('Continue'),
           'spacing' => '                 ',
           'isDefault' => TRUE,
         ),
       );
     }
-    $buttons[] =
-      array(
-            'type' => 'cancel',
-            'name' => ts('Cancel'),
-            );
+    $buttons[] = array(
+      'type' => 'cancel',
+      'name' => ts('Cancel'),
+    );
     $this->addButtons($buttons);
 
     $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
@@ -146,26 +143,26 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
       if ($tabTitle == 'Main') {
         $tabTitle = 'Main settings';
       }
-      $subPage   = strtolower($className);
+      $subPage = strtolower($className);
       CRM_Core_Session::setStatus(ts("'%1' have been saved.", array(1 => $tabTitle)), ts('Saved'), 'success');
 
       $this->postProcessHook();
 
-      if ($this->_action & CRM_Core_Action::ADD)
+      if ($this->_action & CRM_Core_Action::ADD) {
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/survey/configure/questions",
-                                                         "action=update&reset=1&id={$this->_surveyId}"));
-
+          "action=update&reset=1&id={$this->_surveyId}"));
+      }
       if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'));
       }
-      else if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_next") {
+      elseif ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_next") {
         $subPage = CRM_Campaign_Form_Survey_TabHeader::getNextTab($this);
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/survey/configure/{$subPage}",
-                                                         "action=update&reset=1&id={$this->_surveyId}"));
+          "action=update&reset=1&id={$this->_surveyId}"));
       }
       else {
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/survey/configure/{$subPage}",
-                                                         "action=update&reset=1&id={$this->_surveyId}"));
+          "action=update&reset=1&id={$this->_surveyId}"));
       }
     }
   }
@@ -174,7 +171,7 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
    * @return string
    */
   public function getTemplateFileName() {
-    if ($this->controller->getPrint() || $this->getVar('_surveyId') <= 0 ) {
+    if ($this->controller->getPrint() || $this->getVar('_surveyId') <= 0) {
       return parent::getTemplateFileName();
     }
     else {
@@ -183,4 +180,5 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
       return 'CRM/Campaign/Form/Survey/Tab.tpl';
     }
   }
+
 }