public function __construct()
 {
     parent::__construct();
     $module_instance = Module::getInstanceByName('textmaster');
     // module object is needed for calling text translations
     $this->context = Context::getContext();
     $this->id_shop = $this->context->shop->id;
     /* assigns default configuration values */
     $this->data = array('api_key' => '', 'api_secret' => '', 'copywriting_on' => 1, 'proofreading_on' => 1, 'translation_on' => 1, 'copywriting_language_from' => $this->context->language->iso_code, 'copywriting_category' => 'C001', 'copywriting_project_briefing' => $module_instance->l('Hello, Thank you for making the changes asked on the text. Please maintain the style and vocabulary level and make sure you correct any grammatical error or typo. Also, please maintain the text format and HTML tags. Thank you', 'Configuration'), 'copywriting_same_author_must_do_entire_project' => 1, 'copywriting_language_level' => 'regular', 'copywriting_quality_on' => 0, 'copywriting_expertise_on' => 0, 'copywriting_target_reader_groups' => 'not_specified', 'proofreading_language_from' => $this->context->language->iso_code, 'proofreading_category' => 'C019', 'proofreading_project_briefing' => $module_instance->l('Hello, Thank you for proofreading this text. Please maintain the style and vocabulary level and make sure you correct any grammatical error or typo. Also, please maintain the text format and HTML tags. Thank you', 'Configuration'), 'proofreading_same_author_must_do_entire_project' => 0, 'proofreading_language_level' => 'regular', 'proofreading_quality_on' => 0, 'proofreading_expertise_on' => 0, 'proofreading_target_reader_groups' => 'not_specified', 'translation_language_from' => $this->context->language->iso_code, 'translation_language_to' => $this->context->language->iso_code, 'translation_category' => 'C019', 'translation_project_briefing' => $module_instance->l('Hello, Please translate as faithfully as possible the text provided while respecting the paragraph structure of the document. Please note that the expected number of words is given as an indication only. Also, please maintain the text format and HTML tags. Thank you.', 'Configuration'), 'translation_same_author_must_do_entire_project' => 0, 'translation_language_level' => 'premium', 'translation_quality_on' => 0, 'translation_expertise_on' => 0, 'translation_vocabulary_type' => 'not_specified', 'translation_target_reader_groups' => 'not_specified', 'translation_grammatical_person' => 'not_specified');
     /* overrides default configuration values with user defined configuration values */
     foreach ($this->getSettings() as $setting) {
         $this->data[$setting['name']] = $setting['value'];
     }
 }
 public function launch()
 {
     $textMasterAPI = TextMasterAPI::getInstance();
     $result = $textMasterAPI->launchProject($this->id_project_api);
     if (!is_array($result)) {
         return $result;
     }
     // error
     $this->status = $result['status'];
     return parent::update();
 }
Exemple #3
0
 public function delete()
 {
     $textMasterAPI = new TextMasterAPI();
     $result = $textMasterAPI->deleteDocument($this->api_data['id_project_api'], $this->id_document_api);
     if ($result) {
         return false;
     }
     if (!$this->id) {
         return true;
     }
     return parent::delete();
 }