public function afterExample(ExampleEvent $event) { $total = $this->stats->getEventsCount(); $counts = $this->stats->getCountsHash(); $percents = array_map(function ($count) use($total) { return round($count / ($total / 100), 0); }, $counts); $lengths = array_map(function ($percent) { return round($percent / 2, 0); }, $percents); $size = 50; asort($lengths); $progress = array(); foreach ($lengths as $status => $length) { $text = $percents[$status] . '%'; $length = $size - $length >= 0 ? $length : $size; $size = $size - $length; if ($length > strlen($text) + 2) { $text = str_pad($text, $length, ' ', STR_PAD_BOTH); } else { $text = str_pad('', $length, ' '); } $progress[$status] = sprintf("<{$status}-bg>%s</{$status}-bg>", $text); } krsort($progress); $this->printException($event, 2); $this->io->writeTemp(implode('', $progress) . ' ' . $total); }
function get_content() { global $CFG, $COURSE; if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); $this->content->items = array(); $this->content->icons = array(); $this->content->footer = ''; if ($COURSE->id == $this->instance->pageid) { $course = $COURSE; } else { $course = get_record('course', 'id', $this->instance->pageid); } require_once $CFG->dirroot . '/course/lib.php'; $modinfo = get_fast_modinfo($course); $modfullnames = array(); foreach ($modinfo->cms as $cm) { if (!$cm->uservisible) { continue; } $modfullnames[$cm->modname] = $cm->modplural; } asort($modfullnames, SORT_LOCALE_STRING); foreach ($modfullnames as $modname => $modfullname) { if ($modname != 'label') { $this->content->items[] = '<a href="' . $CFG->wwwroot . '/mod/' . $modname . '/index.php?id=' . $this->instance->pageid . '">' . $modfullname . '</a>'; $this->content->icons[] = '<img src="' . $CFG->modpixpath . '/' . $modname . '/icon.gif" class="icon" alt="" />'; } } return $this->content; }
/** * Import constructor. * * @param ContactService $contactService * @param SelectionService $selectionService */ public function __construct(ContactService $contactService, SelectionService $selectionService) { parent::__construct(); $this->setAttribute('method', 'post'); $this->setAttribute('action', ''); $this->setAttribute('class', 'form-horizontal'); $selections = []; foreach ($selectionService->findAll('selection') as $selection) { /** @var $selection Selection */ if (is_null($selection->getSql())) { $selections[$selection->getId()] = $selection->getSelection(); } } asort($selections); $this->add(['type' => '\\Zend\\Form\\Element\\Select', 'name' => 'selection_id', 'options' => ["value_options" => $selections, 'empty_option' => '-- Append to existing selection', "label" => "txt-append-to-selection", "help-block" => _("txt-contact-import-append-to-selection-name-help-block")]]); $optins = []; foreach ($contactService->findAll('optIn') as $optin) { /** @var $optin OptIn */ $optins[$optin->getId()] = $optin->getOptIn(); } asort($optins); $this->add(['type' => '\\Zend\\Form\\Element\\MultiCheckbox', 'name' => 'optIn', 'options' => ["value_options" => $optins, "label" => "txt-select-opt-in", "help-block" => _("txt-contact-import-select-opt-in-help-block")]]); $this->add(['type' => '\\Zend\\Form\\Element\\Text', 'name' => 'selection', 'options' => ["label" => "txt-selection", "help-block" => _("txt-contact-import-selection-name-help-block")]]); $this->add(['type' => '\\Zend\\Form\\Element\\File', 'name' => 'file', 'options' => ["label" => "txt-file", "help-block" => _("txt-contact-import-file-requirements")]]); $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'upload', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-verify-data")]]); $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'import', 'attributes' => ['class' => "btn btn-primary", 'value' => _("txt-import")]]); }
function array_sort($array, $on, $order = SORT_ASC) { $new_array = array(); $sortable_array = array(); if (count($array) > 0) { foreach ($array as $k => $v) { if (is_array($v)) { foreach ($v as $k2 => $v2) { if ($k2 == $on) { $sortable_array[$k] = $v2; } } } else { $sortable_array[$k] = $v; } } switch ($order) { case SORT_ASC: asort($sortable_array); break; case SORT_DESC: arsort($sortable_array); break; } foreach ($sortable_array as $k => $v) { $new_array[$k] = $array[$k]; } } return $new_array; }
/** * Function to pre processing * * @return None * @access public */ function preProcess() { $this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0); $this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, false, 0); if ($this->_rgid) { $rgDao =& new CRM_Dedupe_DAO_RuleGroup(); $rgDao->id = $this->_rgid; $rgDao->find(true); $this->_defaults['threshold'] = $rgDao->threshold; $this->_contactType = $rgDao->contact_type; $this->_defaults['level'] = $rgDao->level; $this->_defaults['name'] = $rgDao->name; $ruleDao =& new CRM_Dedupe_DAO_Rule(); $ruleDao->dedupe_rule_group_id = $this->_rgid; $ruleDao->find(); $count = 0; while ($ruleDao->fetch()) { $this->_defaults["where_{$count}"] = "{$ruleDao->rule_table}.{$ruleDao->rule_field}"; $this->_defaults["length_{$count}"] = $ruleDao->rule_length; $this->_defaults["weight_{$count}"] = $ruleDao->rule_weight; $count++; } } $supported =& CRM_Dedupe_BAO_RuleGroup::supportedFields($this->_contactType); if (is_array($supported)) { foreach ($supported as $table => $fields) { foreach ($fields as $field => $title) { $this->_fields["{$table}.{$field}"] = $title; } } } asort($this->_fields); }
/** */ public function __construct() { $this->_rollup = 'WITH ROLLUP'; $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); $count = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } // Check if CiviCampaign is a) enabled and b) has active campaigns $config = CRM_Core_Config::singleton(); $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); if ($campaignEnabled) { $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); $this->activeCampaigns = $getCampaigns['campaigns']; asort($this->activeCampaigns); } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE)))); $this->_columns += $this->addAddressFields(); $this->_columns += array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y'), 'type' => CRM_Utils_Type::T_INT), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1'))))); // If we have a campaign, build out the relevant elements if ($campaignEnabled && !empty($this->activeCampaigns)) { $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false'); $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT); } $this->_groupFilter = TRUE; $this->_tagFilter = TRUE; parent::__construct(); }
public function __construct(&$vars, $title = '') { global $conf; parent::__construct($vars, $title); $this->addHidden('', 'id', 'int', true, true); if (!$GLOBALS['registry']->getAuth()) { $this->addVariable(_("Your Email Address"), 'user_email', 'email', true); if (!empty($conf['guests']['captcha'])) { $this->addVariable(_("Spam protection"), 'captcha', 'figlet', true, null, null, array(Whups::getCAPTCHA(!$this->isSubmitted()), $conf['guests']['figlet_font'])); } } $this->addVariable(_("Comment"), 'newcomment', 'longtext', false); $this->addVariable(_("Attachment"), 'newattachment', 'file', false); $this->addVariable(_("Watch this ticket"), 'add_watch', 'boolean', false); /* Group restrictions. */ if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin')) || $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments', $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { $groups = $GLOBALS['injector']->getInstance('Horde_Group'); $mygroups = $groups->listGroups($GLOBALS['registry']->getAuth()); if ($mygroups) { foreach (array_keys($mygroups) as $gid) { $grouplist[$gid] = $groups->getName($gid, true); } asort($grouplist); $grouplist = array_merge(array(0 => _("This comment is visible to everyone")), $grouplist); $this->addVariable(_("Make this comment visible only to members of a group?"), 'group', 'enum', true, false, null, array($grouplist)); } } }
/** * Function to set variables up before form is built * * @return void * @access public */ public function preProcess() { $this->_mapperFields = $this->get('fields'); unset($this->_mapperFields['id']); asort($this->_mapperFields); $this->_columnCount = $this->get('columnCount'); $this->assign('columnCount', $this->_columnCount); $this->_dataValues = $this->get('dataValues'); $this->assign('dataValues', $this->_dataValues); $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); if ($skipColumnHeader) { $this->assign('skipColumnHeader', $skipColumnHeader); $this->assign('rowDisplayCount', 3); /* if we had a column header to skip, stash it for later */ $this->_columnHeaders = $this->_dataValues[0]; } else { $this->assign('rowDisplayCount', 2); } $highlightedFields = array(); $requiredFields = array('activity_date_time', 'activity_type_id', 'activity_label', 'target_contact_id', 'activity_subject'); foreach ($requiredFields as $val) { $highlightedFields[] = $val; } $this->assign('highlightedFields', $highlightedFields); }
/** * Load into memory list of available export format * * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates (same content than array this->driverlabel) */ function liste_modeles($db, $maxfilenamelength = 0) { dol_syslog(get_class($this) . "::liste_modeles"); $dir = DOL_DOCUMENT_ROOT . "/core/modules/export/"; $handle = opendir($dir); // Recherche des fichiers drivers exports disponibles $var = True; $i = 0; if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { if (preg_match("/^export_(.*)\\.modules\\.php\$/i", $file, $reg)) { $moduleid = $reg[1]; // Chargement de la classe $file = $dir . "/export_" . $moduleid . ".modules.php"; $classname = "Export" . ucfirst($moduleid); require_once $file; $module = new $classname($db); // Picto $this->picto[$module->id] = $module->picto; // Driver properties $this->driverlabel[$module->id] = $module->getDriverLabel() . (empty($module->disabled) ? '' : ' __(Disabled)__'); // '__(Disabled)__' is a key $this->driverdesc[$module->id] = $module->getDriverDesc(); $this->driverversion[$module->id] = $module->getDriverVersion(); // If use an external lib $this->liblabel[$module->id] = $module->getLibLabel(); $this->libversion[$module->id] = $module->getLibVersion(); $i++; } } closedir($handle); } asort($this->driverlabel); return $this->driverlabel; }
function afg_get_sets_groups_galleries(&$photosets_map, &$groups_map, &$galleries_map, $user_id) { global $pf; $rsp_obj = $pf->photosets_getList($user_id); if (!$pf->error_code) { foreach ($rsp_obj['photoset'] as $photoset) { $photosets_map[$photoset['id']] = $photoset['title']['_content']; } } $rsp_obj = $pf->galleries_getList($user_id); if (!$pf->error_code) { foreach ($rsp_obj['galleries']['gallery'] as $gallery) { $galleries_map[$gallery['id']] = $gallery['title']['_content']; } } if (get_option('afg_flickr_token')) { $rsp_obj = $pf->groups_pools_getGroups(); if (!$pf->error_code) { foreach ($rsp_obj['group'] as $group) { $groups_map[$group['nsid']] = $group['name']; } } } else { $rsp_obj = $pf->people_getPublicGroups($user_id); if (!$pf->error_code) { foreach ($rsp_obj as $group) { $groups_map[$group['nsid']] = $group['name']; } } } asort($photosets_map); asort($groups_map); asort($galleries_map); }
function _cacheMiss($cache, $id) { $allLanguages =& Registry::get('allLanguages-' . $cache->cacheId, true, null); if ($allLanguages === null) { // Add a locale load to the debug notes. $notes =& Registry::get('system.debug.notes'); $locale = $cache->cacheId; if ($locale == null) { $locale = AppLocale::getLocale(); } $filename = $this->getLanguageFilename($locale); $notes[] = array('debug.notes.languageListLoad', array('filename' => $filename)); // Reload locale registry file $xmlDao = new XMLDAO(); $data = $xmlDao->parseStruct($filename, array('language')); // Build array with ($charKey => array(stuff)) if (isset($data['language'])) { foreach ($data['language'] as $languageData) { $allLanguages[$languageData['attributes']['code']] = array($languageData['attributes']['name']); } } if (is_array($allLanguages)) { asort($allLanguages); } $cache->setEntireCache($allLanguages); } if (isset($allLanguages[$id])) { return $allLanguages[$id]; } else { return null; } }
function ArraySortBy($Array, $ValueKey, $SortFlag = SORT_NUMERIC, $Reverse = false, $DefaultValue = NULL) { $Keys = array(); if (is_array($ValueKey)) { $ValueFunction = $ValueKey[1]; $ValueKey = $ValueKey[0]; } foreach ($Array as $Key => $SubArray) { if (is_array($SubArray)) { if (array_key_exists($ValueKey, $SubArray)) { if (isset($ValueFunction)) { $Keys[$Key] = $ValueFunction($SubArray[$ValueKey]); } else { $Keys[$Key] = $SubArray[$ValueKey]; } } else { $Keys[$Key] = $DefaultValue; } } } if ($Reverse) { arsort($Keys, $SortFlag); } else { asort($Keys, $SortFlag); } $Result = array(); foreach ($Keys as $Key => $Value) { $Result[] = $Array[$Key]; } return $Result; }
public function renderEditControl(array $handles) { $engines = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorApplicationSearchEngine')->loadObjects(); $value = $this->getFieldValue(); $queries = array(); $seen = false; foreach ($engines as $engine_class => $engine) { $engine->setViewer($this->getViewer()); $engine_queries = $engine->loadEnabledNamedQueries(); $query_map = mpull($engine_queries, 'getQueryName', 'getQueryKey'); asort($query_map); foreach ($query_map as $key => $name) { $queries[$engine_class][] = array('key' => $key, 'name' => $name); if ($key == $value) { $seen = true; } } } if (strlen($value) && !$seen) { $name = pht('Custom Query ("%s")', $value); } else { $name = pht('(None)'); } $options = array($value => $name); $app_control_key = $this->getFieldConfigValue('control.application'); Javelin::initBehavior('dashboard-query-panel-select', array('applicationID' => $this->getFieldControlID($app_control_key), 'queryID' => $this->getFieldControlID(), 'options' => $queries, 'value' => array('key' => strlen($value) ? $value : null, 'name' => $name))); return id(new AphrontFormSelectControl())->setID($this->getFieldControlID())->setLabel($this->getFieldName())->setCaption($this->getCaption())->setName($this->getFieldKey())->setValue($this->getFieldValue())->setOptions($options); }
public function init() { //cached data not outdated? $this->events = $this->pdc->get('pdh_calendar_events_table.events'); $this->repeatable_events = $this->pdc->get('pdh_calendar_events_table.repeatable'); $this->event_timestamps = $this->pdc->get('pdh_calendar_events_table.timestamps'); if ($this->events !== NULL && $this->repeatable_events !== NULL && $this->event_timestamps !== NULL) { return true; } $objQuery = $this->db->query("SELECT * FROM __calendar_events"); if ($objQuery) { while ($row = $objQuery->fetchAssoc()) { $this->events[$row['id']] = array('id' => (int) $row['id'], 'calendar_id' => (int) $row['calendar_id'], 'name' => $row['name'], 'creator' => (int) $row['creator'], 'timestamp_start' => (int) $row['timestamp_start'], 'timestamp_end' => (int) $row['timestamp_end'], 'allday' => (int) $row['allday'], 'private' => (int) $row['private'], 'visible' => (int) $row['visible'], 'closed' => (int) $row['closed'], 'notes' => $row['notes'], 'repeating' => (int) $row['repeating'], 'cloneid' => (int) $row['cloneid'], 'timezone' => $row['timezone']); $this->events[$row['id']]['extension'] = unserialize($row['extension']); $this->event_timestamps[$row['id']] = (int) $row['timestamp_start']; // set the repeatable array if ((int) $row['repeating'] > 0) { $parentid = (int) $row['cloneid'] > 0 ? (int) $row['cloneid'] : (int) $row['id']; $this->repeatable_events[$parentid][] = (int) $row['id']; } } // sort the timestamps if (is_array($this->event_timestamps)) { asort($this->event_timestamps); } // set the cache $this->pdc->put('pdh_calendar_events_table.events', $this->events, null); $this->pdc->put('pdh_calendar_events_table.repeatable', $this->repeatable_events, null); $this->pdc->put('pdh_calendar_events_table.timestamps', $this->event_timestamps, null); } }
/** * {@inheritdoc} */ public function normalize($object, $format = null, array $context = []) { $data = parent::normalize($object, $format, $context); asort($data['attributes']); $data['attributes'] = implode(',', $data['attributes']); return $data; }
public function init() { $this->setMethod('post'); $this->addElement('text', 'fullname', array('label' => 'Name', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'title')); $this->addElement('text', 'nickname', array('label' => 'Nickname', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text')); $this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'validators' => array('emailAddress'), 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text')); $this->addElement('select', 'gender', array('label' => 'Gender', 'required' => false, 'validators' => array(array('inArray', false, array(array('M', 'F')))), 'multiOptions' => array('' => 'Not specified', 'M' => 'Male', 'F' => 'Female'))); $this->addElement('text', 'dob', array('label' => 'Date of birth (dd/mm/yyyy)', 'required' => false, 'class' => 'text', 'validators' => array(array('date', false, array('d/m/Y'))), 'filters' => array('StringTrim', 'StripTags'))); // get the list of countries $countries = Zend_Locale::getTranslationList('Territory', 'en', 2); asort($countries, SORT_LOCALE_STRING); $country = new Zend_Form_Element_Select('country'); $country->setLabel('Country')->addMultiOption('', 'Not specified')->addMultiOption('GB', 'United Kingdom')->addMultiOptions($countries)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim'); $postcode = new Zend_Form_Element_Text('postcode'); $postcode->setLabel('Postcode')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $languages = Zend_Locale::getTranslationList('Language', 'en'); asort($languages, SORT_LOCALE_STRING); $language = new Zend_Form_Element_Select('language'); $language->setLabel('Language')->addMultiOption('', 'Not specified')->addMultiOption('en_GB', 'British English')->addMultiOptions($languages)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim'); $timeZone = new Zend_Form_Element_Text('timezone'); $timeZone->setLabel('Timezone')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $this->addElements(array($country, $postcode, $language, $timeZone)); $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save')); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset')), array('Description', array('placement' => 'prepend', 'class' => 'error')), 'Form')); }
public function renderDefault() { $clanky = array(); $this->backlink = $this->storeRequest(); $moje_clanky = $this->pravaKClankum($this->redakce->findClankyByAutor($this->getUser()->id)); $clanky_ke_schvaleni = $this->pravaKClankum($this->redakce->clankyKeSchvaleni($this->prava->seznamPrav($this->modul), $this->vyse_prav['vsechny_clanky'])); $seznam_clanku = array_merge($clanky_ke_schvaleni, $moje_clanky); $razeni = array('od' => 'DESC'); if ($this->order) { if (preg_match('~(.*)_DESC~', $this->order, $tmp)) { $razeni = array($tmp[1] => 'DESC'); } else { $razeni = array($this->order => 'ASC'); } if (isset($razeni['rubrika'])) { foreach ($seznam_clanku as $key => $clanek) { $rubriky[$key] = join(' - ', $clanek['rubrika_nazev']); } if ($razeni['rubrika'] == 'ASC') { asort($rubriky); } else { arsort($rubriky); } foreach ($rubriky as $key => $rubrika) { $clanky[] = $seznam_clanku[$key]; } } else { $clanky = $seznam_clanku; } } else { $clanky = $seznam_clanku; } $this->template->clanky = $clanky; $this->template->razeni = $razeni; }
/** * Retrieves the overrides data * * @param boolean True if all overrides shall be returned without considering pagination, defaults to false * * @return array Array of objects containing the overrides of the override.ini file * * @since 2.5 */ public function getOverrides($all = false) { // Get a storage key $store = $this->getStoreId(); // Try to load the data from internal storage if (!empty($this->cache[$store])) { return $this->cache[$store]; } // Parse the override.ini file in oder to get the keys and strings $filename = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . DS . 'language' . DS . 'overrides' . DS . $this->getState('filter.language') . '.override.ini'; $strings = LanguagesHelper::parseFile($filename); // Consider the odering if ($this->getState('list.ordering') == 'text') { if (strtoupper($this->getState('list.direction')) == 'DESC') { arsort($strings); } else { asort($strings); } } else { if (strtoupper($this->getState('list.direction')) == 'DESC') { krsort($strings); } else { ksort($strings); } } // Consider the pagination if (!$all && $this->getState('list.limit') && $this->getTotal() > $this->getState('list.limit')) { $strings = array_slice($strings, $this->getStart(), $this->getState('list.limit'), true); } // Add the items to the internal cache $this->cache[$store] = $strings; return $this->cache[$store]; }
public function processOperations($operations = NULL) { $this->_wires = array(); $return = NULL; if ($operations) { $this->_queue = explode('::', $operations); $changed = true; // Repeat so long as there are items in the queue AND we made a change last pass // (if we didn't, we're stalled, let's bail on this) while ($changed && count($this->_queue > 0)) { asort($this->_queue); $changed = false; foreach ($this->_queue as $k => $operation) { $returnSub = explode(" ", $operation); $returnSub = end($returnSub); $return = $this->processOperation($operation, $returnSub); if ($return) { $changed = true; unset($this->_queue[$k]); } } echo "\n a: " . $this->_wires['a'] . "\n"; } } return $return; }
/** * 程序文件列表 */ public function actionIndex() { if (isset($_POST['id'])) { $files = $_POST['id']; if ($files) { //提交打包 $zip = new ZipArchive(); $name = 'yiifcmsBAK_' . date('YmdHis', time()) . '.zip'; $zipname = WWWPATH . '/' . $name; //创建一个空的zip文件 if ($zip->open($zipname, ZipArchive::OVERWRITE)) { foreach ((array) $files as $file) { if (is_dir($file)) { //递归检索文件 $allfiles = Helper::scanfDir($file, true); foreach ((array) $allfiles['files'] as $v) { $zip->addFile(WWWPATH . '/' . $v, $v); } } else { $zip->addFile(WWWPATH . '/' . $file, $file); } } $zip->close(); //开始下载 Yii::app()->request->sendFile($name, file_get_contents($zipname), '', false); //下载完成后要进行删除 @unlink($zipname); } else { throw new CHttpException('404', 'Failed'); } } } else { $files = Helper::scanfDir(WWWPATH); asort($files['dirs']); asort($files['files']); $files = array_merge($files['dirs'], $files['files']); $listfiles = array(); foreach ($files as $file) { $tmpfilename = explode('/', $file); $filename = end($tmpfilename); if (is_dir($file)) { $allfiles = Helper::scanfDir($file, true); if ($allfiles['files']) { $filesize = 0; foreach ((array) $allfiles['files'] as $val) { $filesize += filesize($val); } } $listfiles[$filename]['type'] = 'dir'; } else { $filesize = filesize($file); $listfiles[$filename]['type'] = 'file'; } $listfiles[$filename]['id'] = $filename; $listfiles[$filename]['size'] = Helper::byteFormat($filesize); $listfiles[$filename]['update_time'] = filemtime($filename); } } $this->render('index', array('listfiles' => $listfiles)); }
public static function &getInstance($config, $force_new_conn = false) { $default['dbdriver'] = 'mysql'; $default['hostname'] = '127.0.0.1'; $default['port'] = '3306'; $default['username'] = '******'; $default['password'] = ''; $default['database'] = 'test'; $default['dbprefix'] = ''; $default['pconnect'] = TRUE; $default['db_debug'] = TRUE; $default['char_set'] = 'utf8'; $default['dbcollat'] = 'utf8_general_ci'; $default['swap_pre'] = ''; $default['autoinit'] = TRUE; $default['stricton'] = FALSE; $config = array_merge($default, $config); $class = 'CI_DB_' . $config['dbdriver'] . '_driver'; if (!class_exists($class, false)) { return null; } $config0 = $config; asort($config0); $hash = md5(sha1(var_export($config0, TRUE))); if ($force_new_conn || !isset(self::$conns[$hash])) { self::$conns[$hash] = new $class($config); } if ($config['dbdriver'] == 'pdo' && stripos($config['hostname'], 'mysql') !== FALSE) { //pdo下面dns设置mysql字符会失效,这里hack一下 self::$conns[$hash]->simple_query('set names ' . $config['char_set']); } return self::$conns[$hash]; }
public function loadAttributeOptions() { $attributes = array('clicks_7' => Mage::helper('feedexport')->__('Last 7-days Clicks'), 'orders_7' => Mage::helper('feedexport')->__('Last 7-days Orders'), 'revenue_7' => Mage::helper('feedexport')->__('Last 7-days Revenue'), 'cr_7' => Mage::helper('feedexport')->__('Last 7-days Conversion Rate (%)'), 'clicks_14' => Mage::helper('feedexport')->__('Last 14-days Clicks'), 'orders_14' => Mage::helper('feedexport')->__('Last 14-days Orders'), 'revenue_14' => Mage::helper('feedexport')->__('Last 14-days Revenue'), 'cr_14' => Mage::helper('feedexport')->__('Last 14-days Conversion Rate (%)'), 'clicks_30' => Mage::helper('feedexport')->__('Last 30-days Clicks'), 'orders_30' => Mage::helper('feedexport')->__('Last 30-days Orders'), 'revenue_30' => Mage::helper('feedexport')->__('Last 30-days Revenue'), 'cr_30' => Mage::helper('feedexport')->__('Last 30-days Conversion Rate (%)')); asort($attributes); $this->setAttributeOption($attributes); return $this; }
/** * 加密/校验流程: * 1. 将token、timestamp、nonce三个参数进行字典序排序 * 2. 将三个参数字符串拼接成一个字符串进行sha1加密 * 3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于易信 * * 若确认此次GET请求来自易信服务器,请原样返回echostr参数内容,则接入生效,否则接入失败。 */ public function join($params) { $signature = $params['signature']; $timestamp = $params['timestamp']; $nonce = $params['nonce']; $echostr = $params['echostr']; $mpa = TMS_APP::G('mp\\mpaccount'); $p = array($mpa->token, $timestamp, $nonce); asort($p); $s = implode('', $p); $ss = sha1($s); if ($ss === $signature) { /** * 断开连接 */ TMS_APP::model()->update('xxt_mpaccount', array('yx_joined' => 'N'), "yx_appid='{$mpa->yx_appid}' and yx_appsecret='{$mpa->yx_appsecret}'"); /** * 确认建立连接 */ TMS_APP::model()->update('xxt_mpaccount', array('yx_joined' => 'Y'), "mpid='{$this->mpid}'"); return array(true, $echostr); } else { return array(false, 'failed'); } }
/** * Set variables up before form is built. * * @return void */ public function preProcess() { $this->_mapperFields = $this->get('fields'); asort($this->_mapperFields); $this->_columnCount = $this->get('columnCount'); $this->assign('columnCount', $this->_columnCount); $this->_dataValues = $this->get('dataValues'); //Separate column names from actual values. $columnNames = $this->_dataValues[0]; //actual values need to be in 2d array ($array[$i][$j]) format to be parsed by the template. $dataValues[] = $this->_dataValues[1]; $this->assign('dataValues', $dataValues); $this->_entity = $this->_multipleCustomData = $this->get('multipleCustomData'); $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); $this->_onDuplicate = $this->get('onDuplicate'); if ($skipColumnHeader) { //showColNames needs to be true to show "Column Names" column $this->assign('showColNames', $skipColumnHeader); $this->assign('columnNames', $columnNames); /* if we had a column header to skip, stash it for later */ $this->_columnHeaders = $this->_dataValues[0]; } $this->assign('rowDisplayCount', 2); $this->assign('highlightedFields', $this->_highlightedFields); }
public function topic($p = 0) { $active_key = $this->redis_event_key_prefix . "topics:valid"; $tid = $this->redis_server->lindex($active_key, $p); $topic = $this->redis_server->lindex($this->redis_event_key_prefix . "topics:all", $tid); // var_dump($tid); // var_dump($topic); $topic = $this->formatString($topic); // var_dump($topic); $topic = json_decode($topic, true); //var_dump($topic); $events = array(); foreach ($topic['events'] as $e) { $event = $this->redis_server->lindex($this->redis_event_key_prefix . "events", $e); //var_dump($event); $event = json_decode($this->formatString($event), true); //var_dump($event); asort($event['keywords']); $events[$e] = $event; } $data['p'] = $p; $data['percentage'] = round(100 * ($p + 1.0) / $this->redis_server->llen($active_key), 2); $data['topic'] = $topic; $data['events'] = $events; $this->assign($data); $this->display(); // var_dump($data); }
public static function getSearchableAttributesAndLabels($viewClassName, $modelClassName) { assert('is_string($viewClassName)'); assert('is_string($modelClassName) && is_subclass_of($modelClassName, "RedBeanModel")'); $searchFormClassName = $viewClassName::getModelForMetadataClassName(); $editableMetadata = $viewClassName::getMetadata(); $designerRulesType = $viewClassName::getDesignerRulesType(); $designerRulesClassName = $designerRulesType . 'DesignerRules'; $designerRules = new $designerRulesClassName(); $modelAttributesAdapter = DesignerModelToViewUtil::getModelAttributesAdapter($viewClassName, $modelClassName); $derivedAttributesAdapter = new DerivedAttributesAdapter($modelClassName); $attributeCollection = array_merge($modelAttributesAdapter->getAttributes(), $derivedAttributesAdapter->getAttributes()); $attributesLayoutAdapter = AttributesLayoutAdapterUtil::makeAttributesLayoutAdapter($attributeCollection, $designerRules, $editableMetadata); $attributeIndexOrDerivedTypeAndLabels = array(); foreach ($attributesLayoutAdapter->makeDesignerLayoutAttributes()->get() as $attributeIndexOrDerivedType => $data) { //special case with anyMixedAttributes since it is searchable but in the basic search part so never dynamically searchable if ($searchFormClassName::isAttributeSearchable($attributeIndexOrDerivedType) && $attributeIndexOrDerivedType != 'anyMixedAttributes') { $attributeIndexOrDerivedTypeAndLabels[$attributeIndexOrDerivedType] = $data['attributeLabel']; } } self::resolveAndAddViewDefinedNestedAttributes($modelAttributesAdapter->getModel(), $viewClassName, $attributeIndexOrDerivedTypeAndLabels); if (is_subclass_of($viewClassName, 'DynamicSearchView')) { $viewClassName::resolveAttributeIndexOrDerivedTypeAndLabelsForDynamicSearchRow($attributeIndexOrDerivedTypeAndLabels); } asort($attributeIndexOrDerivedTypeAndLabels); return $attributeIndexOrDerivedTypeAndLabels; }
/** */ public function __construct() { $this->_autoIncludeIndexedFieldsAsOrderBys = 1; // Check if CiviCampaign is a) enabled and b) has active campaigns $config = CRM_Core_Config::singleton(); $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); if ($campaignEnabled) { $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); $this->activeCampaigns = $getCampaigns['campaigns']; asort($this->activeCampaigns); } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge(array('sort_name_linked' => array('title' => ts('Participant Name'), 'required' => TRUE, 'no_repeat' => TRUE, 'dbAlias' => 'contact_civireport.sort_name')), $this->getBasicContactFields(), array('age_at_event' => array('title' => ts('Age at Event'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Participant Name'), 'operator' => 'like'), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields', 'filters' => array('email' => array('title' => ts('Participant E-mail'), 'operator' => 'like'))), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'supplemental_address_1' => NULL, 'supplemental_address_2' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID'), 'participant_record' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'event_id' => array('default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'status_id' => array('title' => ts('Status'), 'default' => TRUE), 'role_id' => array('title' => ts('Role'), 'default' => TRUE), 'fee_currency' => array('required' => TRUE, 'no_display' => TRUE), 'registered_by_id' => array('title' => ts('Registered by Participant ID')), 'participant_fee_level' => NULL, 'participant_fee_amount' => array('title' => ts('Participant Fee')), 'participant_register_date' => array('title' => ts('Registration Date')), 'total_paid' => array('title' => ts('Total Paid'), 'dbAlias' => 'SUM(ft.total_amount)', 'type' => 1024), 'balance' => array('title' => ts('Balance'), 'dbAlias' => 'participant_civireport.fee_amount - SUM(ft.total_amount)', 'type' => 1024)), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, 'attributes' => array('entity' => 'event', 'select' => array('minimumInputLength' => 0))), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label')), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole()), 'participant_register_date' => array('title' => 'Registration Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'fee_currency' => array('title' => ts('Fee Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'registered_by_id' => array('title' => ts('Registered by Participant ID'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like')), 'order_bys' => array('participant_register_date' => array('title' => ts('Registration Date'), 'default_weight' => '1', 'default_order' => 'ASC'), 'event_id' => array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'fields' => array('event_type_id' => array('title' => ts('Event Type')), 'event_start_date' => array('title' => ts('Event Start Date'))), 'grouping' => 'event-fields', 'filters' => array('eid' => array('name' => 'event_type_id', 'title' => ts('Event Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type')), 'event_start_date' => array('title' => ts('Event Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE)), 'order_bys' => array('event_type_id' => array('title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC'), 'event_start_date' => array('title' => ts('Event Start Date')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type')), 'receive_date' => array('title' => ts('Payment Date')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'fee_amount' => array('title' => ts('Transaction Fee')), 'net_amount' => NULL), 'grouping' => 'contrib-fields', 'filters' => array('receive_date' => array('title' => 'Payment Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => ts('Contribution Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => NULL))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'grouping' => 'priceset-fields', 'filters' => array('price_field_value_id' => array('name' => 'price_field_value_id', 'title' => ts('Fee Level'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->getPriceLevels())))); $this->_options = array('blank_column_begin' => array('title' => ts('Blank column at the Begining'), 'type' => 'checkbox'), 'blank_column_end' => array('title' => ts('Blank column at the End'), 'type' => 'select', 'options' => array('' => '-select-', 1 => ts('One'), 2 => ts('Two'), 3 => ts('Three')))); // CRM-17115 avoid duplication of sort_name - would be better to standardise name // & behaviour across reports but trying for no change at this point. $this->_columns['civicrm_contact']['fields']['sort_name']['no_display'] = TRUE; // If we have active campaigns add those elements to both the fields and filters if ($campaignEnabled && !empty($this->activeCampaigns)) { $this->_columns['civicrm_participant']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false'); $this->_columns['civicrm_participant']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns); $this->_columns['civicrm_participant']['order_bys']['campaign_id'] = array('title' => ts('Campaign')); } $this->_currencyColumn = 'civicrm_participant_fee_currency'; parent::__construct(); }
protected function identifiers() { $refl = new \ReflectionClass($this); $constants = $refl->getConstants(); asort($constants); return $constants; }
public static function sort($array) { $widest = 0; $result = array(); foreach ($array as $item) { $vsi = self::parse_version_word($item); foreach ($vsi as $it) { $tmp = strlen($it); if ($widest < $tmp) { $widest = $tmp; } } $result[$item] = $vsi; } $normalized = array(); foreach ($result as $key => $item) { foreach ($item as $b) { $length = strlen($b); if (ctype_digit((string) $b[0])) { for ($i = 0; $i < $widest - $length; $i++) { @($normalized[$key] .= ' '); } } @($normalized[$key] .= $b); if (ctype_alpha((string) $b[0])) { for ($i = 0; $i < $widest - $length; $i++) { @($normalized[$key] .= ' '); } } } } asort($normalized); return array_keys($normalized); }
function __construct() { $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); $count = $date['maxYear']; while ($date['minYear'] <= $count) { $optionYear[$date['minYear']] = $date['minYear']; $date['minYear']++; } // Check if CiviCampaign is a) enabled and b) has active campaigns $config = CRM_Core_Config::singleton(); $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); if ($campaignEnabled) { $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE); $this->activeCampaigns = $getCampaigns['campaigns']; asort($this->activeCampaigns); } $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'last_name' => array('title' => ts('Last Name')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE)))) + $this->addAddressFields() + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y')), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group())))); // If we have a campaign, build out the relevant elements if ($campaignEnabled && !empty($this->activeCampaigns)) { $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false'); $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns); } $this->_tagFilter = TRUE; parent::__construct(); }