Merge pull request #4621 from atif-shaikh/CRM-15589
[civicrm-core.git] / CRM / Contribute / Form / ManagePremiums.php
index b2c4cdcb398a0447a03d3bc25d1563f779af2b81..3d9159993366cc061d3b206732a96382a64fa5f2 100644 (file)
@@ -40,7 +40,7 @@
 class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
 
   /**
-   * Function to pre  process the form
+   * pre  process the form
    *
    * @access public
    *
@@ -51,7 +51,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
   }
 
   /**
-   * This function sets the default values for the form. Manage Premiums that in edit/view mode
+   * Set default values for the form. Manage Premiums that in edit/view mode
    * the default values are retrieved from the database
    *
    * @access public
@@ -87,42 +87,21 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
   }
 
   /**
-   * Function to build the form
+   * Build the form object
    *
    * @return void
    * @access public
    */
   public function buildQuickForm() {
-    //parent::buildQuickForm( );
+    parent::buildQuickForm( );
+    $this->setPageTitle(ts('Premium Product'));
 
     if ($this->_action & CRM_Core_Action::PREVIEW) {
       CRM_Contribute_BAO_Premium::buildPremiumPreviewBlock($this, $this->_id);
-
-      $this->addButtons(array(
-          array(
-            'type' => 'next',
-            'name' => ts('Done with Preview'),
-            'isDefault' => TRUE,
-          ),
-        )
-      );
-
       return;
     }
 
     if ($this->_action & CRM_Core_Action::DELETE) {
-      $this->addButtons(array(
-          array(
-            'type' => 'next',
-            'name' => ts('Delete'),
-            'isDefault' => TRUE,
-          ),
-          array(
-            'type' => 'cancel',
-            'name' => ts('Cancel'),
-          ),
-        )
-      );
       return;
     }
 
@@ -142,9 +121,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
     $this->addRule('imageOption', ts('Please select an option for the premium image.'), 'required');
 
     $this->addElement('text', 'imageUrl', ts('Image URL'));
-    $this->addRule('imageUrl', 'Please enter the valid URL to display this image.', 'url');
     $this->addElement('text', 'thumbnailUrl', ts('Thumbnail URL'));
-    $this->addRule('thumbnailUrl', 'Please enter the valid URL to display a thumbnail of this image.', 'url');
 
     $this->add('file', 'uploadFile', ts('Image File Name'), 'onChange="select_option();"');
 
@@ -224,7 +201,6 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
         ),
       )
     );
-
     $this->assign('productId', $this->_id);
   }
 
@@ -233,6 +209,8 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
    *
    * @param array $params (ref.) an assoc array of name/value pairs
    *
+   * @param $files
+   *
    * @return mixed true or array of errors
    * @access public
    * @static
@@ -294,7 +272,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
   }
 
   /**
-   * Function to process the form
+   * Process the form submission
    *
    * @access public
    *
@@ -377,6 +355,11 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
    *
    * @access private
    *
+   * @param $filename
+   * @param $resizedName
+   * @param $width
+   * @param $height
+   *
    * @return Path to image
    */
   private function _resizeImage($filename, $resizedName, $width, $height) {
@@ -415,5 +398,6 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
     $config = CRM_Core_Config::singleton();
     return $config->imageUploadURL.basename($newFilename);
   }
+
 }