X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FWci%2FBAO%2FWidget.php;fp=CRM%2FWci%2FBAO%2FWidget.php;h=6598530183e78d9cd16e61490f6a186030a1c8d8;hb=c2de1a211c95774274dded6cf5d8863899bce217;hp=e1b46300731e3c71ee781e1b7ae3342c9672a16f;hpb=85e57793b02b57cf139c9c42a88da0f52f3f1cdc;p=com.zyxware.civiwci.git 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;