<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
protected $_surveyActivities;
/**
- * Build all the data structures needed to build the form
+ * Build all the data structures needed to build the form.
*
* @return void
- * @access public
- */ function preProcess() {
+ */
+ public function preProcess() {
$this->_interviewToRelease = $this->get('interviewToRelease');
if ($this->_interviewToRelease) {
//user came from interview form.
foreach (array(
- 'surveyId', 'contactIds', 'interviewerId') as $fld) {
+ 'surveyId',
+ 'contactIds',
+ 'interviewerId',
+ ) as $fld) {
$this->{"_$fld"} = $this->get($fld);
}
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$statusIds = array();
foreach (array(
- 'Scheduled') as $name) {
+ 'Scheduled',
+ ) as $name) {
if ($statusId = array_search($name, $activityStatus)) {
$statusIds[] = $statusId;
}
}
/**
- * Build the form object
+ * Build the form object.
*
- * @access public
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$this->addDefaultButtons(ts('Release Respondents'), 'done');
}
- function postProcess() {
+ public function postProcess() {
$deleteActivityIds = array();
foreach ($this->_contactIds as $cid) {
if (array_key_exists($cid, $this->_surveyActivities)) {
}
}
- //set survey activites as deleted = true.
+ //set survey activities as deleted = true.
if (!empty($deleteActivityIds)) {
$query = 'UPDATE civicrm_activity SET is_deleted = 1 WHERE id IN ( ' . implode(', ', $deleteActivityIds) . ' )';
CRM_Core_DAO::executeQuery($query);
- $status = array(ts("%1 respondent(s) have been released.", array(1 => count($deleteActivityIds))));
+ if ($deleteActivityIds) {
+ $status = ts("Respondent has been released.", array(
+ 'count' => count($deleteActivityIds),
+ 'plural' => '%count respondents have been released.',
+ ));
+ CRM_Core_Session::setStatus($status, ts('Released'), 'success');
+ }
+
if (count($this->_contactIds) > count($deleteActivityIds)) {
- $status[] = ts("%1 respondents did not release.",
- array(1 => (count($this->_contactIds) - count($deleteActivityIds)))
+ $status = ts('1 respondent did not release.',
+ array(
+ 'count' => (count($this->_contactIds) - count($deleteActivityIds)),
+ 'plural' => '%count respondents did not release.',
+ )
);
+ CRM_Core_Session::setStatus($status, ts('Notice'), 'alert');
}
- CRM_Core_Session::setStatus(implode(' ', $status), '', 'info');
}
}
-}
+}