}
return FALSE;
}
+ 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;
+ $data["button_title"] = $dao->button_title;
+ $data["progress_bar_id"] = $dao->button_link_to;
+ $data["description"] = strip_tags(base64_decode($dao->description));
+ $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_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;
+ }
+
+ return $data;
+ }
}
'style_rules' => $wid_page[$dao->id]['style_rules']));
$this->setDefaults(array(
'override' => $wid_page[$dao->id]['override']));
- $cust_templ = base64_decode($wid_page[$dao->id]['custom_template']);
-
- $this->setDefaults(array(
+ if(true == $wid_page[$dao->id]['override']) {
+ $cust_templ = base64_decode($wid_page[$dao->id]['custom_template']);
+ $this->setDefaults(array(
'custom_template' => $cust_templ));
+ }
}
}
else {
$cust_tmpl = "";
$cust_tmpl_col = "";
$sql = "";
+ $coma = "";
+ $equals = "";
/** If override check is checked state then only save the custom_template to the
database. otherwise wci uses default tpl file.
*/
$override = $values['override'];
$cust_tmpl = base64_encode(html_entity_decode($values['custom_template']));
$cust_tmpl_col = ", custom_template";
+ $coma = "','";
+ $equals = "='";
}
if (isset($this->_id)) {
- $cust_tmpl_col = "'" . $cust_tmpl_col . "='";
$sql = "UPDATE civicrm_wci_widget SET title = '". $values['title']
. "', logo_image = '" . $values['logo_image'] . "', image = '"
. $values['image'] . "', button_title = '" . $values['button_title']
. "', color_button = '" . $values['color_button']
. "', color_button_bg = '" . $values['color_button_bg']
. "', style_rules = '" . $values['style_rules'] . "', override = '"
- . $override . $cust_tmpl_col . $cust_tmpl . "'";
+ . $override . $cust_tmpl_col . $cust_tmpl . "' where id =" . $this->_id ;
}
else {
$sql = "INSERT INTO civicrm_wci_widget (title, logo_image, image,
$values['color_widget_bg'] . "','" . $values['color_description'] . "','" .
$values['color_border'] . "','" . $values['color_button'] . "','" .
$values['color_button_bg'] . "','" . $values['style_rules'] . "','" .
- $override . "','" . $cust_tmpl
+ $override . $coma . $cust_tmpl
. "')";
- }
+ }
+ echo $sql;
$errorScope = CRM_Core_TemporaryErrorScope::useException();
try {
$transaction = new CRM_Core_Transaction();