Exemplo n.º 1
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Booking_DAO_AdhocChargesItem object on success, null otherwise
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $item = new CRM_Booking_DAO_AdhocChargesItem();
     $item->copyValues($params);
     if ($item->find(TRUE)) {
         CRM_Core_DAO::storeValues($item, $defaults);
         return $item;
     }
     return NULL;
 }
Exemplo n.º 2
0
 /**
  * Browse all resources.
  *
  * @return void
  * @access public
  * @static
  */
 function browse($action = NULL)
 {
     // get all custom groups sorted by weight
     $adhoc_charges_item = array();
     $dao = new CRM_Booking_DAO_AdhocChargesItem();
     $dao->orderBy('weight');
     $dao->is_deleted = FALSE;
     $dao->find();
     while ($dao->fetch()) {
         $adhoc_charges_item[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $adhoc_charges_item[$dao->id]);
         // form all action links
         $action = array_sum(array_keys($this->links()));
         // update enable/disable links.
         if ($dao->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $adhoc_charges_item[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
     }
     $this->assign('rows', $adhoc_charges_item);
 }