示例#1
0
 function process(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $moduleName = $request->getModule();
     $componentName = $request->get('name');
     $linkId = $request->get('linkid');
     if (!empty($componentName)) {
         $className = Vtiger_Loader::getComponentClassName('Dashboard', $componentName, $moduleName);
         if (!empty($className)) {
             $widget = NULL;
             if (!empty($linkId)) {
                 $widget = new Vtiger_Widget_Model();
                 $widget->set('linkid', $linkId);
                 $widget->set('userid', $currentUser->getId());
                 $widget->set('filterid', $request->get('filterid', NULL));
                 if ($request->has('data')) {
                     $widget->set('data', $request->get('data'));
                 }
                 $widget->add();
             }
             $classInstance = new $className();
             $classInstance->process($request, $widget);
             return;
         }
     }
     $response = new Vtiger_Response();
     $response->setResult(array('success' => false, 'message' => vtranslate('NO_DATA')));
     $response->emit();
 }