Ejemplo n.º 1
0
 /**
  * takes an associative array and creates a contact object
  * 
  * The function extract all the params it needs to initialize the create a
  * contact object. the params array could contain additional unused name/value
  * pairs
  * 
  * @param array  $params         (reference) an assoc array of name/value pairs
  * @param array  $ids            (reference) the array that holds all the db ids
  * 
  * @return object    CRM_Core_DAO_Tag object on success, otherwise null
  * @access public
  * @static
  */
 function add(&$params, &$ids)
 {
     if (!CRM_Core_BAO_Tag::dataExists($params)) {
         return null;
     }
     $tag =& new CRM_Core_DAO_Tag();
     $tag->domain_id = CRM_Core_Config::domainID();
     $tag->copyValues($params);
     $tag->id = CRM_Utils_Array::value('tag', $ids);
     $tag->save();
     CRM_Core_Session::setStatus(ts('The tag "%1" has been saved.', array(1 => $tag->name)));
     return $tag;
 }