From: Jagadedes Date: Thu, 20 Nov 2014 11:29:35 +0000 (+0530) Subject: 31456. removed unwanted bao code X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c2de1a211c95774274dded6cf5d8863899bce217;p=com.zyxware.civiwci.git 31456. removed unwanted bao code --- diff --git a/CRM/Wci/BAO/EmbedCode.php b/CRM/Wci/BAO/EmbedCode.php index e20c6d9..0eeb73e 100644 --- a/CRM/Wci/BAO/EmbedCode.php +++ b/CRM/Wci/BAO/EmbedCode.php @@ -34,99 +34,6 @@ require_once 'CRM/Wci/DAO/NewEmbedCode.php'; class CRM_Wci_BAO_EmbedCode extends CRM_Wci_DAO_EmbedCode { - - /** - * class constructor - */ - function __construct() { - parent::__construct(); - } - - /** - * Function to create embed code - * takes an associative array - * - * This function is invoked from within the web form layer and also from the api layer - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return object CRM_Wci_BAO_EmbedCode object - * @access public - * @static - */ - static function create(array $params) { - - // check required params - if (!self::dataExists($params)) { - CRM_Core_Error::fatal('Not enough data to create a progress bar formula entry.'); - } - - $embed_code = new CRM_Wci_BAO_EmbedCode(); - $embed_code->copyValues($params); - - $embed_code->save(); - - return $embed_code; - } - - /** - * Get a list of Widgets matching the params, where params keys are column - * names of civicrm_wci_widget. - * - * @param array $params - * @return array of CRM_Wci_BAO_ProgressBarFormula objects - */ - static function retrieve(array $params) { - $result = array(); - - $progress_bar_formula = new CRM_Wci_BAO_ProgressBarFormula(); - $progress_bar_formula->copyValues($params); - $progress_bar_formula->find(); - - while ($progress_bar_formula->fetch()) { - $result[(int) $progress_bar_formula->id] = clone $progress_bar_formula; - } - - $progress_bar_formula->free(); - - return $result; - } - - /** - * Wrapper method for retrieve - * - * @param mixed $id Int or int-like string representing widget ID - * @return CRM_Wci_BAO_ProgressBarFormula - */ - static function retrieveByID($id) { - if (!is_int($id) && !ctype_digit($id)) { - CRM_Core_Error::fatal(__CLASS__ . '::' . __FUNCTION__ . ' expects an integer.'); - } - $id = (int) $id; - - $embed_code = self::retrieve(array('id' => $id)); - - if (!array_key_exists($id, $embed_code)) { - CRM_Core_Error::fatal("No formula entry with ID $id exists."); - } - - return $embed_code[$id]; - } - - /** - * Check if there is absolute minimum of data to add the object - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return boolean - * @access public - */ - public static function dataExists($params) { - if (CRM_Utils_Array::value('contribution_page_id', $params) && CRM_Utils_Array::value('progress_bar_id', $params)) { - return TRUE; - } - return FALSE; - } /** * Returns widget id for the embed code diff --git a/CRM/Wci/BAO/ProgressBar.php b/CRM/Wci/BAO/ProgressBar.php index 3bb0124..358c80f 100644 --- a/CRM/Wci/BAO/ProgressBar.php +++ b/CRM/Wci/BAO/ProgressBar.php @@ -35,99 +35,6 @@ require_once 'CRM/Wci/DAO/ProgressBar.php'; class CRM_Wci_BAO_ProgressBar extends CRM_Wci_DAO_ProgressBar { - /** - * class constructor - */ - function __construct() { - parent::__construct(); - } - - /** - * Function to create a ProgressBar - * takes an associative array and creates a ProgressBar object - * - * This function is invoked from within the web form layer and also from the api layer - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return object CRM_Wci_BAO_ProgressBar object - * @access public - * @static - */ - static function create(array $params) { - - // check required params - if (!self::dataExists($params)) { - CRM_Core_Error::fatal('Not enough data to create a progress bar.'); - } - - $progress_bar = new CRM_Wci_BAO_ProgressBar(); - $progress_bar->copyValues($params); - - $progress_bar->save(); - - return $progress_bar; - } - - /** - * Get a list of Widgets matching the params, where params keys are column - * names of civicrm_wci_widget. - * - * @param array $params - * @return array of CRM_Wci_BAO_ProgressBar objects - */ - static function retrieve(array $params) { - $result = array(); - - $progress_bar = new CRM_Wci_BAO_ProgressBar(); - $progress_bar->copyValues($params); - $progress_bar->find(); - - while ($progress_bar->fetch()) { - $result[(int) $progress_bar->id] = clone $progress_bar; - } - - $progress_bar->free(); - - return $result; - } - - /** - * Wrapper method for retrieve - * - * @param mixed $id Int or int-like string representing widget ID - * @return CRM_Wci_BAO_ProgressBar - */ - static function retrieveByID($id) { - if (!is_int($id) && !ctype_digit($id)) { - CRM_Core_Error::fatal(__CLASS__ . '::' . __FUNCTION__ . ' expects an integer.'); - } - $id = (int) $id; - - $progress_bars = self::retrieve(array('id' => $id)); - - if (!array_key_exists($id, $progress_bars)) { - CRM_Core_Error::fatal("No Progress bar with ID $id exists."); - } - - return $progress_bars[$id]; - } - - /** - * Check if there is absolute minimum of data to add the object - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return boolean - * @access public - */ - public static function dataExists($params) { - if (CRM_Utils_Array::value('name', $params)) { - return TRUE; - } - return FALSE; - } - /** * Returns array of progressbars * Fields : id, name, starting_amount, goal_amount @@ -151,9 +58,7 @@ class CRM_Wci_BAO_ProgressBar extends CRM_Wci_DAO_ProgressBar { /** * Returns percentage value of a progressbar - * * @param integer progressbar id - * * @return decimal percentage value * @access public */ diff --git a/CRM/Wci/BAO/ProgressBarFormula.php b/CRM/Wci/BAO/ProgressBarFormula.php deleted file mode 100644 index d45c69a..0000000 --- a/CRM/Wci/BAO/ProgressBarFormula.php +++ /dev/null @@ -1,129 +0,0 @@ -copyValues($params); - - $progress_bar_formula->save(); - - return $progress_bar_formula; - } - - /** - * Get a list of Widgets matching the params, where params keys are column - * names of civicrm_wci_widget. - * - * @param array $params - * @return array of CRM_Wci_BAO_ProgressBarFormula objects - */ - static function retrieve(array $params) { - $result = array(); - - $progress_bar_formula = new CRM_Wci_BAO_ProgressBarFormula(); - $progress_bar_formula->copyValues($params); - $progress_bar_formula->find(); - - while ($progress_bar_formula->fetch()) { - $result[(int) $progress_bar_formula->id] = clone $progress_bar_formula; - } - - $progress_bar_formula->free(); - - return $result; - } - - /** - * Wrapper method for retrieve - * - * @param mixed $id Int or int-like string representing widget ID - * @return CRM_Wci_BAO_ProgressBarFormula - */ - static function retrieveByID($id) { - if (!is_int($id) && !ctype_digit($id)) { - CRM_Core_Error::fatal(__CLASS__ . '::' . __FUNCTION__ . ' expects an integer.'); - } - $id = (int) $id; - - $progress_bar_formulas = self::retrieve(array('id' => $id)); - - if (!array_key_exists($id, $progress_bar_formulas)) { - CRM_Core_Error::fatal("No formula entry with ID $id exists."); - } - - return $progress_bar_formulas[$id]; - } - - /** - * Check if there is absolute minimum of data to add the object - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return boolean - * @access public - */ - public static function dataExists($params) { - if (CRM_Utils_Array::value('contribution_page_id', $params) && CRM_Utils_Array::value('progress_bar_id', $params)) { - return TRUE; - } - return FALSE; - } -} diff --git a/CRM/Wci/BAO/Widget.php b/CRM/Wci/BAO/Widget.php index e1b4630..6598530 100644 --- a/CRM/Wci/BAO/Widget.php +++ b/CRM/Wci/BAO/Widget.php @@ -34,98 +34,6 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget { - /** - * class constructor - */ - function __construct() { - parent::__construct(); - } - - /** - * Function to create a Widget - * takes an associative array and creates a Widget object - * - * This function is invoked from within the web form layer and also from the api layer - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return object CRM_Wci_BAO_Widget object - * @access public - * @static - */ - static function create(array $params) { - - // check required params - if (!self::dataExists($params)) { - CRM_Core_Error::fatal('Not enough data to create a widget.'); - } - - $widget = new CRM_Wci_BAO_Widget(); - $widget->copyValues($params); - - $widget->save(); - - return $widget; - } - - /** - * Get a list of Widgets matching the params, where params keys are column - * names of civicrm_wci_widget. - * - * @param array $params - * @return array of CRM_Wci_BAO_Widget objects - */ - static function retrieve(array $params) { - $result = array(); - - $widget = new CRM_Wci_BAO_Widget(); - $widget->copyValues($params); - $widget->find(); - - while ($widget->fetch()) { - $result[(int) $widget->id] = clone $widget; - } - - $widget->free(); - - return $result; - } - - /** - * Wrapper method for retrieve - * - * @param mixed $id Int or int-like string representing widget ID - * @return CRM_Wci_BAO_Widget - */ - static function retrieveByID($id) { - if (!is_int($id) && !ctype_digit($id)) { - CRM_Core_Error::fatal(__CLASS__ . '::' . __FUNCTION__ . ' expects an integer.'); - } - $id = (int) $id; - - $widgets = self::retrieve(array('id' => $id)); - - if (!array_key_exists($id, $widgets)) { - CRM_Core_Error::fatal("No widget with ID $id exists."); - } - - return $widgets[$id]; - } - - /** - * Check if there is absolute minimum of data to add the object - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return boolean - * @access public - */ - public static function dataExists($params) { - if (CRM_Utils_Array::value('title', $params)) { - return TRUE; - } - return FALSE; - } public static function getWidgetData($widgetId) { $query = "SELECT * FROM civicrm_wci_widget where id=".$widgetId; diff --git a/CRM/Wci/BAO/WidgetCache.php b/CRM/Wci/BAO/WidgetCache.php index ca7232c..bb4899d 100644 --- a/CRM/Wci/BAO/WidgetCache.php +++ b/CRM/Wci/BAO/WidgetCache.php @@ -34,84 +34,6 @@ class CRM_Wci_BAO_WidgetCache extends CRM_Wci_DAO_WidgetCache { - /** - * class constructor - */ - function __construct() { - parent::__construct(); - } - - /** - * Function to create widget cache - * takes an associative array - * - * This function is invoked from within the web form layer and also from the api layer - * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return object CRM_Wci_BAO_WidgetCache object - * @access public - * @static - */ - static function create(array $params) { - - // check required params - if (!self::dataExists($params)) { - CRM_Core_Error::fatal('Not enough data to create a progress bar formula entry.'); - } - - $widget_cache = new CRM_Wci_BAO_WidgetCache(); - $widget_cache->copyValues($params); - - $widget_cache->save(); - - return $widget_cache; - } - - /** - * Get a list of Widgets matching the params, where params keys are column - * names of civicrm_wci_widget. - * - * @param array $params - * @return array of CRM_Wci_BAO_ProgressBarFormula objects - */ - static function retrieve(array $params) { - $result = array(); - - $widget_cache = new CRM_Wci_BAO_WidgetCache(); - $widget_cache->copyValues($params); - $widget_cache->find(); - - while ($widget_cache->fetch()) { - $result[(int) $widget_cache->id] = clone $widget_cache; - } - - $widget_cache->free(); - - return $result; - } - - /** - * Wrapper method for retrieve - * - * @param mixed $id Int or int-like string representing widget ID - * @return CRM_Wci_BAO_ProgressBarFormula - */ - static function retrieveByID($id) { - if (!is_int($id) && !ctype_digit($id)) { - CRM_Core_Error::fatal(__CLASS__ . '::' . __FUNCTION__ . ' expects an integer.'); - } - $id = (int) $id; - - $widget_cache = self::retrieve(array('id' => $id)); - - if (!array_key_exists($id, $widget_cache)) { - CRM_Core_Error::fatal("No formula entry with ID $id exists."); - } - - return $widget_cache[$id]; - } - public static function setWidgetCache($widgetId, $code) { $cacheTime = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'widget_cache_timeout'));