" title="<?php echo $translationStatesText[$translation->state]; ?> "></span> </td> <td title="<?php echo JText::sprintf('COM_NENO_VIEW_STRINGS_EDIT', NenoHelper::html2text($translation->original_text, 200)); ?> "> <a href="index.php?option=com_neno&view=editor&stringId=<?php echo $translation->id; ?> "> <?php echo NenoHelper::html2text($translation->string, 200); ?> </a> </td> <td><?php echo $translation->breadcrumbs[0]; ?> </td> <td><?php echo $translation->breadcrumbs[1]; ?> </td> <td><?php echo $translation->breadcrumbs[2]; ?> </td>
<div class="status <?php echo $translationStatesClasses[$translation->state]; ?> " alt="<?php echo $translationStatesText[$translation->state]; ?> " title="<?php echo $translationStatesText[$translation->state]; ?> "> </div> <div class="string-text" title="<?php echo NenoHelper::html2text($translation->original_text, 300); ?> "> <?php echo JHtmlString::truncate(strip_tags($translation->string), 50, false); ?> </div> </div> <div class="clearfix"></div> <?php } } else { ?> <div class="no-results"><?php echo JText::_('COM_NENO_EDITOR_STRINGS_NO_MATCHES'); ?>
<span class="normal-text"><?php echo JText::_('COM_NENO_EDITOR_SAVE_AND_NEXT_BUTTON'); ?> </span> <span class="small-text">Ctrl + Enter</span> </button> </div> </div> </div> </div> <div> <div> <div class="span6"> <div class="uneditable-input full-width original-text"> <?php echo empty($translation) ? '' : NenoHelper::highlightHTMLTags(NenoHelper::html2text($translation->original_text)); ?> </div> <div class="clearfix"></div> <div class="pull-right last-modified"> <?php echo empty($translation) ? '' : JText::sprintf('COM_NENO_EDITOR_LAST_MODIFIED', $translation->time_added); ?> </div> <?php if (!empty($translation)) { ?> <?php if (empty($translation->comment)) { ?> <div class="add-comment-to-translator">
/** * Save translation as completed * * @return void */ public function saveAsCompleted() { $input = $this->input; $translationId = $input->getInt('id'); $translationText = $input->get('text', '', 'RAW'); if ($this->saveTranslation($translationId, $translationText, NenoContentElementTranslation::TRANSLATED_STATE)) { /* @var $translation NenoContentElementTranslation */ $translation = NenoContentElementTranslation::load($translationId, false); $data = array('translation' => $translation->prepareDataForView()); $original_text = $translation->getOriginalText(); $model = $this->getModel(); $counter = $model->getSimilarTranslationsCounter($translationId, $translation->getLanguage(), $original_text); if ($counter != 0) { $data['message'] = JText::sprintf('COM_NENO_EDITOR_CONSOLIDATE_MESSAGE', $counter, NenoHelper::html2text($original_text, 200), NenoHelper::html2text($translationText, 200)); $data['counter'] = $counter; } echo json_encode($data); } JFactory::getApplication()->close(); }
/** * Save translation as completed * * @return void */ public function saveAllAsCompleted() { // Get input and turn it into an array with objects $input = $this->input; $stringsJson = $input->get('strings', '', 'RAW'); $strings = json_decode($stringsJson); // Create an array to hold info about the translations $messages = array(); if (!empty($strings) && count($strings) > 0) { $checkedStrings = array(); foreach ($strings as $string) { $string->text = NenoHelper::cleanXssString($string->text); // Save the translation if ($this->saveTranslation($string->translation_id, $string->text, NenoContentElementTranslation::TRANSLATED_STATE)) { /* @var $translation NenoContentElementTranslation */ $translation = NenoContentElementTranslation::load($string->translation_id, false); // Check for number of same translations to offer consolidation // Only check for one string once $counter = 0; $originalText = $translation->getOriginalText(); if (in_array(strtolower(trim($originalText)), $checkedStrings) === false) { $checkedStrings[] = strtolower(trim($originalText)); $model = $this->getModel(); $counter = $model->getSimilarTranslationsCounter($string->translation_id, $translation->getLanguage(), $originalText); } // If we found matches prepare data to return $message = array(); if ($counter != 0) { $message['translation_id'] = $string->translation_id; $message['message'] = '<div><input type="checkbox" class="consolidate-checkbox" value="' . $string->translation_id . '" checked="checked"> ' . JText::sprintf('COM_NENO_EDITOR_CONSOLIDATE_MESSAGE', $counter, NenoHelper::html2text($originalText, 200), NenoHelper::html2text($string->text, 200)) . '</div>'; $message['counter'] = $counter; } if (!empty($message)) { $messages[] = $message; } } } } // Echo any messages if (count($messages) > 0) { echo json_encode($messages); } JFactory::getApplication()->close(); }