getObject($params); /* @var $object kDBItem */ $user_reply = $this->IsUserReply($params); return $user_reply && ($object->GetDBField('ReplyStatus') != SUBMISSION_LOG_REPLIED); } /** * Checks, that current log record is mail from client to admin * * @param Array $params * @return bool */ function IsUserReply($params) { $object =& $this->getObject($params); /* @var $object kDBItem */ $reply_email = $this->Application->ConfigValue('SubmissionReplyFromEmail'); return $object->GetDBField('ToEmail') == $reply_email; } /** * Checks if there is draft for given article * * @param Array $params * @return bool */ function HasDraft($params) { if (!$this->IsNewItem($params)) { // use drafts only for unsent (new) messages return false; } $object =& $this->getObject($params); /* @var $object kDBItem */ $draft =& $this->Application->recallObject('draft', null, Array('skip_autoload' => true)); /* @var $draft kDBItem */ $load_keys = Array ( 'FormSubmissionId' => $object->GetDBField('FormSubmissionId'), 'CreatedById' => $this->Application->RecallVar('user_id'), ); // get existing draft for given submission and user $draft->Load($load_keys); return $draft->isLoaded(); } /** * Lists all files, uploadeded to given field * * @param Array $params * @return string */ function IterateFiles($params) { $object =& $this->getObject($params); /* @var $object kDBItem */ $field = $this->SelectParam($params, 'name,field'); $value = $object->GetDBField($field); if (!$value) { return ''; } $ret = ''; $files = explode('|', $value); $block_params = $this->prepareTagParams($params); $block_params['name'] = $params['render_as']; foreach ($files as $file) { $object->SetDBField($field, $file); $ret .= $this->Application->ParseBlock($block_params); } $object->SetDBField($field, $value); return $ret; } }