$tagfields = str_replace(array("'", '"'), '', $tagfields); if ($tagfields != "") { $freetag = new freetag(); if (isset($_REQUEST["tagfields"]) && trim($_REQUEST["tagfields"]) != "") { $freetag->tag_object($userid, $crmid, $tagfields, $module); $tagcloud = $freetag->get_tag_cloud_html($module, $userid, $crmid); echo $tagcloud; } } else { echo ":#:FAILURE"; } } elseif ($ajaxaction == 'GETTAGCLOUD') { require_once 'include/freetag/freetag.class.php'; $freetag = new freetag(); if (trim($module) != "") { $tagcloud = $freetag->get_tag_cloud_html($module, $userid, $crmid); echo $tagcloud; } else { $tagcloud = $freetag->get_tag_cloud_html("", $userid); echo $tagcloud; } } elseif ($ajaxaction == 'DELETETAG') { if (is_numeric($_REQUEST['tagid'])) { $tagid = vtlib_purify($_REQUEST['tagid']); require_once 'include/freetag/freetag.class.php'; $freetag = new freetag(); $tag = $freetag->get_tag_from_id($tagid); $delok = $freetag->delete_object_tag($userid, $crmid, $tag); if ($delok) { echo 'SUCCESS'; } else {
require_once 'include/freetag/freetag.class.php'; $homeObj = new Homestuff(); $smarty = new vtigerCRM_Smarty(); $smarty->assign("MOD", $mod_strings); $smarty->assign("APP", $app_strings); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); if (!empty($_REQUEST['homestuffid'])) { $stuffid = $_REQUEST['homestuffid']; } if (!empty($_REQUEST['blockstufftype'])) { $stufftype = $_REQUEST['blockstufftype']; } if ($stufftype == 'Tag Cloud') { $freetag = new freetag(); $smarty->assign("ALL_TAG", $freetag->get_tag_cloud_html("", $current_user->id)); $smarty->display("Home/TagCloud.tpl"); } elseif ($stufftype == 'Notebook') { $contents = $homeObj->getNoteBookContents($stuffid); $smarty->assign("NOTEBOOK_CONTENTS", $contents); $smarty->assign("NOTEBOOKID", $stuffid); $smarty->display("Home/notebook.tpl"); } elseif ($stufftype == 'URL') { $url = $homeObj->getWidgetURL($stuffid); if (strpos($url, "://") === false) { $url = "http://" . trim($url); } $smarty->assign("URL", $url); $smarty->assign("WIDGETID", $stuffid); $smarty->display("Home/HomeWidgetURL.tpl"); } else {
/** * this function returns the information about a widget in an array * @return array(stuffid=>"id", stufftype=>"type", stufftitle=>"title") */ function getHomePageFrame() { global $adb; global $current_user; $querystuff = "select vtiger_homestuff.stuffid,stufftype,stufftitle,setype from vtiger_homestuff \n\t\t\t\t\t\tleft join vtiger_homedefault on vtiger_homedefault.stuffid=vtiger_homestuff.stuffid\n\t\t\t\t\t\twhere visible=0 and userid=? order by stuffsequence desc"; $resultstuff = $adb->pquery($querystuff, array($current_user->id)); for ($i = 0; $i < $adb->num_rows($resultstuff); $i++) { $modulename = $adb->query_result($resultstuff, $i, 'setype'); $stuffid = $adb->query_result($resultstuff, $i, 'stuffid'); $stufftype = $adb->query_result($resultstuff, $i, 'stufftype'); if (!empty($modulename) && $modulename != 'NULL') { if (!vtlib_isModuleActive($modulename)) { continue; } } elseif ($stufftype == 'Module') { //check for setype in vtiger_homemodule table and hide if module is de-activated $sql = "select setype from vtiger_homemodule where stuffid=?"; $result_setype = $adb->pquery($sql, array($stuffid)); if ($adb->num_rows($result_setype) > 0) { $module_name = $adb->query_result($result_setype, 0, "setype"); } if (!empty($module_name) && $module_name != 'NULL') { if (!vtlib_isModuleActive($module_name)) { continue; } } } elseif ($stufftype == 'DashBoard') { if (!vtlib_isModuleActive('Dashboard')) { continue; } } elseif (!empty($stufftype) && $stufftype == 'RSS') { if (!vtlib_isModuleActive($stufftype)) { continue; } } $nontrans_stufftitle = $adb->query_result($resultstuff, $i, 'stufftitle'); $trans_stufftitle = getTranslatedString($nontrans_stufftitle); $stufftitle = decode_html($trans_stufftitle); if (strlen($stufftitle) > 100) { $stuff_title = substr($stufftitle, 0, 97) . "..."; } else { $stuff_title = $stufftitle; } if ($stufftype == 'Default' && $nontrans_stufftitle != 'Home Page Dashboard' && $nontrans_stufftitle != 'Tag Cloud') { if ($modulename != 'NULL') { if (isPermitted($modulename, 'index') == "yes") { $count_entries = $this->getDefaultDetails($stuffid, 'calculateCnt'); if ($count_entries > 0) { $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title); } } } else { $count_entries = $this->getDefaultDetails($stuffid, 'calculateCnt'); if ($count_entries > 0) { $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title); } } } else { if ($stufftype == 'Tag Cloud') { $freetag = new freetag(); if ($freetag->get_tag_cloud_html("", $current_user->id) != '') { $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title); } } else { if ($modulename != 'NULL') { if (isPermitted($modulename, 'index') == "yes") { $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title); } } else { $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title); } } } } $homeframe = $homeval; return $homeframe; }