public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $page = $request->get('page'); $linkId = $request->get('linkid'); $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) { $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); } else { $owner = $request->get('owner'); } $pagingModel = new Vtiger_Paging_Model(); $pagingModel->set('page', $page); $pagingModel->set('limit', (int) $widget->get('limit')); $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $projectsTasks = $owner === false ? array() : $moduleModel->getAssignedProjectsTasks('upcoming', $pagingModel, $owner); $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('PROJECTSTASKS', $projectsTasks); $viewer->assign('PAGING', $pagingModel); $viewer->assign('CURRENTUSER', $currentUser); global $title_max_length, $href_max_length; $viewer->assign('NAMELENGHT', $title_max_length); $viewer->assign('HREFNAMELENGHT', $href_max_length); $viewer->assign('NODATAMSGLABLE', 'LBL_NO_OVERDUE_ACTIVITIES'); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/AssignedProjectsTasksContents.tpl', $moduleName); } else { $viewer->view('dashboards/AssignedProjectsTasks.tpl', $moduleName); } }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $stateActivityLabels = Calendar_Module_Model::getComponentActivityStateLabel(); $page = $request->get('page'); $linkId = $request->get('linkid'); $sortOrder = $request->get('sortorder'); $orderBy = $request->get('orderby'); $params = ['status' => $stateActivityLabels['in_realization']]; if ($request->get('switchParams')) { $params = ['status' => $request->get('switchParams')]; } $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); else $owner = $request->get('owner'); $pagingModel = new Vtiger_Paging_Model(); $pagingModel->set('page', $page); $pagingModel->set('limit', (int) $widget->get('limit')); $pagingModel->set('orderby', $orderBy); $pagingModel->set('sortorder', $sortOrder); $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $calendarActivities = ($owner === false) ? array() : $moduleModel->getCalendarActivities('upcoming', $pagingModel, $owner, false, $params); $switchLabels = []; $switchLabels[] = ['label' => vtranslate($stateActivityLabels['in_realization'], 'Calendar'), 'name' => $stateActivityLabels['in_realization']]; $switchLabels[] = ['label' => vtranslate($stateActivityLabels['not_started'], 'Calendar'), 'name' => $stateActivityLabels['not_started']]; $msgLabel = 'LBL_NO_SCHEDULED_ACTIVITIES'; if ($params['status'] == $stateActivityLabels['in_realization']) { $msgLabel = 'LBL_NO_CURRENT_ACTIVITIES'; } $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('ACTIVITIES', $calendarActivities); $viewer->assign('PAGING', $pagingModel); $viewer->assign('CURRENTUSER', $currentUser); $title_max_length = vglobal('title_max_length'); $href_max_length = vglobal('href_max_length'); $viewer->assign('NAMELENGHT', $title_max_length); $viewer->assign('OWNER', $owner); $viewer->assign('HREFNAMELENGHT', $href_max_length); $viewer->assign('NODATAMSGLABLE', $msgLabel); $viewer->assign('SWITCH', $switchLabels); $viewer->assign('LISTVIEWLINKS', true); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/CalendarActivitiesContents.tpl', $moduleName); } else { $viewer->view('dashboards/CalendarActivities.tpl', $moduleName); } }
public function process(Vtiger_Request $request) { $adb = PearDatabase::getInstance(); $moduleName = $request->getModule(false); $widgetsToRole = $request->get('widgetsToRole'); $oldWidgetsToRole = $request->get('oldWidgetsToRole'); if (!is_array($widgetsToRole)) { $widgetsToRole = array(); } if (!is_array($oldWidgetsToRole)) { $oldWidgetsToRole = array(); } $overlap = $request->get('overlap'); if ($overlap == 'mandatory') { $change = Settings_WidgetsManagement_Module_Model::setMandatoryWidgets($widgetsToRole, $oldWidgetsToRole); } elseif ($overlap == 'inactive') { $change = Settings_WidgetsManagement_Module_Model::setInactiveWidgets($widgetsToRole, $oldWidgetsToRole); } if (!$change) { $result = array('success' => false, 'message' => vtranslate('LBL_FAILED_TO_SAVE', $moduleName)); } else { $result = array('success' => true, 'message' => vtranslate('LBL_SAVE_CHANGE', $moduleName)); } $response = new Vtiger_Response(); $response->setResult($result); $response->emit(); }
public function process(Vtiger_Request $request, $widget = NULL) { $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); // Initialize Widget to the right-state of information if ($widget && !$request->has('widgetid')) { $widgetId = $widget->get('id'); } else { $widgetId = $request->get('widgetid'); } $widget = Vtiger_Widget_Model::getInstanceWithWidgetId($widgetId, $currentUser->getId()); if (!$request->has('owner')) { $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); } else { $owner = $request->get('owner'); } $minilistWidgetModel = new Vtiger_MiniList_Model(); $minilistWidgetModel->setWidgetModel($widget); $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('USER', $owner); $viewer->assign('CURRENTUSER', $currentUser); $viewer->assign('MINILIST_WIDGET_MODEL', $minilistWidgetModel); $viewer->assign('BASE_MODULE', $minilistWidgetModel->getTargetModule()); $viewer->assign('SCRIPTS', $this->getFooterScripts()); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/MiniListContents.tpl', $moduleName); } else { $widget->set('title', $minilistWidgetModel->getTitle()); $viewer->view('dashboards/MiniList.tpl', $moduleName); } }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $page = $request->get('page'); $linkId = $request->get('linkid'); $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) { $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); } else { $owner = $request->get('owner'); } $pagingModel = new Vtiger_Paging_Model(); $pagingModel->set('page', $page); $pagingModel->set('limit', (int) $widget->get('limit')); $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('PAGING', $pagingModel); $viewer->assign('CURRENTUSER', $currentUser); $title_max_length = vglobal('title_max_length'); $href_max_length = vglobal('href_max_length'); $viewer->assign('NAMELENGHT', $title_max_length); $viewer->assign('HREFNAMELENGHT', $href_max_length); $viewer->assign('NODATAMSGLABLE', 'LBL_NO_SCHEDULED_ACTIVITIES'); $currentUserModel = Users_Record_Model::getCurrentUserModel(); $viewer->assign('CURRENT_USER', $currentUserModel); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/CalendarContents.tpl', $moduleName); } else { $viewer->view('dashboards/Calendar.tpl', $moduleName); } }
public function showWidgetsManagement(Vtiger_Request $request) { global $log; $log->debug("Entering Settings_WidgetsManagement_Configuration_View::showWidgetsManagement() method ..."); $sourceModule = $request->get('sourceModule'); $dashboardModules = Settings_WidgetsManagement_Module_Model::getSelectableDashboard(); if (empty($sourceModule)) { $sourceModule = 'Home'; } $moduleName = $request->getModule(); $viewer = $this->getViewer($request); // get widgets list $widgets = $dashboardModules[$sourceModule]; $role = Settings_WidgetsManagement_Module_Model::getRole(); $widgetsStored = Settings_WidgetsManagement_Module_Model::getWidgets($sourceModule); if (!$widgetsStored['mandatory']) { $widgetsStored['mandatory'] = array(); } if (!$widgetsStored['inactive']) { $widgetsStored['inactive'] = array(); } $viewer->assign('MANDATORY_WIDGETS', $widgetsStored['mandatory']); $viewer->assign('INACTIVE_WIDGETS', $widgetsStored['inactive']); $viewer->assign('ROLES', $role); $viewer->assign('SELECTED_MODULE_NAME', $sourceModule); $viewer->assign('SUPPORTED_MODULES', array_keys($dashboardModules)); $viewer->assign('WIDGETS', $widgets); $viewer->assign('MODULENAME', $request->getModule(false)); echo $viewer->view('Configuration.tpl', $request->getModule(false), true); $log->debug("Exiting Settings_WidgetsManagement_Configuration_View::showWidgetsManagement() method ..."); }
public function process(Vtiger_Request $request) { global $log; $log->debug("Entering Settings_WidgetsManagement_Configuration_View::showWidgetsManagement() method ..."); $sourceModule = $request->get('sourceModule'); $dashboardModules = Settings_WidgetsManagement_Module_Model::getSelectableDashboard(); if (empty($sourceModule)) { $sourceModule = 'Home'; } $moduleName = $request->getModule(); $viewer = $this->getViewer($request); // get widgets list $widgets = $dashboardModules[$sourceModule]; $dashboardStored = Settings_WidgetsManagement_Module_Model::getDashboardForModule($sourceModule); $authorization = Settings_WidgetsManagement_Module_Model::getAuthorization(); $bloks = Settings_WidgetsManagement_Module_Model::getBlocksId(); $specialWidgets = Settings_WidgetsManagement_Module_Model::getSpecialWidgets($sourceModule); $viewer->assign('ALL_AUTHORIZATION', $authorization); $viewer->assign('SELECTED_MODULE_NAME', $sourceModule); $viewer->assign('SUPPORTED_MODULES', array_keys($dashboardModules)); $viewer->assign('DASHBOARD_AUTHORIZATION_BLOCKS', $bloks[$sourceModule]); $viewer->assign('WIDGETS_AUTHORIZATION_INFO', $dashboardStored); $viewer->assign('SPECIAL_WIDGETS', $specialWidgets); $viewer->assign('WIDGETS', $widgets); $viewer->assign('QUALIFIED_MODULE', $request->getModule(false)); echo $viewer->view('Configuration.tpl', $request->getModule(false), true); $log->debug("Exiting Settings_WidgetsManagement_Configuration_View::showWidgetsManagement() method ..."); }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $moduleName = $request->getModule(); $page = $request->get('page'); $linkId = $request->get('linkid'); $sortOrder = $request->get('sortorder'); $orderBy = $request->get('orderby'); $data = $request->getAll(); $params = ['activitesType' => 'upcoming']; if ($request->get('activitesType')) { $params = ['activitesType' => $request->get('activitesType')]; } else { $data['activitesType'] = 'upcoming'; $params = ['activitesType' => 'upcoming']; } $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) { $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); } else { $owner = $request->get('owner'); } $pagingModel = new Vtiger_Paging_Model(); $pagingModel->set('page', $page); $pagingModel->set('limit', (int) $widget->get('limit')); $pagingModel->set('orderby', $orderBy); $pagingModel->set('sortorder', $sortOrder); $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $overDueActivities = $owner === false ? array() : $moduleModel->getCalendarActivities('createdByMeButNotMine', $pagingModel, $owner, false, $params); $viewer = $this->getViewer($request); $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('ACTIVITIES', $overDueActivities); $viewer->assign('PAGING', $pagingModel); $viewer->assign('CURRENTUSER', $currentUser); $title_max_length = vglobal('title_max_length'); $href_max_length = vglobal('href_max_length'); $viewer->assign('NAMELENGHT', $title_max_length); $viewer->assign('HREFNAMELENGHT', $href_max_length); $viewer->assign('NODATAMSGLABLE', 'LBL_NO_RECORDS_MATCHED_THIS_CRITERIA'); $viewer->assign('OWNER', $owner); $viewer->assign('DATA', $data); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/CalendarActivitiesContents.tpl', $moduleName); } else { $viewer->view('dashboards/CreatedNotMineActivities.tpl', $moduleName); } }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $linkId = $request->get('linkid'); $data = $request->get('data'); $createdTime = $request->get('createdtime'); $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) { $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget, 'Leads'); } else { $owner = $request->get('owner'); } $ownerForwarded = $owner; if ($owner == 'all') { $owner = ''; } //Date conversion from user to database format if (!empty($createdTime)) { $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']); $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']); } $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $data = $owner === false ? array() : $moduleModel->getLeadsByStatusConverted($owner, $dates); $listViewUrl = $moduleModel->getListViewUrl(); for ($i = 0; $i < count($data); $i++) { $data[$i]["links"] = $listViewUrl . $this->getSearchParams($data[$i][2], $owner, $dates); } //Include special script and css needed for this widget $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('DATA', $data); $viewer->assign('CURRENTUSER', $currentUser); $accessibleUsers = $currentUser->getAccessibleUsersForModule('Leads'); $accessibleGroups = $currentUser->getAccessibleGroupForModule('Leads'); $viewer->assign('ACCESSIBLE_USERS', $accessibleUsers); $viewer->assign('ACCESSIBLE_GROUPS', $accessibleGroups); $viewer->assign('OWNER', $ownerForwarded); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName); } else { $viewer->view('dashboards/LeadsByStatusConverted.tpl', $moduleName); } }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $moduleName = $request->getModule(); $page = $request->get('page'); $linkId = $request->get('linkid'); $sortOrder = $request->get('sortorder'); $orderBy = $request->get('orderby'); $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); else $owner = $request->get('owner'); $pagingModel = new Vtiger_Paging_Model(); $pagingModel->set('page', $page); $pagingModel->set('limit', (int) $widget->get('limit')); $pagingModel->set('orderby', $orderBy); $pagingModel->set('sortorder', $sortOrder); $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $overDueActivities = ($owner === false) ? array() : $moduleModel->getCalendarActivities('overdue', $pagingModel, $owner); $viewer = $this->getViewer($request); $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('ACTIVITIES', $overDueActivities); $viewer->assign('PAGING', $pagingModel); $viewer->assign('CURRENTUSER', $currentUser); $title_max_length = vglobal('title_max_length'); $href_max_length = vglobal('href_max_length'); $viewer->assign('NAMELENGHT', $title_max_length); $viewer->assign('HREFNAMELENGHT', $href_max_length); $viewer->assign('NODATAMSGLABLE', 'LBL_NO_OVERDUE_ACTIVITIES'); $viewer->assign('OWNER', $owner); $viewer->assign('LISTVIEWLINKS', true); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/CalendarActivitiesContents.tpl', $moduleName); } else { $viewer->view('dashboards/CalendarActivities.tpl', $moduleName); } }
public function process(Vtiger_Request $request) { $log = vglobal('log'); $log->debug("Entering Settings_WidgetsManagement_Configuration_View::process() method ..."); $currentUser = Users_Record_Model::getCurrentUserModel(); $sourceModule = $request->get('sourceModule'); $dashboardModules = Settings_WidgetsManagement_Module_Model::getSelectableDashboard(); if (empty($sourceModule)) { $sourceModule = 'Home'; } $moduleName = $request->getModule(); $viewer = $this->getViewer($request); // get widgets list $widgets = $dashboardModules[$sourceModule]; $dashboardStored = Settings_WidgetsManagement_Module_Model::getDashboardForModule($sourceModule); $defaultValues = Settings_WidgetsManagement_Module_Model::getDefaultValues(); $size = Settings_WidgetsManagement_Module_Model::getSize(); $widgetsWithLimit = Settings_WidgetsManagement_Module_Model::getWidgetsWithLimit(); $authorization = Settings_Roles_Record_Model::getAll(); $bloks = Settings_WidgetsManagement_Module_Model::getBlocksId(); $specialWidgets = Settings_WidgetsManagement_Module_Model::getSpecialWidgets($sourceModule); $filterSelect = Settings_WidgetsManagement_Module_Model::getFilterSelect(); $filterSelectDefault = Settings_WidgetsManagement_Module_Model::getFilterSelectDefault(); $widgetsWithFilterUsers = Settings_WidgetsManagement_Module_Model::getWidgetsWithFilterUsers(); $restrictFilter = Settings_WidgetsManagement_Module_Model::getRestrictFilter(); $viewer->assign('FILTER_SELECT', $filterSelect); $viewer->assign('FILTER_SELECT_DEFAULT', $filterSelectDefault); $viewer->assign('WIDGETS_WITH_FILTER_USERS', $widgetsWithFilterUsers); $viewer->assign('ALL_AUTHORIZATION', $authorization); $viewer->assign('SELECTED_MODULE_NAME', $sourceModule); $viewer->assign('SUPPORTED_MODULES', array_keys($dashboardModules)); $viewer->assign('DASHBOARD_AUTHORIZATION_BLOCKS', $bloks[$sourceModule]); $viewer->assign('WIDGETS_AUTHORIZATION_INFO', $dashboardStored); $viewer->assign('SPECIAL_WIDGETS', $specialWidgets); $viewer->assign('CURRENTUSER', $currentUser); $viewer->assign('WIDGETS', $widgets); $viewer->assign('SIZE', $size); $viewer->assign('DEFAULTVALUES', $defaultValues); $viewer->assign('TITLE_OF_LIMIT', $widgetsWithLimit); $viewer->assign('QUALIFIED_MODULE', $request->getModule(false)); $viewer->assign('RESTRICT_FILTER', $restrictFilter); echo $viewer->view('Configuration.tpl', $request->getModule(false), true); $log->debug("Exiting Settings_WidgetsManagement_Configuration_View::process() method ..."); }
public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $linkId = $request->get('linkid'); $dates = $request->get('expectedclosedate'); $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); if (!$request->has('owner')) { $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget); } else { $owner = $request->get('owner'); } //Date conversion from user to database format if (!empty($dates)) { $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($dates['start']); $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($dates['end']); } $moduleModel = Vtiger_Module_Model::getInstance($moduleName); $data = $owner === false ? array() : $moduleModel->getPotentialsCountBySalesStage($owner, $dates); $listViewUrl = $moduleModel->getListViewUrl(); for ($i = 0; $i < count($data); $i++) { $data[$i][] = $listViewUrl . $this->getSearchParams($data[$i][0], $owner, $dates); } $viewer->assign('WIDGET', $widget); $viewer->assign('MODULE_NAME', $moduleName); $viewer->assign('DATA', $data); //Include special script and css needed for this widget $viewer->assign('STYLES', $this->getHeaderCss($request)); $viewer->assign('CURRENTUSER', $currentUser); $viewer->assign('OWNER', $owner); $content = $request->get('content'); if (!empty($content)) { $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName); } else { $viewer->view('dashboards/GroupBySalesStage.tpl', $moduleName); } }
public function verifyDashboard($moduleName) { global $log; $log->debug("Entering Vtiger_DashBoard_Model::verifyDashboard() method ..."); $adb = PearDatabase::getInstance(); $currentUser = Users_Record_Model::getCurrentUserModel(); $moduleModel = $this->getModule(); $blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole()); $query = 'SELECT * FROM `vtiger_module_dashboard` WHERE `blockid` = ?;'; if (count($blockId) == 0) { return; } $params = array($blockId); $result = $adb->pquery($query, $params); for ($i = 0; $i < $adb->num_rows($result); $i++) { $row = $adb->query_result_rowdata($result, $i); $row['data'] = htmlspecialchars_decode($row['data']); $query = 'SELECT * FROM `vtiger_module_dashboard_widgets` WHERE `userid` = ? AND `templateid` = ?;'; $params = array($currentUser->getId(), $row['id']); $resultVerify = $adb->pquery($query, $params); if (!$adb->num_rows($resultVerify)) { $query = 'INSERT INTO vtiger_module_dashboard_widgets(`linkid`, `userid`, `templateid`, `filterid`, `title`, `data`, `isdefault`, `active`) VALUES(?,?,?,?,?,?,?,?);'; $active = 0; if ($row['isdefault']) { $active = 1; } $params = array($row['linkid'], $currentUser->getId(), $row['id'], $row['filterid'], $row['title'], $row['data'], $row['isdefault'], $active); $adb->pquery($query, $params); } } $log->debug("Exiting Vtiger_DashBoard_Model::verifyDashboard() method ..."); }