Пример #1
0
 /**
  * Get the action links for this page.
  *
  * @return array
  */
 public static function &actionLinks()
 {
     if (!isset(self::$_actionLinks)) {
         self::$_actionLinks = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/uf/group/field/update', 'qs' => 'reset=1&action=update&id=%%id%%&gid=%%gid%%', 'title' => ts('Edit CiviCRM Profile Field')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/uf/group/field', 'qs' => 'action=preview&id=%%id%%&field=1', 'title' => ts('Preview CiviCRM Profile Field')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable CiviCRM Profile Field')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable CiviCRM Profile Field')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/uf/group/field', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Enable CiviCRM Profile Field')));
     }
     return self::$_actionLinks;
 }
Пример #2
0
 /**
  * Get the action links for this page.
  *
  * @return array $_actionLinks
  *
  */
 function &actionLinks()
 {
     if (!isset(self::$_actionLinks)) {
         self::$_actionLinks = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/uf/group/field/update', 'qs' => 'reset=1&action=update&id=%%id%%&gid=%%gid%%', 'title' => ts('Edit CiviCRM Profile Field')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/uf/group/field', 'qs' => 'action=preview&id=%%id%%&field=1', 'title' => ts('Preview CiviCRM Profile Field')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_UFField' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable CiviCRM Profile Field')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_UFField' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable CiviCRM Profile Field')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/uf/group/field', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Enable CiviCRM Profile Field')));
     }
     return self::$_actionLinks;
 }
Пример #3
0
 /**
  * Browse all CiviCRM Profile group fields.
  *
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     $ufField = array();
     $ufFieldBAO =& new CRM_Core_BAO_UFField();
     // fkey is gid
     $ufFieldBAO->uf_group_id = $this->_gid;
     $ufFieldBAO->orderBy('weight', 'field_name');
     $ufFieldBAO->find();
     $locationType = array();
     $locationType =& CRM_Core_PseudoConstant::locationType();
     require_once 'CRM/Contact/BAO/Contact.php';
     $fields =& CRM_Contact_BAO_Contact::exportableFields('All', false, true);
     $fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields);
     $select = array();
     foreach ($fields as $name => $field) {
         if ($name) {
             $select[$name] = $field['title'];
         }
     }
     $select['group'] = ts('Group(s)');
     $select['tag'] = ts('Tag(s)');
     while ($ufFieldBAO->fetch()) {
         $ufField[$ufFieldBAO->id] = array();
         $phoneType = $locType = '';
         CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
         CRM_Core_DAO_UFField::addDisplayEnums($ufField[$ufFieldBAO->id]);
         // fix the field_name value
         $ufField[$ufFieldBAO->id]['field_name'] = $select[$ufField[$ufFieldBAO->id]['field_name']];
         if ($ufFieldBAO->location_type_id) {
             $locType = ' (' . $locationType[$ufFieldBAO->location_type_id] . ') ';
         }
         if ($ufFieldBAO->phone_type) {
             if ($ufFieldBAO->phone_type != 'Phone') {
                 // this hack is to prevent Phone Phone
                 $phoneType .= '-' . $ufFieldBAO->phone_type;
             }
         }
         $ufField[$ufFieldBAO->id]['field_name'] .= $phoneType . $locType;
         $action = array_sum(array_keys($this->actionLinks()));
         if ($ufFieldBAO->is_active) {
             $action -= CRM_CORE_ACTION_ENABLE;
         } else {
             $action -= CRM_CORE_ACTION_DISABLE;
         }
         $ufField[$ufFieldBAO->id]['action'] = CRM_Core_Action::formLink(CRM_UF_Page_Field::actionLinks(), $action, array('id' => $ufFieldBAO->id, 'gid' => $this->_gid));
     }
     $this->assign('ufField', $ufField);
 }