public function doAction() { $this->generateAuthURL(); //pay a little query to avoid to fetch 5000 rows $this->jobData = $jobData = getJobData($this->jid, $this->password); $wStruct = new WordCount_Struct(); $wStruct->setIdJob($this->jid); $wStruct->setJobPassword($this->password); $wStruct->setNewWords($jobData['new_words']); $wStruct->setDraftWords($jobData['draft_words']); $wStruct->setTranslatedWords($jobData['translated_words']); $wStruct->setApprovedWords($jobData['approved_words']); $wStruct->setRejectedWords($jobData['rejected_words']); if ($jobData['status'] == Constants_JobStatus::STATUS_ARCHIVED || $jobData['status'] == Constants_JobStatus::STATUS_CANCELLED) { //this job has been archived $this->job_archived = true; $this->job_owner_email = $jobData['job_owner']; } $tmp = CatUtils::getEditingLogData($this->jid, $this->password); $this->data = $tmp[0]; $this->stats = $tmp[1]; $this->job_stats = CatUtils::getFastStatsForJob($wStruct); $proj = getProject($jobData['id_project']); $this->project_status = $proj[0]; }
public function doAction() { $data = CatUtils::getEditingLogData($this->jid, $this->password, true); $data = $data[0]; $csvHandler = new SplTempFileObject(-1); $csvHandler->setCsvControl(';'); $csv_fields = array("Job ID", "Segment ID", "Suggestion Source", "Words", "Match percentage", "Time-to-edit", "Post-editing effort", "HTER", "Segment", "Suggestion", "Translation", "MT QE", "ID translator", "Suggestion1-source", "Suggestion1-translation", "Suggestion1-match", "Suggestion1-origin", "Suggestion2-source", "Suggestion2-translation", "Suggestion2-match", "Suggestion2-origin", "Suggestion3-source", "Suggestion3-translation", "Suggestion3-match", "Suggestion3-origin", "Choosen-Suggestion", "Statistically relevant"); $csvHandler->fputcsv($csv_fields); foreach ($data as $d) { $statistical_relevant = $d['stats-valid'] == 'No' ? 0 : 1; $sid = $d['sid']; $sugg_source = $d['ss']; $rwc = $d['rwc']; $sugg_match = $d['sm']; $sugg_tte = $d['tte']; $pe_effort_perc = $d['pe_effort_perc']; $hter = $d['ter']; $segment = $d['source_csv']; $suggestion = $d['sug_csv']; $translation = $d['translation_csv']; $id_translator = $d['tid']; $s1_source = ""; $s2_source = ""; $s3_source = ""; $s1_translation = ""; $s2_translation = ""; $s3_translation = ""; $s1_match = ""; $s2_match = ""; $s3_match = ""; $s1_origin = ""; $s2_origin = ""; $s3_origin = ""; $mt_qe = $d['mt_qe']; if (!empty($d['sar'])) { $sar = json_decode($d['sar']); $s1_source = $sar[0]->segment; $s1_translation = $sar[0]->translation; $s1_match = $sar[0]->match; if (isset($sar[1])) { $s2_source = $sar[1]->segment; $s2_translation = $sar[1]->translation; $s2_match = $sar[1]->match; } if (isset($sar[2])) { $s3_source = $sar[2]->segment; $s3_translation = $sar[2]->translation; $s3_match = $sar[2]->match; } $s1_origin = substr($sar[0]->created_by, 0, 2) == 'MT' ? 'MT' : 'TM'; $s2_origin = substr($sar[1]->created_by, 0, 2) == 'MT' ? 'MT' : 'TM'; $s3_origin = substr($sar[2]->created_by, 0, 2) == 'MT' ? 'MT' : 'TM'; } $row_array = array($this->jid, $sid, $sugg_source, $rwc, $sugg_match, $sugg_tte, $pe_effort_perc, $hter, $segment, $suggestion, $translation, $mt_qe, $id_translator, $s1_source, $s1_translation, $s1_match, $s1_origin, $s2_source, $s2_translation, $s2_match, $s2_origin, $s3_source, $s3_translation, $s3_match, $s3_origin, $d['sp'], $statistical_relevant); $csvHandler->fputcsv($row_array); } $csvHandler->rewind(); foreach ($csvHandler as $row) { $this->content .= $row; } }
public function doAction() { $tmp = CatUtils::getEditingLogData($this->jid, $this->password); $this->data = $tmp[0]; $this->stats = $tmp[1]; }
public function doAction() { $csv = "Job ID;Segment ID;Suggestion Source;Words;Match percentage;Time-to-edit;Post-editing effort;Segment;Suggestion;Translation;ID translator;Suggestion1-source;Suggestion1-translation;Suggestion1-match;Suggestion1-origin;Suggestion2-source;Suggestion2-translation;Suggestion2-match;Suggestion2-origin;Suggestion3-source;Suggestion3-translation;Suggestion3-match;Suggestion3-origin\n"; $data = CatUtils::getEditingLogData($this->jid, $this->password); $data = $data[0]; foreach ($data as $d) { $sid = $d['sid']; $rwc = $d['rwc']; $sugg_source = str_replace("';", "\\'\\;", $d['ss']); $sugg_match = $d['sm']; $sugg_tte = $d['tte']; $pe_effort_perc = $d['pe_effort_perc']; $segment = str_replace("\r\n", " ", $d['source']); $suggestion = str_replace("\r\n", " ", $d['sug']); $translation = str_replace("\r\n", " ", $d['translation']); $segment = str_replace("\n", " ", $segment); $suggestion = str_replace("\n", " ", $suggestion); $translation = str_replace("\n", " ", $translation); $segment = str_replace("';", "\\'\\;", $segment); $suggestion = str_replace("';", "\\'\\;", $suggestion); $translation = str_replace("';", "\\'\\;", $translation); $id_translator = str_replace("';", "\\'\\;", $d['tid']); $s1_source = ""; $s2_source = ""; $s3_source = ""; $s1_translation = ""; $s2_translation = ""; $s3_translation = ""; $s1_match = ""; $s2_match = ""; $s3_match = ""; $s1_origin = ""; $s2_origin = ""; $s3_origin = ""; echo $d['sar'] . "\n"; if (!empty($d['sar'])) { echo "here\n\n"; $sar = json_decode($d['sar']); $s1_source = str_replace("';", "\\'\\;", $sar[0]->segment); $s2_source = str_replace("';", "\\'\\;", $sar[1]->segment); $s3_source = str_replace("';", "\\'\\;", $sar[2]->segment); $s1_translation = str_replace("';", "\\'\\;", $sar[0]->translation); $s2_translation = str_replace("';", "\\'\\;", $sar[1]->translation); $s3_translation = str_replace("';", "\\'\\;", $sar[2]->translation); $s1_match = str_replace("';", "\\'\\;", $sar[0]->match); $s2_match = str_replace("';", "\\'\\;", $sar[1]->match); $s3_match = str_replace("';", "\\'\\;", $sar[2]->match); $s1_source = str_replace("\r\n", " ", $s1_source); $s2_source = str_replace("\r\n", " ", $s2_source); $s3_source = str_replace("\r\n", " ", $s3_source); $s1_source = str_replace("\n", " ", $s1_source); $s2_source = str_replace("\n", " ", $s2_source); $s3_source = str_replace("\n", " ", $s3_source); $s1_translation = str_replace("\r\n", " ", $s1_translation); $s2_translation = str_replace("\r\n", " ", $s2_translation); $s3_translation = str_replace("\r\n", " ", $s3_translation); $s1_translation = str_replace("\n", " ", $s1_translation); $s2_translation = str_replace("\n", " ", $s2_translation); $s3_translation = str_replace("\n", " ", $s3_translation); $s1_origin = substr($sar[0]->created_by, 0, 2) == 'MT' ? 'MT' : 'TM'; $s2_origin = substr($sar[1]->created_by, 0, 2) == 'MT' ? 'MT' : 'TM'; $s3_origin = substr($sar[2]->created_by, 0, 2) == 'MT' ? 'MT' : 'TM'; } $csv .= "{$this->jid};{$sid};\"{$sugg_source}\";{$rwc};\"{$sugg_match}\";\"{$sugg_tte}\";\"{$pe_effort_perc}\";\"{$segment}\";\"{$suggestion}\";\"{$translation}\";\"{$id_translator}\";\"{$s1_source}\";\"{$s1_translation}\";\"{$s1_match}\";\"{$s1_origin}\";\"{$s2_source}\";\"{$s2_translation}\";\"{$s2_match}\";\"{$s2_origin}\";\"{$s3_source}\";\"{$s3_translation}\";\"{$s3_match}\";\"{$s3_origin}\"\n"; } $this->content = $csv; }