/**
  * Gets array for stages
  * @return array
  */
 protected function getStageDropDownArray()
 {
     $filterStages = CampaignItemsConfigurationForm::getFilterStages();
     foreach ($filterStages as $key => $stageString) {
         $type = CampaignItemsConfigurationForm::resolveCampaignItemActivityType($key);
         $count = CampaignItem::getByTypeAndCampaignId($type, (int) $this->params['relationModel']->id, null, true);
         $filterStages[$key] = $stageString . " ({$count})";
     }
     $data = array_merge(array(CampaignItemsConfigurationForm::FILTERED_BY_ALL_STAGES => Zurmo::t('Core', 'All')), $filterStages);
     return $data;
 }
 /**
  *
  * Override to filter by email message stage
  */
 protected function makeSearchAttributeData()
 {
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => $this->getRelationAttributeName(), 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => (int) $this->params['relationModel']->id));
     $searchAttributeData['structure'] = '1';
     if ($this->configurationForm->filteredByStage != CampaignItemsConfigurationForm::FILTERED_BY_ALL_STAGES) {
         $type = CampaignItemsConfigurationForm::resolveCampaignItemActivityType($this->configurationForm->filteredByStage);
         $searchAttributeData['clauses'][2] = array('attributeName' => 'campaignItemActivities', 'relatedAttributeName' => 'type', 'operatorType' => 'equals', 'value' => $type);
         $searchAttributeData['structure'] = '1 AND 2';
     }
     return $searchAttributeData;
 }