Ejemplo n.º 1
0
 public function process(Vtiger_Request $request, $widget = NULL)
 {
     global $log;
     $log->debug("Entering ./dashboards/MiniList.php::process");
     $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());
     $minilistWidgetModel = new Vtiger_MiniList_Model();
     $minilistWidgetModel->setWidgetModel($widget);
     $viewer->assign('WIDGET', $widget);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('MINILIST_WIDGET_MODEL', $minilistWidgetModel);
     $viewer->assign('BASE_MODULE', $minilistWidgetModel->getTargetModule());
     $viewer->assign('SCRIPTS', $this->getHeaderScripts());
     $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);
     }
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 public function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $linkId = $request->get('linkid');
     $response = new Vtiger_Response();
     if ($request->has('widgetid')) {
         $widget = Vtiger_Widget_Model::getInstanceWithWidgetId($request->get('widgetid'), $currentUser->getId());
     } else {
         $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
     }
     if (!$widget->isDefault()) {
         $widget->remove();
         $response->setResult(array('linkid' => $linkId, 'name' => $widget->getName(), 'url' => $widget->getUrl(), 'title' => vtranslate($widget->getTitle(), $request->getModule())));
     } else {
         $response->setError(vtranslate('LBL_CAN_NOT_REMOVE_DEFAULT_WIDGET', $moduleName));
     }
     $response->emit();
 }