<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
$ctype = NULL,
$permissionType = CRM_Core_Permission::CREATE,
$orderBy = 'field_name',
- $orderProfiles = NULL
+ $orderProfiles = NULL,
+ $eventProfile = FALSE
) {
if (!is_array($id)) {
$id = CRM_Utils_Type::escape($id, 'Positive');
$query .= " AND g.is_active = 1";
}
+ $checkPermission = array(
+ array(
+ 'administer CiviCRM',
+ 'manage event profiles',
+ ),
+ );
+ if ($eventProfile && CRM_Core_Permission::check($checkPermission)) {
+ $skipPermission = TRUE;
+ }
+
// add permissioning for profiles only if not registration
if (!$skipPermission) {
$permissionClause = CRM_Core_Permission::ufGroupClause($permissionType, 'g.');
$selectAttributes = array('class' => 'crm-select2', 'placeholder' => TRUE);
if ($fieldName == 'image_URL' && $mode == CRM_Profile_Form::MODE_EDIT) {
- $deleteExtra = ts('Are you sure you want to delete contact image.');
+ $deleteExtra = json_encode(ts('Are you sure you want to delete contact image.'));
$deleteURL = array(
CRM_Core_Action::DELETE => array(
'name' => ts('Delete Contact Image'),
'url' => 'civicrm/contact/image',
'qs' => 'reset=1&id=%%id%%&gid=%%gid%%&action=delete',
- 'extra' =>
- 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
+ 'extra' => 'onclick = "' . htmlspecialchars("if (confirm($deleteExtra)) this.href+='&confirmed=1'; else return false;") . '"',
),
);
$deleteURL = CRM_Core_Action::formLink($deleteURL,
$subtypeList = $subtypes;
}
- $sel = $form->add('select', $name, $title, $subtypeList, $required);
- $sel->setMultiple(TRUE);
+ $form->add('select', $name, $title, $subtypeList, $required, array('class' => 'crm-select2', 'multiple' => TRUE));
}
elseif (in_array($fieldName, CRM_Contact_BAO_Contact::$_greetingTypes)) {
//add email greeting, postal greeting, addressee, CRM-4575
);
}
elseif (substr($fieldName, 0, 4) === 'url-') {
- $form->add('text', $name, $title,
- array_merge(CRM_Core_DAO::getAttribute('CRM_Core_DAO_Website', 'url'),
- array(
- 'onfocus' => "if (!this.value) { this.value='http://';} else return false",
- 'onblur' => "if ( this.value == 'http://') { this.value='';} else return false",
- )
- ), $required
- );
-
- $form->addRule($name, ts('Enter a valid Website.'), 'url');
+ $form->add('text', $name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Website', 'url'), $required);
+ $form->addRule($name, ts('Enter a valid web address beginning with \'http://\' or \'https://\'.'), 'url');
}
// Note should be rendered as textarea
elseif (substr($fieldName, -4) == 'note') {