<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
class CRM_Member_BAO_MembershipBlock extends CRM_Member_DAO_MembershipBlock {
- // placeholder required because there's some magic code which assumes that BAOs exist
-}
\ No newline at end of file
+ /**
+ * class constructor
+ */
+ function __construct() {
+ parent::__construct();
+ }
+ /**
+ * function to add the membership Blocks
+ *
+ * @param array $params reference array contains the values submitted by the form
+ *
+ * @access public
+ * @static
+ *
+ * @return object
+ */
+ static function create(&$params) {
+ $hook = empty($params['id']) ? 'create' : 'edit';
+ CRM_Utils_Hook::pre($hook, 'MembershipBlock', CRM_Utils_Array::value('id', $params), $params);
+ $dao = new CRM_Member_DAO_MembershipBlock();
+ $dao->copyValues($params);
+ $dao->id = CRM_Utils_Array::value('id', $params);
+ $dao->save();
+ CRM_Utils_Hook::post($hook, 'MembershipBlock', $dao->id, $dao);
+ return $dao;
+ }
+
+ /**
+ * Function to delete membership Blocks
+ *
+ * @param int $id
+ *
+ * @return bool
+ * @static
+ */
+ static function del($id) {
+ $dao = new CRM_Member_DAO_MembershipBlock();
+ $dao->id = $id;
+ $result = FALSE;
+ if ($dao->find(TRUE)) {
+ $dao->delete();
+ $result = TRUE;
+ }
+ return $result;
+ }
+
+}