Ejemplo n.º 1
0
 /**
  * Get the action links for this page.
  *
  * @return array $_actionLinks
  *
  */
 function &actionLinks()
 {
     // check if variable _actionsLinks is populated
     if (!isset(self::$_actionLinks)) {
         // helper variable for nicer formatting
         $deleteExtra = ts('Are you sure you want to delete this Contribution page?');
         $copyExtra = ts('Are you sure you want to make a copy of this Contribution page?');
         self::$_actionLinks = array(CRM_Core_Action::UPDATE => array('name' => ts('Configure'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'reset=1&action=update&id=%%id%%', 'title' => ts('Configure')), CRM_Core_Action::PREVIEW => array('name' => ts('Test-drive'), 'url' => 'civicrm/contribute/transact', 'qs' => 'reset=1&action=preview&id=%%id%%', 'title' => ts('Preview')), CRM_Core_Action::FOLLOWUP => array('name' => ts('Live Page'), 'url' => 'civicrm/contribute/transact', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('FollowUp')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'title' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_ContributionPage' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action'), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_ContributionPage' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=delete&reset=1&id=%%id%%', 'title' => ts('Delete Custom Field'), 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"'), CRM_Core_Action::COPY => array('name' => ts('Copy Contribution Page'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'action=copy&gid=%%id%%', 'title' => ts('Make a Copy of CiviCRM Contribution Page'), 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"'));
     }
     return self::$_actionLinks;
 }
Ejemplo n.º 2
0
 /**
  * Get the contributions links.
  *
  * @return array
  */
 public function &contributionLinks()
 {
     if (!isset(self::$_contributionLinks)) {
         //get contribution dates.
         $dates = CRM_Contribute_BAO_Contribution::getContributionDates();
         $now = $dates['now'];
         $yearDate = $dates['yearDate'];
         $monthDate = $dates['monthDate'];
         $yearNow = $yearDate + 10000;
         $urlString = 'civicrm/contribute/search';
         $urlParams = 'reset=1&pid=%%id%%&force=1&test=0';
         self::$_contributionLinks = array(CRM_Core_Action::DETACH => array('name' => ts('Current Month-To-Date'), 'title' => ts('Current Month-To-Date'), 'url' => $urlString, 'qs' => "{$urlParams}&start={$monthDate}&end={$now}", 'uniqueName' => 'current_month_to_date'), CRM_Core_Action::REVERT => array('name' => ts('Fiscal Year-To-Date'), 'title' => ts('Fiscal Year-To-Date'), 'url' => $urlString, 'qs' => "{$urlParams}&start={$yearDate}&end={$yearNow}", 'uniqueName' => 'fiscal_year_to_date'), CRM_Core_Action::BROWSE => array('name' => ts('Cumulative'), 'title' => ts('Cumulative'), 'url' => $urlString, 'qs' => "{$urlParams}&start=&end={$now}", 'uniqueName' => 'cumulative'));
     }
     return self::$_contributionLinks;
 }
 /**
  * Browse all custom data groups.
  *
  * @return void
  * @access public
  * @static
  */
 function browse($action = null)
 {
     // get all custom groups sorted by weight
     $contribution = array();
     $dao =& new CRM_Contribute_DAO_ContributionPage();
     // set the domain_id parameter
     $config =& CRM_Core_Config::singleton();
     $dao->domain_id = $config->domainID();
     $dao->orderBy('title');
     $dao->find();
     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()));
         // update enable/disable links depending on custom_group properties.
         if ($dao->is_active) {
             $action -= CRM_CORE_ACTION_ENABLE;
         } else {
             $action -= CRM_CORE_ACTION_DISABLE;
         }
         $contribution[$dao->id]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_ContributionPage::actionLinks(), $action, array('id' => $dao->id));
     }
     $this->assign('rows', $contribution);
 }