Skip to content

Commit

Permalink
Dev: Export filtered participants (CPDB, WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Dec 2, 2016
1 parent ab8c603 commit fe45034
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -160,9 +160,9 @@ public function editValueParticipantPanel()
/**
* Export to csv using optional search/filter
*
* @todo Return value never checked?
* @param type $search CDCriteria?
* @paran mixed $mAttributeIDs Empty array for no attributes, or array of attribute IDs or null for all attributes
*
* @param CDCriteria $search
* @paran mixed $aAttributeIDs Empty array for no attributes, or array of attribute IDs or null for all attributes
* @return boolean
*/
private function csvExport($search = null, $aAttributeIDs = null)
Expand Down Expand Up @@ -1117,8 +1117,16 @@ public function exporttocsv()
$search = $searchSelected;
}

if ($filteredOrSelected == 'filtered') {
$p = new Participant();
$p->setAttributes(Yii::app()->request->getPost('Participant'));
$dataProvider = $p->search();
$dataProvider->setPagination(false);
$search = $dataProvider->getCriteria();
}

$aAttributes=explode('+',Yii::app()->request->getPost('attributes',''));
$this->csvExport($search,$aAttributes);
$this->csvExport($search, $aAttributes);
}

/**
Expand Down
1 change: 1 addition & 0 deletions application/models/Participant.php
Expand Up @@ -740,6 +740,7 @@ public function getParticipantsCount($attid, $search = null, $userid = null) {
}

/**
* @param boolean $count
* @param integer $page
* @param integer $limit
* @return CDbCommand
Expand Down

0 comments on commit fe45034

Please sign in to comment.