/** * Build all the data structures needed to build the form. */ public function preProcess() { // reset action from the session $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'update'); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this); $rcid = $rcid ? "&id={$rcid}" : ''; $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1{$rcid}")); if ($this->_contactId) { $contact = new CRM_Contact_DAO_Contact(); $contact->id = $this->_contactId; if (!$contact->find(TRUE)) { CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId))); } $this->_contactType = $contact->contact_type; // check for permissions if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) { CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.')); } list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId); CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName); } else { CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type')); } }
/** * Function to build the form * * @access public * @return None */ 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' => 'form-submit')); $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'form-submit')); $this->addButtons(array(array('type' => 'next', 'name' => ts('Add to Organization'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); }
public function preProcess() { if (!CRM_Campaign_BAO_Campaign::accessCampaign()) { CRM_Utils_System::permissionDenied(); } $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST'); $this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); if ($this->_surveyId) { $this->_single = TRUE; $params = array('id' => $this->_surveyId); CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo); $this->_surveyTitle = $surveyInfo['title']; $this->assign('surveyTitle', $this->_surveyTitle); CRM_Utils_System::setTitle(ts('Configure Survey - %1', array(1 => $this->_surveyTitle))); } $this->assign('action', $this->_action); $this->assign('surveyId', $this->_surveyId); // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { $this->set('type', 'Event'); $this->set('entityId', $this->_surveyId); CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); } // CRM-11480, CRM-11682 // Preload libraries required by the "Questions" tab CRM_UF_Page_ProfileEditor::registerProfileScripts(); CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ActivityModel')); CRM_Campaign_Form_Survey_TabHeader::build($this); }
/** * Build the form object. */ public function buildQuickForm() { $config = CRM_Core_Config::singleton(); CRM_Utils_System::setTitle(ts('Settings - Localization')); $warningTitle = json_encode(ts("Warning")); $defaultLocaleOptions = CRM_Admin_Form_Setting_Localization::getDefaultLocaleOptions(); $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); if ($domain->locales) { // add language limiter and language adder $this->addCheckBox('languageLimit', ts('Available Languages'), array_flip($defaultLocaleOptions), NULL, NULL, NULL, NULL, ' '); $this->addElement('select', 'addLanguage', ts('Add Language'), array_merge(array('' => ts('- select -')), array_diff(CRM_Core_I18n::languages(), $defaultLocaleOptions))); // add the ability to return to single language $warning = ts('This will make your CiviCRM installation a single-language one again. THIS WILL DELETE ALL DATA RELATED TO LANGUAGES OTHER THAN THE DEFAULT ONE SELECTED ABOVE (and only that language will be preserved).'); $this->assign('warning', $warning); $warning = json_encode($warning); $this->addElement('checkbox', 'makeSinglelingual', ts('Return to Single Language'), NULL, array('onChange' => "if (this.checked) CRM.alert({$warning}, {$warningTitle})")); } else { $warning = ts('Enabling multiple languages changes the schema of your database, so make sure you know what you are doing when enabling this function; making a database backup is strongly recommended.'); $this->assign('warning', $warning); $warning = json_encode($warning); $validTriggerPermission = CRM_Core_DAO::checkTriggerViewPermission(TRUE); if ($validTriggerPermission && !$config->logging) { $this->addElement('checkbox', 'makeMultilingual', ts('Enable Multiple Languages'), NULL, array('onChange' => "if (this.checked) CRM.alert({$warning}, {$warningTitle})")); } } $this->addElement('select', 'contact_default_language', ts('Default Language for users'), CRM_Admin_Form_Setting_Localization::getDefaultLanguageOptions()); $includeCurrency =& $this->addElement('advmultiselect', 'currencyLimit', ts('Available Currencies') . ' ', self::getCurrencySymbols(), array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect')); $includeCurrency->setButtonAttributes('add', array('value' => ts('Add >>'))); $includeCurrency->setButtonAttributes('remove', array('value' => ts('<< Remove'))); $this->addFormRule(array('CRM_Admin_Form_Setting_Localization', 'formRule')); parent::buildQuickForm(); }
/** * 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); } }
/** * Build the form object. */ public function buildQuickForm() { CRM_Utils_System::setTitle(ts('Settings - Cleanup Caches and Update Paths')); $this->addElement('submit', $this->getButtonName('next', 'cleanup'), 'Cleanup Caches', array('class' => 'crm-form-submit', 'id' => 'cleanup-cache')); $this->addElement('submit', $this->getButtonName('next', 'resetpaths'), 'Reset Paths', array('class' => 'crm-form-submit', 'id' => 'resetpaths')); //parent::buildQuickForm(); }
/** * set up variables to build the form * * @param null * * @return void * @acess protected */ function preProcess() { $this->_fid = $this->get('fid'); $this->_title = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $this->_fid, 'label', 'id'); $this->assign('title', $this->_title); CRM_Utils_System::setTitle(ts('Confirm Price Field Delete')); }
public function preProcess() { parent::preProcess(); $this->_groupID = CRM_Utils_Request::retrieve('gid', 'Integer', $this, FALSE, NULL, 'REQUEST'); // ensure that there is a destination, if not set the destination to the // referrer string if (!$this->controller->getDestination()) { $this->controller->setDestination(NULL, TRUE); } if ($this->_groupID) { $groupTypeCondition = CRM_Contact_BAO_Group::groupTypeCondition('Mailing'); // make sure requested qroup is accessible and exists $query = "\nSELECT title, description\n FROM civicrm_group\n WHERE id={$this->_groupID}\n AND visibility != 'User and User Admin Only'\n AND {$groupTypeCondition}"; $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); if ($dao->fetch()) { $this->assign('groupName', $dao->title); CRM_Utils_System::setTitle(ts('Subscribe to Mailing List - %1', array(1 => $dao->title))); } else { CRM_Core_Error::statusBounce("The specified group is not configured for this action OR The group doesn't exist."); } $this->assign('single', TRUE); } else { $this->assign('single', FALSE); CRM_Utils_System::setTitle(ts('Mailing List Subscription')); } }
/** * Build the form object. * * @return void */ public function buildQuickForm() { parent::buildQuickForm(); $this->setPageTitle(ts('Financial Batch')); if (isset($this->_id)) { $this->_title = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'title'); CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Accounting Batch')); $this->assign('batchTitle', $this->_title); $contactID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id'); $contactName = CRM_Contact_BAO_Contact::displayName($contactID); $this->assign('contactName', $contactName); } $this->applyFilter('__ALL__', 'trim'); $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel')))); if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) { $batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id'); //unset exported status $exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus); unset($batchStatus[$exportedStatusId]); $this->add('select', 'status_id', ts('Batch Status'), array('' => ts('- select -')) + $batchStatus, TRUE); $this->freeze(array('status_id')); } $attributes = CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch'); $this->add('text', 'title', ts('Batch Name'), $attributes['name'], TRUE); $this->add('textarea', 'description', ts('Description'), $attributes['description']); $this->add('select', 'payment_instrument_id', ts('Payment Method'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), FALSE); $this->add('text', 'total', ts('Total Amount'), $attributes['total']); $this->add('text', 'item_count', ts('Number of Transactions'), $attributes['item_count']); $this->addFormRule(array('CRM_Financial_Form_FinancialBatch', 'formRule'), $this); }
/** * Run dashboard. * * @return void */ public function run() { // Add dashboard js and css $resources = CRM_Core_Resources::singleton(); $resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE); $resources->addStyleFile('civicrm', 'css/dashboard.css'); $resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject); CRM_Utils_System::setTitle(ts('CiviCRM Home')); $session = CRM_Core_Session::singleton(); $contactID = $session->get('userID'); if ($resetCache) { CRM_Core_BAO_Dashboard::resetDashletCache($contactID); } // call hook to get html from other modules // ignored but needed to prevent warnings $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW; $html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement); if (is_array($html)) { $this->assign_by_ref('hookContent', $html); $this->assign('hookContentPlacement', $contentPlacement); } $communityMessages = CRM_Core_CommunityMessages::create(); if ($communityMessages->isEnabled()) { $message = $communityMessages->pick(); if ($message) { $this->assign('communityMessages', $communityMessages->evalMarkup($message['markup'])); } } return parent::run(); }
function preProcess() { parent::preProcess(); CRM_Utils_System::setTitle(ts('Settings - Addresses')); // add all the checkboxes $this->_cbs = array('address_options' => ts('Address Fields')); }
/** * run this page (figure out the action needed and perform it). * * @return void */ function run() { $instanceId = CRM_Report_Utils_Report::getInstanceID(); $action = CRM_Utils_Request::retrieve('action', 'String', $this); $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId); $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1"); if ($action & CRM_Core_Action::DELETE) { if (!CRM_Core_Permission::check('administer Reports')) { $statusMessage = ts('Your do not have permission to Delete Report.'); CRM_Core_Error::statusBounce($statusMessage, $reportUrl); } CRM_Report_BAO_Instance::delete($instanceId); CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.')); } else { require_once 'CRM/Core/OptionGroup.php'; $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value'); if (strstr($templateInfo['name'], '_Form')) { $instanceInfo = array(); CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo); if (!empty($instanceInfo['title'])) { CRM_Utils_System::setTitle($instanceInfo['title']); $this->assign('reportTitle', $instanceInfo['title']); } else { CRM_Utils_System::setTitle($templateInfo['label']); $this->assign('reportTitle', $templateInfo['label']); } $wrapper =& new CRM_Utils_Wrapper(); return $wrapper->run($templateInfo['name'], null, null); } CRM_Core_Session::setStatus(ts('Could not find template for the instance.')); } return CRM_Utils_System::redirect($reportUrl); }
function run() { list($ext, $suite) = $this->getRequestExtAndSuite(); if (empty($ext) || empty($suite)) { throw new CRM_Core_Exception("FIXME: Not implemented: QUnit browser"); } if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+$/', $suite) || strpos($suite, '..') !== FALSE) { throw new CRM_Core_Exception("Malformed suite name"); } $path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath($ext); if (!is_dir("{$path}/tests/qunit/{$suite}")) { throw new CRM_Core_Exception("Failed to locate test suite"); } // Load the test suite -- including any PHP, TPL, or JS content if (file_exists("{$path}/tests/qunit/{$suite}/test.php")) { // e.g. load resources require_once "{$path}/tests/qunit/{$suite}/test.php"; } if (file_exists("{$path}/tests/qunit/{$suite}/test.tpl")) { // e.g. setup markup and/or load resources CRM_Core_Smarty::singleton()->addTemplateDir("{$path}/tests"); $this->assign('qunitTpl', "qunit/{$suite}/test.tpl"); } if (file_exists("{$path}/tests/qunit/{$suite}/test.js")) { CRM_Core_Resources::singleton()->addScriptFile($ext, "tests/qunit/{$suite}/test.js", 1000); } CRM_Utils_System::setTitle(ts('QUnit: %2 (%1)', array(1 => $ext, 2 => $suite))); CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/qunit/qunit.js')->addStyleFile('civicrm', 'packages/qunit/qunit.css'); parent::run(); }
/** * Process the form submission. * * * @return void */ public function preProcess() { $config = CRM_Core_Config::singleton(); CRM_Utils_System::setTitle(ts('CiviContribute Component Settings')); $this->_varNames = array(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME => array('invoice_prefix' => array('html_type' => 'text', 'title' => ts('Invoice Prefix'), 'weight' => 1, 'description' => ts('Enter prefix to be display on PDF for invoice')), 'credit_notes_prefix' => array('html_type' => 'text', 'title' => ts('Credit Notes Prefix'), 'weight' => 2, 'description' => ts('Enter prefix to be display on PDF for credit notes.')), 'due_date' => array('html_type' => 'text', 'title' => ts('Due Date'), 'weight' => 3), 'due_date_period' => array('html_type' => 'select', 'title' => ts('For transmission'), 'weight' => 4, 'description' => ts('Select the interval for due date.'), 'option_values' => array('select' => ts('- select -'), 'days' => ts('Days'), 'months' => ts('Months'), 'years' => ts('Years'))), 'notes' => array('html_type' => 'wysiwyg', 'title' => ts('Notes or Standard Terms'), 'weight' => 5, 'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '), 'attributes' => array('rows' => 2, 'cols' => 40)), 'is_email_pdf' => array('html_type' => 'checkbox', 'title' => ts('Automatically email invoice when user purchases online'), 'weight' => 6), 'tax_term' => array('html_type' => 'text', 'title' => ts('Tax Term'), 'weight' => 7), 'tax_display_settings' => array('html_type' => 'select', 'title' => ts('Tax Display Settings'), 'weight' => 8, 'option_values' => array('Do_not_show' => ts('Do not show breakdown, only show total -i.e ' . $config->defaultCurrencySymbol . '120.00'), 'Inclusive' => ts('Show [tax term] inclusive price - i.e. ' . $config->defaultCurrencySymbol . '120.00 (includes [tax term] of ' . $config->defaultCurrencySymbol . '20.00)'), 'Exclusive' => ts('Show [tax term] exclusive price - i.e. ' . $config->defaultCurrencySymbol . '100.00 + ' . $config->defaultCurrencySymbol . '20.00 [tax term]'))))); parent::preProcess(); }
/** * 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')); }
/** * Set variables up before form is built. * * * @return void */ public function preProcess() { // current set id $this->_id = $this->get('id'); if ($this->_id && ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_id, 'is_reserved', 'id'))) { CRM_Core_Error::fatal("You cannot edit the settings of a reserved custom field-set."); } // setting title for html page if ($this->_action == CRM_Core_Action::UPDATE) { $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id); CRM_Utils_System::setTitle(ts('Edit %1', array(1 => $title))); } elseif ($this->_action == CRM_Core_Action::VIEW) { $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id); CRM_Utils_System::setTitle(ts('Preview %1', array(1 => $title))); } else { CRM_Utils_System::setTitle(ts('New Custom Field Set')); } if (isset($this->_id)) { $params = array('id' => $this->_id); CRM_Core_BAO_CustomGroup::retrieve($params, $this->_defaults); $subExtends = CRM_Utils_Array::value('extends_entity_column_value', $this->_defaults); if (!empty($subExtends)) { $this->_subtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subExtends, 1, -1)); } } }
function preProcess() { parent::preProcess(); CRM_Utils_System::setTitle(ts('Settings - Resource Configuration Option')); $this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this, FALSE, 0); $this->assign('sid', $this->_sid); }
/** * This function is called prior to building and submitting the form */ function preProcess() { // check contact_id $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); if (empty($this->_contactId)) { CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact')); // this also redirects to the default civicrm page } // check for permissions $session = CRM_Core_Session::singleton(); if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) { CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'), NULL, ts('Lidmaatschap Wijziging - Contact')); // this also redirects to the default civicrm page } // get session $session = CRM_Core_Session::singleton(); // get values $this->_configGroup = CRM_Lidmaatschapwijziging_ConfigGroup::singleton($this->_contactId); $this->_values = $this->_configGroup->getContact(); // set display name $this->_display_name = $this->_values['display_name']; // set title CRM_Utils_System::setTitle('LidmaatschapWijziging - Group - ' . $this->_values['display_name']); // set contact id $this->_values['contact_id'] = $this->_contactId; }
public function run() { // lets get around the time limit issue if possible for upgrades if (!ini_get('safe_mode')) { set_time_limit(0); } $upgrade = new CRM_Upgrade_Form(); list($currentVer, $latestVer) = $upgrade->getUpgradeVersions(); CRM_Utils_System::setTitle(ts('Upgrade CiviCRM to Version %1', array(1 => $latestVer))); $template = CRM_Core_Smarty::singleton(); $template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $latestVer))); $template->assign('cancelURL', CRM_Utils_System::url('civicrm/dashboard', 'reset=1')); $action = CRM_Utils_Array::value('action', $_REQUEST, 'intro'); switch ($action) { case 'intro': $this->runIntro(); break; case 'begin': $this->runBegin(); break; case 'finish': $this->runFinish(); break; default: CRM_Core_Error::fatal(ts('Unrecognized upgrade action')); } }
/** * Run dashboard * * @return void * @access public */ function run() { CRM_Utils_System::setTitle(ts('Dashlets')); $this->assign('admin', CRM_Core_Permission::check('administer CiviCRM')); // get all dashlets $allDashlets = CRM_Core_BAO_Dashboard::getDashlets(FALSE); // get dashlets for logged in contact $currentDashlets = CRM_Core_BAO_Dashboard::getContactDashlets(); $contactDashlets = $availableDashlets = array(); foreach ($currentDashlets as $columnNo => $values) { foreach ($values as $val => $isMinimized) { list($weight, $dashletID) = explode('-', $val); $key = "{$dashletID}-{$isMinimized}"; $contactDashlets[$columnNo][$key] = array('label' => $allDashlets[$dashletID]['label'], 'is_reserved' => $allDashlets[$dashletID]['is_reserved']); unset($allDashlets[$dashletID]); } } foreach ($allDashlets as $dashletID => $values) { $key = "{$dashletID}-0"; $availableDashlets[$key] = array('label' => $values['label'], 'is_reserved' => $values['is_reserved']); } $this->assign('contactDashlets', $contactDashlets); $this->assign('availableDashlets', $availableDashlets); return parent::run(); }
/** * 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(); }
/** * Function to build the form * * @return void * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } CRM_Utils_System::setTitle(ts('Dropdown Options')); $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'name'), TRUE); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_OptionGroup', $this->_id)); $this->add('text', 'title', ts('Group Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'title')); $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'description')); $element = $this->add('checkbox', 'is_active', ts('Enabled?')); if ($this->_action & CRM_Core_Action::UPDATE) { if (in_array($this->_values['name'], array('encounter_medium', 'case_type', 'case_status'))) { static $caseCount = NULL; if (!isset($caseCount)) { $caseCount = CRM_Case_BAO_Case::caseCount(NULL, FALSE); } if ($caseCount > 0) { $element->freeze(); } } if (!empty($this->_values['is_reserved'])) { $this->freeze(array('name', 'is_active')); } } $this->assign('id', $this->_id); }
/** * Set variables up before form is built. * * @return void */ public function preProcess() { parent::preProcess(); $participantNo = substr($this->_name, 12); //lets process in-queue participants. if ($this->_participantId && $this->_additionalParticipantIds) { $this->_additionalParticipantId = CRM_Utils_Array::value($participantNo, $this->_additionalParticipantIds); } $participantCnt = $participantNo + 1; $this->assign('formId', $participantNo); $this->_params = array(); $this->_params = $this->get('params'); $participantTot = $this->_params[0]['additional_participants'] + 1; $skipCount = count(array_keys($this->_params, "skip")); if ($skipCount) { $this->assign('skipCount', $skipCount); } CRM_Utils_System::setTitle(ts('Register Participant %1 of %2', array(1 => $participantCnt, 2 => $participantTot))); //CRM-4320, hack to check last participant. $this->_lastParticipant = FALSE; if ($participantTot == $participantCnt) { $this->_lastParticipant = TRUE; } $this->assign('lastParticipant', $this->_lastParticipant); }
/** * Obtains the group name from url and sets the title. * * @return void */ public function preProcess() { CRM_Utils_System::setTitle(ts('CiviCRM Extensions')); $destination = CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1'); $destination = urlencode($destination); $this->assign('destination', $destination); }
/** * This function is called prior to building and submitting the form */ function preProcess() { // check contact_id $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); if (empty($this->_contactId)) { CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact')); // this also redirects to the default civicrm page } // check for permissions $session = CRM_Core_Session::singleton(); if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) { CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'), NULL, ts('Lidmaatschap Wijziging - Contact')); // this also redirects to the default civicrm page } // get request $this->_request = CRM_Utils_Request::retrieve('request', 'String', $this, FALSE, 'choose'); // get session $session = CRM_Core_Session::singleton(); // get values $this->_configRelationship = CRM_Lidmaatschapwijziging_ConfigRelationship::singleton($this->_contactId); $this->_values = $this->_configRelationship->getContact(); // set contact id $this->_values['contact_id'] = $this->_contactId; // set display name $this->_display_name = $this->_values['display_name']; // set request $this->_values['request'] = $this->_request; // set title CRM_Utils_System::setTitle('LidmaatschapWijziging - Relatie - ' . $this->_values['display_name']); // request if ('empty' == $this->_request) { } if ('choose' == $this->_request) { // if there is no relatiosnhips then the options are empty, we // show a message that there are no memebrships and a submit butten to // go to the relationship, first we redirect them to request empty $relationships = $this->_configRelationship->getRelationships(); if (empty($relationships)) { // redirect user $url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/relationship', 'reset=1&request=empty&cid=' . $this->_contactId); CRM_Utils_System::redirect($url); } } if ('update' == $this->_request) { // get relationship id $this->_relationshipId = CRM_Utils_Request::retrieve('relationship_id', 'Positive', $this); $this->_values['relationship_id'] = $this->_relationshipId; // get relationship $this->_values = array_merge($this->_values, $this->_configRelationship->getRelationship($this->_relationshipId)); if (!empty($this->_values['contact_a']['display_name'])) { $this->assign('sort_name_a', $this->_values['contact_a']['display_name']); } if (!empty($this->_values['contact_b']['display_name'])) { $this->assign('sort_name_b', $this->_values['contact_b']['display_name']); } // note $this->_values['note_id'] = $this->_values['notes']['id']; $this->_values['note'] = $this->_values['notes']['note']; } }
/** * set up variables to build the form * * @return void * @acess protected */ function preProcess() { $this->_srcFID = CRM_Utils_Request::retrieve('fid', 'Positive', $this, true); $this->_srcGID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $this->_srcFID, 'custom_group_id'); $this->_label = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $this->_srcFID, 'label'); CRM_Utils_System::setTitle(ts('Custom Field Move: %1', array(1 => $this->_label))); }
/** * 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() { CRM_Utils_System::setTitle(ts('Smart Group')); require_once "CRM/Event/BAO/Query.php"; // get the qill $query =& new CRM_Event_BAO_Query($this->get('formValues')); $qill = $query->qill(); // need to save qill for the smarty template $this->assign('qill', $qill); // the name and description are actually stored with the group and not the saved search $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), true); $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description')); // get the group id for the saved search $groupId = null; if (isset($this->_id)) { $params = array('saved_search_id' => $this->_id); require_once "CRM/Contact/BAO/Group.php"; CRM_Contact_BAO_Group::retrieve($params, $values); $groupId = $values['id']; $this->addDefaultButtons(ts('Update Smart Group')); } else { $this->addDefaultButtons(ts('Save Smart Group')); } $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupId, 'title')); }
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(); } }
/** * Build all the data structures needed to build the form. * * @return void */ public function preProcess() { $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); if ($id) { $this->_contributionIds = array($id); $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) "; $this->_single = TRUE; $this->assign('totalSelectedContributions', 1); } else { parent::preProcess(); } // check that all the contribution ids have pending status $query = "\nSELECT count(*)\nFROM civicrm_contribution\nWHERE contribution_status_id != 1\nAND {$this->_componentClause}"; $count = CRM_Core_DAO::singleValueQuery($query); if ($count != 0) { CRM_Core_Error::statusBounce("Please select only online contributions with Completed status."); } // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $this->assign('single', $this->_single); $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= "&qfKey={$qfKey}"; } $url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams); $breadCrumb = array(array('url' => $url, 'title' => ts('Search Results'))); CRM_Utils_System::appendBreadCrumb($breadCrumb); CRM_Utils_System::setTitle(ts('Print Contribution Receipts')); }
/** * Set default values for the form. * * * @return void */ public function setDefaultValues() { $defaults = array(); $defaults = array(); if (isset($this->_id)) { $title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title'); CRM_Utils_System::setTitle(ts('Personal Campaign Page Settings (%1)', array(1 => $title))); $params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event'); CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $defaults); $defaults['pcp_active'] = CRM_Utils_Array::value('is_active', $defaults); // Assign contribution page ID to pageId for referencing in PCP.hlp - since $id is overwritten there. dgg $this->assign('pageId', $this->_id); } if (empty($defaults['id'])) { $defaults['target_entity_type'] = 'event'; $defaults['is_approval_needed'] = 1; $defaults['is_tellfriend_enabled'] = 1; $defaults['tellfriend_limit'] = 5; $defaults['link_text'] = ts('Promote this event with a personal campaign page'); $defaults['owner_notify_id'] = CRM_Core_OptionGroup::getDefaultValue('pcp_owner_notify'); if ($this->_id && ($ccReceipt = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'cc_receipt'))) { $defaults['notify_email'] = $ccReceipt; } } return $defaults; }