<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | 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$
*
*/
return NULL;
}
+ /**
+ * @param null $usedFor
+ * @param bool $excludeHidden
+ *
+ * @return mixed
+ */
function getTree($usedFor = NULL, $excludeHidden = FALSE) {
if (!isset($this->tree)) {
$this->buildTree($usedFor, $excludeHidden);
return $this->tree;
}
+ /**
+ * @param null $usedFor
+ * @param bool $excludeHidden
+ */
function buildTree($usedFor = NULL, $excludeHidden = FALSE) {
$sql = "SELECT civicrm_tag.id, civicrm_tag.parent_id,civicrm_tag.name FROM civicrm_tag ";
}
}
+ /**
+ * @param array $usedFor
+ * @param bool $buildSelect
+ * @param bool $all
+ * @param null $parentId
+ *
+ * @return array
+ */
static function getTagsUsedFor($usedFor = array('civicrm_contact'),
$buildSelect = TRUE,
$all = FALSE,
return $tags;
}
+ /**
+ * @param string $usedFor
+ * @param array $tags
+ * @param null $parentId
+ * @param string $separator
+ *
+ * @return array
+ */
static function getTags($usedFor = 'civicrm_contact',
&$tags = array(),
$parentId = NULL,
if ($tag->delete()) {
CRM_Utils_Hook::post('delete', 'Tag', $id, $tag);
- CRM_Core_Session::setStatus(ts('Selected tag has been deleted successfuly.'), ts('Tag Deleted'), 'success');
return TRUE;
}
return FALSE;
$tag = new CRM_Core_DAO_Tag();
// if parent id is set then inherit used for and is hidden properties
- if (CRM_Utils_Array::value('parent_id', $params)) {
+ if (!empty($params['parent_id'])) {
// get parent details
$params['used_for'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $params['parent_id'], 'used_for');
}
* @static
*/
static function dataExists(&$params) {
- if (!empty($params['name'])) {
+ // Disallow empty values except for the number zero.
+ // TODO: create a utility for this since it's needed in many places
+ if (!empty($params['name']) || (string) $params['name'] === '0') {
return TRUE;
}
/**
* Function to get the tags that are not children of a tagset.
*
- * @return $tags associated array of tag name and id
- * @access public
+ * @return array $tags associated array of tag name and id@access public
* @static
*/
static function getTagsNotInTagset() {