/** * Implementation of hook_civicrm_postInstall * * Note: This hook only runs in CiviCRM 4.4+. */ function hrrecruitment_civicrm_postInstall() { $caseTypes = CRM_Case_PseudoConstant::caseType('name'); $value = array_search('Application', $caseTypes); //update url of Find Application CRM_Core_BAO_Navigation::processUpdate(array('name' => 'find_application'), array('url' => "civicrm/case/search?force=1&type={$value}&reset=1")); CRM_Core_BAO_Navigation::resetNavigation(); $value = CRM_Core_DAO::VALUE_SEPARATOR . $value . CRM_Core_DAO::VALUE_SEPARATOR; $sql = "UPDATE civicrm_custom_group SET extends_entity_column_value = '{$value}' WHERE extends_entity_column_value = 'Application'"; CRM_Core_DAO::executeQuery($sql); //change the profile Type of Application if ($ufID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', 'application_profile', 'id', 'name')) { $fieldsType = CRM_Core_BAO_UFGroup::calculateGroupType($ufID, TRUE); CRM_Core_BAO_UFGroup::updateGroupTypes($ufID, $fieldsType); } }
/** * Update the is_active flag in the db. * * @param int $id * Id of the database record. * @param bool $is_active * Value we want to set the is_active field. * * @return Object * DAO object on success, null otherwise */ public static function setIsActive($id, $is_active) { $params = array('id' => $id); self::retrieve($params, $contactinfo); $params = array('name' => "New {$contactinfo['name']}"); $newParams = array('is_active' => $is_active); CRM_Core_BAO_Navigation::processUpdate($params, $newParams); CRM_Core_BAO_Navigation::resetNavigation(); return CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_ContactType', $id, 'is_active', $is_active); }
function _hrstaffdir_setActiveFields($oParams, $nParams) { $profileId = hrstaffdir_getUFGroupID(); $path = array('url' => "civicrm/profile?reset=1&gid={$profileId}&force=1"); $navigationPath = CRM_Core_BAO_Navigation::retrieve($path, $defaultpath); if ($navigationPath) { $params = array('label' => 'Directory', 'url' => "civicrm/profile?reset=1&gid={$profileId}&force=1", 'is_active' => $oParams); $newParams = array('is_active' => $nParams); $navigation = CRM_Core_BAO_Navigation::processUpdate($params, $newParams); CRM_Core_BAO_Navigation::resetNavigation(); } //disable/enable ufgroup and uffield $sql = "UPDATE civicrm_uf_field JOIN civicrm_uf_group ON civicrm_uf_group.id = civicrm_uf_field.uf_group_id SET civicrm_uf_field.is_active = {$nParams} WHERE civicrm_uf_group.name = 'hrstaffdir_listing'"; CRM_Core_DAO::executeQuery($sql); CRM_Core_DAO::executeQuery("UPDATE civicrm_uf_group SET is_active = {$nParams} WHERE name = 'hrstaffdir_listing'"); }
function hrprofile_updateNavigation($orginalUrl, $updatedUrl) { $navigationParams = array('label' => 'Directory', 'url' => "{$orginalUrl}", 'is_active' => 1); $navigationParamsNew = array('label' => 'Directory', 'url' => "{$updatedUrl}", 'is_active' => 1); $navigation = CRM_Core_BAO_Navigation::processUpdate($navigationParams, $navigationParamsNew); return true; }