/**
  * Build the widget
  *
  * @param array $args Widget arguments.
  * @param array $instance Widget instance.
  */
 public function widget($args, $instance)
 {
     $widget = new CRM_Contribute_BAO_Widget();
     $widget->contribution_page_id = $instance['cpageId'];
     if (!$widget->find(true)) {
         $widget = 'test here';
     }
     $widgetVals = array('url_logo' => array('value' => $widget->url_logo), 'color_title' => array('value' => $widget->color_title), 'color_button' => array('value' => $widget->color_button), 'color_bar' => array('value' => $widget->color_bar), 'color_main_text' => array('value' => $widget->color_main_text), 'color_main' => array('value' => $widget->color_main), 'color_main_bg' => array('value' => $widget->color_main_bg), 'color_bg' => array('value' => $widget->color_bg), 'color_about_link' => array('value' => $widget->color_about_link), 'color_homepage_link' => array('value' => $widget->color_homepage_link));
     $template = CRM_Core_Smarty::singleton()->fetchWith('CRM/Contribute/Page/Widget.tpl', array('widgetId' => $widget->id, 'cpageId' => $widget->contribution_page_id, 'form' => $widgetVals));
     $classes = 'widget civicontribute-widget civicontribute-widget-' . $widget->contribution_page_id;
     echo "<div class=\"{$classes}\">{$template}</div>";
 }
示例#2
0
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| 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-2015
 * $Id$
 */
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
$template = CRM_Core_Smarty::singleton();
require_once 'CRM/Utils/Request.php';
$cpageId = CRM_Utils_Request::retrieve('cpageId', 'Positive', CRM_Core_DAO::$_nullObject);
$widgetId = CRM_Utils_Request::retrieve('widgetId', 'Positive', CRM_Core_DAO::$_nullObject);
$format = CRM_Utils_Request::retrieve('format', 'Positive', CRM_Core_DAO::$_nullObject);
$includePending = CRM_Utils_Request::retrieve('includePending', 'Boolean', CRM_Core_DAO::$_nullObject);
require_once 'CRM/Contribute/BAO/Widget.php';
$jsonvar = 'jsondata';
if (isset($format)) {
    $jsonvar .= $cpageId;
}
$data = CRM_Contribute_BAO_Widget::getContributionPageData($cpageId, $widgetId, $includePending);
$output = '
    var ' . $jsonvar . ' = ' . json_encode($data) . ';
';
echo $output;
CRM_Utils_System::civiExit();
示例#3
0
 | with this program; if not, contact CiviCRM LLC                     |
 | at info[AT]civicrm[DOT]org. If you have questions about the        |
 | 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
 * $Id$
 */
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
$template = CRM_Core_Smarty::singleton();
require_once 'CRM/Utils/Request.php';
$cpageId = CRM_Utils_Request::retrieve('cpageId', 'Positive', CRM_Core_DAO::$_nullObject);
$widgetId = CRM_Utils_Request::retrieve('widgetId', 'Positive', CRM_Core_DAO::$_nullObject);
$format = CRM_Utils_Request::retrieve('format', 'Positive', CRM_Core_DAO::$_nullObject);
require_once 'CRM/Contribute/BAO/Widget.php';
$jsonvar = 'jsondata';
if (isset($format)) {
    $jsonvar .= $cpageId;
}
$data = CRM_Contribute_BAO_Widget::getContributionPageData($cpageId, $widgetId);
$output = '
    var ' . $jsonvar . ' = ' . json_encode($data) . ';
';
echo $output;
CRM_Utils_System::civiExit();