>>>>>
global $oCustomView;
//<<<<<>>>>>>
$error_msg = '';
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once('modules/CustomView/CustomView.php');
$cv_module = vtlib_purify($_REQUEST['module']);
$recordid = vtlib_purify($_REQUEST['record']);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("CATEGORY", getParentTab());
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE",$cv_module);
$smarty->assign("MODULELABEL",getTranslatedString($cv_module,$cv_module));
$smarty->assign("CVMODULE", $cv_module);
$smarty->assign("CUSTOMVIEWID",$recordid);
$smarty->assign("DATEFORMAT",$current_user->date_format);
$smarty->assign("JS_DATEFORMAT",parse_calendardate($app_strings['NTC_DATE_FORMAT']));
if($recordid == "") {
$oCustomView = new CustomView();
$modulecollist = $oCustomView->getModuleColumnsList($cv_module);
$log->info('CustomView :: Successfully got ColumnsList for the module'.$cv_module);
if(isset($modulecollist)) {
$choosecolslist = getByModule_ColumnsList($cv_module,$modulecollist);
}
for($i=1;$i<10;$i++) {
$smarty->assign("CHOOSECOLUMN".$i,$choosecolslist);
}
$stdfilterhtml = $oCustomView->getStdFilterCriteria();
$stdfiltercolhtml = getStdFilterHTML($cv_module);
$stdfilterjs = $oCustomView->getCriteriaJS();
$smarty->assign("STDFILTERCOLUMNS",$stdfiltercolhtml);
$smarty->assign("STDCOLUMNSCOUNT",count($stdfiltercolhtml));
$smarty->assign("STDFILTERCRITERIA",$stdfilterhtml);
$smarty->assign("STDFILTER_JAVASCRIPT",$stdfilterjs);
$advfilterhtml = getAdvCriteriaHTML();
$modulecolumnshtml = getByModule_ColumnsHTML($cv_module,$modulecollist);
$smarty->assign("FOPTION",$advfilterhtml);
$smarty->assign("COLUMNS_BLOCK",$modulecolumnshtml);
$smarty->assign("MANDATORYCHECK",implode(",",array_unique($oCustomView->mandatoryvalues)));
$smarty->assign("SHOWVALUES",implode(",",$oCustomView->showvalues));
$data_type[] = $oCustomView->data_type;
$smarty->assign("DATATYPE",$data_type);
} else {
$oCustomView = new CustomView($cv_module);
$now_action = vtlib_purify($_REQUEST['action']);
if($oCustomView->isPermittedCustomView($recordid,$now_action,$oCustomView->customviewmodule) == 'yes') {
$customviewdtls = $oCustomView->getCustomViewByCvid($recordid);
$log->info('CustomView :: Successfully got ViewDetails for the Viewid'.$recordid);
$modulecollist = $oCustomView->getModuleColumnsList($cv_module);
$selectedcolumnslist = $oCustomView->getColumnsListByCvid($recordid);
$log->info('CustomView :: Successfully got ColumnsList for the Viewid'.$recordid);
$smarty->assign("VIEWNAME",$customviewdtls["viewname"]);
if($customviewdtls["setdefault"] == 1) {
$smarty->assign("CHECKED","checked");
}
if($customviewdtls["setmetrics"] == 1) {
$smarty->assign("MCHECKED","checked");
}
$status = $customviewdtls["status"];
$smarty->assign("STATUS",$status);
for($i=1;$i<10;$i++) {
$choosecolslist = getByModule_ColumnsList($cv_module,$modulecollist,$selectedcolumnslist[$i-1]);
$smarty->assign("CHOOSECOLUMN".$i,$choosecolslist);
}
$stdfilterlist = $oCustomView->getStdFilterByCvid($recordid);
$log->info('CustomView :: Successfully got Standard Filter for the Viewid'.$recordid);
$stdfilterlist["stdfilter"] = ($stdfilterlist["stdfilter"] != "") ? ($stdfilterlist["stdfilter"]) : ("custom");
$stdfilterhtml = $oCustomView->getStdFilterCriteria($stdfilterlist["stdfilter"]);
$stdfiltercolhtml = getStdFilterHTML($cv_module,$stdfilterlist["columnname"]);
$stdfilterjs = $oCustomView->getCriteriaJS();
$smarty->assign("STARTDATE",$stdfilterlist["startdate"]);
$smarty->assign("ENDDATE",$stdfilterlist["enddate"]);
$smarty->assign("STDFILTERCOLUMNS",$stdfiltercolhtml);
$smarty->assign("STDCOLUMNSCOUNT",count($stdfiltercolhtml));
$smarty->assign("STDFILTERCRITERIA",$stdfilterhtml);
$smarty->assign("STDFILTER_JAVASCRIPT",$stdfilterjs);
$advfilterlist = $oCustomView->getAdvFilterByCvid($recordid);
$advfilterhtml = getAdvCriteriaHTML();
$modulecolumnshtml = getByModule_ColumnsHTML($cv_module,$modulecollist);
$smarty->assign("FOPTION",$advfilterhtml);
$smarty->assign("COLUMNS_BLOCK",$modulecolumnshtml);
$smarty->assign("CRITERIA_GROUPS",$advfilterlist);
$smarty->assign("MANDATORYCHECK",implode(",",array_unique($oCustomView->mandatoryvalues)));
$smarty->assign("SHOWVALUES",implode(",",$oCustomView->showvalues));
$smarty->assign("EXIST","true");
$cactionhtml = "";
if($cv_module == "Leads" || $cv_module == "Accounts" || $cv_module == "Contacts")
{
$smarty->assign("CUSTOMACTIONBUTTON",$cactionhtml);
}
$data_type[] = $oCustomView->data_type;
$smarty->assign("DATATYPE",$data_type);
}
else
{
echo "
";
exit;
}
}
$smarty->assign("RETURN_MODULE", $cv_module);
if($cv_module == "Calendar")
$return_action = "ListView";
else
$return_action = "index";
if($recordid == '')
$act = $mod_strings['LBL_NEW'];
else
$act = $mod_strings['LBL_EDIT'];
$smarty->assign("ACT", $act);
$smarty->assign("RETURN_ACTION", $return_action);
$smarty->display("CustomView.tpl");
function getByModule_ColumnsHTML($module,$columnslist,$selected="") {
$columnsList = getByModule_ColumnsList($module,$columnslist,$selected);
return generateSelectColumnsHTML($columnsList,$module);
}
function generateSelectColumnsHTML($columnsList, $module) {
$shtml = '';
foreach($columnsList as $blocklabel=>$blockcolumns) {
$shtml .= "