本文整理汇总了PHP中CRM_Contribute_BAO_ContributionPage::getSectionInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_ContributionPage::getSectionInfo方法的具体用法?PHP CRM_Contribute_BAO_ContributionPage::getSectionInfo怎么用?PHP CRM_Contribute_BAO_ContributionPage::getSectionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_ContributionPage
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_ContributionPage::getSectionInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
static function process(&$form)
{
if ($form->getVar('_id') <= 0) {
return NULL;
}
$tabs = array('settings' => array('title' => ts('Title'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'amount' => array('title' => ts('Amounts'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'membership' => array('title' => ts('Memberships'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'thankyou' => array('title' => ts('Receipt'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'friend' => array('title' => ts('Tell a Friend'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'custom' => array('title' => ts('Profiles'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'premium' => array('title' => ts('Premiums'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'widget' => array('title' => ts('Widgets'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'pcp' => array('title' => ts('Personal Campaigns'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE));
$contribPageId = $form->getVar('_id');
$fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
// Hack for special cases.
switch ($className) {
case 'Contribute':
$attributes = $form->getVar('_attributes');
$class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
break;
case 'MembershipBlock':
$class = 'membership';
break;
default:
$class = strtolower($className);
break;
}
$qfKey = $form->get('qfKey');
$form->assign('qfKey', $qfKey);
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = TRUE;
}
if ($contribPageId) {
$reset = CRM_Utils_Array::value('reset', $_GET) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
$tabs[$key]['link'] = CRM_Utils_System::url("civicrm/admin/contribute/{$key}", "{$reset}action=update&snippet=4&id={$contribPageId}&qfKey={$qfKey}");
$tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE;
}
//get all section info.
$contriPageInfo = CRM_Contribute_BAO_ContributionPage::getSectionInfo(array($contribPageId));
foreach ($contriPageInfo[$contribPageId] as $section => $info) {
if (!$info) {
$tabs[$section]['valid'] = FALSE;
}
}
}
return $tabs;
}
示例2: browse
/**
* Browse all contribution pages.
*
* @param mixed $action
* Unused parameter.
*/
public function browse($action = NULL)
{
Civi::resources()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
// @todo Unused local variable can be safely removed.
// But are there any side effects of CRM_Utils_Request::retrieve() that we
// need to preserve?
$createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
if ($this->_sortByCharacter == 'all' || !empty($_POST)) {
$this->_sortByCharacter = '';
$this->set('sortByCharacter', '');
}
$this->search();
$params = array();
$whereClause = $this->whereClause($params, FALSE);
$this->pagerAToZ($whereClause, $params);
$params = array();
$whereClause = $this->whereClause($params, TRUE);
$this->pager($whereClause, $params);
list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
//check for delete CRM-4418
$allowToDelete = CRM_Core_Permission::check('delete in CiviContribute');
$query = "\n SELECT id\n FROM civicrm_contribution_page\n WHERE {$whereClause}\n ORDER BY is_active desc, title asc\n LIMIT {$offset}, {$rowCount}";
$contribPage = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Contribute_DAO_ContributionPage');
$contribPageIds = array();
while ($contribPage->fetch()) {
$contribPageIds[$contribPage->id] = $contribPage->id;
}
//get all section info.
$contriPageSectionInfo = CRM_Contribute_BAO_ContributionPage::getSectionInfo($contribPageIds);
$query = "\nSELECT *\nFROM civicrm_contribution_page\nWHERE {$whereClause}\nORDER BY is_active desc, title asc\n LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Contribute_DAO_ContributionPage');
//get all campaigns.
$allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
//get configure actions links.
$configureActionLinks = self::configureActionLinks();
while ($dao->fetch()) {
$contribution[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $contribution[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->actionLinks()));
//add configure actions links.
$action += array_sum(array_keys($configureActionLinks));
//add online contribution links.
$action += array_sum(array_keys(self::onlineContributionLinks()));
//add contribution search links.
$action += array_sum(array_keys(self::contributionLinks()));
if ($dao->is_active) {
$action -= (int) CRM_Core_Action::ENABLE;
} else {
$action -= (int) CRM_Core_Action::DISABLE;
}
//CRM-4418
if (!$allowToDelete) {
$action -= (int) CRM_Core_Action::DELETE;
}
//build the configure links.
$sectionsInfo = CRM_Utils_Array::value($dao->id, $contriPageSectionInfo, array());
$contribution[$dao->id]['configureActionLinks'] = CRM_Core_Action::formLink(self::formatConfigureLinks($sectionsInfo), $action, array('id' => $dao->id), ts('Configure'), TRUE, 'contributionpage.configure.actions', 'ContributionPage', $dao->id);
//build the contributions links.
$contribution[$dao->id]['contributionLinks'] = CRM_Core_Action::formLink(self::contributionLinks(), $action, array('id' => $dao->id), ts('Contributions'), TRUE, 'contributionpage.contributions.search', 'ContributionPage', $dao->id);
//build the online contribution links.
$contribution[$dao->id]['onlineContributionLinks'] = CRM_Core_Action::formLink(self::onlineContributionLinks(), $action, array('id' => $dao->id), ts('Links'), TRUE, 'contributionpage.online.links', 'ContributionPage', $dao->id);
//build the normal action links.
$contribution[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id), ts('more'), TRUE, 'contributionpage.action.links', 'ContributionPage', $dao->id);
//show campaigns on selector.
$contribution[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
}
if (isset($contribution)) {
$this->assign('rows', $contribution);
}
}
示例3: browse
/**
* Browse all contribution pages
*
* @return void
* @access public
* @static
*/
function browse($action = null)
{
$this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
$createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false, 0);
if ($this->_sortByCharacter == 1 || !empty($_POST)) {
$this->_sortByCharacter = '';
$this->set('sortByCharacter', '');
}
$this->search();
$params = array();
$whereClause = $this->whereClause($params, false);
$this->pagerAToZ($whereClause, $params);
$params = array();
$whereClause = $this->whereClause($params, true);
$this->pager($whereClause, $params);
list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
//check for delete CRM-4418
require_once 'CRM/Core/Permission.php';
$allowToDelete = CRM_Core_Permission::check('delete in CiviContribute');
$query = "\n SELECT id\n FROM civicrm_contribution_page\n WHERE {$whereClause}\n LIMIT {$offset}, {$rowCount}";
$contribPage = CRM_Core_DAO::executeQuery($query, $params, true, 'CRM_Contribute_DAO_ContributionPage');
$contribPageIds = array();
while ($contribPage->fetch()) {
$contribPageIds[$contribPage->id] = $contribPage->id;
}
//get all section info.
$contriPageSectionInfo = CRM_Contribute_BAO_ContributionPage::getSectionInfo($contribPageIds);
$query = "\nSELECT *\nFROM civicrm_contribution_page\nWHERE {$whereClause}\nORDER BY title asc\n LIMIT {$offset}, {$rowCount}";
$dao = CRM_Core_DAO::executeQuery($query, $params, true, 'CRM_Contribute_DAO_ContributionPage');
//get configure actions links.
$configureActionLinks = self::configureActionLinks();
while ($dao->fetch()) {
$contribution[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $contribution[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->actionLinks()));
//add configure actions links.
$action += array_sum(array_keys($configureActionLinks));
//add online contribution links.
$action += array_sum(array_keys(self::onlineContributionLinks()));
//add contribution search links.
$action += array_sum(array_keys(self::contributionLinks()));
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
//CRM-4418
if (!$allowToDelete) {
$action -= CRM_Core_Action::DELETE;
}
//build the configure links.
$sectionsInfo = CRM_Utils_Array::value($dao->id, $contriPageSectionInfo, array());
$contribution[$dao->id]['configureActionLinks'] = CRM_Core_Action::formLink(self::formatConfigureLinks($sectionsInfo), $action, array('id' => $dao->id), ts('Configure'), true);
//build the contributions links.
$contribution[$dao->id]['contributionLinks'] = CRM_Core_Action::formLink(self::contributionLinks(), $action, array('id' => $dao->id), ts('Contributions'), true);
//build the online contribution links.
$contribution[$dao->id]['onlineContributionLinks'] = CRM_Core_Action::formLink(self::onlineContributionLinks(), $action, array('id' => $dao->id), ts('Links'), true);
//build the normal action links.
$contribution[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id), ts('more'), true);
}
if (isset($contribution)) {
$this->assign('rows', $contribution);
}
}