Ejemplo n.º 1
0
 /**
  * Function returns the parent Comment Model
  * @return <Vtiger_Record_Model>
  */
 public function getParentCommentModel()
 {
     $recordId = $this->get('parent_comments');
     if (!empty($recordId)) {
         return ModComments_Record_Model::getInstanceById($recordId, 'ModComments');
     }
     return false;
 }
Ejemplo n.º 2
0
 public function process(Vtiger_Request $request)
 {
     $record = $request->get('record');
     $moduleName = $request->getModule();
     $recordModel = ModComments_Record_Model::getInstanceById($record);
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $viewer->assign('CURRENTUSER', $currentUserModel);
     $viewer->assign('COMMENT', $recordModel);
     echo $viewer->view('Comment.tpl', $moduleName, true);
 }
Ejemplo n.º 3
0
 public function process(Vtiger_Request $request)
 {
     $recordId = $request->get('record');
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $request->set('assigned_user_id', $currentUserModel->getId());
     $request->set('userid', $currentUserModel->getId());
     $this->saveRecord($request);
     $recordModel = ModComments_Record_Model::getInstanceById($recordId);
     $result['success'] = true;
     $result['reasontoedit'] = $recordModel->get('reasontoedit');
     $result['commentcontent'] = $recordModel->get('commentcontent');
     $result['modifiedtime'] = Vtiger_Util_Helper::formatDateDiffInStrings($recordModel->get('modifiedtime'));
     $result['modifiedtimetitle'] = Vtiger_Util_Helper::formatDateTimeIntoDayString($recordModel->get('modifiedtime'));
     $response = new Vtiger_Response();
     $response->setEmitType(Vtiger_Response::$EMIT_JSON);
     $response->setResult($result);
     $response->emit();
 }
Ejemplo n.º 4
0
 /**
  * Function sends all the comments for a parent(Accounts, Contacts etc)
  * @param Vtiger_Request $request
  * @return <type>
  */
 function showAllComments(Vtiger_Request $request)
 {
     $parentRecordId = $request->get('record');
     $commentRecordId = $request->get('commentid');
     $moduleName = $request->getModule();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
     $parentCommentModels = ModComments_Record_Model::getAllParentComments($parentRecordId);
     if (!empty($commentRecordId)) {
         $currentCommentModel = ModComments_Record_Model::getInstanceById($commentRecordId);
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('CURRENTUSER', $currentUserModel);
     $viewer->assign('COMMENTS_MODULE_MODEL', $modCommentsModel);
     $viewer->assign('PARENT_COMMENTS', $parentCommentModels);
     $viewer->assign('CURRENT_COMMENT', $currentCommentModel);
     return $viewer->view('ShowAllComments.tpl', $moduleName, 'true');
 }