• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_ShowHideBlocks类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CRM_Core_ShowHideBlocks的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_ShowHideBlocks类的具体用法?PHP CRM_Core_ShowHideBlocks怎么用?PHP CRM_Core_ShowHideBlocks使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CRM_Core_ShowHideBlocks类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * @return string
  */
 function run()
 {
     $errorMessage = '';
     // ensure that all CiviCRM tables are InnoDB, else abort
     // this is not a very fast operation, so we do it randomly 10% of the times
     // but we do it for most / all tables
     // http://bugs.mysql.com/bug.php?id=43664
     if (rand(1, 10) == 3 && CRM_Core_DAO::isDBMyISAM(150)) {
         $errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.');
         CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert");
     }
     if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
         CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert", array('expires' => 0));
     }
     $groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviContribute', $config->enableComponents)) {
         $groups['CiviContribute'] = ts('CiviContribute');
     }
     if (in_array('CiviMember', $config->enableComponents)) {
         $groups['CiviMember'] = ts('CiviMember');
     }
     if (in_array('CiviEvent', $config->enableComponents)) {
         $groups['CiviEvent'] = ts('CiviEvent');
     }
     if (in_array('CiviMail', $config->enableComponents)) {
         $groups['CiviMail'] = ts('CiviMail');
     }
     if (in_array('CiviCase', $config->enableComponents)) {
         $groups['CiviCase'] = ts('CiviCase');
     }
     if (in_array('CiviReport', $config->enableComponents)) {
         $groups['CiviReport'] = ts('CiviReport');
     }
     if (in_array('CiviCampaign', $config->enableComponents)) {
         $groups['CiviCampaign'] = ts('CiviCampaign');
     }
     $values = CRM_Core_Menu::getAdminLinks();
     $this->_showHide = new CRM_Core_ShowHideBlocks();
     foreach ($groups as $group => $title) {
         $groupId = str_replace(' ', '_', $group);
         $this->_showHide->addShow("id_{$groupId}_show");
         $this->_showHide->addHide("id_{$groupId}");
         $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
         if (isset($values[$group])) {
             $adminPanel[$groupId] = $values[$group];
             $adminPanel[$groupId]['show'] = $v['show'];
             $adminPanel[$groupId]['hide'] = $v['hide'];
             $adminPanel[$groupId]['title'] = $title;
         } else {
             $adminPanel[$groupId] = array();
             $adminPanel[$groupId]['show'] = '';
             $adminPanel[$groupId]['hide'] = '';
             $adminPanel[$groupId]['title'] = $title;
         }
     }
     $this->assign('adminPanel', $adminPanel);
     $this->_showHide->addToTemplate();
     return parent::run();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:63,代码来源:Admin.php


