<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright (C) 2011 Marty Wright |
| Licensed to CiviCRM under the Academic Free License version 3.0. |
class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
/**
- * static holder for the PDF Page Formats Option Group ID
+ * Static holder for the PDF Page Formats Option Group ID
*/
private static $_gid = NULL;
),
'stationery' => array(
'name' => 'stationery',
- 'type' =>CRM_Utils_Type::T_STRING,
+ 'type' => CRM_Utils_Type::T_STRING,
'default' => '',
),
'orientation' => array(
* @param void
*
* @return array array of page orientations
- * @access public
*/
public static function getPageOrientations() {
return array(
* @param void
*
* @return array array of measurement units
- * @access public
*/
public static function getUnits() {
return array(
* @param void
*
* @return int Group ID (null if Group ID doesn't exist)
- * @access private
*/
private static function _getGid() {
if (!self::$_gid) {
/**
* Add ordering fields to Page Format list
*
- * @param array (reference) $list List of PDF Page Formats
- * @param string $returnURL URL of page calling this function
+ * @param array (reference) $list List of PDF Page Formats
+ * @param string $returnURL
+ * URL of page calling this function.
*
* @return void
* @static
- * @access public
*/
- static function addOrder(&$list, $returnURL) {
+ public static function addOrder(&$list, $returnURL) {
$filter = "option_group_id = " . self::_getGid();
CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
}
/**
* Get list of PDF Page Formats.
*
- * @param bool $namesOnly return simple list of names
+ * @param bool $namesOnly
+ * Return simple list of names.
*
* @return array (reference) PDF Page Format list
* @static
- * @access public
*/
- static function &getList($namesOnly = FALSE) {
+ public static function &getList($namesOnly = FALSE) {
static $list = array();
if (self::_getGid()) {
// get saved PDF Page Formats from Option Value table
*
* @return array Name/value pairs containing the default PDF Page Format values.
* @static
- * @access public
*/
- static function &getDefaultValues() {
+ public static function &getDefaultValues() {
$params = array('is_active' => 1, 'is_default' => 1);
$defaults = array();
if (!self::retrieve($params, $defaults)) {
/**
* Get PDF Page Format from the DB
*
- * @param string $field Field name to search by
- * @param int $val Field value to search for
+ * @param string $field
+ * Field name to search by.
+ * @param int $val
+ * Field value to search for.
*
* @return array $values (reference) associative array of name/value pairs
- * @access public
*/
- static function &getPdfFormat($field, $val) {
+ public static function &getPdfFormat($field, $val) {
$params = array('is_active' => 1, $field => $val);
$pdfFormat = array();
if (self::retrieve($params, $pdfFormat)) {
/**
* Get PDF Page Format by Name
*
- * @param int $name PDF Page Format name. Empty = get default PDF Page Format
+ * @param int $name
+ * PDF Page Format name. Empty = get default PDF Page Format.
*
* @return array $values (reference) associative array of name/value pairs
- * @access public
*/
- static function &getByName($name) {
+ public static function &getByName($name) {
return self::getPdfFormat('name', $name);
}
/**
* Get PDF Page Format by ID
*
- * @param int $id PDF Page Format id. 0 = get default PDF Page Format
+ * @param int $id
+ * PDF Page Format id. 0 = get default PDF Page Format.
*
* @return array $values (reference) associative array of name/value pairs
- * @access public
*/
- static function &getById($id) {
+ public static function &getById($id) {
return self::getPdfFormat('id', $id);
}
/**
* Get PDF Page Format field from associative array
*
- * @param string $field name of a PDF Page Format field
+ * @param string $field
+ * Name of a PDF Page Format field.
* @param array (reference) $values associative array of name/value pairs containing
* PDF Page Format field selections
*
* @param null $default
*
* @return value
- * @access public
* @static
*/
- static function getValue($field, &$values, $default = NULL) {
+ public static function getValue($field, &$values, $default = NULL) {
if (array_key_exists($field, self::$optionValueFields)) {
switch (self::$optionValueFields[$field]['type']) {
case CRM_Utils_Type::T_INT:
* retrieves the relevant objects. Typically the valid params are only
* format id. It also stores all the retrieved values in the default array.
*
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $values (reference ) an assoc array to hold the flattened values
+ * @param array $params
+ * (reference ) an assoc array of name/value pairs.
+ * @param array $values
+ * (reference ) an assoc array to hold the flattened values.
*
- * @return object CRM_Core_DAO_OptionValue object
- * @access public
+ * @return CRM_Core_DAO_OptionValue object
* @static
*/
- static function retrieve(&$params, &$values) {
+ public static function retrieve(&$params, &$values) {
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->copyValues($params);
$optionValue->option_group_id = self::_getGid();
/**
* Save the PDF Page Format in the DB
*
- * @param array (reference) $values associative array of name/value pairs
- * @param int $id id of the database record (null = new record)
+ * @param array (reference) $values associative array of name/value pairs
+ * @param int $id
+ * Id of the database record (null = new record).
*
* @return void
- * @access public
*/
- function savePdfFormat(&$values, $id = NULL) {
+ public function savePdfFormat(&$values, $id = NULL) {
// get the Option Group ID for PDF Page Formats (create one if it doesn't exist)
$group_id = self::_getGid();
}
/**
- * Function to delete a PDF Page Format
+ * Delete a PDF Page Format
*
- * @param int $id ID of the PDF Page Format to be deleted.
+ * @param int $id
+ * ID of the PDF Page Format to be deleted.
*
- * @access public
* @static
*/
- static function del($id) {
+ public static function del($id) {
if ($id) {
$dao = new CRM_Core_DAO_OptionValue();
$dao->id = $id;
CRM_Core_Error::fatal(ts('Invalid value passed to delete function.'));
}
}
-