本文整理匯總了PHP中CRM_Campaign_BAO_Survey::buildPermissionLinks方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Campaign_BAO_Survey::buildPermissionLinks方法的具體用法?PHP CRM_Campaign_BAO_Survey::buildPermissionLinks怎麽用?PHP CRM_Campaign_BAO_Survey::buildPermissionLinks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Campaign_BAO_Survey
的用法示例。
在下文中一共展示了CRM_Campaign_BAO_Survey::buildPermissionLinks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: 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;
}
示例3: browseSurvey
function browseSurvey()
{
$surveysData = array();
//get the survey.
$surveys = CRM_Campaign_BAO_Survey::getSurvey(true);
if (!empty($surveys)) {
$campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
$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_id'] = 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($this->surveyActionLinks($surveysData[$sid]['activity_type'])));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$surveysData[$sid]['action'] = CRM_Core_Action::formLink($this->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);
}
}
}
$this->assign('surveys', $surveysData);
$this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
}