Exemplo n.º 1
0
 public static function getWidgetData($widgetId)
 {
     $query = "SELECT * FROM civicrm_wci_widget where id=" . $widgetId;
     $params = array();
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_Widget');
     $data = array();
     while ($dao->fetch()) {
         $data["title"] = $dao->title;
         $data["logo_image"] = $dao->logo_image;
         $data["image"] = $dao->image;
         empty($dao->button_title) ? $contrin_title = "Donate" : ($contrin_title = $dao->button_title);
         $data["button_title"] = $contrin_title;
         $data["button_link_to"] = $dao->button_link_to;
         $data["progress_bar_id"] = $dao->progress_bar_id;
         $data["description"] = $dao->description;
         $data["email_signup_group_id"] = $dao->email_signup_group_id;
         $data["size_variant"] = $dao->size_variant;
         $data["color_title"] = $dao->color_title;
         $data["color_title_bg"] = $dao->color_title_bg;
         $data["color_progress_bar"] = $dao->color_progress_bar;
         $data["color_progress_bar_bg"] = $dao->color_progress_bar_bg;
         $data["color_widget_bg"] = $dao->color_widget_bg;
         $data["color_description"] = $dao->color_description;
         $data["color_border"] = $dao->color_border;
         $data["color_button"] = $dao->color_button;
         $data["color_button_bg"] = $dao->color_button_bg;
         $data['style_rules'] = $dao->style_rules;
         $data["show_pb_perc"] = $dao->show_pb_perc;
         CRM_Wci_BAO_ProgressBar::getProgressbarData($dao->progress_bar_id, $data);
         $data["custom_template"] = $dao->custom_template;
         $data["widgetId"] = $widgetId;
         $data["override"] = $dao->override;
         $data["hide_title"] = $dao->hide_title;
         $data["hide_border"] = $dao->hide_border;
         $data["hide_pbcap"] = $dao->hide_pbcap;
         $data["color_bar"] = $dao->color_progress_bar;
         $defProf = civicrm_api3('setting', 'getValue', array('group' => 'Wci Preference', 'name' => 'default_wci_profile'));
         $data["emailSignupGroupFormURL"] = CRM_Utils_System::baseCMSURL() . '/civicrm/profile/create?reset=1&gid=' . $defProf;
         $data["color_btn_newsletter"] = $dao->color_btn_newsletter;
         $data["color_btn_newsletter_bg"] = $dao->color_btn_newsletter_bg;
         $data["newsletter_text"] = $dao->newsletter_text;
         $data["color_newsletter_text"] = $dao->color_newsletter_text;
     }
     return $data;
 }
Exemplo n.º 2
0
 public static function getProgressbarData($pbId, &$pbData)
 {
     if (0 != $pbId) {
         $pbInfo = CRM_Wci_BAO_ProgressBar::getProgressbarInfo($pbId);
         $amount_collected = CRM_Wci_BAO_ProgressBar::getPBCollectedAmount($pbId);
         $amount_raised = $amount_collected + $pbInfo['starting_amount'];
         $goal = $pbInfo['goal_amount'];
         $pbData['pb_collected'] = $amount_raised < 0 ? 0 : $amount_raised;
         $pbData["pb_percentage"] = $pbData['pb_collected'] / $goal * 100;
         $pbData["goal_amount"] = $goal;
         $pbData["no_pb"] = False;
     } else {
         $pbData["no_pb"] = True;
     }
     return $pbData;
 }
Exemplo n.º 3
0
 function getProgressBars()
 {
     $options = array(0 => ts('- select -'));
     $pbList = CRM_Wci_BAO_ProgressBar::getProgressbarList();
     foreach ($pbList as $pb) {
         $options[$pb['id']] = $pb['name'];
     }
     return $options;
 }