function Reports($reportId = "") { $db = PearDatabase::getInstance(); $currentUser = Users_Record_Model::getCurrentUserModel(); $userId = $currentUser->getId(); $this->initListOfModules(); if ($reportId != "") { // Lookup information in cache first $cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId); $subOrdinateUsers = VTCacheUtils::lookupReport_SubordinateUsers($reportId); if ($cachedInfo === false) { $ssql = "SELECT vtiger_reportmodules.*, vtiger_report.* FROM vtiger_report\n\t\t\t\t\t\t\tINNER JOIN vtiger_reportmodules ON vtiger_report.reportid = vtiger_reportmodules.reportmodulesid\n\t\t\t\t\t\t\tWHERE vtiger_report.reportid = ?"; $params = array($reportId); require_once 'include/utils/GetUserGroups.php'; require 'user_privileges/user_privileges_' . $userId . '.php'; $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($userId); $userGroupsList = $userGroups->user_groups; if (!empty($userGroupsList) && $currentUser->isAdminUser() == false) { $userGroupsQuery = " (shareid IN (" . generateQuestionMarks($userGroupsList) . ") AND setype='groups') OR"; array_push($params, $userGroupsList); } $nonAdminQuery = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing\n\t\t\t\t\t\t\t\t\tWHERE {$userGroupsQuery} (shareid=? AND setype='users'))"; if ($currentUser->isAdminUser() == false) { $ssql .= " AND (({$nonAdminQuery})\n\t\t\t\t\t\t\t\tOR vtiger_report.sharingtype = 'Public'\n\t\t\t\t\t\t\t\tOR vtiger_report.owner = ? OR vtiger_report.owner IN\n\t\t\t\t\t\t\t\t\t(SELECT vtiger_user2role.userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%')\n\t\t\t\t\t\t\t\t)"; array_push($params, $userId, $userId); } $result = $db->pquery($ssql, $params); if ($result && $db->num_rows($result)) { $reportModulesRow = $db->fetch_array($result); // Update information in cache now VTCacheUtils::updateReport_Info($userId, $reportId, $reportModulesRow["primarymodule"], $reportModulesRow["secondarymodules"], $reportModulesRow["reporttype"], $reportModulesRow["reportname"], $reportModulesRow["description"], $reportModulesRow["folderid"], $reportModulesRow["owner"]); } $subOrdinateUsers = array(); $subResult = $db->pquery("SELECT userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%'", array()); $numOfSubRows = $db->num_rows($subResult); for ($i = 0; $i < $numOfSubRows; $i++) { $subOrdinateUsers[] = $db->query_result($subResult, $i, 'userid'); } // Update subordinate user information for re-use VTCacheUtils::updateReport_SubordinateUsers($reportId, $subOrdinateUsers); // Re-look at cache to maintain code-consistency below $cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId); } if ($cachedInfo) { $this->primodule = $cachedInfo["primarymodule"]; $this->secmodule = $cachedInfo["secondarymodules"]; $this->reporttype = $cachedInfo["reporttype"]; $this->reportname = decode_html($cachedInfo["reportname"]); $this->reportdescription = decode_html($cachedInfo["description"]); $this->folderid = $cachedInfo["folderid"]; if ($currentUser->isAdminUser() == true || in_array($cachedInfo["owner"], $subOrdinateUsers) || $cachedInfo["owner"] == $userId) { $this->is_editable = true; } else { $this->is_editable = false; } } } return $this; }
public function getGroupsIdsForUsers($userId) { vimport('~include/utils/GetUserGroups.php'); $userGroupInstance = new GetUserGroups(); $userGroupInstance->getAllUserGroups($userId); return $userGroupInstance->user_groups; }
/** Function to get the lists of groupids releated with an user * This function accepts the user id as arguments and * returns the groupids related with the user id * as a comma seperated string */ function fetchUserGroupids($userid) { global $log, $adb; $log->debug("Entering fetchUserGroupids(" . $userid . ") method ..."); $focus = new GetUserGroups(); $focus->getAllUserGroups($userid); //Asha: Remove implode if not required and if so, also remove explode functions used at the recieving end of this function $groupidlists = implode(",", $focus->user_groups); $log->debug("Exiting fetchUserGroupids method ..."); return $groupidlists; }
function vtws_getUsersInTheSameGroup($id) { require_once 'include/utils/GetGroupUsers.php'; require_once 'include/utils/GetUserGroups.php'; $groupUsers = new GetGroupUsers(); $userGroups = new GetUserGroups(); $allUsers = array(); $userGroups->getAllUserGroups($id); $groups = $userGroups->user_groups; foreach ($groups as $group) { $groupUsers->getAllUsersInGroup($group); $usersInGroup = $groupUsers->group_users; foreach ($usersInGroup as $user) { if ($user != $id) { $allUsers[$user] = getUserFullName($user); } } } return $allUsers; }
public static function getVariable($var, $default, $module = '', $gvuserid = '') { global $adb, $current_user, $gvvalidationinfo, $currentModule; $gvvalidationinfo[] = "search for variable '{$var}' with default value of '{$default}'"; if (empty($module)) { $module = $currentModule; } if (empty($gvuserid)) { $gvuserid = $current_user->id; } $key = md5('gvcache' . $var . $module . $gvuserid); list($value, $found) = VTCacheUtils::lookupCachedInformation($key); if ($found) { $gvvalidationinfo[] = "variable found in cache"; return $value; } $value = ''; $list_of_modules = array(); $focus = CRMEntity::getInstance('GlobalVariable'); $select = 'SELECT * FROM vtiger_globalvariable INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_globalvariable.globalvariableid '; $where = ' where vtiger_crmentity.deleted=0 and gvname=? '; $mandatory = " and mandatory='1'"; $sql = $select . $where . $mandatory; $gvvalidationinfo[] = '---'; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as mandatory in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } if (!is_numeric($gvuserid) and $gvuserid > 0) { return $default; } $user = $adb->convert2Sql(' and vtiger_crmentity.smownerid=?', array($gvuserid)); $sql = $select . $where . $user; $gvvalidationinfo[] = '---'; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as set per user {$gvuserid} in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } $gvvalidationinfo[] = '---'; require_once 'include/utils/GetUserGroups.php'; $UserGroups = new GetUserGroups(); $UserGroups->getAllUserGroups($gvuserid); if (count($UserGroups->user_groups) > 0) { $groups = implode(',', $UserGroups->user_groups); $group = ' and vtiger_crmentity.smownerid in (' . $groups . ') '; $sql = $select . $where . $group; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as set per group {$groups} in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } } else { $gvvalidationinfo[] = 'no groups to search in'; } $sql = $select . $where . " and default_check='1'"; $gvvalidationinfo[] = '---'; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as default variable in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } $gvvalidationinfo[] = '---'; $gvvalidationinfo[] = "return default value give: {$default}"; return $default; }
/** Creates a file with all the user, user-role,user-profile, user-groups informations * @param $userid -- user id:: Type integer * @returns user_privileges_userid file under the user_privileges directory */ function createUserPrivilegesfile($userid) { global $root_directory; $handle = @fopen($root_directory . 'user_privileges/user_privileges_' . $userid . '.php', "w+"); if ($handle) { $newbuf = ''; $newbuf .= "<?php\n\n"; $newbuf .= "\n"; $newbuf .= "//This is the access privilege file\n"; $user_focus = new Users(); $user_focus->retrieve_entity_info($userid, "Users"); $userInfo = array(); $user_focus->column_fields["id"] = ''; $user_focus->id = $userid; foreach ($user_focus->column_fields as $field => $value_iter) { $userInfo[$field] = $user_focus->{$field}; } if ($user_focus->is_admin == 'on') { $newbuf .= "\$is_admin=true;\n"; $newbuf .= "\n"; $newbuf .= "\$user_info=" . constructSingleStringKeyValueArray($userInfo) . ";\n"; $newbuf .= "\n"; $newbuf .= "?>"; fputs($handle, $newbuf); fclose($handle); return; } else { $newbuf .= "\$is_admin=false;\n"; $newbuf .= "\n"; $globalPermissionArr = getCombinedUserGlobalPermissions($userid); $tabsPermissionArr = getCombinedUserTabsPermissions($userid); //$tabsPermissionArr=getCombinedUserTabsPermissions($userid); $actionPermissionArr = getCombinedUserActionPermissions($userid); $user_role = fetchUserRole($userid); $user_role_info = getRoleInformation($user_role); $user_role_parent = $user_role_info[$user_role][1]; $userGroupFocus = new GetUserGroups(); $userGroupFocus->getAllUserGroups($userid); $subRoles = getRoleSubordinates($user_role); $subRoleAndUsers = getSubordinateRoleAndUsers($user_role); $def_org_share = getDefaultSharingAction(); $parentRoles = getParentRole($user_role); $newbuf .= "\$current_user_roles='" . $user_role . "';\n"; $newbuf .= "\n"; $newbuf .= "\$current_user_parent_role_seq='" . $user_role_parent . "';\n"; $newbuf .= "\n"; $newbuf .= "\$current_user_profiles=" . constructSingleArray(getUserProfile($userid)) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$profileGlobalPermission=" . constructArray($globalPermissionArr) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$profileTabsPermission=" . constructArray($tabsPermissionArr) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$profileActionPermission=" . constructTwoDimensionalArray($actionPermissionArr) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$current_user_groups=" . constructSingleArray($userGroupFocus->user_groups) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$subordinate_roles=" . constructSingleCharArray($subRoles) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$parent_roles=" . constructSingleCharArray($parentRoles) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$subordinate_roles_users=" . constructTwoDimensionalCharIntSingleArray($subRoleAndUsers) . ";\n"; $newbuf .= "\n"; $newbuf .= "\$user_info=" . constructSingleStringKeyValueArray($userInfo) . ";\n"; $newbuf .= "?>"; fputs($handle, $newbuf); fclose($handle); } } }
/** Function to get the Reports inside each modules * This function accepts the folderid * This Generates the Reports under each Reports module * This Returns a HTML sring */ function sgetRptsforFldr($rpt_fldr_id, $paramsList = false) { $srptdetails = ""; global $adb; global $log; global $mod_strings, $current_user; $returndata = array(); require_once 'include/utils/UserInfoUtil.php'; $sql = "select vtiger_report.*, vtiger_reportmodules.*, vtiger_reportfolder.folderid from vtiger_report inner join vtiger_reportfolder on vtiger_reportfolder.folderid = vtiger_report.folderid"; $sql .= " inner join vtiger_reportmodules on vtiger_reportmodules.reportmodulesid = vtiger_report.reportid"; $params = array(); // If information is required only for specific report folder? if ($rpt_fldr_id !== false) { $sql .= " where vtiger_reportfolder.folderid=?"; $params[] = $rpt_fldr_id; } require 'user_privileges/user_privileges_' . $current_user->id . '.php'; require_once 'include/utils/GetUserGroups.php'; $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($current_user->id); $user_groups = $userGroups->user_groups; if (!empty($user_groups) && $is_admin == false) { $user_group_query = " (shareid IN (" . generateQuestionMarks($user_groups) . ") AND setype='groups') OR"; array_push($params, $user_groups); } $non_admin_query = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing WHERE {$user_group_query} (shareid=? AND setype='users'))"; if ($is_admin == false) { $sql .= " and ( (" . $non_admin_query . ") or vtiger_report.sharingtype='Public' or vtiger_report.owner = ? or vtiger_report.owner in(select vtiger_user2role.userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '" . $current_user_parent_role_seq . "::%'))"; array_push($params, $current_user->id); array_push($params, $current_user->id); } if ($paramsList) { $startIndex = $paramsList['startIndex']; $pageLimit = $paramsList['pageLimit']; $orderBy = $paramsList['orderBy']; $sortBy = $paramsList['sortBy']; if ($orderBy) { $sql .= " ORDER BY {$orderBy} {$sortBy}"; } $sql .= " LIMIT {$startIndex}," . ($pageLimit + 1); } $query = $adb->pquery("select userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '" . $current_user_parent_role_seq . "::%'", array()); $subordinate_users = array(); for ($i = 0; $i < $adb->num_rows($query); $i++) { $subordinate_users[] = $adb->query_result($query, $i, 'userid'); } $result = $adb->pquery($sql, $params); $report = $adb->fetch_array($result); if (count($report) > 0) { do { $report_details = array(); $report_details['customizable'] = $report["customizable"]; $report_details['reportid'] = $report["reportid"]; $report_details['primarymodule'] = $report["primarymodule"]; $report_details['secondarymodules'] = $report["secondarymodules"]; $report_details['state'] = $report["state"]; $report_details['description'] = $report["description"]; $report_details['reportname'] = $report["reportname"]; $report_details['reporttype'] = $report["reporttype"]; $report_details['sharingtype'] = $report["sharingtype"]; if ($is_admin == true || in_array($report["owner"], $subordinate_users) || $report["owner"] == $current_user->id) { $report_details['editable'] = 'true'; } else { $report_details['editable'] = 'false'; } if (isPermitted($report["primarymodule"], 'index') == "yes") { $returndata[$report["folderid"]][] = $report_details; } } while ($report = $adb->fetch_array($result)); } if ($rpt_fldr_id !== false) { $returndata = $returndata[$rpt_fldr_id]; } $log->info("Reports :: ListView->Successfully returned vtiger_report details HTML"); return $returndata; }
$focus->id = ""; } global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; //the user might belong to multiple groups $log->info("User detail view"); $category = getParenttab(); $smarty = new vtigerCRM_Smarty(); $smarty->assign("UMOD", $mod_strings); global $current_language; $smod_strings = return_module_language($current_language, 'Settings'); $smarty->assign("MOD", $smod_strings); $smarty->assign("APP", $app_strings); $oGetUserGroups = new GetUserGroups(); $oGetUserGroups->getAllUserGroups($focus->id); if (useInternalMailer() == 1) { $smarty->assign("INT_MAILER", "true"); } $smarty->assign("GROUP_COUNT", count($oGetUserGroups->user_groups)); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("PRINT_URL", "phprint.php?jt=" . session_id() . $GLOBALS['request_string']); $smarty->assign("ID", $focus->id); $smarty->assign("CATEGORY", $category); if (isset($focus->imagename) && $focus->imagename != '') { $imagestring = "<div id='track1' style='margin: 4px 0pt 0pt 10px; width: 200px; background-image: url(themes/images/scaler_slider_track.gif); background-repeat: repeat-x; background-position: left center; height: 18px;'>\n\t<div class='selected' id='handle1' style='width: 18px; height: 18px; position: relative; left: 145px;cursor:pointer;'><img src='" . vtiger_imageurl('scaler_slider.gif', $theme) . "'></div>\n\t</div>\n<script language='JavaScript' type='text/javascript' src='include/js/slider.js'></script>\n\n\t<div class='scale-image' style='padding: 10px; float: left; width: 83.415px;'><img src='test/user/" . $focus->imagename . "' width='100%'</div>\n\t<p><script type='text/javascript' src='include/js/scale_demo.js'></script></p>"; //$smarty->assign("USER_IMAGE",$imagestring); } if (isset($_REQUEST['modechk']) && $_REQUEST['modechk'] != '') { $modepref = $_REQUEST['modechk'];
public function checkUserPermissions() { $permissions = $this->get('template_members'); if (empty($permissions)) { return true; } $currentUser = Users_Record_Model::getCurrentUserModel(); $permissions = explode(',', $permissions); if (in_array('Users:' . $currentUser->getId(), $permissions)) { // check user id return true; } else { $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($currentUser->getId()); foreach ($userGroups->user_groups as $group) { if (in_array('Groups:' . $group, $permissions)) { return true; } } } return false; }
public function put($recordDetails, $user) { $log = vglobal('log'); $this->user = $user; $recordDetails = $this->syncToNativeFormat($recordDetails); $createdRecords = $recordDetails['created']; $updatedRecords = $recordDetails['updated']; $deletedRecords = $recordDetails['deleted']; if (count($createdRecords) > 0) { $createdRecords = $this->translateReferenceFieldNamesToIds($createdRecords, $user); $createdRecords = $this->fillNonExistingMandatoryPicklistValues($createdRecords); $createdRecords = $this->fillMandatoryFields($createdRecords, $user); } foreach ($createdRecords as $index => $record) { $createdRecords[$index] = vtws_create($record['module'], $record, $this->user); } if (count($updatedRecords) > 0) { $updatedRecords = $this->translateReferenceFieldNamesToIds($updatedRecords, $user); } $crmIds = array(); foreach ($updatedRecords as $index => $record) { $webserviceRecordId = $record["id"]; $recordIdComp = vtws_getIdComponents($webserviceRecordId); $crmIds[] = $recordIdComp[1]; } $assignedRecordIds = array(); if ($this->isClientUserSyncType()) { $assignedRecordIds = wsapp_checkIfRecordsAssignToUser($crmIds, $this->user->id); // To check if the record assigned to group if ($this->isClientUserAndGroupSyncType()) { $getUserGroups = new GetUserGroups(); $getUserGroups->getAllUserGroups($this->user->id); $groupIds = $getUserGroups->user_groups; if (!empty($groupIds)) { $groupRecordId = wsapp_checkIfRecordsAssignToUser($crmIds, $groupIds); $assignedRecordIds = array_merge($assignedRecordIds, $groupRecordId); } } // End } foreach ($updatedRecords as $index => $record) { $webserviceRecordId = $record["id"]; $recordIdComp = vtws_getIdComponents($webserviceRecordId); try { if (in_array($recordIdComp[1], $assignedRecordIds)) { $updatedRecords[$index] = vtws_revise($record, $this->user); } else { if (!$this->isClientUserSyncType()) { $updatedRecords[$index] = vtws_revise($record, $this->user); } else { $this->assignToChangedRecords[$index] = $record; } } } catch (Exception $e) { continue; } // Added to handle duplication if ($record['duplicate']) { $updatedRecords[$index]['duplicate'] = true; } // End } $hasDeleteAccess = null; $deletedCrmIds = array(); foreach ($deletedRecords as $index => $record) { $webserviceRecordId = $record; $recordIdComp = vtws_getIdComponents($webserviceRecordId); $deletedCrmIds[] = $recordIdComp[1]; } $assignedDeletedRecordIds = wsapp_checkIfRecordsAssignToUser($deletedCrmIds, $this->user->id); // To get record id's assigned to group of the current user if ($this->isClientUserAndGroupSyncType()) { if (!empty($groupIds)) { foreach ($groupIds as $group) { $groupRecordId = wsapp_checkIfRecordsAssignToUser($deletedCrmIds, $group); $assignedDeletedRecordIds = array_merge($assignedDeletedRecordIds, $groupRecordId); } } } // End foreach ($deletedRecords as $index => $record) { $idComp = vtws_getIdComponents($record); if (empty($hasDeleteAccess)) { $handler = vtws_getModuleHandlerFromId($idComp[0], $this->user); $meta = $handler->getMeta(); $hasDeleteAccess = $meta->hasDeleteAccess(); } if ($hasDeleteAccess) { if (in_array($idComp[1], $assignedDeletedRecordIds)) { try { vtws_delete($record, $this->user); } catch (Exception $e) { continue; } } } } $recordDetails['created'] = $createdRecords; $recordDetails['updated'] = $updatedRecords; $recordDetails['deleted'] = $deletedRecords; return $this->nativeToSyncFormat($recordDetails); }
public function checkUserPermissions() { $log = vglobal('log'); $log->debug('Entering ' . __CLASS__ . '::' . __METHOD__ . '() method ...'); $permissions = $this->get('permissions'); if (empty($permissions)) { $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...'); return true; } $currentUser = Users_Record_Model::getCurrentUserModel(); $permissions = explode(',', $permissions); if (in_array('Users:' . $currentUser->getId(), $permissions)) { // check user id $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...'); return true; } else { $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($currentUser->getId()); foreach ($userGroups->user_groups as $group) { if (in_array('Groups:' . $group, $permissions)) { $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...'); return true; } } } $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...'); return false; }
<?php /********************************************************************************* ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 * ("License"); You may not use this file except in compliance with the License * The Original Code is: vtiger CRM Open Source * The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. * ********************************************************************************/ require_once 'include/utils/GetUserGroups.php'; require_once 'Smarty_setup.php'; $user_id = vtlib_purify($_REQUEST['record']); global $current_user; global $mod_strings; $smarty = new vtigerCRM_Smarty(); $oGetUserGroups = new GetUserGroups(); $oGetUserGroups->getAllUserGroups($user_id); $user_group_info = array(); foreach ($oGetUserGroups->user_groups as $groupid) { $user_group_info[$groupid] = getGroupDetails($groupid); } $smarty->assign("IS_ADMIN", is_admin($current_user)); $smarty->assign("GROUPLIST", $user_group_info); $smarty->assign("UMOD", $mod_strings); $smarty->display("UserGroups.tpl");
public function getSelectedValuesToSmarty($smarty_obj = "", $step_name = "") { if ($smarty_obj != "" && $step_name != "") { global $app_strings; global $mod_strings; global $default_charset; global $current_language; global $image_path; global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $smarty_obj->assign("THEME", $theme_path); $smarty_obj->assign("IMAGE_PATH", $image_path); $adb = PEARDatabase::getInstance(); $get_all_steps = "all"; if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') { $recordid = vtlib_purify($_REQUEST["record"]); } else { $recordid = ""; } $smarty_obj->assign("RECORDID", $recordid); $smarty_obj->assign("DISPLAY_FILTER_HEADER", false); if (in_array($step_name, array("ReportsStep1"))) { if (isset($_REQUEST["reportname"]) && $_REQUEST["reportname"] != "") { $reportname = htmlspecialchars(vtlib_purify($_REQUEST["reportname"])); } else { $reportname = $this->reportinformations["reports4youname"]; } $smarty_obj->assign("REPORTNAME", $reportname); if (isset($_REQUEST["reportdesc"]) && $_REQUEST["reportdesc"] != "") { $reportdesc = htmlspecialchars(vtlib_purify($_REQUEST["reportdesc"])); } else { $reportdesc = $this->reportinformations["reportdesc"]; } $smarty_obj->assign("REPORTDESC", $reportdesc); $smarty_obj->assign("REP_MODULE", $this->reportinformations["primarymodule"]); $smarty_obj->assign("PRIMARYMODULES", $this->getPrimaryModules()); $smarty_obj->assign("REP_FOLDERS", $this->getReportFolders()); if (isset($this->primarymodule) && $this->primarymodule != '') { $rel_modules = $this->getReportRelatedModules($this->primarymoduleid); foreach ($rel_modules as $key => $relmodule) { $restricted_modules .= $relmodule['id'] . ":"; } $smarty_obj->assign("REL_MODULES_STR", trim($restricted_modules, ":")); $smarty_obj->assign("RELATEDMODULES", $rel_modules); } $smarty_obj->assign("FOLDERID", vtlib_purify($_REQUEST['folder'])); } if (in_array($step_name, array("ReportsStep2", $get_all_steps))) { if (isset($this->primarymodule) && $this->primarymodule != '') { $rel_modules = $this->getReportRelatedModules($this->primarymoduleid); foreach ($rel_modules as $key => $relmodule) { $restricted_modules .= $relmodule['id'] . ":"; } $smarty_obj->assign("REL_MODULES_STR", trim($restricted_modules, ":")); $smarty_obj->assign("RELATEDMODULES", $rel_modules); } } if (in_array($step_name, array("ReportGrouping", $get_all_steps))) { // TIMELINE COLUMNS DEFINITION CHANGED New Code 13.5.2014 11:58 // ITS4YOU-CR SlOl | 13.5.2014 11:53 if (isset($_REQUEST["primarymodule"]) && $_REQUEST["primarymodule"] != "") { $primary_moduleid = $_REQUEST["primarymodule"]; $primary_module = vtlib_getModuleNameById($_REQUEST["primarymodule"]); if (vtlib_isModuleActive($primary_module)) { $primary_df_arr = getPrimaryTLStdFilter($primary_module, $this); } } else { $primary_module = $this->primarymodule; $primary_moduleid = $this->primarymoduleid; $primary_df_arr = getPrimaryTLStdFilter($primary_module, $this); } $date_options = array(); if (!empty($primary_df_arr)) { foreach ($primary_df_arr as $val_arr) { foreach ($val_arr as $val_dtls) { $date_options[] = $val_dtls["value"]; } } } $date_options_json = Zend_JSON::encode($date_options); $smarty_obj->assign("date_options_json", $date_options_json); $timelinecolumn = $this->getTimeLineColumnHTML(); $smarty_obj->assign("timelinecolumn", $timelinecolumn); // ITS4YOU-END 13.5.2014 11:53 if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') { $reportid = vtlib_purify($_REQUEST["record"]); $secondarymodule = ''; $secondarymodules = array(); if (!empty($this->related_modules[$primary_module])) { foreach ($this->related_modules[$primary_module] as $key => $value) { if (isset($_REQUEST["secondarymodule_" . $value])) { $secondarymodules[] = vtlib_purify($_REQUEST["secondarymodule_" . $value]); } } } if ($primary_moduleid == getTabid('Invoice')) { $secondarymodules[] = getTabid('Products'); $secondarymodules[] = getTabid('Services'); } $secondarymodule = implode(":", $secondarymodules); if ($secondarymodule != '') { $this->secondarymodules .= $secondarymodule; } if (isset($_REQUEST["summaries_limit"])) { $summaries_limit = vtlib_purify($_REQUEST["summaries_limit"]); } else { $summaries_limit = $this->reportinformations["summaries_limit"]; } } else { $secondarymodule = ''; $secondarymodules = array(); $this->getPriModuleColumnsList($primary_module); foreach ($this->secondarymodules as $key => $secmodid) { $this->getSecModuleColumnsList(vtlib_getModuleNameById($secmodid)); } $summaries_limit = "20"; } $smarty_obj->assign("SUMMARIES_MAX_LIMIT", $summaries_limit); for ($tc_i = 1; $tc_i < 4; $tc_i++) { $timelinecol = $selected_timeline_column = ""; if (isset($_REQUEST["group{$tc_i}"]) && $_REQUEST["group{$tc_i}"] != "" && $step_name != "ReportGrouping") { $group = vtlib_purify($_REQUEST["group{$tc_i}"]); if (isset($_REQUEST["timeline_column{$tc_i}"]) && $_REQUEST["timeline_column{$tc_i}"] != "") { $selected_timeline_column = vtlib_purify($_REQUEST["timeline_column{$tc_i}"]); } } else { $group = $this->reportinformations["Group{$tc_i}"]; $selected_timeline_column = $this->reportinformations["timeline_columnstr{$tc_i}"]; } if (isset($selected_timeline_column) && !in_array($selected_timeline_column, array("", "none", "@vlv@"))) { $timelinecol = $this->getTimeLineColumnHTML($tc_i, $selected_timeline_column); $smarty_obj->assign("timelinecolumn" . $tc_i . "_html", $timelinecol); } $RG_BLOCK = getPrimaryColumns_GroupingHTML($primary_module, $group, $this); $smarty_obj->assign("RG_BLOCK{$tc_i}", $RG_BLOCK); if ($tc_i > 1) { if (isset($_REQUEST["timeline_type{$tc_i}"]) && $_REQUEST["timeline_type{$tc_i}"] != "") { $timeline_type = vtlib_purify($_REQUEST["timeline_type{$tc_i}"]); } else { $timeline_type = $this->reportinformations["timeline_type{$tc_i}"]; } $smarty_obj->assign("timeline_type{$tc_i}", $timeline_type); } } for ($sci = 1; $sci < 4; $sci++) { if (isset($_REQUEST["sort" . $sci]) && $_REQUEST["sort" . $sci] != "") { $sortorder = vtlib_purify($_REQUEST["sort" . $sci]); } else { $sortorder = $this->reportinformations["Sort" . $sci]; } $sa = $sd = ""; if ($sortorder != "Descending") { $sa = "checked"; } else { $sd = "checked"; } $shtml = '<input type="radio" id="Sort' . $sci . 'a" name="Sort' . $sci . '" value="Ascending" ' . $sa . '>' . vtranslate('Ascending') . ' <input type="radio" id="Sort' . $sci . 'd" name="Sort' . $sci . '" value="Descending" ' . $sd . '>' . vtranslate('Descending'); $smarty_obj->assign("ASCDESC" . $sci, $shtml); } // ITS4YOU-CR SlOl 5. 3. 2014 14:50:45 SUMMARIES START $module_id = $primary_moduleid; $modulename_prefix = ""; $module_array["module"] = $primary_module; $module_array["id"] = $module_id; $selectedmodule = $module_array["id"]; $modulename = $module_array["module"]; $modulename_lbl = vtranslate($modulename, $modulename); $availModules[$module_array["id"]] = $modulename_lbl; $modulename_id = $module_array["id"]; if (isset($selectedmodule)) { $secondarymodule_arr = $this->getReportRelatedModules($module_array["id"]); $this->getSecModuleColumnsList($selectedmodule); $RG_BLOCK4 = sgetSummariesHTMLOptions($module_array["id"], $module_id); $available_modules[] = array("id" => $module_id, "name" => $modulename_lbl, "checked" => "checked"); foreach ($secondarymodule_arr as $key => $value) { $exploded_mid = explode("x", $value["id"]); if (strtolower($exploded_mid[1]) != "mif") { $available_modules[] = array("id" => $value["id"], "name" => "- " . $value["name"], "checked" => ""); } } $smarty_obj->assign("RG_BLOCK4", $RG_BLOCK4); } $smarty_obj->assign("SummariesModules", $available_modules); $SumOptions = sgetSummariesOptions($selectedmodule); if (empty($SumOptions)) { $SumOptions = vtranslate("NO_SUMMARIES_COLUMNS", $this->currentModule); } $SPSumOptions[$module_array["id"]][$module_array["id"]] = $SumOptions; $smarty_obj->assign("SUMOPTIONS", $SPSumOptions); if (isset($_REQUEST["selectedSummariesString"])) { $selectedSummariesString = vtlib_purify($_REQUEST["selectedSummariesString"]); $selectedSummariesArr = explode(";", $selectedSummariesString); $summaries_orderby = vtlib_purify($_REQUEST["summaries_orderby"]); $RG_BLOCK6 = sgetSelectedSummariesHTMLOptions($selectedSummariesArr, $summaries_orderby); } else { if (!empty($this->reportinformations["summaries_columns"])) { foreach ($this->reportinformations["summaries_columns"] as $key => $summaries_columns_arr) { $selectedSummariesArr[] = $summaries_columns_arr["columnname"]; } } $selectedSummariesString = implode(";", $selectedSummariesString); $summaries_orderby = ""; if (isset($this->reportinformations["summaries_orderby_columns"][0]) && $this->reportinformations["summaries_orderby_columns"][0] != "") { $summaries_orderby = $this->reportinformations["summaries_orderby_columns"][0]; } $RG_BLOCK6 = sgetSelectedSummariesHTMLOptions($selectedSummariesArr, $summaries_orderby); } // sum_group_columns for group filters start $sm_arr = sgetSelectedSummariesOptions($selectedSummariesArr); $sm_str = ""; foreach ($sm_arr as $key => $opt_arr) { if ($sm_str != "") { $sm_str .= "(|@!@|)"; } $sm_str .= $opt_arr["value"] . "(|@|)" . $opt_arr["text"]; } $smarty_obj->assign("sum_group_columns", $sm_str); // sum_group_columns for group filters end $smarty_obj->assign("selectedSummariesString", $selectedSummariesString); $smarty_obj->assign("RG_BLOCK6", $RG_BLOCK6); $RG_BLOCKx2 = array(); $all_fields_str = ""; foreach ($SPSumOptions as $module_key => $SumOptions) { $RG_BLOCKx2 = ""; $r_modulename = vtlib_getModuleNameById($module_key); $r_modulename_lbl = vtranslate($r_modulename, $r_modulename); foreach ($SumOptions as $SumOptions_key => $SumOptions_value) { if (is_array($SumOptions_value)) { foreach ($SumOptions_value as $optgroup => $optionsdata) { if ($RG_BLOCKx2 != "") { $RG_BLOCKx2 .= "(|@!@|)"; } $RG_BLOCKx2 .= $optgroup; $RG_BLOCKx2 .= "(|@|)"; $RG_BLOCKx2 .= Zend_JSON::encode($optionsdata); } } else { $RG_BLOCKx2 .= $SumOptions_value; $RG_BLOCKx2 .= "(|@|)"; $optionsdata[] = array("value" => "none", "text" => vtranslate("LBL_NONE", $this->currentModule)); $RG_BLOCKx2 .= Zend_JSON::encode($optionsdata); } $all_fields_str .= $module_key . "(!#_ID@ID_#!)" . $r_modulename_lbl . "(!#_ID@ID_#!)" . $RG_BLOCKx2; } } $smarty_obj->assign("ALL_FIELDS_STRING", $all_fields_str); // ITS4YOU-END 5. 3. 2014 14:50:47 SUMMARIES END if (isset($_REQUEST["summaries_orderby"]) && $_REQUEST["summaries_orderby"] != "" && isset($_REQUEST["summaries_orderby_type"]) && $_REQUEST["summaries_orderby_type"] != "") { $summaries_orderby = vtlib_purify($_REQUEST["summaries_orderby"]); $summaries_orderby_type = vtlib_purify($_REQUEST["summaries_orderby_type"]); } elseif (isset($this->reportinformations["summaries_orderby_columns"]) && !empty($this->reportinformations["summaries_orderby_columns"])) { $summaries_orderby = $this->reportinformations["summaries_orderby_columns"][0]["column"]; $summaries_orderby_type = $this->reportinformations["summaries_orderby_columns"][0]["type"]; } else { $summaries_orderby = "none"; $summaries_orderby_type = "ASC"; } $smarty_obj->assign("summaries_orderby", $summaries_orderby); $smarty_obj->assign("summaries_orderby_type", $summaries_orderby_type); } if (in_array($step_name, array("ReportColumns", $get_all_steps))) { if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') { $RC_BLOCK1 = getPrimaryColumnsHTML($this->primarymodule); $secondarymodule = ''; $secondarymodules = array(); if (!empty($this->related_modules[$this->primarymodule])) { foreach ($this->related_modules[$this->primarymodule] as $key => $value) { if (isset($_REQUEST["secondarymodule_" . $value])) { $secondarymodules[] = $_REQUEST["secondarymodule_" . $value]; } } } $secondarymodule = implode(":", $secondarymodules); $RC_BLOCK2 = $this->getSelectedColumnsList($this->selected_columns_list_arr); $smarty_obj->assign("RC_BLOCK1", $RC_BLOCK1); $smarty_obj->assign("RC_BLOCK2", $RC_BLOCK2); $sreportsortsql = "SELECT columnname, sortorder FROM its4you_reports4you_sortcol WHERE reportid =? AND sortcolid = 4"; $result_sort = $adb->pquery($sreportsortsql, array($recordid)); $num_rows = $adb->num_rows($result_sort); if ($num_rows > 0) { $columnname = $adb->query_result($result_sort, 0, "columnname"); $sortorder = $adb->query_result($result_sort, 0, "sortorder"); $RC_BLOCK3 = $this->getSelectedColumnsList($this->selected_columns_list_arr, $columnname); } else { $RC_BLOCK3 = $RC_BLOCK2; } $smarty_obj->assign("RC_BLOCK3", $RC_BLOCK3); $this->secmodule = $secondarymodule; $RC_BLOCK4 = ""; $RC_BLOCK4 = getSecondaryColumnsHTML($this->relatedmodulesstring, $this); $smarty_obj->assign("RC_BLOCK4", $RC_BLOCK4); } else { $primarymodule = vtlib_purify($_REQUEST["primarymodule"]); $RC_BLOCK1 = getPrimaryColumnsHTML($primarymodule); if (!empty($this->related_modules[$primarymodule])) { foreach ($this->related_modules[$primarymodule] as $key => $value) { $RC_BLOCK1 .= getSecondaryColumnsHTML($_REQUEST["secondarymodule_" . $value], $this); } } $smarty_obj->assign("RC_BLOCK1", $RC_BLOCK1); $this->reportinformations["columns_limit"] = "20"; } $smarty_obj->assign("MAX_LIMIT", $this->reportinformations["columns_limit"]); if ($sortorder != "DESC") { $shtml = '<input type="radio" name="SortOrderColumn" value="ASC" checked>' . vtranslate('Ascending') . ' <input type="radio" name="SortOrderColumn" value="DESC">' . vtranslate('Descending'); } else { $shtml = '<input type="radio" name="SortOrderColumn" value="ASC">' . vtranslate('Ascending') . ' <input type="radio" name="SortOrderColumn" value="DESC" checked>' . vtranslate('Descending'); } $smarty_obj->assign("COLUMNASCDESC", $shtml); $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="DAYS" checked>' . $mod_strings['TL_DAYS'] . ' '; $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="WEEK" >' . $mod_strings['TL_WEEKS'] . ' '; $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="MONTH" >' . $mod_strings['TL_MONTHS'] . ' '; $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="YEAR" >' . $mod_strings['TL_YEARS'] . ' '; $timelinecolumns .= '<input type="radio" name="TimeLineColumn" value="QUARTER" >' . $mod_strings['TL_QUARTERS'] . ' '; $smarty_obj->assign("TIMELINE_FIELDS", $timelinecolumns); // ITS4YOU-CR SlOl 19. 2. 2014 16:30:20 $SPSumOptions = $availModules = array(); $RC_BLOCK0 = ""; $smarty_obj->assign("availModules", $availModules); $smarty_obj->assign("ALL_FIELDS_STRING", $RC_BLOCK0); // ITS4YOU-END 19. 2. 2014 16:30:23 $smarty_obj->assign("currentModule", $this->currentModule); } if (in_array($step_name, array("ReportColumnsTotal", $get_all_steps))) { $Objects = array(); $curl_array = array(); if (isset($_REQUEST["curl"])) { $curl = vtlib_purify($_REQUEST["curl"]); $curl_array = explode('$_@_$', $curl); $selectedColumnsString = str_replace("@AMPKO@", "&", $_REQUEST["selectedColumnsStr"]); $R_Objects = explode("<_@!@_>", $selectedColumnsString); } else { $curl_array = $this->getSelectedColumnsToTotal($this->record); $curl = implode('$_@_$', $curl_array); $selectedColumnsString = str_replace("@AMPKO@", "&", $this->reportinformations["selectedColumnsString"]); $R_Objects = explode(";", $selectedColumnsString); } $smarty_obj->assign("CURL", $curl); $Objects = sgetNewColumnstoTotalHTMLScript($R_Objects); $this->columnssummary = $Objects; $CT_BLOCK1 = $this->sgetNewColumntoTotalSelected($recordid, $R_Objects, $curl_array); $smarty_obj->assign("CT_BLOCK1", $CT_BLOCK1); //added to avoid displaying "No data avaiable to total" when using related modules in report. $rows_count = 0; $rows_count = count($CT_BLOCK1); $smarty_obj->assign("ROWS_COUNT", $rows_count); } if (in_array($step_name, array("ReportLabels", $get_all_steps))) { // selected labels from url $lbl_url_string = html_entity_decode(vtlib_purify($_REQUEST["lblurl"]), ENT_QUOTES, $default_charset); if ($lbl_url_string != "") { $lbl_url_arr = explode('$_@_$', $lbl_url_string); foreach ($lbl_url_arr as $key => $lbl_value) { if (strpos($lbl_value, 'hidden_') === false) { if (strpos($lbl_value, '_SC_lLbLl_') !== false) { $temp = explode('_SC_lLbLl_', $lbl_value); $temp_lbls = explode('_lLGbGLl_', $temp[1]); $lbl_key = trim($temp_lbls[0]); $lbl_value = trim($temp_lbls[1]); $lbl_url_selected["SC"][$lbl_key] = $lbl_value; } if (strpos($lbl_value, '_SM_lLbLl_') !== false) { $temp = explode('_SM_lLbLl_', $lbl_value); $temp_lbls = explode('_lLGbGLl_', $temp[1]); $lbl_key = trim($temp_lbls[0]); $lbl_value = trim($temp_lbls[1]); $lbl_url_selected["SM"][$lbl_key] = $lbl_value; } if (strpos($lbl_value, '_CT_lLbLl_') !== false) { $temp = explode('_CT_lLbLl_', $lbl_value); $temp_lbls = explode('_lLGbGLl_', $temp[1]); $lbl_key = trim($temp_lbls[0]); $lbl_value = trim($temp_lbls[1]); $lbl_url_selected["CT"][$lbl_key] = $lbl_value; } } } } // COLUMNS labeltype SC if (isset($_REQUEST["selectedColumnsStr"]) && $_REQUEST["selectedColumnsStr"] != "") { $selectedColumnsString = vtlib_purify($_REQUEST["selectedColumnsStr"]); $selectedColumnsString = html_entity_decode($selectedColumnsString, ENT_QUOTES, $default_charset); $selected_columns_array = explode("<_@!@_>", $selectedColumnsString); $decode_labels = true; } else { $selectedColumnsString = html_entity_decode($this->reportinformations["selectedColumnsString"], ENT_QUOTES, $default_charset); $selected_columns_array = explode(";", $selectedColumnsString); $decode_labels = false; } $labels_html["SC"] = $this->getLabelsHTML($selected_columns_array, "SC", $lbl_url_selected, $decode_labels); // SUMMARIES labeltype SM $selectedSummariesString = vtlib_purify($_REQUEST["selectedSummariesString"]); if ($selectedSummariesString != "") { $selectedSummaries_array = explode(";", trim($selectedSummariesString, ";")); } else { foreach ($this->reportinformations["summaries_columns"] as $key => $sum_arr) { $selectedSummaries_array[] = $sum_arr["columnname"]; } } $labels_html["SM"] = $this->getLabelsHTML($selectedSummaries_array, "SM", $lbl_url_selected, $decode_labels); $smarty_obj->assign("labels_html", $labels_html); $smarty_obj->assign("LABELS", $curl); //added to avoid displaying "No data avaiable to total" when using related modules in report. $rows_count = count($labels_html); foreach ($labels_html as $key => $labels_type_arr) { $rows_count += count($labels_type_arr); } $smarty_obj->assign("ROWS_COUNT", $rows_count); } if (in_array($step_name, array("ReportFilters", $get_all_steps))) { require_once 'modules/ITS4YouReports/FilterUtils.php'; if (isset($_REQUEST["primarymodule"]) && $_REQUEST["primarymodule"] != "") { $primary_moduleid = $_REQUEST["primarymodule"]; $primary_module = vtlib_getModuleNameById($_REQUEST["primarymodule"]); } else { $primary_module = $this->primarymodule; $primary_moduleid = $this->primarymoduleid; } // NEW ADVANCE FILTERS START $this->getGroupFilterList($this->record); $this->getAdvancedFilterList($this->record); $this->getSummariesFilterList($this->record); $sel_fields = Zend_Json::encode($this->adv_sel_fields); $smarty_obj->assign("SEL_FIELDS", $sel_fields); if (isset($_REQUEST["reload"])) { $criteria_groups = $this->getRequestCriteria($sel_fields); } else { $criteria_groups = $this->advft_criteria; } $smarty_obj->assign("CRITERIA_GROUPS", $criteria_groups); $smarty_obj->assign("EMPTY_CRITERIA_GROUPS", empty($criteria_groups)); $smarty_obj->assign("SUMMARIES_CRITERIA", $this->summaries_criteria); $FILTER_OPTION = getAdvCriteriaHTML(); $smarty_obj->assign("FOPTION", $FILTER_OPTION); $COLUMNS_BLOCK_JSON = $this->getAdvanceFilterOptionsJSON($primary_module); $smarty_obj->assign("COLUMNS_BLOCK", $COLUMNS_BLOCK); if ($mode != "ajax") { echo "<textarea style='display:none;' id='filter_columns'>" . $COLUMNS_BLOCK_JSON . "</textarea>"; $smarty_obj->assign("filter_columns", $COLUMNS_BLOCK_JSON); $sel_fields = Zend_Json::encode($this->adv_sel_fields); $smarty_obj->assign("SEL_FIELDS", $sel_fields); global $default_charset; $std_filter_columns = $this->getStdFilterColumns(); $std_filter_columns_js = implode("<%jsstdjs%>", $std_filter_columns); $std_filter_columns_js = html_entity_decode($std_filter_columns_js, ENT_QUOTES, $default_charset); $smarty_obj->assign("std_filter_columns", $std_filter_columns_js); $std_filter_criteria = Zend_Json::encode($this->Date_Filter_Values); $smarty_obj->assign("std_filter_criteria", $std_filter_criteria); } $rel_fields = $this->adv_rel_fields; $smarty_obj->assign("REL_FIELDS", Zend_Json::encode($rel_fields)); // NEW ADVANCE FILTERS END $BLOCKJS = $this->getCriteriaJS(); $smarty_obj->assign("BLOCKJS_STD", $BLOCKJS); } if (in_array($step_name, array("ReportSharing", $get_all_steps))) { $roleid = $this->current_user->column_fields['roleid']; $user_array = getRoleAndSubordinateUsers($roleid); $userIdStr = ""; $userNameStr = ""; $m = 0; foreach ($user_array as $userid => $username) { if ($userid != $this->current_user->id) { if ($m != 0) { $userIdStr .= ","; $userNameStr .= ","; } $userIdStr .= "'" . $userid . "'"; $userNameStr .= "'" . escape_single_quotes(decode_html($username)) . "'"; $m++; } } require_once 'include/utils/GetUserGroups.php'; // ITS4YOU-UP SlOl 26. 4. 2013 9:47:59 $template_owners = get_user_array(false); if (isset($this->reportinformations["owner"]) && $this->reportinformations["owner"] != "") { $selected_owner = $this->reportinformations["owner"]; } else { $selected_owner = $this->current_user->id; } $smarty_obj->assign("TEMPLATE_OWNERS", $template_owners); $owner = isset($_REQUEST['template_owner']) && $_REQUEST['template_owner'] != '' ? $_REQUEST['template_owner'] : $selected_owner; $smarty_obj->assign("TEMPLATE_OWNER", $owner); $sharing_types = array("public" => vtranslate("PUBLIC_FILTER"), "private" => vtranslate("PRIVATE_FILTER"), "share" => vtranslate("SHARE_FILTER")); $smarty_obj->assign("SHARINGTYPES", $sharing_types); $sharingtype = "public"; if (isset($_REQUEST['sharing']) && $_REQUEST['sharing'] != '') { $sharingtype = $_REQUEST['sharing']; } elseif (isset($this->reportinformations["sharingtype"]) && $this->reportinformations["sharingtype"] != "") { $sharingtype = $this->reportinformations["sharingtype"]; } $smarty_obj->assign("SHARINGTYPE", $sharingtype); $cmod = return_specified_module_language($current_language, "Settings"); $smarty_obj->assign("CMOD", $cmod); $sharingMemberArray = array(); if (isset($_REQUEST['sharingSelectedColumns']) && $_REQUEST['sharingSelectedColumns'] != '') { $sharingMemberArray = explode("|", trim($_REQUEST['sharingSelectedColumns'], "|")); } elseif (isset($this->reportinformations["members_array"]) && !empty($this->reportinformations["members_array"])) { $sharingMemberArray = $this->reportinformations["members_array"]; } $sharingMemberArray = array_unique($sharingMemberArray); if (count($sharingMemberArray) > 0) { $outputMemberArr = array(); foreach ($sharingMemberArray as $setype => $shareIdArr) { $shareIdArr = explode("::", $shareIdArr); $shareIdArray = array(); $shareIdArray[$shareIdArr[0]] = $shareIdArr[1]; foreach ($shareIdArray as $shareType => $shareId) { switch ($shareType) { case "groups": $memberName = fetchGroupName($shareId); $memberDisplay = "Group::"; break; case "roles": $memberName = getRoleName($shareId); $memberDisplay = "Roles::"; break; case "rs": $memberName = getRoleName($shareId); $memberDisplay = "RoleAndSubordinates::"; break; case "users": $memberName = getUserFullName($shareId); $memberDisplay = "User::"; break; } $outputMemberArr[] = $shareType . "::" . $shareId; $outputMemberArr[] = $memberDisplay . $memberName; } } $smarty_obj->assign("MEMBER", array_chunk($outputMemberArr, 2)); } // ITS4YOU-END $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($this->current_user->id); $user_groups = $userGroups->user_groups; $groupIdStr = ""; $groupNameStr = ""; $l = 0; foreach ($user_groups as $i => $grpid) { $grp_details = getGroupDetails($grpid); if ($l != 0) { $groupIdStr .= ","; $groupNameStr .= ","; } $groupIdStr .= "'" . $grp_details[0] . "'"; $groupNameStr .= "'" . escape_single_quotes(decode_html($grp_details[1])) . "'"; $l++; } $visiblecriteria = getVisibleCriteria(); $smarty_obj->assign("VISIBLECRITERIA", $visiblecriteria); $smarty_obj->assign("GROUPNAMESTR", $groupNameStr); $smarty_obj->assign("USERNAMESTR", $userNameStr); $smarty_obj->assign("GROUPIDSTR", $groupIdStr); $smarty_obj->assign("USERIDSTR", $userIdStr); } if (in_array($step_name, array("ReportScheduler", $get_all_steps))) { // SEE ReportScheduler.php for this step for a reason of problem with incomplemete ReportScheduler object } if (in_array($step_name, array("ReportGraphs", $get_all_steps))) { if (isset($_REQUEST["chart_type"]) && $_REQUEST["chart_type"] != "" && $_REQUEST["chart_type"] != "none") { $selected_chart_type = vtlib_purify($_REQUEST["chart_type"]); } else { $selected_chart_type = $this->reportinformations["charts"]["charttype"]; } $smarty_obj->assign("IMAGE_PATH", $chart_type); if (isset($_REQUEST["data_series"]) && $_REQUEST["data_series"] != "" && $_REQUEST["data_series"] != "none") { $selected_data_series = vtlib_purify($_REQUEST["data_series"]); } else { $selected_data_series = $this->reportinformations["charts"]["dataseries"]; } if (isset($_REQUEST["charttitle"]) && $_REQUEST["charttitle"] != "") { $selected_charttitle = htmlspecialchars(vtlib_purify($_REQUEST["charttitle"])); } else { $selected_charttitle = $this->reportinformations["charts"]["charttitle"]; } $chart_type["horizontal"] = array("value" => vtranslate("LBL_CHART_horizontal", $this->currentModule), "selected" => $selected_chart_type == "horizontal" ? "selected" : ""); $chart_type["vertical"] = array("value" => vtranslate("LBL_CHART_vertical", $this->currentModule), "selected" => $selected_chart_type == "vertical" ? "selected" : ""); $chart_type["linechart"] = array("value" => vtranslate("LBL_CHART_linechart", $this->currentModule), "selected" => $selected_chart_type == "linechart" ? "selected" : ""); $chart_type["pie"] = array("value" => vtranslate("LBL_CHART_pie", $this->currentModule), "selected" => $selected_chart_type == "pie" ? "selected" : ""); $chart_type["pie3d"] = array("value" => vtranslate("LBL_CHART_pie3D", $this->currentModule), "selected" => $selected_chart_type == "pie3d" ? "selected" : ""); $chart_type["funnel"] = array("value" => vtranslate("LBL_CHART_funnel", $this->currentModule), "selected" => $selected_chart_type == "funnel" ? "selected" : ""); $smarty_obj->assign("CHART_TYPE", $chart_type); // selected labels from url if (isset($_REQUEST["lblurl"])) { global $default_charset; $lbl_url_string = html_entity_decode(vtlib_purify($_REQUEST["lblurl"]), ENT_QUOTES, $default_charset); } $lbl_url_string = str_replace("@AMPKO@", "&", $lbl_url_string); if ($lbl_url_string != "") { $lbl_url_arr = explode('$_@_$', $lbl_url_string); foreach ($lbl_url_arr as $key => $lbl_value) { if (strpos($lbl_value, 'hidden_') === false) { if (strpos($lbl_value, '_SC_lLbLl_') !== false) { $temp = explode('_SC_lLbLl_', $lbl_value); $temp_lbls = explode('_lLGbGLl_', $temp[1]); $lbl_key = $temp_lbls[0]; $lbl_value = $temp_lbls[1]; $lbl_url_selected["SC"][$lbl_key] = $lbl_value; } if (strpos($lbl_value, '_SM_lLbLl_') !== false) { $temp = explode('_SM_lLbLl_', $lbl_value); $temp_lbls = explode('_lLGbGLl_', $temp[1]); $lbl_key = $temp_lbls[0]; $lbl_value = $temp_lbls[1]; $lbl_url_selected["SM"][$lbl_key] = $lbl_value; } if (strpos($lbl_value, '_CT_lLbLl_') !== false) { $temp = explode('_CT_lLbLl_', $lbl_value); $temp_lbls = explode('_lLGbGLl_', $temp[1]); $lbl_key = $temp_lbls[0]; $lbl_value = $temp_lbls[1]; $lbl_url_selected["CT"][$lbl_key] = $lbl_value; } } } } $selectedSummariesString = vtlib_purify($_REQUEST["selectedSummariesString"]); if ($selectedSummariesString != "") { $selectedSummariesArray = explode(";", $selectedSummariesString); if (!empty($selectedSummariesArray)) { foreach ($selectedSummariesArray as $column_str) { if ($column_str != "") { if (isset($lbl_url_selected["SM"][$column_str]) && $lbl_url_selected["SM"][$column_str] != "") { $column_lbl = $lbl_url_selected["SM"][$column_str]; } else { $column_str_arr = explode(":", $column_str); $translate_arr = explode("_", $column_str_arr[2]); $translate_module = $translate_arr[0]; unset($translate_arr[0]); $translate_str = implode("_", $translate_arr); $translate_mod_str = return_module_language($current_language, $translate_module); if (isset($translate_mod_str[$translate_str])) { $column_lbl = $translate_mod_str[$translate_str]; } else { $column_lbl = $translate_str; } } $data_series[$column_str] = array("value" => $column_lbl, "selected" => $column_str == $selected_data_series ? "selected" : ""); } } } } if (empty($data_series) && $selected_data_series != "") { $column_lbl = $this->getColumnStr_Label($selected_data_series, "SM"); $data_series[$selected_data_series] = array("value" => $column_lbl, "selected" => "selected"); } $smarty_obj->assign("DATA_SERIES", $data_series); $smarty_obj->assign("CHART_TITLE", $selected_charttitle); } return $smarty_obj; } }
$userNameStr = ""; $m = 0; foreach ($user_array as $userid => $username) { if ($userid != $current_user->id) { if ($m != 0) { $userIdStr .= ","; $userNameStr .= ","; } $userIdStr .= "'" . $userid . "'"; $userNameStr .= "'" . escape_single_quotes(decode_html($username)) . "'"; $m++; } } require_once 'include/utils/GetUserGroups.php'; $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($current_user->id); $user_groups = $userGroups->user_groups; $groupIdStr = ""; $groupNameStr = ""; $l = 0; foreach ($user_groups as $i => $grpid) { $grp_details = getGroupDetails($grpid); if ($l != 0) { $groupIdStr .= ","; $groupNameStr .= ","; } $groupIdStr .= "'" . $grp_details[0] . "'"; $groupNameStr .= "'" . escape_single_quotes(decode_html($grp_details[1])) . "'"; $l++; } if (isset($_REQUEST["record"]) && $_REQUEST['record'] != '') {