class CRM_Utils_Weight

Class CRM_Utils_Weight

Properties

static array, $SIGNABLE_FIELDS

Methods

static bool
correctDuplicateWeights(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Correct duplicate weight entries by putting them (duplicate weights) in sequence.

static bool
delWeight(string $daoName, int $fieldID, array $fieldValues = NULL, string $weightField = 'weight')

Remove a row from the specified weight, and shift all rows below it up

static int
updateOtherWeights(string $daoName, int $oldWeight, int $newWeight, array $fieldValues = NULL, string $weightField = 'weight')

Updates the weight fields of other rows according to the new and old weight passed in.

static int
getNewWeight(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Returns the new calculated weight.

static int
getMax(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Returns the highest weight.

static int
getDefaultWeight(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Returns the default weight ( highest weight + 1 ) to be used.

static CRM_Core_DAO
query(string $queryType, string $daoName, array $fieldValues = NULL, string $queryData, null $additionalWhere = NULL, string $orderBy = NULL, null $groupBy = NULL)

Execute a weight-related query

static 
addOrder($rows, string $daoName, string $idName, $returnURL, null $filter = NULL)

No description

static 
fixOrder()

No description

static 
fixOrderOutput($url)

No description

Details

at line 54
static bool correctDuplicateWeights(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Correct duplicate weight entries by putting them (duplicate weights) in sequence.

Parameters

string $daoName Full name of the DAO.
array $fieldValues Field => value to be used in the WHERE.
string $weightField Field which contains the weight value. defaults to 'weight'

Return Value

bool

at line 101
static bool delWeight(string $daoName, int $fieldID, array $fieldValues = NULL, string $weightField = 'weight')

Remove a row from the specified weight, and shift all rows below it up

Parameters

string $daoName Full name of the DAO. $param integer $weight the weight to be removed
int $fieldID
array $fieldValues Field => value to be used in the WHERE.
string $weightField Field which contains the weight value. defaults to 'weight'

Return Value

bool

at line 138
static int updateOtherWeights(string $daoName, int $oldWeight, int $newWeight, array $fieldValues = NULL, string $weightField = 'weight')

Updates the weight fields of other rows according to the new and old weight passed in.

And returns the new weight be used. If old-weight not present, Creates a gap for a new row to be inserted at the specified new weight

Parameters

string $daoName Full name of the DAO.
int $oldWeight
int $newWeight
array $fieldValues Field => value to be used in the WHERE.
string $weightField Field which contains the weight value,. defaults to 'weight'

Return Value

int

at line 204
static int getNewWeight(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Returns the new calculated weight.

Parameters

string $daoName Full name of the DAO.
array $fieldValues Field => value to be used in the WHERE.
string $weightField Field which used to get the wt, default to 'weight'.

Return Value

int

at line 246
static int getMax(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Returns the highest weight.

Parameters

string $daoName Full name of the DAO.
array $fieldValues Field => value to be used in the WHERE.
string $weightField Field which contains the weight value. defaults to 'weight'

Return Value

int

at line 269
static int getDefaultWeight(string $daoName, array $fieldValues = NULL, string $weightField = 'weight')

Returns the default weight ( highest weight + 1 ) to be used.

Parameters

string $daoName Full name of the DAO.
array $fieldValues Field => value to be used in the WHERE.
string $weightField Field which contains the weight value. defaults to 'weight'

Return Value

int

at line 294
static CRM_Core_DAO query(string $queryType, string $daoName, array $fieldValues = NULL, string $queryData, null $additionalWhere = NULL, string $orderBy = NULL, null $groupBy = NULL)

Execute a weight-related query

Parameters

string $queryType SELECT, UPDATE, DELETE.
string $daoName Full name of the DAO.
array $fieldValues Field => value to be used in the WHERE.
string $queryData Data to be used, dependent on the query type.
null $additionalWhere
string $orderBy Optional ORDER BY field.
null $groupBy

Return Value

CRM_Core_DAO objet that holds the results of the query

at line 371
static addOrder($rows, string $daoName, string $idName, $returnURL, null $filter = NULL)

Parameters

$rows
string $daoName
string $idName
$returnURL
null $filter

at line 436
static fixOrder()

at line 508
static fixOrderOutput($url)

Parameters

$url