/**
  * By default promotion scopes can use this method to return a list of checkboxes for
  * selecting what scope items are applied to the promotion.  Scopes can override this
  * however they want tho.
  *
  * @since 1.0.0
  * @throws EE_Error
  *
  * @param  EE_Base_Class[]    		$items_to_select
  * @param  array    $selected_items  	Should be an array of existing applied to items IDs (
  *                                    		EE_Base_Class ids)
  * @param int        $PRO_ID                 EE_Promotion object id. Optional. Default 0.
  * @return string                     		unordered list of checkboxes.
  */
 protected function _get_applies_to_items_to_select($items_to_select, $selected_items, $PRO_ID = 0)
 {
     $selected_items = (array) $selected_items;
     $disabled = '';
     //verification
     if (empty($items_to_select) || !is_array($items_to_select) || !$items_to_select[key($items_to_select)] instanceof EE_Base_Class) {
         return sprintf(__('There are no active %s to assign to this scope.  You will need to create some first.', 'event_espresso'), $this->label->plural);
     }
     $checkboxes = '<ul class="promotion-applies-to-items-ul">';
     foreach ($items_to_select as $id => $obj) {
         $checked = in_array($id, $selected_items) ? ' checked=checked' : '';
         //disabled check
         if (!empty($PRO_ID)) {
             $promo_obj = EEM_Promotion_Object::instance()->get_one(array(array('PRO_ID' => $PRO_ID, 'OBJ_ID' => $id)));
             $disabled = $promo_obj instanceof EE_Promotion_Object && $promo_obj->used() > 0 ? ' disabled="disabled"' : '';
         }
         $checkboxes .= '<li><input type="checkbox" id="PRO_applied_to_selected[' . $id . ']" name="PRO_applied_to_selected[' . $id . ']" value="' . $id . '" ' . $checked . $disabled . '>';
         $checkboxes .= '<label class="pro-applied-to-selector-checkbox-label" for="PRO_applied_to_selected[' . $id . ']">' . $this->name($obj) . '</label>';
     }
     $checkboxes .= '</ul>';
     return $checkboxes;
 }
 /**
  * This returns how many times this promotion has been redeemed (via promotion object table)
  *
  * @since  1.0.0
  *
  * @param int 	$objID	 If a specific object ID is included then we only return the count
  * for that specific object ID.  Otherwise we sum all the values for the matching PRO_ID in
  * the Promotion Objects table.
  * @return int
  */
 public function redeemed($objID = 0)
 {
     $query_params[0] = array('PRO_ID' => $this->ID());
     if (!empty($objID)) {
         $query_params[0]['OBJ_ID'] = $objID;
     }
     return EEM_Promotion_Object::instance()->sum($query_params, 'POB_used');
 }