本文整理汇总了PHP中CRM_Campaign_BAO_Survey::getSurveySummary方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Campaign_BAO_Survey::getSurveySummary方法的具体用法?PHP CRM_Campaign_BAO_Survey::getSurveySummary怎么用?PHP CRM_Campaign_BAO_Survey::getSurveySummary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Campaign_BAO_Survey
的用法示例。
在下文中一共展示了CRM_Campaign_BAO_Survey::getSurveySummary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
function browse()
{
$surveys = CRM_Campaign_BAO_Survey::getSurveySummary();
if (!empty($surveys)) {
$surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
$campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
$activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, FALSE, 'name');
foreach ($surveys as $sid => $survey) {
$surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
$surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
$surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
$action = array_sum(array_keys($this->actionLinks()));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid));
}
}
$this->assign('surveys', $surveys);
$this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
}
示例2: surveyList
/**
* This function uses the deprecated v1 datatable api and needs updating. See CRM-16353.
* @deprecated
*/
public function surveyList()
{
//get the search criteria params.
$searchCriteria = CRM_Utils_Request::retrieve('searchCriteria', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'POST');
$searchParams = explode(',', $searchCriteria);
$params = $searchRows = array();
foreach ($searchParams as $param) {
if (!empty($_POST[$param])) {
$params[$param] = $_POST[$param];
}
}
//this is sequence columns on datatable.
$selectorCols = array('id', 'title', 'campaign_id', 'campaign', 'activity_type_id', 'activity_type', 'release_frequency', 'default_number_of_contacts', 'max_number_of_contacts', 'is_default', 'is_active', 'isActive', 'result_id', 'action', 'voterLinks');
// get the data table params.
$dataTableParams = array('sEcho' => array('name' => 'sEcho', 'type' => 'Integer', 'default' => 0), 'offset' => array('name' => 'iDisplayStart', 'type' => 'Integer', 'default' => 0), 'rowCount' => array('name' => 'iDisplayLength', 'type' => 'Integer', 'default' => 25), 'sort' => array('name' => 'iSortCol_0', 'type' => 'Integer', 'default' => 'created_date'), 'sortOrder' => array('name' => 'sSortDir_0', 'type' => 'String', 'default' => 'desc'));
foreach ($dataTableParams as $pName => $pValues) {
${$pName} = $pValues['default'];
if (!empty($_POST[$pValues['name']])) {
${$pName} = CRM_Utils_Type::escape($_POST[$pValues['name']], $pValues['type']);
if ($pName == 'sort') {
${$pName} = $selectorCols[${$pName}];
}
}
}
foreach (array('sort', 'offset', 'rowCount', 'sortOrder') as $sortParam) {
$params[$sortParam] = ${$sortParam};
}
$surveys = CRM_Campaign_Page_DashBoard::getSurveySummary($params);
$searchCount = CRM_Campaign_BAO_Survey::getSurveySummary($params, TRUE);
$iTotal = $searchCount;
if ($searchCount > 0) {
if ($searchCount < $offset) {
$offset = 0;
}
foreach ($surveys as $surveyID => $values) {
foreach ($selectorCols as $col) {
$searchRows[$surveyID][$col] = CRM_Utils_Array::value($col, $values);
}
}
}
$selectorElements = $selectorCols;
$iFilteredTotal = $iTotal;
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例3: getSurveySummary
/**
* @param array $params
*
* @return array
*/
public static function getSurveySummary($params = array())
{
$surveysData = array();
//get the survey.
$config = CRM_Core_Config::singleton();
$surveys = CRM_Campaign_BAO_Survey::getSurveySummary($params);
if (!empty($surveys)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
$surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
foreach ($surveys as $sid => $survey) {
$surveysData[$sid] = $survey;
$campaignId = CRM_Utils_Array::value('campaign_id', $survey);
$surveysData[$sid]['campaign'] = CRM_Utils_Array::value($campaignId, $campaigns);
$surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']];
if (!empty($survey['release_frequency'])) {
$surveysData[$sid]['release_frequency'] = ts('1 Day', array('plural' => '%count Days', 'count' => $survey['release_frequency']));
}
$action = array_sum(array_keys(self::surveyActionLinks($surveysData[$sid]['activity_type'])));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$isActive = ts('No');
if ($surveysData[$sid]['is_active']) {
$isActive = ts('Yes');
}
$surveysData[$sid]['isActive'] = $isActive;
$isDefault = NULL;
if ($surveysData[$sid]['is_default']) {
$isDefault = '<img src="' . $config->resourceBase . 'i/check.gif" alt="' . ts('Default') . '" />';
}
$surveysData[$sid]['is_default'] = $isDefault;
if ($surveysData[$sid]['result_id']) {
$resultSet = '<a href= "javascript:displayResultSet( ' . $sid . ',' . "'" . $surveysData[$sid]['title'] . "'" . ', ' . $surveysData[$sid]['result_id'] . ' )" title="' . ts('view result set') . '">' . ts('Result Set') . '</a>';
$surveysData[$sid]['result_id'] = $resultSet;
} else {
$resultUrl = CRM_Utils_System::url("civicrm/survey/configure/results", "action=update&id={$sid}&reset=1");
$surveysData[$sid]['result_id'] = "<a href='{$resultUrl}' class='status-warning'>(" . ts('Incomplete. Click to configure result set.') . ')</a>';
}
$surveysData[$sid]['action'] = CRM_Core_Action::formLink(self::surveyActionLinks($surveysData[$sid]['activity_type']), $action, array('id' => $sid), ts('more'), FALSE, 'survey.dashboard.row', 'Survey', $sid);
if (CRM_Utils_Array::value('activity_type', $surveysData[$sid]) != 'Petition') {
$surveysData[$sid]['voterLinks'] = CRM_Campaign_BAO_Survey::buildPermissionLinks($sid, TRUE, ts('more'));
}
if ($reportID = CRM_Campaign_BAO_Survey::getReportID($sid)) {
$url = CRM_Utils_System::url("civicrm/report/instance/{$reportID}", 'reset=1');
$surveysData[$sid]['title'] = "<a href='{$url}' title='View Survey Report'>{$surveysData[$sid]['title']}</a>";
}
}
}
return $surveysData;
}
示例4: getSurveySummary
function getSurveySummary($params = array())
{
$surveysData = array();
//get the survey.
$config = CRM_Core_Config::singleton();
$surveys = CRM_Campaign_BAO_Survey::getSurveySummary($params);
if (!empty($surveys)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
$surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
foreach ($surveys as $sid => $survey) {
$surveysData[$sid] = $survey;
$campaignId = CRM_Utils_Array::value('campaign_id', $survey);
$surveysData[$sid]['campaign'] = CRM_Utils_Array::value($campaignId, $campaigns);
$surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']];
if (CRM_Utils_Array::value('release_frequency', $survey)) {
$surveysData[$sid]['release_frequency'] = $survey['release_frequency'] . ' Day(s)';
}
$action = array_sum(array_keys(self::surveyActionLinks($surveysData[$sid]['activity_type'])));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$isActive = ts('No');
if ($surveysData[$sid]['is_active']) {
$isActive = ts('Yes');
}
$surveysData[$sid]['isActive'] = $isActive;
$isDefault = NULL;
if ($surveysData[$sid]['is_default']) {
$isDefault = '<img src="' . $config->resourceBase . 'i/check.gif" alt="' . ts('Default') . '" />';
}
$surveysData[$sid]['is_default'] = $isDefault;
if ($surveysData[$sid]['result_id']) {
$resultSet = '<a href= "javascript:displayResultSet( ' . $sid . ',' . "'" . $surveysData[$sid]['title'] . "'" . ', ' . $surveysData[$sid]['result_id'] . ' )">' . ts('Result Set') . '</a>';
$surveysData[$sid]['result_id'] = $resultSet;
}
$surveysData[$sid]['action'] = CRM_Core_Action::formLink(self::surveyActionLinks($surveysData[$sid]['activity_type']), $action, array('id' => $sid));
if (CRM_Utils_Array::value('activity_type', $surveysData[$sid]) != 'Petition') {
$surveysData[$sid]['voterLinks'] = CRM_Campaign_BAO_Survey::buildPermissionLinks($sid, TRUE, ts('more'));
}
}
}
return $surveysData;
}