示例2: setShowHide

 /**
  * Fix what blocks to show/hide based on the default values set
  *
  * @param array   $defaults the array of default values
  * @param boolean $force    should we set show hide based on input defaults
  *
  * @return void
  */
 function setShowHide(&$defaults)
 {
     require_once 'CRM/Core/ShowHideBlocks.php';
     $this->_showHide = new CRM_Core_ShowHideBlocks(array('registration' => 1), '');
     if (empty($defaults)) {
         $this->_showHide->addShow('registration_screen_show');
         $this->_showHide->addShow('confirm_show');
         $this->_showHide->addShow('mail_show');
         $this->_showHide->addShow('thankyou_show');
         $this->_showHide->addHide('registration');
         $this->_showHide->addHide('registration_screen');
         $this->_showHide->addHide('confirm');
         $this->_showHide->addHide('mail');
         $this->_showHide->addHide('thankyou');
         $this->_showHide->addHide('additional_profile_pre');
         $this->_showHide->addHide('additional_profile_post');
         $this->_showHide->addHide('id-approval-text');
     } else {
         $this->_showHide->addShow('confirm');
         $this->_showHide->addShow('mail');
         $this->_showHide->addShow('thankyou');
         $this->_showHide->addHide('registration_screen_show');
         $this->_showHide->addHide('confirm_show');
         $this->_showHide->addHide('mail_show');
         $this->_showHide->addHide('thankyou_show');
         if (!$defaults['is_multiple_registrations']) {
             $this->_showHide->addHide('additional_profile_pre');
             $this->_showHide->addHide('additional_profile_post');
         }
         if (!CRM_Utils_Array::value('requires_approval', $defaults)) {
             $this->_showHide->addHide('id-approval-text');
         }
     }
     $this->_showHide->addToTemplate();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:43,代码来源:Registration.php


示例3: buildIMBlock

 /**
  * build the form elements for an IM object
  *
  * @param CRM_Core_Form $form       reference to the form object
  * @param array         $location   the location object to store all the form elements in
  * @param int           $locationId the locationId we are dealing with
  * @param int           $count      the number of blocks to create
  *
  * @return void
  * @access public
  * @static
  */
 function buildIMBlock(&$form, &$location, $locationId, $count)
 {
     for ($i = 1; $i <= $count; $i++) {
         $label = $i == 1 ? ts('Instant Messenger (preferred)') : ts('Instant Messenger');
         CRM_Core_ShowHideBlocks::linksForArray($form, $i, $count, "location[{$locationId}][im]", ts('another IM'), ts('hide this IM'));
         $location[$locationId]['im'][$i]['service_id'] = $form->addElement('select', "location[{$locationId}][im][{$i}][provider_id]", $label, array('' => ts('- select service -')) + CRM_Core_PseudoConstant::IMProvider());
         $location[$locationId]['im'][$i]['name'] = $form->addElement('text', "location[{$locationId}][im][{$i}][name]", null, CRM_Core_DAO::getAttribute('CRM_Core_DAO_IM', 'name'));
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:21,代码来源:IM.php


示例4: buildEmailBlock

 /**
  * build the form elements for an email object
  *
  * @param CRM_Core_Form $form       reference to the form object
  * @param array         $location   the location object to store all the form elements in
  * @param int           $locationId the locationId we are dealing with
  * @param int           $count      the number of blocks to create
  *
  * @return void
  * @access public
  * @static
  */
 function buildEmailBlock(&$form, &$location, $locationId, $count)
 {
     for ($i = 1; $i <= $count; $i++) {
         $label = $i == 1 ? ts('Email (preferred)') : ts('Email');
         CRM_Core_ShowHideBlocks::linksForArray($form, $i, $count, "location[{$locationId}][email]", ts('another email'), ts('hide this email'));
         $location[$locationId]['email'][$i]['email'] = $form->addElement('text', "location[{$locationId}][email][{$i}][email]", $label, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'));
         $form->addRule("location[{$locationId}][email][{$i}][email]", ts('Email is not valid.'), 'email');
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:21,代码来源:Email.php


示例5: run

 function run()
 {
     // ensure that all CiviCRM tables are InnoDB, else abort
     if (CRM_Core_DAO::isDBMyISAM()) {
         $errorMessage = 'Your database is configured to use the MyISAM database engine. CiviCRM  requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues. This will be a fatal error in CiviCRM v2.1.';
         require_once 'CRM/Core/Session.php';
         CRM_Core_Session::setStatus($errorMessage);
     }
     if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
         CRM_Core_Session::setStatus($errorMessage);
     }
     $groups = array('Customize' => ts('Customize'), 'Configure' => ts('Configure'), 'Manage' => ts('Manage'), 'Option Lists' => ts('Option Lists'));
     $config = CRM_Core_Config::singleton();
     if (in_array("CiviContribute", $config->enableComponents)) {
         $groups['CiviContribute'] = ts('CiviContribute');
     }
     if (in_array("CiviMember", $config->enableComponents)) {
         $groups['CiviMember'] = ts('CiviMember');
     }
     if (in_array("CiviEvent", $config->enableComponents)) {
         $groups['CiviEvent'] = ts('CiviEvent');
     }
     if (in_array("CiviMail", $config->enableComponents)) {
         $groups['CiviMail'] = ts('CiviMail');
     }
     if (in_array("CiviCase", $config->enableComponents)) {
         $groups['CiviCase'] = ts('CiviCase');
     }
     if (in_array("CiviReport", $config->enableComponents)) {
         $groups['CiviReport'] = ts('CiviReport');
     }
     if (in_array("CiviCampaign", $config->enableComponents)) {
         $groups['CiviCampaign'] = ts('CiviCampaign');
     }
     require_once 'CRM/Core/Menu.php';
     $values =& CRM_Core_Menu::getAdminLinks();
     require_once 'CRM/Core/ShowHideBlocks.php';
     $this->_showHide = new CRM_Core_ShowHideBlocks();
     foreach ($groups as $group => $title) {
         $this->_showHide->addShow("id_{$group}_show");
         $this->_showHide->addHide("id_{$group}");
         $v = CRM_Core_ShowHideBlocks::links($this, $group, '', '', false);
         $adminPanel[$group] = $values[$group];
         $adminPanel[$group]['show'] = $v['show'];
         $adminPanel[$group]['hide'] = $v['hide'];
         $adminPanel[$group]['title'] = $title;
     }
     require_once 'CRM/Utils/VersionCheck.php';
     $versionCheck =& CRM_Utils_VersionCheck::singleton();
     $this->assign('newVersion', $versionCheck->newerVersion());
     $this->assign('localVersion', $versionCheck->localVersion);
     $this->assign('adminPanel', $adminPanel);
     $this->_showHide->addToTemplate();
     return parent::run();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:55,代码来源:Admin.php


示例6: buildPhoneBlock

 /**
  * build the form elements for a phone object
  *
  * @param CRM_Core_Form $form       reference to the form object
  * @param array         $location   the location object to store all the form elements in
  * @param int           $locationId the locationId we are dealing with
  * @param int           $count      the number of blocks to create
  *
  * @return void
  * @access public
  * @static
  */
 function buildPhoneBlock(&$form, &$location, $locationId, $count)
 {
     for ($i = 1; $i <= $count; $i++) {
         $label = $i == 1 ? ts('Phone (preferred)') : ts('Phone');
         CRM_Core_ShowHideBlocks::linksForArray($form, $i, $count, "location[{$locationId}][phone]", ts('another phone'), ts('hide this phone'));
         $location[$locationId]['phone'][$i]['phone_type'] = $form->addElement('select', "location[{$locationId}][phone][{$i}][phone_type]", null, CRM_Core_SelectValues::phoneType());
         $location[$locationId]['phone'][$i]['phone'] = $form->addElement('text', "location[{$locationId}][phone][{$i}][phone]", $label, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
         // TODO: set this up as a group, we need a valid phone_type_id if we have a  phone number
         //             $form->addRule( "location[$locationId][phone][$i][phone]", ts('Phone number is not valid.'), 'phone' );
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:23,代码来源:Phone.php


示例7: setDefaultValues

 /**
  * Set default values for the form.
  */
 public function setDefaultValues()
 {
     $defaults = array();
     // check if there is a widget already created
     if ($this->_widget) {
         CRM_Core_DAO::storeValues($this->_widget, $defaults);
     } else {
         foreach ($this->_fields as $name => $val) {
             $defaults[$name] = $val[3];
         }
         foreach ($this->_colorFields as $name => $val) {
             $defaults[$name] = $val[3];
         }
         $defaults['about'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'intro_text');
     }
     $showHide = new CRM_Core_ShowHideBlocks();
     $showHide->addHide('id-colors');
     $showHide->addToTemplate();
     return $defaults;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:23,代码来源:Widget.php


示例8: setShowHide

 /**
  * Fix what blocks to show/hide based on the default values set
  *
  * @param array $defaults
  *   The array of default values.
  *
  * @return void
  */
 public function setShowHide($defaults)
 {
     $this->_showHide = new CRM_Core_ShowHideBlocks(array('registration' => 1), '');
     if (empty($defaults)) {
         $this->_showHide->addHide('registration');
         $this->_showHide->addHide('id-approval-text');
     } else {
         if (empty($defaults['requires_approval'])) {
             $this->_showHide->addHide('id-approval-text');
         }
     }
     $this->assign('defaultsEmpty', empty($defaults));
     $this->_showHide->addToTemplate();
 }
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:22,代码来源:Registration.php


示例9: run

 /**
  * Run page.
  *
  * @return string
  */
 public function run()
 {
     Civi::resources()->addStyleFile('civicrm', 'css/admin.css');
     $this->assign('registerSite', htmlspecialchars('https://civicrm.org/register-your-site?src=iam&sid=' . CRM_Utils_System::getSiteID()));
     $groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviContribute', $config->enableComponents)) {
         $groups['CiviContribute'] = ts('CiviContribute');
     }
     if (in_array('CiviMember', $config->enableComponents)) {
         $groups['CiviMember'] = ts('CiviMember');
     }
     if (in_array('CiviEvent', $config->enableComponents)) {
         $groups['CiviEvent'] = ts('CiviEvent');
     }
     if (in_array('CiviMail', $config->enableComponents)) {
         $groups['CiviMail'] = ts('CiviMail');
     }
     if (in_array('CiviCase', $config->enableComponents)) {
         $groups['CiviCase'] = ts('CiviCase');
     }
     if (in_array('CiviReport', $config->enableComponents)) {
         $groups['CiviReport'] = ts('CiviReport');
     }
     if (in_array('CiviCampaign', $config->enableComponents)) {
         $groups['CiviCampaign'] = ts('CiviCampaign');
     }
     $values = CRM_Core_Menu::getAdminLinks();
     $this->_showHide = new CRM_Core_ShowHideBlocks();
     foreach ($groups as $group => $title) {
         $groupId = str_replace(' ', '_', $group);
         $this->_showHide->addShow("id_{$groupId}_show");
         $this->_showHide->addHide("id_{$groupId}");
         $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
         if (isset($values[$group])) {
             $adminPanel[$groupId] = $values[$group];
             $adminPanel[$groupId]['show'] = $v['show'];
             $adminPanel[$groupId]['hide'] = $v['hide'];
             $adminPanel[$groupId]['title'] = $title;
         } else {
             $adminPanel[$groupId] = array();
             $adminPanel[$groupId]['show'] = '';
             $adminPanel[$groupId]['hide'] = '';
             $adminPanel[$groupId]['title'] = $title;
         }
     }
     $this->assign('adminPanel', $adminPanel);
     $this->_showHide->addToTemplate();
     return parent::run();
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:55,代码来源:Admin.php


示例10: run

 /**
  * @return string
  */
 public function run()
 {
     $groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviContribute', $config->enableComponents)) {
         $groups['CiviContribute'] = ts('CiviContribute');
     }
     if (in_array('CiviMember', $config->enableComponents)) {
         $groups['CiviMember'] = ts('CiviMember');
     }
     if (in_array('CiviEvent', $config->enableComponents)) {
         $groups['CiviEvent'] = ts('CiviEvent');
     }
     if (in_array('CiviMail', $config->enableComponents)) {
         $groups['CiviMail'] = ts('CiviMail');
     }
     if (in_array('CiviCase', $config->enableComponents)) {
         $groups['CiviCase'] = ts('CiviCase');
     }
     if (in_array('CiviReport', $config->enableComponents)) {
         $groups['CiviReport'] = ts('CiviReport');
     }
     if (in_array('CiviCampaign', $config->enableComponents)) {
         $groups['CiviCampaign'] = ts('CiviCampaign');
     }
     $values = CRM_Core_Menu::getAdminLinks();
     $this->_showHide = new CRM_Core_ShowHideBlocks();
     foreach ($groups as $group => $title) {
         $groupId = str_replace(' ', '_', $group);
         $this->_showHide->addShow("id_{$groupId}_show");
         $this->_showHide->addHide("id_{$groupId}");
         $v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
         if (isset($values[$group])) {
             $adminPanel[$groupId] = $values[$group];
             $adminPanel[$groupId]['show'] = $v['show'];
             $adminPanel[$groupId]['hide'] = $v['hide'];
             $adminPanel[$groupId]['title'] = $title;
         } else {
             $adminPanel[$groupId] = array();
             $adminPanel[$groupId]['show'] = '';
             $adminPanel[$groupId]['hide'] = '';
             $adminPanel[$groupId]['title'] = $title;
         }
     }
     $this->assign('adminPanel', $adminPanel);
     $this->_showHide->addToTemplate();
     return parent::run();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:51,代码来源:Admin.php


示例11: custom

 /**
  * Generate the custom Data Fields based
  * on the is_searchable
  *
  *
  * @param $form
  *
  * @return void
  */
 public static function custom(&$form)
 {
     $form->add('hidden', 'hidden_custom', 1);
     $extends = array('Relationship');
     $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
     $form->assign('groupTree', $groupDetails);
     foreach ($groupDetails as $key => $group) {
         $_groupTitle[$key] = $group['name'];
         CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
         $groupId = $group['id'];
         foreach ($group['fields'] as $field) {
             $fieldId = $field['id'];
             $elementName = 'custom_' . $fieldId;
             CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
         }
     }
 }
开发者ID:Chirojeugd-Vlaanderen,项目名称:civicrm-relationship-entity,代码行数:26,代码来源:Criteria.php


示例12: setShowHide

 /**
  * Fix what blocks to show/hide based on the default values set
  *
  * @param    array    array of Group Titles
  * @param    array    array of Group Collapse Display 
  *
  * @return   
  *
  * @access   protected
  */
 function setShowHide(&$groupTitle, &$groupCollapseDisplay)
 {
     if (empty($groupTitle)) {
         return;
     }
     $this->_showHide =& new CRM_Core_ShowHideBlocks('', '');
     foreach ($groupTitle as $key => $title) {
         $showBlocks = $title . '[show]';
         $hideBlocks = $title;
         if ($groupCollapseDisplay[$key]) {
             $this->_showHide->addShow($showBlocks);
             $this->_showHide->addHide($hideBlocks);
         } else {
             $this->_showHide->addShow($hideBlocks);
             $this->_showHide->addHide($showBlocks);
         }
     }
     $this->_showHide->addToTemplate();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:29,代码来源:CustomData.php


示例13: setShowHide

 /**
  * Fix what blocks to show/hide based on the default values set
  *
  * @param array   $defaults the array of default values
  * @param boolean $force    should we set show hide based on input defaults
  *
  * @return void
  */
 function setShowHide($defaults)
 {
     $this->_showHide = new CRM_Core_ShowHideBlocks(array('registration' => 1), '');
     if (empty($defaults)) {
         $this->_showHide->addHide('registration');
         $this->_showHide->addHide('additional_profile_pre');
         $this->_showHide->addHide('additional_profile_post');
         $this->_showHide->addHide('id-approval-text');
     } else {
         if (!CRM_Utils_Array::value('is_multiple_registrations', $defaults)) {
             $this->_showHide->addHide('additional_profile_pre');
             $this->_showHide->addHide('additional_profile_post');
         }
         if (!CRM_Utils_Array::value('requires_approval', $defaults)) {
             $this->_showHide->addHide('id-approval-text');
         }
     }
     $this->assign('defaultsEmpty', empty($defaults));
     $this->_showHide->addToTemplate();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:28,代码来源:Registration.php


示例14: buildQuickForm

 /**
  * This function provides the HTML form elements that are specific to the Individual Contact Type
  * 
  * @access public
  * @return None 
  */
 function buildQuickForm(&$form)
 {
     $form->applyFilter('__ALL__', 'trim');
     // prefix
     $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix());
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Individual');
     // first_name
     $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
     //middle_name
     $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
     // last_name
     $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
     // suffix
     $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => ts('- suffix -')) + CRM_Core_PseudoConstant::individualSuffix());
     // nick_name
     $form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name'));
     // greeting type
     $form->addElement('select', 'greeting_type', ts('Greeting'), CRM_Core_SelectValues::greeting());
     // job title
     $form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title']);
     // radio button for gender
     $genderOptions = array();
     $gender = CRM_Core_PseudoConstant::gender();
     foreach ($gender as $key => $var) {
         $genderOptions[$key] = HTML_QuickForm::createElement('radio', null, ts('Gender'), $var, $key);
     }
     $form->addGroup($genderOptions, 'gender_id', ts('Gender'));
     $form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased'));
     $form->addElement('date', 'birth_date', ts('Date of birth'), CRM_Core_SelectValues::date('birth'));
     $form->addRule('birth_date', ts('Select a valid date.'), 'qfDate');
     $form->addElement('text', 'home_URL', ts('Website'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL'));
     $form->addRule('home_URL', ts('Enter a valid Website.'), 'url');
     $config =& CRM_Core_Config::singleton();
     CRM_Core_ShowHideBlocks::links($this, 'demographics', '', '');
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:41,代码来源:Individual.php


示例15: custom

 /**
  * Generate the custom Data Fields based
  * on the is_searchable
  *
  *
  * @param $form
  *
  * @return void
  */
 public static function custom(&$form)
 {
     $form->add('hidden', 'hidden_custom', 1);
     $extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
     $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
     $form->assign('groupTree', $groupDetails);
     foreach ($groupDetails as $key => $group) {
         $_groupTitle[$key] = $group['name'];
         CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
         $groupId = $group['id'];
         foreach ($group['fields'] as $field) {
             $fieldId = $field['id'];
             $elementName = 'custom_' . $fieldId;
             if ($field['data_type'] == 'Date' && $field['is_search_range']) {
                 CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
             } else {
                 CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
             }
         }
     }
     //TODO: validate for only one state if prox_distance isset
 }
开发者ID:kidaa30,项目名称:yes,代码行数:31,代码来源:Criteria.php


示例16: buildQuickForm

 /**
  * Generic function to build all the form elements for a specific group tree.
  *
  * @param CRM_Core_Form $form
  *   The form object.
  * @param array $groupTree
  *   The group tree object.
  * @param bool $inactiveNeeded
  *   Return inactive custom groups.
  * @param string $prefix
  *   Prefix for custom grouptree assigned to template.
  */
 public static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '')
 {
     $form->assign_by_ref("{$prefix}groupTree", $groupTree);
     foreach ($groupTree as $id => $group) {
         CRM_Core_ShowHideBlocks::links($form, $group['title'], '', '');
         foreach ($group['fields'] as $field) {
             $required = CRM_Utils_Array::value('is_required', $field);
             //fix for CRM-1620
             if ($field['data_type'] == 'File') {
                 if (!empty($field['element_value']['data'])) {
                     $required = 0;
                 }
             }
             $fieldId = $field['id'];
             $elementName = $field['element_name'];
             CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $required);
         }
     }
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:31,代码来源:CustomGroup.php


示例17: formRule

 /**
  * global validation rules for the form
  *
  * @param array  $fields   (referance) posted values of the form
  *
  * @return array    if errors then list of errors to be posted back to the form,
  *                  true otherwise
  * @static
  * @access public
  */
 static function formRule($fields, $files, $form)
 {
     // all option fields are of type "money"
     $errors = array();
     /** Check the option values entered
      *  Appropriate values are required for the selected datatype
      *  Incomplete row checking is also required.
      */
     if (($form->_action & CRM_Core_Action::ADD || $form->_action & CRM_Core_Action::UPDATE) && $fields['html_type'] == 'Text' && $fields['price'] == NULL) {
         $errors['price'] = ts('Price is a required field');
     }
     //avoid the same price field label in Within PriceSet
     $priceFieldLabel = new CRM_Price_DAO_Field();
     $priceFieldLabel->label = $fields['label'];
     $priceFieldLabel->price_set_id = $form->_sid;
     $dupeLabel = false;
     if ($priceFieldLabel->find(true) && $form->_fid != $priceFieldLabel->id) {
         $dupeLabel = true;
     }
     if ($dupeLabel) {
         $errors['label'] = ts('Name already exists in Database.');
     }
     if (is_numeric(CRM_Utils_Array::value('count', $fields)) && CRM_Utils_Array::value('count', $fields) == 0 && CRM_Utils_Array::value('html_type', $fields) == 'Text') {
         $errors['count'] = ts('Participant Count must be greater than zero.');
     }
     if ($form->_action & CRM_Core_Action::ADD) {
         if ($fields['html_type'] != 'Text') {
             $countemptyrows = 0;
             $_flagOption = $_rowError = 0;
             $_showHide = new CRM_Core_ShowHideBlocks('', '');
             for ($index = 1; $index <= self::NUM_OPTION; $index++) {
                 $noLabel = $noAmount = $noWeight = 1;
                 if (!empty($fields['option_label'][$index])) {
                     $noLabel = 0;
                     $duplicateIndex = CRM_Utils_Array::key($fields['option_label'][$index], $fields['option_label']);
                     if (!($duplicateIndex === false) && !($duplicateIndex == $index)) {
                         $errors["option_label[{$index}]"] = ts('Duplicate label value');
                         $_flagOption = 1;
                     }
                 }
                 // allow for 0 value.
                 if (!empty($fields['option_amount'][$index]) || strlen($fields['option_amount'][$index]) > 0) {
                     $noAmount = 0;
                 }
                 if (!empty($fields['option_weight'][$index])) {
                     $noWeight = 0;
                     $duplicateIndex = CRM_Utils_Array::key($fields['option_weight'][$index], $fields['option_weight']);
                     if (!($duplicateIndex === false) && !($duplicateIndex == $index)) {
                         $errors["option_weight[{$index}]"] = ts('Duplicate weight value');
                         $_flagOption = 1;
                     }
                 }
                 if ($noLabel && !$noAmount) {
                     $errors["option_label[{$index}]"] = ts('Label cannot be empty.');
                     $_flagOption = 1;
                 }
                 if (!$noLabel && $noAmount) {
                     $errors["option_amount[{$index}]"] = ts('Amount cannot be empty.');
                     $_flagOption = 1;
                 }
                 if ($noLabel && $noAmount) {
                     $countemptyrows++;
                     $_emptyRow = 1;
                 } else {
                     if (!empty($fields['option_max_value'][$index]) && !empty($fields['option_count'][$index]) && $fields['option_count'][$index] > $fields['option_max_value'][$index]) {
                         $errors["option_max_value[{$index}]"] = ts('Participant count can not be greater than max participants.');
                         $_flagOption = 1;
                     }
                 }
                 $showBlocks = 'optionField_' . $index;
                 if ($_flagOption) {
                     $_showHide->addShow($showBlocks);
                     $_rowError = 1;
                 }
                 if (!empty($_emptyRow)) {
                     $_showHide->addHide($showBlocks);
                 } else {
                     $_showHide->addShow($showBlocks);
                 }
                 if ($index == self::NUM_OPTION) {
                     $hideBlock = 'additionalOption';
                     $_showHide->addHide($hideBlock);
                 }
                 $_flagOption = $_emptyRow = 0;
             }
             $_showHide->addToTemplate();
             if ($countemptyrows == 11) {
                 $errors["option_label[1]"] = $errors["option_amount[1]"] = ts('Label and value cannot be empty.');
                 $_flagOption = 1;
             }
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Field.php


示例18: buildQuickForm

 /**
  * generic function to build all the form elements for a specific group tree
  *
  * @param CRM_Core_Form $form      the form object
  * @param array         $groupTree the group tree object
  * @param string        $showName  
  * @param string        $hideName
  *
  * @return void
  * @access public
  * @static
  */
 function buildQuickForm(&$form, &$groupTree, $showName = 'showBlocks', $hideName = 'hideBlocks')
 {
     //this is fix for calendar for date field
     foreach ($groupTree as $key1 => $group) {
         foreach ($group['fields'] as $key2 => $field) {
             if ($field['data_type'] == 'Date' && $field['date_parts']) {
                 $datePart = explode(CRM_CORE_BAO_CUSTOMOPTION_VALUE_SEPERATOR, $field['date_parts']);
                 if (count($datePart) < 3) {
                     $groupTree[$key1]['fields'][$key2]['skip_calendar'] = true;
                 }
             }
         }
     }
     $form->assign_by_ref('groupTree', $groupTree);
     $sBlocks = array();
     $hBlocks = array();
     // this is fix for date field
     $form->assign('currentYear', date('Y'));
     require_once 'CRM/Core/ShowHideBlocks.php';
     foreach ($groupTree as $group) {
         CRM_Core_ShowHideBlocks::links($form, $group['title'], '', '');
         $groupId = $group['id'];
         foreach ($group['fields'] as $field) {
             $fieldId = $field['id'];
             $elementName = 'custom_' . $fieldId;
             CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $inactiveNeeded, $group['is_required']);
         }
         if ($group['collapse_display']) {
             $sBlocks[] = "'" . $group['title'] . "[show]'";
             $hBlocks[] = "'" . $group['title'] . "'";
         } else {
             $hBlocks[] = "'" . $group['title'] . "[show]'";
             $sBlocks[] = "'" . $group['title'] . "'";
         }
     }
     $showBlocks = implode(",", $sBlocks);
     $hideBlocks = implode(",", $hBlocks);
     $form->assign($showName, $showBlocks);
     $form->assign($hideName, $hideBlocks);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:52,代码来源:CustomGroup.php


示例19: formRule

 /**
  * Global validation rules for the form.
  *
  * @param array $fields
  *   Posted values of the form.
  *
  * @param $files
  * @param CRM_Core_Form $form
  *
  * @return array
  *   if errors then list of errors to be posted back to the form,
  *                  true otherwise
  */
 public static function formRule($fields, $files, $form)
 {
     // all option fields are of type "money"
     $errors = array();
     /** Check the option values entered
      *  Appropriate values are required for the selected datatype
      *  Incomplete row checking is also required.
      */
     if (($form->_action & CRM_Core_Action::ADD || $form->_action & CRM_Core_Action::UPDATE) && $fields['html_type'] == 'Text' && $fields['price'] == NULL) {
         $errors['price'] = ts('Price is a required field');
     }
     if (($form->_action & CRM_Core_Action::ADD || $form->_action & CRM_Core_Action::UPDATE) && $fields['html_type'] == 'Text' && $fields['financial_type_id'] == '') {
         $errors['financial_type_id'] = ts('Financial Type is a required field');
     }
     //avoid the same price field label in Within PriceSet
     $priceFieldLabel = new CRM_Price_DAO_PriceField();
     $priceFieldLabel->label = $fields['label'];
     $priceFieldLabel->price_set_id = $form->_sid;
     $dupeLabel = FALSE;
     if ($priceFieldLabel->find(TRUE) && $form->_fid != $priceFieldLabel->id) {
         $dupeLabel = TRUE;
     }
     if ($dupeLabel) {
         $errors['label'] = ts('Name already exists in Database.');
     }
     if (is_numeric(CRM_Utils_Array::value('count', $fields)) && CRM_Utils_Array::value('count', $fields) == 0 && CRM_Utils_Array::value('html_type', $fields) == 'Text') {
         $errors['count'] = ts('Participant Count must be greater than zero.');
     }
     if ($form->_action & CRM_Core_Action::ADD) {
         if ($fields['html_type'] != 'Text') {
             $countemptyrows = 0;
             $_flagOption = $_rowError = 0;
             $_showHide = new CRM_Core_ShowHideBlocks('', '');
             for ($index = 1; $index <= self::NUM_OPTION; $index++) {
                 $noLabel = $noAmount = $noWeight = 1;
                 if (!empty($fields['option_label'][$index])) {
                     $noLabel = 0;
                     $duplicateIndex = CRM_Utils_Array::key($fields['option_label'][$index], $fields['option_label']);
                     if (!($duplicateIndex === FALSE) && !($duplicateIndex == $index)) {
                         $errors["option_label[{$index}]"] = ts('Duplicate label value');
                         $_flagOption = 1;
                     }
                 }
                 if ($form->_useForMember) {
                     if (!empty($fields['membership_type_id'][$index])) {
                         $memTypesIDS[] = $fields['membership_type_id'][$index];
                     }
                 }
                 // allow for 0 value.
                 if (!empty($fields['option_amount'][$index]) || strlen($fields['option_amount'][$index]) > 0) {
                     $noAmount = 0;
                 }
                 if (!empty($fields['option_weight'][$index])) {
                     $noWeight = 0;
                     $duplicateIndex = CRM_Utils_Array::key($fields['option_weight'][$index], $fields['option_weight']);
                     if (!($duplicateIndex === FALSE) && !($duplicateIndex == $index)) {
                         $errors["option_weight[{$index}]"] = ts('Duplicate weight value');
                         $_flagOption = 1;
                     }
                 }
                 if (!$noLabel && !$noAmount && !empty($fields['option_financial_type_id']) && $fields['option_financial_type_id'][$index] == '' && $fields['html_type'] != 'Text') {
                     $errors["option_financial_type_id[{$index}]"] = ts('Financial Type is a Required field.');
                 }
                 if ($noLabel && !$noAmount) {
                     $errors["option_label[{$index}]"] = ts('Label cannot be empty.');
                     $_flagOption = 1;
                 }
                 if (!$noLabel && $noAmount) {
                     $errors["option_amount[{$index}]"] = ts('Amount cannot be empty.');
                     $_flagOption = 1;
                 }
                 if ($noLabel && $noAmount) {
                     $countemptyrows++;
                     $_emptyRow = 1;
                 } elseif (!empty($fields['option_max_value'][$index]) && !empty($fields['option_count'][$index]) && $fields['option_count'][$index] > $fields['option_max_value'][$index]) {
                     $errors["option_max_value[{$index}]"] = ts('Participant count can not be greater than max participants.');
                     $_flagOption = 1;
                 }
                 $showBlocks = 'optionField_' . $index;
                 if 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_Smarty类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_Session类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap