/** * Build the form object. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); $multipleCustomData = CRM_Core_BAO_CustomGroup::getMultipleFieldGroup(); $this->add('select', 'multipleCustomData', ts('Multi-value Custom Data'), array('' => ts('- select -')) + $multipleCustomData, TRUE); $this->addContactTypeSelector(); }
/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::BROWSE => array('name' => ts('Accounts'), 'url' => 'civicrm/admin/financial/financialType/accounts', 'qs' => 'reset=1&action=browse&aid=%%id%%', 'title' => ts('Accounts')), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/financial/financialType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Financial Type')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Financial_BAO_FinancialType' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Financial Type')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Financial_BAO_FinancialType' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Financial Type')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/financial/financialType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Financial Type'))); } return self::$_links; }
/** * Build the form - it consists of * - displaying the QILL (query in local language) * - displaying elements for saving the search * * @access public * @return void */ function buildQuickForm() { // // just need to add a javacript to popup the window for printing // $this->addButtons(array(array('type' => 'next', 'name' => ts('Print Pledge List'), 'js' => array('onclick' => 'window.print()'), 'isDefault' => true), array('type' => 'back', 'name' => ts('Done')))); }
/** * Update an existing membership status. * * This api is used for updating an existing membership status. * Required parameters: id of a membership status * * @param array $params * Array of name/value property values of civicrm_membership_status. * * @deprecated - should just use create * * @return array * Array of updated membership status property values */ function civicrm_api3_membership_status_update($params) { civicrm_api3_verify_mandatory($params, NULL, array('id')); //don't allow duplicate names. $name = CRM_Utils_Array::value('name', $params); if ($name) { $status = new CRM_Member_DAO_MembershipStatus(); $status->name = $params['name']; if ($status->find(TRUE) && $status->id != $params['id']) { return civicrm_api3_create_error(ts('A membership status with this name already exists.')); } } $membershipStatusBAO = new CRM_Member_BAO_MembershipStatus(); $membershipStatusBAO->id = $params['id']; if ($membershipStatusBAO->find(TRUE)) { $fields = $membershipStatusBAO->fields(); foreach ($fields as $name => $field) { if (array_key_exists($name, $params)) { $membershipStatusBAO->{$name} = $params[$name]; } } $membershipStatusBAO->save(); } $membershipStatus = array(); _civicrm_api3_object_to_array(clone $membershipStatusBAO, $membershipStatus); $membershipStatus['is_error'] = 0; return $membershipStatus; }
function run() { $upgrade = new CRM_Upgrade_Form(); $message = ts('CiviCRM upgrade successful'); if ($upgrade->checkVersion($upgrade->latestVersion)) { $message = ts('Your database has already been upgraded to CiviCRM %1', array(1 => $upgrade->latestVersion)); } elseif ($upgrade->checkVersion('2.1.2') || $upgrade->checkVersion('2.1.3') || $upgrade->checkVersion('2.1.4') || $upgrade->checkVersion('2.1.5')) { // do nothing, db version is changed for all upgrades } elseif ($upgrade->checkVersion('2.1.0') || $upgrade->checkVersion('2.1') || $upgrade->checkVersion('2.1.1')) { // 2.1 to 2.1.2 $this->runTwoOneTwo(); } else { // 2.0 to 2.1 for ($i = 1; $i <= 4; $i++) { $this->runForm($i); } // 2.1 to 2.1.2 $this->runTwoOneTwo(); } // just change the ver in the db, since nothing to upgrade $upgrade->setVersion($upgrade->latestVersion); // also cleanup the templates_c directory $config = CRM_Core_Config::singleton(); $config->cleanup(1); $template = CRM_Core_Smarty::singleton(); $template->assign('message', $message); $template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $upgrade->latestVersion))); $template->assign('menuRebuildURL', CRM_Utils_System::url('civicrm/menu/rebuild', 'reset=1')); $contents = $template->fetch('CRM/common/success.tpl'); echo $contents; }
/** * build the form elements for an email object * * @return void * @access public */ public function buildQuickForm() { CRM_Contact_Form_Edit_CommunicationPreferences::buildQuickForm($this); $this->addFormRule(array('CRM_Contact_Form_Edit_CommunicationPreferences', 'formRule'), $this); $buttons = array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))); $this->addButtons($buttons); }
/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/paymentProcessorType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Payment ProcessorType')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable Payment ProcessorType')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable Payment ProcessorType')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/paymentProcessorType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Payment ProcessorType'))); } return self::$_links; }
/** * Build the form object. */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Add Contacts to Organization')); $this->addElement('text', 'name', ts('Find Target Organization')); $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getRelationType("Organization"), TRUE); $searchRows = $this->get('searchRows'); $searchCount = $this->get('searchCount'); if ($searchRows) { $checkBoxes = array(); $chekFlag = 0; foreach ($searchRows as $id => $row) { if (!$chekFlag) { $chekFlag = $id; } $checkBoxes[$id] = $this->createElement('radio', NULL, NULL, NULL, $id); } $this->addGroup($checkBoxes, 'contact_check'); if ($chekFlag) { $checkBoxes[$chekFlag]->setChecked(TRUE); } $this->assign('searchRows', $searchRows); } $this->assign('searchCount', $searchCount); $this->assign('searchDone', $this->get('searchDone')); $this->assign('contact_type_display', ts('Organization')); $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'crm-form-submit')); $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'crm-form-submit')); $this->addButtons(array(array('type' => 'next', 'name' => ts('Add to Organization'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); }
/** * Add relationships from form. */ public function addRelationships() { if (!is_array($this->_contactIds)) { // Could this really happen? return; } $relationshipTypeParts = explode('_', $this->params['relationship_type_id']); $params = array('relationship_type_id' => $relationshipTypeParts[0], 'is_active' => 1); $secondaryRelationshipSide = $relationshipTypeParts[1]; $primaryRelationshipSide = $relationshipTypeParts[2]; $primaryFieldName = 'contact_id_' . $primaryRelationshipSide; $secondaryFieldName = 'contact_id_' . $secondaryRelationshipSide; $relationshipLabel = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $params['relationship_type_id'], "label_{$secondaryRelationshipSide}_{$primaryRelationshipSide}"); $params[$secondaryFieldName] = $this->_contactIds; $params[$primaryFieldName] = $this->params['contact_check']; $outcome = CRM_Contact_BAO_Relationship::createMultiple($params, $primaryRelationshipSide); $relatedContactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $params[$primaryFieldName], 'display_name'); $status = array(ts('%count %2 %3 relationship created', array('count' => $outcome['valid'], 'plural' => '%count %2 %3 relationships created', 2 => $relationshipLabel, 3 => $relatedContactName))); if ($outcome['duplicate']) { $status[] = ts('%count was skipped because the contact is already %2 %3', array('count' => $outcome['duplicate'], 'plural' => '%count were skipped because the contacts are already %2 %3', 2 => $relationshipLabel, 3 => $relatedContactName)); } if ($outcome['invalid']) { $status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array('count' => $outcome['invalid'], 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship')); } $status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>'; CRM_Core_Session::setStatus($status, ts('Relationship created.', array('count' => $outcome['valid'], 'plural' => 'Relationships created.')), 'success', array('expires' => 0)); }
/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=update&id=%%id%%', 'title' => ts('Edit Mailing Component')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Mailing_BAO_Component' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Mailing Component')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Mailing_BAO_Component' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Mailing Component'))); } return self::$_links; }
public function run() { $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE); $fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE); $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $quest = CRM_Utils_Request::retrieve('quest', 'String', $this); $action = CRM_Utils_Request::retrieve('action', 'String', $this); list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, NULL, $quest); if (!$path) { CRM_Core_Error::statusBounce('Could not retrieve the file'); } $buffer = file_get_contents($path); if (!$buffer) { CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file'); } if ($action & CRM_Core_Action::DELETE) { if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) { CRM_Core_BAO_File::deleteFileReferences($id, $eid, $fid); CRM_Core_Session::setStatus(ts('The attached file has been deleted.'), ts('Complete'), 'success'); $session = CRM_Core_Session::singleton(); $toUrl = $session->popUserContext(); CRM_Utils_System::redirect($toUrl); } } else { CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer); } }
/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::BROWSE => array('name' => ts('Multiple Choice Options'), 'url' => 'civicrm/admin/optionValue', 'qs' => 'reset=1&action=browse&gid=%%id%%', 'title' => ts('View and Edit Multiple Choice Options')), CRM_Core_Action::UPDATE => array('name' => ts('Edit Group'), 'url' => 'civicrm/admin/optionGroup', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Option')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionGroup' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Option')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionGroup' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Option')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/optionGroup', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Option'))); } return self::$_links; }
function run() { $sql = "SELECT * FROM civicrm_metrics_server ORDER BY site_name, timestamp"; $dao =& CRM_Core_DAO::executeQuery($sql); $rows = array(); while ($dao->fetch()) { $row = array(); $row['id'] = $dao->id; $row['site_name'] = $dao->site_name; $row['site_url'] = $dao->site_url; $row['timestamp'] = $dao->timestamp; $row['type'] = $dao->type; $row['data'] = $dao->data; $rows[] = $row; } if (array_key_exists("export", $_REQUEST) && $_REQUEST['export'] == 'csv') { header('Content-type: text/csv'); header('Content-disposition: attachment;filename=metrics_data_' . date("Ymd_HiO") . '.csv'); $output = fopen('php://output', 'w'); $headers = array("Id", "Site Name", "Site URL", "Timestamp", "Metric Type", "Metric Data"); fputcsv($output, $headers); foreach ($rows as $row) { fputcsv($output, $row); } fclose($output); die; } else { CRM_Utils_System::setTitle(ts('Metrics Report')); $this->assign('data', $rows); $this->assign('headers', array_keys($rows[0])); parent::run(); } }
/** * Function to validate parameters * * @param array $params * @return string $errorMessage */ function _validateParams($params) { $errorMessage = ''; if (!isset($params['id']) && empty($params['label'])) { return ts('Label can not be empty when adding a new CiviRule Trigger'); } if (_checkClassNameObjectNameOperation($params) == FALSE) { return ts('Either class_name or a combination of object_name and op is mandatory'); } if (isset($params['cron']) && $params['cron'] == 1) { $params['object_name'] = null; $params['op'] = null; if (!isset($params['class_name']) || empty($params['class_name'])) { return ts('For a cron type trigger the class_name is mandatory'); } } if (isset($params['object_name']) && !empty($params['object_name'])) { $extensionConfig = CRM_Civirules_Config::singleton(); if (!in_array($params['object_name'], $extensionConfig->getValidTriggerObjectNames())) { return ts('ObjectName passed in parameters (' . $params['object_name'] . ')is not a valid object for a CiviRule Trigger'); } } if (isset($params['op']) && !empty($params['op'])) { $extensionConfig = CRM_Civirules_Config::singleton(); if (!in_array($params['op'], $extensionConfig->getValidTriggerOperations())) { return ts('Operation passed in parameters (' . $params['op'] . ')is not a valid operation for a CiviRule Trigger'); } } if (CRM_Civirules_BAO_Trigger::triggerExists($params) == TRUE) { return ts('There is already a trigger for this class_name or combination of object_name and op'); } return $errorMessage; }
/** * Heart of the viewing process. The runner gets all the meta data for * the contact and calls the appropriate type of page to view. * * @return void * @access public * */ function preProcess() { // Make sure case types have been configured for the component require_once 'CRM/Core/OptionGroup.php'; $caseType = CRM_Core_OptionGroup::values('case_type'); if (empty($caseType)) { $this->assign('notConfigured', 1); return; } $session =& CRM_Core_Session::singleton(); $allCases = CRM_Utils_Request::retrieve('all', 'Positive', $session); CRM_Utils_System::setTitle(ts('CiviCase Dashboard')); $userID = $session->get('userID'); if (!$allCases) { $this->assign('myCases', true); } else { $this->assign('myCases', false); } $this->assign('newClient', false); if (CRM_Core_Permission::check('add contacts')) { $this->assign('newClient', true); } require_once 'CRM/Case/BAO/Case.php'; $summary = CRM_Case_BAO_Case::getCasesSummary($allCases, $userID); $upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming'); $recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent'); $this->assign('casesSummary', $summary); if (!empty($upcoming)) { $this->assign('upcomingCases', $upcoming); } if (!empty($recent)) { $this->assign('recentCases', $recent); } }
/** * Get action Links. * * @return array * (reference) of action links */ public function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/badgelayout', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Badge Layout')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable Badge Layout')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable Badge Layout')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/badgelayout', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Badge Layout'))); } return self::$_links; }
static function operation() { if (!self::$_operation) { self::$_operation = array('View' => ts('View'), 'Edit' => ts('Edit'), 'Create' => ts('Create'), 'Delete' => ts('Delete'), 'Search' => ts('Search'), 'All' => ts('All')); } return self::$_operation; }
/** * run this page (figure out the action needed and perform it). * * @return void */ function run() { if (!CRM_Core_Permission::check('administer Reports')) { return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1')); } $optionVal = CRM_Report_Utils_Report::getValueFromUrl(); $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', 'String', FALSE); $extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.'); $reportClass = NULL; if ($extKey !== FALSE) { $ext = CRM_Extension_System::singleton()->getMapper(); $reportClass = $ext->keyToClass($templateInfo['name'], 'report'); $templateInfo['name'] = $reportClass; } if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form') || !is_null($reportClass)) { CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template'); $this->assign('reportTitle', $templateInfo['label']); $session = CRM_Core_Session::singleton(); $session->set('reportDescription', $templateInfo['description']); $wrapper = new CRM_Utils_Wrapper(); return $wrapper->run($templateInfo['name'], NULL, NULL); } if ($optionVal) { CRM_Core_Session::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'), ts('Template Not Found'), 'error'); } return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1')); }
/** * Implements hook_civicrm_navigationMenu(). * * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_navigationMenu */ function statelegemail_civicrm_navigationMenu(&$menu) { // We'd like the item to be beneath these two items. $idealTree = array('Administer', 'CiviCampaign'); // Walk down the menu to see if we can find them where we expect them. $walkMenu = $menu; $branches = array(); foreach ($idealTree as $limb) { foreach ($walkMenu as $id => $item) { if ($item['attributes']['name'] == $limb) { $walkMenu = CRM_Utils_Array::value('child', $item, array()); $branches[] = $id; $branches[] = 'child'; continue 2; } } // If the expected parent isn't at this level of the menu, we'll just drop // it here. break; } $item = array('attributes' => array('label' => ts('State Legislators Email Settings', array('domain' => 'com.aghstrategies.statelegemail')), 'name' => 'statelegemail_settings', 'url' => 'civicrm/statelegemail/settings?reset=1', 'permission' => 'administer CiviCRM', 'operator' => 'AND', 'separator' => 0, 'active' => 1)); if (!empty($id)) { $item['parentID'] = $id; } // Need to put together exactly where the item should be added; $treeMenu =& $menu; foreach ($branches as $branch) { $treeMenu =& $treeMenu[$branch]; } $newId = 0; statelegemail_scanMaxNavId($menu, $newId); $newId++; $item['navID'] = $newId; $treeMenu[$newId] = $item; }
/** * Alter display of rows. * * Iterate through the rows retrieved via SQL and make changes for display purposes, * such as rendering contacts as links. * * @param array $rows * Rows generated by SQL, with an array for each row. */ public function alterDisplay(&$rows) { // cache for id → is_deleted mapping $isDeleted = array(); foreach ($rows as &$row) { if (!isset($isDeleted[$row['civicrm_contact_is_deleted']])) { $isDeleted[$row['civicrm_contact_is_deleted']] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['civicrm_contact_altered_contact_id'], 'is_deleted') !== '0'; } if (!$isDeleted[$row['civicrm_contact_is_deleted']]) { $row['civicrm_contact_altered_contact_display_name_link'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_contribution_contact_id']); $row['civicrm_contact_altered_contact_display_name_hover'] = ts('Go to contact summary'); } $row['civicrm_contact_altered_by_display_name_link'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_contribution_log_user_id']); $row['civicrm_contact_altered_by_display_name_hover'] = ts('Go to contact summary'); if ($row['civicrm_contact_altered_contact_is_deleted'] and $row['log_civicrm_contribution_log_action'] == 'Update') { $row['log_civicrm_contribution_log_action'] = ts('Delete'); } if ($row['log_civicrm_contribution_log_action'] == 'Update') { $q = "reset=1&log_conn_id={$row['log_civicrm_contribution_log_conn_id']}&log_date={$row['log_civicrm_contribution_log_date']}"; if ($this->cid) { $q .= '&cid=' . $this->cid; } $url = CRM_Report_Utils_Report::getNextUrl('logging/contribute/detail', $q, FALSE, TRUE); $row['log_civicrm_contribution_log_action_link'] = $url; $row['log_civicrm_contribution_log_action_hover'] = ts('View details for this update'); $row['log_civicrm_contribution_log_action'] = '<div class="icon ui-icon-zoomin"></div> ' . ts('Update'); } unset($row['log_civicrm_contribute_log_user_id']); unset($row['log_civicrm_contribute_log_conn_id']); } }
/** * Format size. * */ public static function formatUnitSize($size, $checkForPostMax = FALSE) { if ($size) { $last = strtolower($size[strlen($size) - 1]); switch ($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $size *= 1024; case 'm': $size *= 1024; case 'k': $size *= 1024; } if ($checkForPostMax) { $maxImportFileSize = self::formatUnitSize(ini_get('upload_max_filesize')); $postMaxSize = self::formatUnitSize(ini_get('post_max_size')); if ($maxImportFileSize > $postMaxSize && $postMaxSize == $size) { CRM_Core_Session::setStatus(ts("Note: Upload max filesize ('upload_max_filesize') should not exceed Post max size ('post_max_size') as defined in PHP.ini, please check with your system administrator."), ts("Warning"), "alert"); } //respect php.ini upload_max_filesize if ($size > $maxImportFileSize && $size !== $postMaxSize) { $size = $maxImportFileSize; CRM_Core_Session::setStatus(ts("Note: Please verify your configuration for Maximum File Size (in MB) <a href='%1'>Administrator >> System Settings >> Misc</a>. It should support 'upload_max_size' as defined in PHP.ini.Please check with your system administrator.", array(1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1'))), ts("Warning"), "alert"); } } return $size; } }
/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/tag', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Tag')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/tag', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Tag')), CRM_Core_Action::FOLLOWUP => array('name' => ts('Merge'), 'class' => 'merge_tag', 'title' => ts('Merge Tag'))); } return self::$_links; }
/** * Smarty block function providing gettext support * * See CRM_Core_I18n class documentation for details. * * @param array $params template call's parameters * @param string $text {ts} block contents from the template * @param object $smarty the Smarty object * * @return string the string, translated by gettext */ function smarty_block_ts($params, $text, &$smarty) { if (!isset($params['domain'])) { $params['domain'] = $smarty->get_template_vars('extensionKey'); } return ts($text, $params); }
static function importableFields($contactType = 'HRJobContractRevision', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE) { if (empty($contactType)) { $contactType = 'HRJobContractRevision'; } $cacheKeyString = ""; $cacheKeyString .= $status ? '_1' : '_0'; $cacheKeyString .= $showAll ? '_1' : '_0'; $cacheKeyString .= $isProfile ? '_1' : '_0'; $cacheKeyString .= $checkPermission ? '_1' : '_0'; $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields); if (!$fields) { $fields = CRM_Hrjobcontract_DAO_HRJobContractRevision::import(); $fields = array_merge($fields, CRM_Hrjobcontract_DAO_HRJobContractRevision::import()); //Sorting fields in alphabetical order(CRM-1507) $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title'); $fields = CRM_Utils_Array::index(array('name'), $fields); CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString); } self::$_importableFields[$cacheKeyString] = $fields; if (!$isProfile) { $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]); } return $fields; }
/** * @param CRM_Core_Form $form * * @return array */ public static function process(&$form) { if ($form->getVar('_surveyId') <= 0) { return NULL; } $tabs = array('main' => array('title' => ts('Main Information'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'questions' => array('title' => ts('Questions'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'results' => array('title' => ts('Results'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE)); $surveyID = $form->getVar('_surveyId'); $class = $form->getVar('_name'); $class = CRM_Utils_String::getClassName($class); $class = strtolower($class); if (array_key_exists($class, $tabs)) { $tabs[$class]['current'] = TRUE; $qfKey = $form->get('qfKey'); if ($qfKey) { $tabs[$class]['qfKey'] = "&qfKey={$qfKey}"; } } if ($surveyID) { $reset = !empty($_GET['reset']) ? 'reset=1&' : ''; foreach ($tabs as $key => $value) { if (!isset($tabs[$key]['qfKey'])) { $tabs[$key]['qfKey'] = NULL; } $tabs[$key]['link'] = CRM_Utils_System::url("civicrm/survey/configure/{$key}", "{$reset}action=update&id={$surveyID}{$tabs[$key]['qfKey']}"); $tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE; } } return $tabs; }
/** * Build the form object. */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - Search Preferences')); // @todo remove the following adds in favour of setting via the settings array (above). $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard')); $this->addYesNo('includeEmailInName', ts('Include Email')); $this->addYesNo('includeNickNameInName', ts('Include Nickname')); $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager')); $this->addYesNo('includeOrderByClause', ts('Include Order By Clause')); $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5)); $types = array('Contact', 'Individual', 'Organization', 'Household'); $profiles = CRM_Core_BAO_UFGroup::getProfiles($types); $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge')); // Autocomplete for Contact Search (quick search etc.) $options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE)); $this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options, NULL, NULL, NULL, NULL, array(' ')); $element = $this->getElement('autocompleteContactSearch'); $element->_elements[0]->_flagFrozen = TRUE; // Autocomplete for Contact Reference (custom fields) $optionsCR = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE)); $this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR, NULL, NULL, NULL, NULL, array(' ')); $element = $this->getElement('autocompleteContactReference'); $element->_elements[0]->_flagFrozen = TRUE; parent::buildQuickForm(); }
static function entityTable() { if (!self::$_entityTable) { self::$_entityTable = array('civicrm_contact' => ts('Contact'), 'civicrm_group' => ts('Group')); } return self::$_entityTable; }
/** * Build the form object. * * * @return void */ public function buildQuickForm() { if ($this->_search) { return; } $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey'); $this->add('text', 'petition_title', ts('Title'), $attributes['title']); //campaigns $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $this->add('select', 'petition_campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns); $this->set('petitionCampaigns', $campaigns); $this->assign('petitionCampaigns', json_encode($campaigns)); //build the array of all search params. $this->_searchParams = array(); foreach ($this->_elements as $element) { $name = $element->_attributes['name']; $label = $element->_label; if ($name == 'qfKey') { continue; } $this->_searchParams[$name] = $label ? $label : $name; } $this->set('searchParams', $this->_searchParams); $this->assign('searchParams', json_encode($this->_searchParams)); }
/** * Get action Links * * @return array (reference) of action links */ function &links() { if (!self::$_links) { self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/admin/member/membershipType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Membership Type')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Member_BAO_MembershipType' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Membership Type')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Member_BAO_MembershipType' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Membership Type')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/member/membershipType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Membership Type'))); } return self::$_links; }
/** * Overridden parent method to build form * * @access public */ public function buildQuickForm() { $this->add('hidden', 'rule_condition_id'); $this->add('select', 'payment_instrument_id', ts('Payment instrument'), $this->getPaymentInstruments(), true); $this->add('select', 'operator', ts('Operator'), array('equals', 'is not equal to'), true); $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); }