Version Notes
Module textmaster
Download this release
Release Info
Developer | Textmaster |
Extension | Textmaster_Textmaster |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Credit.php +61 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Document/Renderer/Status.php +33 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Document/Supportmessage.php +46 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Document/View.php +70 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project.php +39 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid.php +325 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid/Column/Renderer/Checkbox.php +39 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid/Column/Renderer/Massaction.php +40 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets.php +55 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Form.php +41 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step1.php +252 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step2.php +415 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3.php +211 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3/Author.php +46 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3/Form/Author.php +144 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Summary.php +70 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Nbdocument.php +34 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Price.php +34 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Progression.php +33 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Status.php +33 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Store.php +52 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Wordcount.php +34 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View.php +96 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View/Documents.php +223 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View/Grid/Column/Renderer/Checkbox.php +39 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View/Grid/Column/Renderer/Massaction.php +42 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Renderer/Sourcelanguage.php +39 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Renderer/Targetlanguage.php +40 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/Renderer/UpdatedAt.php +35 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Briefing.php +56 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Creation.php +76 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Islog.php +50 -0
- app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Login.php +98 -0
- app/code/community/Textmaster/Textmaster/Helper/Data.php +150 -0
- app/code/community/Textmaster/Textmaster/Model/Api.php +1110 -0
- app/code/community/Textmaster/Textmaster/Model/Document.php +259 -0
- app/code/community/Textmaster/Textmaster/Model/Mysql4/Document.php +44 -0
- app/code/community/Textmaster/Textmaster/Model/Mysql4/Document/Collection.php +182 -0
- app/code/community/Textmaster/Textmaster/Model/Mysql4/Project.php +32 -0
- app/code/community/Textmaster/Textmaster/Model/Mysql4/Project/Attribute.php +32 -0
- app/code/community/Textmaster/Textmaster/Model/Mysql4/Project/Attribute/Collection.php +33 -0
- app/code/community/Textmaster/Textmaster/Model/Mysql4/Project/Collection.php +323 -0
- app/code/community/Textmaster/Textmaster/Model/Observer.php +46 -0
- app/code/community/Textmaster/Textmaster/Model/Project.php +738 -0
- app/code/community/Textmaster/Textmaster/Model/Project/Attribute.php +32 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Audience.php +37 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Author.php +43 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Category.php +41 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Grammatical.php +37 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Lang.php +44 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Type.php +42 -0
- app/code/community/Textmaster/Textmaster/Model/Source/Api/Vocabulary.php +37 -0
- app/code/community/Textmaster/Textmaster/controllers/Adminhtml/AjaxController.php +139 -0
- app/code/community/Textmaster/Textmaster/controllers/Adminhtml/ApiController.php +33 -0
- app/code/community/Textmaster/Textmaster/controllers/Adminhtml/ProjectController.php +643 -0
- app/code/community/Textmaster/Textmaster/controllers/CallbackController.php +93 -0
- app/code/community/Textmaster/Textmaster/controllers/IndexController.php +33 -0
- app/code/community/Textmaster/Textmaster/etc/config.xml +206 -0
- app/code/community/Textmaster/Textmaster/etc/jstranslator.xml +45 -0
- app/code/community/Textmaster/Textmaster/etc/system.xml +226 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-install-0.0.1.php +110 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.1-0.0.2.php +42 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.2-0.0.3.php +55 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.3-0.0.4.php +44 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.4-0.0.5.php +43 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.5-0.0.6.php +60 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.6-0.0.7.php +47 -0
- app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.7-0.0.8.php +52 -0
- app/design/adminhtml/default/default/layout/textmaster.xml +135 -0
- app/design/adminhtml/default/default/template/textmaster/credit.phtml +27 -0
- app/design/adminhtml/default/default/template/textmaster/document/support_messages.phtml +40 -0
- app/design/adminhtml/default/default/template/textmaster/document/view.phtml +102 -0
- app/design/adminhtml/default/default/template/textmaster/form/container.phtml +44 -0
- app/design/adminhtml/default/default/template/textmaster/grid/container.phtml +34 -0
- app/design/adminhtml/default/default/template/textmaster/login.phtml +28 -0
- app/design/adminhtml/default/default/template/textmaster/onglet.phtml +61 -0
- app/design/adminhtml/default/default/template/textmaster/onglet/popinauthors.phtml +32 -0
- app/design/adminhtml/default/default/template/textmaster/page.phtml +68 -0
- app/design/adminhtml/default/default/template/textmaster/product/edit.phtml +35 -0
- app/design/adminhtml/default/default/template/textmaster/view.phtml +143 -0
- app/etc/modules/Textmaster_Textmaster.xml +9 -0
- app/locale/en_US/Textmaster_Textmaster.csv +195 -0
- app/locale/fr_FR/Textmaster_Textmaster.csv +201 -0
- package.xml +18 -0
- skin/adminhtml/default/default/css/textmaster/popin.css +22 -0
- skin/adminhtml/default/default/css/textmaster/styles.css +176 -0
- skin/adminhtml/default/default/images/textmaster/ad.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ae.png +0 -0
- skin/adminhtml/default/default/images/textmaster/af.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ag.png +0 -0
- skin/adminhtml/default/default/images/textmaster/al.png +0 -0
- skin/adminhtml/default/default/images/textmaster/am.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ao.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ar.png +0 -0
- skin/adminhtml/default/default/images/textmaster/at.png +0 -0
- skin/adminhtml/default/default/images/textmaster/au.png +0 -0
- skin/adminhtml/default/default/images/textmaster/az.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ba.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bb.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bd.png +0 -0
- skin/adminhtml/default/default/images/textmaster/be.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bf.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bh.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bi.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bj.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bo.png +0 -0
- skin/adminhtml/default/default/images/textmaster/br.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bs.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bt.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/by.png +0 -0
- skin/adminhtml/default/default/images/textmaster/bz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ca.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cd.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cf.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ch.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ci.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cl.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/co.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cu.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cv.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cy.png +0 -0
- skin/adminhtml/default/default/images/textmaster/cz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/de.png +0 -0
- skin/adminhtml/default/default/images/textmaster/dj.png +0 -0
- skin/adminhtml/default/default/images/textmaster/dk.png +0 -0
- skin/adminhtml/default/default/images/textmaster/dm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/do.png +0 -0
- skin/adminhtml/default/default/images/textmaster/dz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ec.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ee.png +0 -0
- skin/adminhtml/default/default/images/textmaster/eg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/eh.png +0 -0
- skin/adminhtml/default/default/images/textmaster/en.png +0 -0
- skin/adminhtml/default/default/images/textmaster/er.png +0 -0
- skin/adminhtml/default/default/images/textmaster/es.png +0 -0
- skin/adminhtml/default/default/images/textmaster/et.png +0 -0
- skin/adminhtml/default/default/images/textmaster/fi.png +0 -0
- skin/adminhtml/default/default/images/textmaster/fj.png +0 -0
- skin/adminhtml/default/default/images/textmaster/flags-mini.zip +0 -0
- skin/adminhtml/default/default/images/textmaster/fm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/fr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ga.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gd.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ge.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gh.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gq.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gt.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/gy.png +0 -0
- skin/adminhtml/default/default/images/textmaster/hn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/hr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ht.png +0 -0
- skin/adminhtml/default/default/images/textmaster/hu.png +0 -0
- skin/adminhtml/default/default/images/textmaster/id.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ie.png +0 -0
- skin/adminhtml/default/default/images/textmaster/il.png +0 -0
- skin/adminhtml/default/default/images/textmaster/in.png +0 -0
- skin/adminhtml/default/default/images/textmaster/iq.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ir.png +0 -0
- skin/adminhtml/default/default/images/textmaster/is.png +0 -0
- skin/adminhtml/default/default/images/textmaster/it.png +0 -0
- skin/adminhtml/default/default/images/textmaster/jm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/jo.png +0 -0
- skin/adminhtml/default/default/images/textmaster/jp.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ke.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kh.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ki.png +0 -0
- skin/adminhtml/default/default/images/textmaster/km.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kp.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ks.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/kz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/la.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lb.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lc.png +0 -0
- skin/adminhtml/default/default/images/textmaster/li.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lk.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ls.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lt.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lu.png +0 -0
- skin/adminhtml/default/default/images/textmaster/lv.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ly.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ma.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mc.png +0 -0
- skin/adminhtml/default/default/images/textmaster/md.png +0 -0
- skin/adminhtml/default/default/images/textmaster/me.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mh.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mk.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ml.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mt.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mu.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mv.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mx.png +0 -0
- skin/adminhtml/default/default/images/textmaster/my.png +0 -0
- skin/adminhtml/default/default/images/textmaster/mz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/na.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ne.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ng.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ni.png +0 -0
- skin/adminhtml/default/default/images/textmaster/nl.png +0 -0
- skin/adminhtml/default/default/images/textmaster/no.png +0 -0
- skin/adminhtml/default/default/images/textmaster/np.png +0 -0
- skin/adminhtml/default/default/images/textmaster/nr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/nz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/om.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pa.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pe.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ph.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pk.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pl.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pt.png +0 -0
- skin/adminhtml/default/default/images/textmaster/pw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/py.png +0 -0
- skin/adminhtml/default/default/images/textmaster/qa.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ro.png +0 -0
- skin/adminhtml/default/default/images/textmaster/rs.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ru.png +0 -0
- skin/adminhtml/default/default/images/textmaster/rw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sa.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sb.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sc.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sd.png +0 -0
- skin/adminhtml/default/default/images/textmaster/se.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/si.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sk.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sl.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/so.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/st.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sv.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sy.png +0 -0
- skin/adminhtml/default/default/images/textmaster/sz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/td.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tg.png +0 -0
- skin/adminhtml/default/default/images/textmaster/th.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tj.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tl.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/to.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tr.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tt.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tv.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tw.png +0 -0
- skin/adminhtml/default/default/images/textmaster/tz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ua.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ug.png +0 -0
- skin/adminhtml/default/default/images/textmaster/us.png +0 -0
- skin/adminhtml/default/default/images/textmaster/uy.png +0 -0
- skin/adminhtml/default/default/images/textmaster/uz.png +0 -0
- skin/adminhtml/default/default/images/textmaster/va.png +0 -0
- skin/adminhtml/default/default/images/textmaster/vc.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ve.png +0 -0
- skin/adminhtml/default/default/images/textmaster/vn.png +0 -0
- skin/adminhtml/default/default/images/textmaster/vu.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ws.png +0 -0
- skin/adminhtml/default/default/images/textmaster/ye.png +0 -0
- skin/adminhtml/default/default/images/textmaster/za.png +0 -0
- skin/adminhtml/default/default/images/textmaster/zm.png +0 -0
- skin/adminhtml/default/default/images/textmaster/zw.png +0 -0
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Credit.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Credit extends Mage_Adminhtml_Block_Template
|
27 |
+
{
|
28 |
+
private $_noapi = false;
|
29 |
+
public function __construct()
|
30 |
+
{
|
31 |
+
|
32 |
+
$this->_controller = 'adminhtml_project';
|
33 |
+
$this->_blockGroup = 'textmaster';
|
34 |
+
$api_key = Mage::getStoreConfig('textmaster/textmaster/api_key');;
|
35 |
+
$api_secret = Mage::getStoreConfig('textmaster/textmaster/api_secret');
|
36 |
+
if($api_key=='' || $api_secret=='') $this->_noapi = true;
|
37 |
+
if($this->_noapi){
|
38 |
+
|
39 |
+
}
|
40 |
+
parent::__construct();
|
41 |
+
}
|
42 |
+
public function getCredit(){
|
43 |
+
$_api = Mage::helper('textmaster')->getApi();
|
44 |
+
$user_info = $_api->getUserInfo();
|
45 |
+
|
46 |
+
if(isset($user_info['wallet'])){
|
47 |
+
$currency = Mage::getModel('directory/currency')->load($user_info['wallet']['currency_code']);
|
48 |
+
return $currency->format($user_info['wallet']['current_money']);
|
49 |
+
}
|
50 |
+
return '';
|
51 |
+
}
|
52 |
+
public function getEmail(){
|
53 |
+
$_api = Mage::helper('textmaster')->getApi();
|
54 |
+
$user_info = $_api->getUserInfo();
|
55 |
+
if(isset($user_info['email']))
|
56 |
+
return $user_info['email'];
|
57 |
+
return '';
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Document/Renderer/Status.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Document_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getStatusTexte();
|
31 |
+
return ''.str_replace(' ',' ',$value).'';
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Document/Supportmessage.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Document_Supportmessage extends Mage_Adminhtml_Block_Template {
|
27 |
+
|
28 |
+
private $_document;
|
29 |
+
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
parent::__construct();
|
33 |
+
$this->_objectId = 'textmaster_document_supportmessage';
|
34 |
+
$this->_controller = 'adminhtml_project';
|
35 |
+
$this->_blockGroup = 'textmaster';
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
public function setDocument($document){
|
40 |
+
$this->_document = $document;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function getDocument(){
|
44 |
+
return $this->_document;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Document/View.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Document_View extends Mage_Adminhtml_Block_Widget_View_Container {
|
27 |
+
|
28 |
+
private $_document;
|
29 |
+
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
parent::__construct();
|
33 |
+
$this->_objectId = 'textmaster_document_view';
|
34 |
+
$this->_controller = 'adminhtml_project';
|
35 |
+
$this->_blockGroup = 'textmaster';
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
public function setDocument($document){
|
40 |
+
$this->_document = $document;
|
41 |
+
$this->removeButton('back');
|
42 |
+
$this->addButton('back',array(
|
43 |
+
'label' => Mage::helper('adminhtml')->__('Back'),
|
44 |
+
'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/view',array('id'=>$this->getDocument()->getProject()->getId())) . '\'',
|
45 |
+
'class' => 'back',
|
46 |
+
));
|
47 |
+
if($this->_document->canComplete()){
|
48 |
+
$this->addButton('complete',array(
|
49 |
+
'label' => Mage::helper('adminhtml')->__('Update file'),
|
50 |
+
'onclick' => 'completeDocument(\'' . $this->getUrl('*/*/doccomplete',array('id'=>$this->getDocument()->getId())) . '\','.$this->getDocument()->getId().')',
|
51 |
+
'class' => 'save',
|
52 |
+
));
|
53 |
+
$btn = $this->addButton('revision',array(
|
54 |
+
'label' => Mage::helper('adminhtml')->__('Put in revision'),
|
55 |
+
'onclick' => "showCompare('" . $this->getUrl('*/*/view',array('id'=>$this->getDocument()->getProject()->getId()))."');",
|
56 |
+
'class' => 'save',
|
57 |
+
));
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getDocument(){
|
65 |
+
|
66 |
+
return $this->_document;
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project extends Mage_Adminhtml_Block_Widget_Grid_Container
|
27 |
+
{
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
|
31 |
+
$this->_controller = 'adminhtml_project';
|
32 |
+
$this->_blockGroup = 'textmaster';
|
33 |
+
$this->_headerText = Mage::helper('textmaster')->__('My Projects');
|
34 |
+
$this->_addButtonLabel = Mage::helper('textmaster')->__('New Project');
|
35 |
+
parent::__construct();
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid.php
ADDED
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
27 |
+
|
28 |
+
private $_is_regex_op = array(
|
29 |
+
'name',
|
30 |
+
'ref'
|
31 |
+
);
|
32 |
+
|
33 |
+
public function __construct() {
|
34 |
+
parent::__construct ();
|
35 |
+
$this->setId ( 'projetGrid' );
|
36 |
+
$this->setDefaultSort ( 'textmaster_project_id' );
|
37 |
+
$this->setDefaultDir ( 'DESC' );
|
38 |
+
//$this->setDefaultLimit(3);
|
39 |
+
$this->setSaveParametersInSession ( true );
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function _prepareCollection() {
|
43 |
+
$collection = Mage::getModel ( 'textmaster/project' )->getCollection()->setAllProject(true);
|
44 |
+
$this->setCollection ( $collection );
|
45 |
+
|
46 |
+
return parent::_prepareCollection ();
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
protected function _prepareColumns() {
|
52 |
+
$this->addColumn ( 'name', array (
|
53 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Name' ),
|
54 |
+
'align' => 'left',
|
55 |
+
'width' => '150px',
|
56 |
+
'index' => 'name',
|
57 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn ( 'reference', array (
|
61 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Reference' ),
|
62 |
+
'align' => 'right',
|
63 |
+
'width' => '50px',
|
64 |
+
'index' => 'reference',
|
65 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn ( 'store_id_origin', array (
|
69 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Source language' ),
|
70 |
+
'align' => 'right',
|
71 |
+
'width' => '150px',
|
72 |
+
'index' => 'store_id_origin',
|
73 |
+
'type' => 'options',
|
74 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Renderer_Sourcelanguage',
|
75 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
76 |
+
'options' => Mage::getModel('core/store')->getCollection()->toOptionHash()
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addColumn ( 'store_id_translation', array (
|
80 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Target language' ),
|
81 |
+
'align' => 'right',
|
82 |
+
'width' => '100px',
|
83 |
+
'index' => 'store_id_translation',
|
84 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Renderer_Targetlanguage',
|
85 |
+
'type' => 'options',
|
86 |
+
'options' => Mage::getModel('core/store')->getCollection()->toOptionHash(),
|
87 |
+
'filter_condition_callback' => array($this, '_apiFilter')
|
88 |
+
//'options' => Mage::getModel('textmaster/source_api_lang')->toOptions()
|
89 |
+
));
|
90 |
+
|
91 |
+
$this->addColumn ( 'level', array (
|
92 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Level' ),
|
93 |
+
'align' => 'right',
|
94 |
+
'width' => '50px',
|
95 |
+
'index' => 'level' ,
|
96 |
+
'type' => 'options',
|
97 |
+
'options'=> array (
|
98 |
+
Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR),
|
99 |
+
Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM),
|
100 |
+
),
|
101 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
102 |
+
));
|
103 |
+
|
104 |
+
$this->addColumn ( 'nb_document', array (
|
105 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Number of documents' ),
|
106 |
+
'align' => 'right',
|
107 |
+
'width' => '20px',
|
108 |
+
'type' => 'number',
|
109 |
+
'index' => 'nb_document',
|
110 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Nbdocument' ,
|
111 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
112 |
+
));
|
113 |
+
|
114 |
+
$this->addColumn ( 'total_word_count', array (
|
115 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Total word count' ),
|
116 |
+
'align' => 'right',
|
117 |
+
'width' => '40px',
|
118 |
+
'index' => 'total_word_count' ,
|
119 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Wordcount',
|
120 |
+
'type' => 'number',
|
121 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
122 |
+
));
|
123 |
+
|
124 |
+
$this->addColumn ( 'price', array (
|
125 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Price' ),
|
126 |
+
'align' => 'right',
|
127 |
+
'width' => '50px',
|
128 |
+
'type' => 'currency',
|
129 |
+
'index' => 'price',
|
130 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Price' ,
|
131 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
132 |
+
));
|
133 |
+
|
134 |
+
$this->addColumn ( 'progression', array (
|
135 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Progression' ),
|
136 |
+
'align' => 'right',
|
137 |
+
'width' => '50px',
|
138 |
+
'type' => 'number',
|
139 |
+
'index' => 'progression',
|
140 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Progression' ,
|
141 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
142 |
+
));
|
143 |
+
|
144 |
+
$this->addColumn ( 'status', array (
|
145 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Status' ),
|
146 |
+
'align' => 'right',
|
147 |
+
'width' => '50px',
|
148 |
+
'index' => 'status',
|
149 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Status' ,
|
150 |
+
'type' => 'options',
|
151 |
+
'options' => Mage::getSingleton('textmaster/project')->getStatuses(),
|
152 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
153 |
+
));
|
154 |
+
|
155 |
+
$this->addColumn ( 'updated_at', array (
|
156 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Last change' ),
|
157 |
+
'align' => 'right',
|
158 |
+
'width' => '50px',
|
159 |
+
'index' => 'updated_at',
|
160 |
+
'type' => 'datetime',
|
161 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Renderer_UpdatedAt' ,
|
162 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
163 |
+
));
|
164 |
+
|
165 |
+
$this->addColumn ( 'actions', array (
|
166 |
+
'header' => Mage::helper ( 'textmaster' )->__ ( 'Actions' ),
|
167 |
+
'align' => 'right',
|
168 |
+
'width' => '50',
|
169 |
+
'type' => 'action',
|
170 |
+
'getter' => 'getId',
|
171 |
+
'filter' => false,
|
172 |
+
'sortable' => false,
|
173 |
+
'actions' => array(
|
174 |
+
array(
|
175 |
+
'caption' => Mage::helper('textmaster')->__('View'),
|
176 |
+
'url' => array('base'=> '*/*/view'),
|
177 |
+
'field' => 'id'
|
178 |
+
)
|
179 |
+
),
|
180 |
+
'index' => 'actions'
|
181 |
+
));
|
182 |
+
|
183 |
+
return parent::_prepareColumns ();
|
184 |
+
}
|
185 |
+
protected function _prepareMassaction() {
|
186 |
+
$this->setMassactionIdField ( 'textmaster_project_id' );
|
187 |
+
$this->getMassactionBlock ()->setFormFieldName ( 'project_id' );
|
188 |
+
|
189 |
+
$this->getMassactionBlock ()->addItem ( 'launch', array (
|
190 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
|
191 |
+
'url' => $this->getUrl ( '*/*/massLaunch' )
|
192 |
+
));
|
193 |
+
$this->getMassactionBlock ()->addItem ( 'pause', array (
|
194 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Pause' ),
|
195 |
+
'url' => $this->getUrl ( '*/*/massPause' )
|
196 |
+
));
|
197 |
+
$this->getMassactionBlock ()->addItem ( 'resume', array (
|
198 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Resume' ),
|
199 |
+
'url' => $this->getUrl ( '*/*/massResume' )
|
200 |
+
));
|
201 |
+
$this->getMassactionBlock ()->addItem ( 'cancel', array (
|
202 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Cancel' ),
|
203 |
+
'url' => $this->getUrl ( '*/*/massCancel' )
|
204 |
+
));
|
205 |
+
$this->getMassactionBlock ()->addItem ( 'complete', array (
|
206 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Complete' ),
|
207 |
+
'url' => $this->getUrl ( '*/*/massComplete' )
|
208 |
+
));
|
209 |
+
$this->getMassactionBlock ()->addItem ( 'duplicate', array (
|
210 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Duplicate' ),
|
211 |
+
'url' => $this->getUrl ( '*/*/massDuplicate' )
|
212 |
+
));
|
213 |
+
|
214 |
+
return $this;
|
215 |
+
}
|
216 |
+
protected function _prepareMassactionColumn()
|
217 |
+
{
|
218 |
+
$columnId = 'massaction';
|
219 |
+
$massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
|
220 |
+
->setData(array(
|
221 |
+
'index' => $this->getMassactionIdField(),
|
222 |
+
'filter_index' => $this->getMassactionIdFilter(),
|
223 |
+
'type' => 'massaction',
|
224 |
+
'name' => $this->getMassactionBlock()->getFormFieldName(),
|
225 |
+
'align' => 'center',
|
226 |
+
'is_system' => true,
|
227 |
+
'filter' => false,
|
228 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Grid_Column_Renderer_Massaction'
|
229 |
+
));
|
230 |
+
|
231 |
+
if ($this->getNoFilterMassactionColumn()) {
|
232 |
+
$massactionColumn->setData('filter', false);
|
233 |
+
}
|
234 |
+
|
235 |
+
$massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
|
236 |
+
->setGrid($this)
|
237 |
+
->setId($columnId);
|
238 |
+
|
239 |
+
$oldColumns = $this->_columns;
|
240 |
+
$this->_columns = array();
|
241 |
+
$this->_columns[$columnId] = $massactionColumn;
|
242 |
+
$this->_columns = array_merge($this->_columns, $oldColumns);
|
243 |
+
return $this;
|
244 |
+
}
|
245 |
+
public function getRowUrl($row) {
|
246 |
+
if($row->getId ())
|
247 |
+
return $this->getUrl ( '*/*/view', array (
|
248 |
+
'id' => $row->getId ()
|
249 |
+
) );
|
250 |
+
}
|
251 |
+
public function _apiFilter($collection, $column) {
|
252 |
+
if (!$value = $column->getFilter()->getValue()) {
|
253 |
+
return $this;
|
254 |
+
}
|
255 |
+
|
256 |
+
$index = $column->getIndex();
|
257 |
+
$subsitute = $this->getCollection()->getSubstitute();
|
258 |
+
if(isset($subsitute[$index])) $index = $subsitute[$index];
|
259 |
+
else return $this;
|
260 |
+
|
261 |
+
$filters = array();
|
262 |
+
if($index=='progress'){
|
263 |
+
if(isset($value['from']))
|
264 |
+
$filters[$index]['$gte'] = $value['from']/100;
|
265 |
+
if(isset($value['to']))
|
266 |
+
$filters[$index]['$lte'] = $value['to']/100;
|
267 |
+
} elseif($column->getType()=='number'){
|
268 |
+
if(isset($value['from']))
|
269 |
+
$filters[$index]['$gte'] = (int)$value['from'];
|
270 |
+
if(isset($value['to']))
|
271 |
+
$filters[$index]['$lte'] = (int)$value['to'];
|
272 |
+
} elseif($column->getType()=='currency'){
|
273 |
+
if(isset($value['from']))
|
274 |
+
$filters[$index]['$gte'] = (int)$value['from'];
|
275 |
+
if(isset($value['to']))
|
276 |
+
$filters[$index]['$lte'] = (int)$value['to'];
|
277 |
+
} elseif($column->getType()=='datetime' ){
|
278 |
+
//
|
279 |
+
if(isset($value['from']))
|
280 |
+
$filters[$index]['$gte'] = date('Y-m-d',$value['from']->getTimestamp()).'T00:00:00Z';
|
281 |
+
if(isset($value['to']))
|
282 |
+
$filters[$index]['$lte'] = date('Y-m-d',$value['to']->getTimestamp()).'T23:59:59Z';
|
283 |
+
} elseif(in_array($index,$this->_is_regex_op)) {
|
284 |
+
$filters[$index]['$regex'] = '/'.$value.'/i';
|
285 |
+
} else {
|
286 |
+
if($index == 'language_from_code' || $index == 'language_to_code') {
|
287 |
+
$localecode = Mage::getStoreConfig('general/locale/code', $value);
|
288 |
+
$data = explode('_', $localecode);
|
289 |
+
$value = $data[0];
|
290 |
+
}
|
291 |
+
$filters[$index] = $value;
|
292 |
+
}
|
293 |
+
$this->getCollection()->addFiltersApi($filters);
|
294 |
+
return $this;
|
295 |
+
}
|
296 |
+
public function _standardFilter($collection, $column) {
|
297 |
+
if (!$value = $column->getFilter()->getValue()) {
|
298 |
+
return $this;
|
299 |
+
}
|
300 |
+
$filters[$column->getIndex()] = $value;
|
301 |
+
$this->getCollection()->addFiltersStandard($filters);
|
302 |
+
}
|
303 |
+
protected function _addColumnFilterToCollection($column)
|
304 |
+
{
|
305 |
+
if ($this->getCollection()) {
|
306 |
+
$field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
|
307 |
+
if ($column->getFilterConditionCallback()) {
|
308 |
+
call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
|
309 |
+
} else {
|
310 |
+
$cond = $column->getFilter()->getCondition();
|
311 |
+
if ($field && isset($cond)) {
|
312 |
+
$this->getCollection()->addFieldToFilter('main_table.'.$field , $cond);
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
return $this;
|
317 |
+
}
|
318 |
+
public function getRowClass($row) {
|
319 |
+
if(!$row->getId ()) return 'text-disable';
|
320 |
+
return '';
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
|
325 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid/Column/Renderer/Checkbox.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Grid_Column_Renderer_Checkbox extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox {
|
27 |
+
|
28 |
+
protected function _getCheckboxHtml($value, $checked)
|
29 |
+
{
|
30 |
+
|
31 |
+
$html = '<input type="checkbox" ';
|
32 |
+
$html .= 'name="' . $this->getColumn()->getFieldName() . '" ';
|
33 |
+
$html .= 'value="' . $this->escapeHtml($value) . '" ';
|
34 |
+
$html .= 'class="'. ($this->getColumn()->getInlineCss() ? $this->getColumn()->getInlineCss() : 'checkbox') .'"';
|
35 |
+
$html .= $checked . $this->getDisabled() . '/>';
|
36 |
+
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid/Column/Renderer/Massaction.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Grid_Column_Renderer_Massaction extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox {
|
27 |
+
|
28 |
+
protected function _getCheckboxHtml($value, $checked)
|
29 |
+
{
|
30 |
+
$collection = $this->getColumn()->getGrid()->getCollection();
|
31 |
+
foreach($collection as $project){
|
32 |
+
if(empty($value)){
|
33 |
+
return '';
|
34 |
+
}
|
35 |
+
}
|
36 |
+
$html = '<input type="checkbox" name="' . $this->getColumn()->getName() . '" ';
|
37 |
+
$html .= 'value="' . $this->escapeHtml($value) . '" class="massaction-checkbox"' . $checked . '/>';
|
38 |
+
return $html;
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets extends Mage_Adminhtml_Block_Widget_Form_Container {
|
27 |
+
public function __construct() {
|
28 |
+
parent::__construct ();
|
29 |
+
$this->_objectId = 'textmaster_project_id';
|
30 |
+
$this->_controller = 'adminhtml_project';
|
31 |
+
$this->_blockGroup = 'textmaster';
|
32 |
+
|
33 |
+
$this->_removeButton ( 'save' );
|
34 |
+
$this->_removeButton ( 'delete' );
|
35 |
+
$this->_removeButton ( 'back' );
|
36 |
+
$this->_removeButton ( 'saveandcontinue' );
|
37 |
+
$this->_removeButton ( 'reset' );
|
38 |
+
$step = $this->getRequest ()->getParam ( "step" );
|
39 |
+
if ($step == 2) {
|
40 |
+
$this->_addButton ( 'save', array (
|
41 |
+
'label' => Mage::helper ( 'adminhtml' )->__ ( 'Continue' ),
|
42 |
+
'onclick' => 'valideStep2();',
|
43 |
+
'class' => 'save'
|
44 |
+
), - 100 );
|
45 |
+
}
|
46 |
+
if ($step == 3) {
|
47 |
+
|
48 |
+
}
|
49 |
+
}
|
50 |
+
public function getHeaderText() {
|
51 |
+
/*
|
52 |
+
* if( Mage::registry('project_data') && Mage::registry('project_data')->getId()) { return Mage::helper('textmaster')->__("Edit Project '%s'", $this->htmlEscape(Mage::registry('project_data')->getId())); } else { return Mage::helper('textmaster')->__('Add Project'); }
|
53 |
+
*/
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Form.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Form extends Mage_Adminhtml_Block_Widget_Form
|
27 |
+
{
|
28 |
+
protected function _prepareForm()
|
29 |
+
{
|
30 |
+
$form = new Varien_Data_Form(
|
31 |
+
array(
|
32 |
+
'id' => 'edit_form',
|
33 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
34 |
+
'method' => 'post',
|
35 |
+
)
|
36 |
+
);
|
37 |
+
$form->setUseContainer(true);
|
38 |
+
$this->setForm($form);
|
39 |
+
return parent::_prepareForm();
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step1.php
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step1 extends Mage_Adminhtml_Block_Widget_Grid
|
27 |
+
{
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
parent::__construct();
|
31 |
+
$this->setId('step1');
|
32 |
+
$this->setDefaultSort('textmaster_project_id');
|
33 |
+
$this->setDefaultDir('DESC');
|
34 |
+
//$this->setDefaultLimit(10);
|
35 |
+
//$this->setSaveParametersInSession(true);
|
36 |
+
//$this->setUseAjax(true);
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _getStore()
|
41 |
+
{
|
42 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
43 |
+
return Mage::app()->getStore($storeId);
|
44 |
+
}
|
45 |
+
|
46 |
+
protected function _prepareCollection()
|
47 |
+
{
|
48 |
+
$store = $this->_getStore();
|
49 |
+
$subcollection = Mage::getModel('core/store')->getCollection();
|
50 |
+
$subcollection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns(new Zend_Db_Expr('GROUP_CONCAT(main_table.store_id SEPARATOR ";") as store_name_to,GROUP_CONCAT(main_table.store_id SEPARATOR ";") as store_id_to, tdocument.product_id'))
|
51 |
+
->joinInner(array('tproject'=>'textmaster_project'),'main_table.store_id = tproject.store_id_translation', array())
|
52 |
+
->joinInner(array('tdocument'=>'textmaster_document'),'tproject.textmaster_project_id = tdocument.textmaster_project_id', array())
|
53 |
+
->where('tproject.store_id_translation!=tproject.store_id_origin')
|
54 |
+
->order('tproject.textmaster_project_id')->group('product_id');
|
55 |
+
|
56 |
+
$subcollection2 = Mage::getModel('core/store')->getCollection();
|
57 |
+
$subcollection2->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns(new Zend_Db_Expr('GROUP_CONCAT(main_table.store_id SEPARATOR ";") as store_name_from, tdocument2.product_id'))
|
58 |
+
->joinInner(array('tproject2'=>'textmaster_project'),'main_table.store_id = tproject2.store_id_origin', array())
|
59 |
+
->joinInner(array('tdocument2'=>'textmaster_document'),'tproject2.textmaster_project_id = tdocument2.textmaster_project_id', array())
|
60 |
+
->where('tproject2.store_id_translation!=tproject2.store_id_origin')
|
61 |
+
->order('tproject2.textmaster_project_id')->group('tdocument2.product_id');
|
62 |
+
|
63 |
+
|
64 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
65 |
+
->addAttributeToSelect('sku')
|
66 |
+
->addAttributeToSelect('name')
|
67 |
+
->addAttributeToSelect('type_id');
|
68 |
+
|
69 |
+
if ($store->getId()) {
|
70 |
+
$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
|
71 |
+
$collection->addStoreFilter($store);
|
72 |
+
$collection->joinAttribute(
|
73 |
+
'name',
|
74 |
+
'catalog_product/name',
|
75 |
+
'entity_id',
|
76 |
+
null,
|
77 |
+
'inner',
|
78 |
+
$adminStore
|
79 |
+
);
|
80 |
+
$collection->joinAttribute(
|
81 |
+
'custom_name',
|
82 |
+
'catalog_product/name',
|
83 |
+
'entity_id',
|
84 |
+
null,
|
85 |
+
'inner',
|
86 |
+
$store->getId()
|
87 |
+
);
|
88 |
+
$collection->joinAttribute(
|
89 |
+
'status',
|
90 |
+
'catalog_product/status',
|
91 |
+
'entity_id',
|
92 |
+
null,
|
93 |
+
'inner',
|
94 |
+
$store->getId()
|
95 |
+
);
|
96 |
+
$collection->joinAttribute(
|
97 |
+
'visibility',
|
98 |
+
'catalog_product/visibility',
|
99 |
+
'entity_id',
|
100 |
+
null,
|
101 |
+
'inner',
|
102 |
+
$store->getId()
|
103 |
+
);
|
104 |
+
$collection->joinAttribute(
|
105 |
+
'price',
|
106 |
+
'catalog_product/price',
|
107 |
+
'entity_id',
|
108 |
+
null,
|
109 |
+
'left',
|
110 |
+
$store->getId()
|
111 |
+
);
|
112 |
+
}
|
113 |
+
else {
|
114 |
+
$collection->addAttributeToSelect('price');
|
115 |
+
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
|
116 |
+
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
|
117 |
+
}
|
118 |
+
|
119 |
+
$collection->getSelect()->joinLeft(array('ttranslation' => new Zend_Db_Expr('('.$subcollection->getSelect()->__toString().')')),'ttranslation.product_id = e.entity_id');
|
120 |
+
$collection->getSelect()->joinLeft(array('ttranslation2'=> new Zend_Db_Expr('('.$subcollection2->getSelect()->__toString().')')),'ttranslation2.product_id = e.entity_id');
|
121 |
+
|
122 |
+
$this->setCollection($collection);
|
123 |
+
return parent::_prepareCollection();
|
124 |
+
}
|
125 |
+
|
126 |
+
protected function _prepareColumns()
|
127 |
+
{
|
128 |
+
$this->addColumn('entity_id',
|
129 |
+
array(
|
130 |
+
'header'=> Mage::helper('catalog')->__('ID'),
|
131 |
+
'width' => '50px',
|
132 |
+
'type' => 'number',
|
133 |
+
'index' => 'entity_id',
|
134 |
+
));
|
135 |
+
|
136 |
+
$this->addColumn('name',
|
137 |
+
array(
|
138 |
+
'header'=> Mage::helper('catalog')->__('Name'),
|
139 |
+
'index' => 'name',
|
140 |
+
));
|
141 |
+
|
142 |
+
$this->addColumn('type',
|
143 |
+
array(
|
144 |
+
'header'=> Mage::helper('catalog')->__('Type'),
|
145 |
+
'width' => '60px',
|
146 |
+
'index' => 'type_id',
|
147 |
+
'type' => 'options',
|
148 |
+
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
|
149 |
+
));
|
150 |
+
|
151 |
+
|
152 |
+
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
153 |
+
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
|
154 |
+
->load()
|
155 |
+
->toOptionHash();
|
156 |
+
|
157 |
+
$this->addColumn('set_name',
|
158 |
+
array(
|
159 |
+
'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
|
160 |
+
'width' => '100px',
|
161 |
+
'index' => 'attribute_set_id',
|
162 |
+
'type' => 'options',
|
163 |
+
'options' => $sets,
|
164 |
+
));
|
165 |
+
|
166 |
+
$this->addColumn('status',
|
167 |
+
array(
|
168 |
+
'header'=> Mage::helper('catalog')->__('Status'),
|
169 |
+
'width' => '70px',
|
170 |
+
'index' => 'status',
|
171 |
+
'type' => 'options',
|
172 |
+
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
|
173 |
+
));
|
174 |
+
|
175 |
+
$this->addColumn('visibility',
|
176 |
+
array(
|
177 |
+
'header'=> Mage::helper('catalog')->__('Visibility'),
|
178 |
+
'width' => '70px',
|
179 |
+
'index' => 'visibility',
|
180 |
+
'type' => 'options',
|
181 |
+
'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
|
182 |
+
));
|
183 |
+
|
184 |
+
$this->addColumn('sku',
|
185 |
+
array(
|
186 |
+
'header'=> Mage::helper('catalog')->__('SKU'),
|
187 |
+
'width' => '80px',
|
188 |
+
'index' => 'sku',
|
189 |
+
));
|
190 |
+
|
191 |
+
$store = $this->_getStore();
|
192 |
+
$this->addColumn('price',
|
193 |
+
array(
|
194 |
+
'header' => Mage::helper('catalog')->__('Price'),
|
195 |
+
'type' => 'price',
|
196 |
+
'currency_code' => $store->getBaseCurrency()->getCode(),
|
197 |
+
'index' => 'price',
|
198 |
+
));
|
199 |
+
|
200 |
+
$aOptions = Mage::getModel('core/store')->getCollection()->toOptionHash();
|
201 |
+
foreach ($aOptions as $k=> $aOption){
|
202 |
+
$aOptions[$k] = Mage::helper('catalog')->__('Traduction manquante : ').$aOption;
|
203 |
+
}
|
204 |
+
$this->addColumn('translation',
|
205 |
+
array(
|
206 |
+
'header' => Mage::helper('catalog')->__('Traduction existante'),
|
207 |
+
'width' => '80px',
|
208 |
+
'index' => 'store_name',
|
209 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Store',
|
210 |
+
'type' => 'options',
|
211 |
+
'options' => $aOptions,
|
212 |
+
'filter_condition_callback' => array($this, 'translationFilter'),
|
213 |
+
));
|
214 |
+
|
215 |
+
|
216 |
+
return parent::_prepareColumns();
|
217 |
+
}
|
218 |
+
public function translationFilter($collection, $column){
|
219 |
+
|
220 |
+
if (!$value = $column->getFilter()->getValue()) {
|
221 |
+
return $this;
|
222 |
+
}
|
223 |
+
$store_name = Mage::getModel('core/store')->load($value)->getName();
|
224 |
+
|
225 |
+
$collection->getSelect()->where(new Zend_Db_Expr("(ttranslation.store_name_to NOT LIKE '%;$value%' AND ttranslation.store_name_to NOT LIKE '%$value;%' AND ttranslation.store_name_to <> '$value') OR ttranslation.store_name_to IS NULL"));
|
226 |
+
$sql = $collection->getSelect()->__toString();
|
227 |
+
|
228 |
+
return $this;
|
229 |
+
}
|
230 |
+
|
231 |
+
protected function _prepareMassaction()
|
232 |
+
{
|
233 |
+
$this->setMassactionIdField('entity_id');
|
234 |
+
$this->getMassactionBlock()->setFormFieldName('products_id');
|
235 |
+
|
236 |
+
$this->getMassactionBlock()->addItem('ajouter', array(
|
237 |
+
'label'=> Mage::helper('textmaster')->__('Add'),
|
238 |
+
'url'=> $this->getUrl('*/*/massAdd')
|
239 |
+
));
|
240 |
+
Mage::dispatchEvent('adminhtml_catalog_product_grid_prepare_massaction', array('block' => $this));
|
241 |
+
|
242 |
+
return $this;
|
243 |
+
}
|
244 |
+
|
245 |
+
public function getRowUrl($row)
|
246 |
+
{
|
247 |
+
// return $this->getUrl('aoadmin/catalog_product/edit', array('id' => $row->getId()));
|
248 |
+
return false;
|
249 |
+
}
|
250 |
+
|
251 |
+
|
252 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step2.php
ADDED
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step2 extends Mage_Adminhtml_Block_Widget_Form {
|
27 |
+
|
28 |
+
private $_exclude_attribute = array(
|
29 |
+
'ean',
|
30 |
+
'sku',
|
31 |
+
'custom_layout_update',
|
32 |
+
'recurring_profile',
|
33 |
+
'small_image',
|
34 |
+
'image',
|
35 |
+
'thumbnail',
|
36 |
+
'media_gallery',
|
37 |
+
'gallery',
|
38 |
+
'url_path',
|
39 |
+
'custom_design',
|
40 |
+
'page_layout',
|
41 |
+
'options_container',
|
42 |
+
'country_of_manufacture',
|
43 |
+
'msrp_enabled',
|
44 |
+
'msrp_display_actual_price_type',
|
45 |
+
);
|
46 |
+
|
47 |
+
protected function _prepareForm() {
|
48 |
+
$_api = Mage::helper('textmaster')->getApi();
|
49 |
+
Mage::helper('textmaster')->getApi();
|
50 |
+
$form = new Varien_Data_Form (array(
|
51 |
+
'id' => 'edit_form',
|
52 |
+
'action' => $this->getUrl('*/*/addproject', array('step' => 2)),
|
53 |
+
'method' => 'post',
|
54 |
+
'enctype' => 'multipart/form-data'
|
55 |
+
));
|
56 |
+
$form->setUseContainer(true);
|
57 |
+
$this->setForm ( $form );
|
58 |
+
$fieldset = $form->addFieldset ( 'project_type', array (
|
59 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Project' )
|
60 |
+
));
|
61 |
+
|
62 |
+
|
63 |
+
$ctype = $fieldset->addField ( 'ctype', 'select', array (
|
64 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Type' ),
|
65 |
+
'class' => 'required-entry',
|
66 |
+
'required' => true,
|
67 |
+
'name' => 'ctype',
|
68 |
+
'values' => array (
|
69 |
+
/*'-1' => Mage::helper ( 'textmaster' )->__ ( 'Select type' ),*/
|
70 |
+
//Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_COPYWRITING => ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_COPYWRITING ),
|
71 |
+
Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION => Mage::helper ( 'textmaster' )->__ (ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION )),
|
72 |
+
Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_PROOFREADING => Mage::helper ( 'textmaster' )->__ (ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_PROOFREADING ))
|
73 |
+
),
|
74 |
+
'disabled' => false,
|
75 |
+
'readonly' => false
|
76 |
+
));
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
$products_id = Mage::getSingleton('core/session')->getSelectedProducts();
|
83 |
+
$text = '';
|
84 |
+
$products = array();
|
85 |
+
foreach($products_id as $id){
|
86 |
+
$products[] = Mage::getModel('catalog/product')->load($id);
|
87 |
+
}
|
88 |
+
|
89 |
+
$fieldset = $form->addFieldset ( 'project_attribute', array (
|
90 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Fields to translate' )
|
91 |
+
) );
|
92 |
+
$aAttributes = Mage::getModel ( 'catalog/product' )->getAttributes ();
|
93 |
+
$aResult = array();
|
94 |
+
$aAfterJs = array();
|
95 |
+
$first = true;
|
96 |
+
$this->_name_attribute_id = false;
|
97 |
+
$this->_description_attribute_id = false;
|
98 |
+
$this->_short_description_attribute_id = false;
|
99 |
+
foreach(Mage::app()->getStores() as $k => $store){
|
100 |
+
|
101 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection();
|
102 |
+
$productCollection->addStoreFilter($store->getId());
|
103 |
+
foreach ($aAttributes as $attr){
|
104 |
+
if($attr->getAttributecode()=='name') $this->_name_attribute_id = $attr->getAttributeId();
|
105 |
+
if($attr->getAttributecode()=='description') $this->_description_attribute_id = $attr->getAttributeId();
|
106 |
+
if($attr->getAttributecode()=='short_description') $this->_short_description_attribute_id = $attr->getAttributeId();
|
107 |
+
|
108 |
+
if(in_array($attr->getAttributecode(),$this->_exclude_attribute)) continue;
|
109 |
+
|
110 |
+
if ($attr->getBackendType () == 'varchar' || $attr->getBackendType () == 'text') {
|
111 |
+
$productCollection->addAttributeToSelect($attr->getAttributecode());
|
112 |
+
}
|
113 |
+
}
|
114 |
+
$productCollection->getSelect()->where('product_id IN ('.implode(',',$products_id).')');
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
foreach ( $aAttributes as $attr ) {
|
119 |
+
|
120 |
+
if(in_array($attr->getAttributecode(),$this->_exclude_attribute)) continue;
|
121 |
+
if ($attr->getBackendType () == 'varchar' || $attr->getBackendType () == 'text') {
|
122 |
+
$word_count = 0;
|
123 |
+
foreach($productCollection as $product){
|
124 |
+
$word_count += Mage::helper ( 'textmaster' )->countWord($product->getData($attr->getAttributecode()));
|
125 |
+
}
|
126 |
+
if($first){
|
127 |
+
$aResult [] = array (
|
128 |
+
'value' => $attr->getAttributeId(),
|
129 |
+
'label' => Mage::helper('catalog')->__($attr->getFrontendLabel ()) . ' - <span class="tprice">'.$word_count.'</span> '.Mage::helper('textmaster')->__('word(s)')
|
130 |
+
);
|
131 |
+
}
|
132 |
+
$aAfterJs[$store->getId()][$attr->getAttributeId()] = $word_count;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
$first = false;
|
136 |
+
}
|
137 |
+
$tarifs = $_api->getPricings();
|
138 |
+
$currency = Mage::getModel('directory/currency')->load($tarifs['code']);
|
139 |
+
$curr = Mage::app()->getLocale()->currency($currency->getCode());
|
140 |
+
|
141 |
+
if($this->getProject() && $this->getProject()->hasDocumentsNotCount()) {
|
142 |
+
$docs = $this->getProject()->getDocuments();
|
143 |
+
$docsc = $this->getProject()->getDocumentsNotCount();
|
144 |
+
$ndoc = count($docs);
|
145 |
+
$ndocc = count($docsc);
|
146 |
+
$nd = $ndoc-$ndocc;
|
147 |
+
$nd = $nd / $ndoc;
|
148 |
+
$r = round($nd,2)*100;
|
149 |
+
} else {
|
150 |
+
$r = 100;
|
151 |
+
}
|
152 |
+
$attributes = $fieldset->addField ( 'attribute', 'checkboxes', array (
|
153 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Product informations' ),
|
154 |
+
'name' => 'attribute[]',
|
155 |
+
'values' => $aResult
|
156 |
+
) )->setAfterElementHtml('
|
157 |
+
<button id="all-attributes">'.Mage::helper ( 'textmaster' )->__ ( 'Select all' ).'</button>
|
158 |
+
<button id="notall-attributes">'.Mage::helper ( 'textmaster' )->__ ( 'Deselect all' ).'</button>
|
159 |
+
<script>
|
160 |
+
var attribute_word_count = '.Mage::helper('core')->jsonEncode($aAfterJs).';
|
161 |
+
var nouveau_message_loader = "'.Mage::helper ( 'textmaster' )->__ ( 'Nouveau message variable' ).'";
|
162 |
+
var must_display_loader = '.($this->getProject()&&$this->getProject()->hasDocumentsNotCount()?"true":'false').';
|
163 |
+
var pourcent_avance = '.$r.';
|
164 |
+
var textmasterurl_count = "'.($this->getProject()?Mage::getSingleton('adminhtml/url')->getUrl('*/*/createprojectready',array('id'=>$this->getProject()->getId())):'').'";
|
165 |
+
var currency_symbol = "'.$curr->getSymbol().'";
|
166 |
+
</script>');
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
$fieldset = $form->addFieldset ( 'project_languages', array (
|
171 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Languages' )
|
172 |
+
) );
|
173 |
+
|
174 |
+
$languages = $_api->getLanguages ();
|
175 |
+
$used_language = array();
|
176 |
+
foreach ($languages as $language){
|
177 |
+
$used_language[] = $language['code'];
|
178 |
+
}
|
179 |
+
|
180 |
+
$stores = Mage::getModel('core/store')->getCollection();
|
181 |
+
|
182 |
+
$languagesSelect = array ();
|
183 |
+
$correspondances = array ();
|
184 |
+
$languagesSelect [''] = Mage::helper ( 'textmaster' )->__ ( 'Select a language' );
|
185 |
+
foreach ( $stores as $store ) {
|
186 |
+
|
187 |
+
}
|
188 |
+
foreach ( $stores as $store ) {
|
189 |
+
$code = Mage::getStoreConfig('general/locale/code',$store->getId());
|
190 |
+
$local = explode('_',$code);
|
191 |
+
if(in_array($local[0],$used_language))
|
192 |
+
$languagesSelect [$store->getId()] = $store->getWebsite()->getName().' - '.$store->getName();
|
193 |
+
$correspondances[$store->getId()] = $local[0];
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
$fieldset->addField ( 'store_id_origin', 'select', array (
|
199 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Source language' ),
|
200 |
+
'class' => 'required-entry',
|
201 |
+
'required' => true,
|
202 |
+
'name' => 'store_id_origin',
|
203 |
+
'values' => $languagesSelect,
|
204 |
+
'disabled' => false,
|
205 |
+
'readonly' => false
|
206 |
+
) );
|
207 |
+
|
208 |
+
$language_to = $fieldset->addField ( 'store_id_translation', 'select', array (
|
209 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Target language' ),
|
210 |
+
'class' => 'required-entry',
|
211 |
+
'required' => true,
|
212 |
+
'name' => 'store_id_translation',
|
213 |
+
'values' => $languagesSelect,
|
214 |
+
'disabled' => false,
|
215 |
+
'readonly' => false
|
216 |
+
) );
|
217 |
+
|
218 |
+
$this->setChild ( 'form_after', $this->getLayout ()->createBlock ( 'adminhtml/widget_form_element_dependence' )->addFieldMap ( $ctype->getHtmlId (), $ctype->getName () )->addFieldMap ( $language_to->getHtmlId (), $language_to->getName () )->addFieldDependence ( $language_to->getName (), $ctype->getName (), Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION ) );
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
$fieldset = $form->addFieldset ( 'project_options', array (
|
224 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Pricing options' )
|
225 |
+
));
|
226 |
+
|
227 |
+
|
228 |
+
|
229 |
+
$fieldset->addField('language_level', 'select', array(
|
230 |
+
'label' => Mage::helper('textmaster')->__('Service level'),
|
231 |
+
'name' => 'language_level',
|
232 |
+
'required' => true,
|
233 |
+
'values' => array(
|
234 |
+
Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR),
|
235 |
+
Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM),
|
236 |
+
),
|
237 |
+
'after_element_html' => '<br/><small>'.
|
238 |
+
Mage::helper('textmaster')->__('Regular (%s/word): native-speaking translator for word-for-word translations of short texts.',$currency->format($tarifs['types']['translation']['regular'])).'<br/>'.
|
239 |
+
Mage::helper('textmaster')->__('Premium (%s/word): experienced translator; suitable for business use.',$currency->format($tarifs['types']['translation']['premium'])) .'<br/>'.
|
240 |
+
Mage::helper('textmaster')->__('Enterprise (%s/word): professional translator specialized in a specific field; suitable for technical or complex content.',$currency->format(0.13)) .'<br/>'.
|
241 |
+
'</small>',
|
242 |
+
));
|
243 |
+
|
244 |
+
|
245 |
+
$fieldset->addField ( 'quality', 'select', array (
|
246 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Quality Control (+%s/word)', $currency->format($tarifs['types']['translation']['quality'],array(),false)),
|
247 |
+
'name' => 'quality',
|
248 |
+
'required' => true,
|
249 |
+
'values' => array(
|
250 |
+
Mage::helper ( 'textmaster' )->__ ( 'No' ),
|
251 |
+
Mage::helper ( 'textmaster' )->__ ( 'Yes' )
|
252 |
+
),
|
253 |
+
'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('The translator\'s work will be proofread and corrected by TextMaster').'</small>',
|
254 |
+
) );
|
255 |
+
$fieldset->addField ( 'priority', 'select', array (
|
256 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Priority Order (+%s/word)', $currency->format($tarifs['types']['translation']['priority'],array(),false) ),
|
257 |
+
'name' => 'priority',
|
258 |
+
'required' => true,
|
259 |
+
'values' => array(
|
260 |
+
Mage::helper ( 'textmaster' )->__ ( 'No' ),
|
261 |
+
Mage::helper ( 'textmaster' )->__ ( 'Yes' )
|
262 |
+
),
|
263 |
+
'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('Your project will be assigned a higher priority status.').'</small>',
|
264 |
+
) );
|
265 |
+
$fieldset->addField ( 'expertise', 'select', array (
|
266 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Expertise (+%s/word)', $currency->format($tarifs['types']['translation']['expertise'],array(),false) ),
|
267 |
+
'name' => 'expertise',
|
268 |
+
'required' => true,
|
269 |
+
'values' => array(
|
270 |
+
Mage::helper ( 'textmaster' )->__ ( 'No' ),
|
271 |
+
Mage::helper ( 'textmaster' )->__ ( 'Yes' )
|
272 |
+
),
|
273 |
+
'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('We provide you with an expert in the selected category.').'</small>',
|
274 |
+
|
275 |
+
) );
|
276 |
+
|
277 |
+
|
278 |
+
$fieldset = $form->addFieldset ( 'project_name', array (
|
279 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Instructions du projet' )
|
280 |
+
));
|
281 |
+
|
282 |
+
$fieldset->addField ( 'name', 'text', array (
|
283 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Name' ),
|
284 |
+
'class' => 'required-entry',
|
285 |
+
'required' => true,
|
286 |
+
'name' => 'name'
|
287 |
+
));
|
288 |
+
|
289 |
+
$html_briefing = '<script>
|
290 |
+
var briefing_translation = new Array();
|
291 |
+
var briefing_proofreading = new Array();'."\n";
|
292 |
+
foreach ($languages as $langue) {
|
293 |
+
$html_briefing .= 'briefing_translation[\''.$langue['code'].'\'] = \''.addslashes(Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_translation_'.$langue['code'])).'\';'."\n";
|
294 |
+
$html_briefing .= 'briefing_proofreading[\''.$langue['code'].'\'] = \''.addslashes(Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_proofreading_'.$langue['code'])).'\';'."\n";
|
295 |
+
}
|
296 |
+
$html_briefing .= 'store_langue_correspondance = '.json_encode($correspondances).';'."\n";
|
297 |
+
|
298 |
+
$html_briefing .= '</script>';
|
299 |
+
|
300 |
+
$fieldset->addField ( 'project_briefing', 'textarea', array (
|
301 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Briefing' ),
|
302 |
+
'class' => 'required-entry',
|
303 |
+
'required' => true,
|
304 |
+
'name' => 'project_briefing'
|
305 |
+
))->setAfterElementHtml($html_briefing);
|
306 |
+
|
307 |
+
$categories = $_api->getCategories();
|
308 |
+
$categoriesSelect = array ();
|
309 |
+
$categoriesSelect [-1] = Mage::helper ( 'textmaster' )->__ ( 'Select a category' );
|
310 |
+
foreach ( $categories as $categorie ) {
|
311 |
+
|
312 |
+
$categoriesSelect [$categorie ["code"]] = $categorie ["value"];
|
313 |
+
}
|
314 |
+
|
315 |
+
$fieldset->addField ( 'category', 'select', array (
|
316 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Category (optional)' ),
|
317 |
+
'name' => 'category',
|
318 |
+
'values' => $categoriesSelect,
|
319 |
+
'disabled' => false,
|
320 |
+
'readonly' => false
|
321 |
+
) );
|
322 |
+
|
323 |
+
$fieldset->addField ( 'same_author_must_do_entire_project', 'select', array (
|
324 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Single Author (Assign the entire project to a single TextMaster)' ),
|
325 |
+
'name' => 'same_author_must_do_entire_project',
|
326 |
+
'required' => true,
|
327 |
+
'values' => array(
|
328 |
+
Mage::helper ( 'textmaster' )->__ ( 'Non' ),
|
329 |
+
Mage::helper ( 'textmaster' )->__ ( 'Oui' )
|
330 |
+
),
|
331 |
+
'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('Ensures better continuity, but longer turnaround time').'</small>',
|
332 |
+
|
333 |
+
) );
|
334 |
+
|
335 |
+
$this->setChild ( 'form_after',
|
336 |
+
$this->getLayout ()->createBlock('adminhtml/widget_form_element_dependence')
|
337 |
+
->addFieldMap($ctype->getHtmlId(),$ctype->getName())
|
338 |
+
->addFieldMap($language_to->getHtmlId(), $language_to->getName())
|
339 |
+
->addFieldDependence($language_to->getName(), $ctype->getName(), Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION )
|
340 |
+
);
|
341 |
+
|
342 |
+
$this->setFormValues();
|
343 |
+
|
344 |
+
|
345 |
+
return parent::_prepareForm ();
|
346 |
+
}
|
347 |
+
|
348 |
+
public function setFormValues(){
|
349 |
+
|
350 |
+
if($this->getProject()){
|
351 |
+
$post = $this->getProject()->getData();
|
352 |
+
$authors = $this->getProject()->getTextmasters();
|
353 |
+
if(count($authors)) {
|
354 |
+
$post['ismytextmaster'] = 1;
|
355 |
+
}
|
356 |
+
$post['attribute'] = array();
|
357 |
+
foreach($this->getProject()->getAttributes() as $attribute){
|
358 |
+
$post['attribute'][] = $attribute->getTextmasterAttributeId();
|
359 |
+
}
|
360 |
+
} else {
|
361 |
+
$post = Mage::getSingleton('core/session')->getProjectInfo();
|
362 |
+
if(!$post || count($post)==0){
|
363 |
+
$post['quality'] = 1;
|
364 |
+
$post['language_level'] = Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM;
|
365 |
+
$post['attribute'] = array();
|
366 |
+
if($this->_name_attribute_id){
|
367 |
+
$post['attribute'][] = $this->_name_attribute_id;
|
368 |
+
}
|
369 |
+
if($this->_description_attribute_id){
|
370 |
+
$post['attribute'][] = $this->_description_attribute_id;
|
371 |
+
}
|
372 |
+
if($this->_short_description_attribute_id){
|
373 |
+
$post['attribute'][] = $this->_short_description_attribute_id;
|
374 |
+
}
|
375 |
+
$post['ctype'] = Mage::getStoreConfig('textmaster/defaultvalue/default_type');
|
376 |
+
|
377 |
+
|
378 |
+
$used_language = Mage::getStoreConfig('textmaster/defaultvalue/default_language');
|
379 |
+
$stores = Mage::getModel('core/store')->getCollection();
|
380 |
+
$current_locale = '';
|
381 |
+
foreach ( $stores as $store ) {
|
382 |
+
$code = Mage::getStoreConfig('general/locale/code',$store->getId());
|
383 |
+
$local = explode('_',$code);
|
384 |
+
if($local[0]==$used_language) {
|
385 |
+
$post['store_id_origin'] = $store->getId();
|
386 |
+
$current_locale = $local[0];
|
387 |
+
}
|
388 |
+
}
|
389 |
+
if($post['ctype']!='translation' && $post['ctype']!='proofreading')
|
390 |
+
$post['ctype']='translation';
|
391 |
+
$post['project_briefing'] = Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_'.$post['ctype'].'_'.$current_locale);
|
392 |
+
$post['same_author_must_do_entire_project'] = Mage::getStoreConfig('textmaster/defaultvalue/single_author');
|
393 |
+
$post['expertise'] = Mage::getStoreConfig('textmaster/defaultvalue/expertise');
|
394 |
+
//Commerce (C019) par default
|
395 |
+
$post['category'] = Mage::getStoreConfig('textmaster/defaultvalue/category')?Mage::getStoreConfig('textmaster/defaultvalue/category'):'C019';
|
396 |
+
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
//$post['word_count'] = $word_count;
|
401 |
+
if ($post) {
|
402 |
+
$this->getForm()->setValues ( $post );
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
public function setProject($project){
|
407 |
+
$this->_project = $project;
|
408 |
+
return $this;
|
409 |
+
}
|
410 |
+
|
411 |
+
public function getProject(){
|
412 |
+
return $this->_project;
|
413 |
+
}
|
414 |
+
|
415 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3.php
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step3 extends Mage_Adminhtml_Block_Widget_Form
|
27 |
+
{
|
28 |
+
private $_project = false;
|
29 |
+
|
30 |
+
protected function _prepareForm() {
|
31 |
+
$_api = Mage::helper('textmaster')->getApi();
|
32 |
+
|
33 |
+
$form = new Varien_Data_Form (array(
|
34 |
+
'id' => 'summary_form',
|
35 |
+
'action' => $this->getUrl('*/*/edit', array('step' => 3)),
|
36 |
+
'method' => 'post',
|
37 |
+
'enctype' => 'multipart/form-data'
|
38 |
+
));
|
39 |
+
if($this->getProject()){
|
40 |
+
$post = $this->getProject()->getData();
|
41 |
+
$post['attribute'] = array();
|
42 |
+
foreach($this->getProject()->getAttributes() as $attribute){
|
43 |
+
$post['attribute'][] = $attribute->getTextmasterAttributeId();
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
$post = Mage::getSingleton('core/session')->getProjectInfo();
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
$form->setUseContainer(true);
|
51 |
+
$this->setForm ( $form );
|
52 |
+
|
53 |
+
$word_count = Mage::getSingleton('core/session')->getWordCount();
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
$fieldset = $form->addFieldset ( 'project_information', array (
|
58 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Project Summary' )
|
59 |
+
) );
|
60 |
+
|
61 |
+
$fieldset->addField ( 'ctype', 'label', array (
|
62 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Type of project' ),
|
63 |
+
//'value'=>'N mot'
|
64 |
+
));
|
65 |
+
|
66 |
+
$fieldset->addField ( 'total_word_count', 'label', array (
|
67 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Total word count' ),
|
68 |
+
));
|
69 |
+
|
70 |
+
$optionsField = $fieldset->addField ( 'options', 'label', array(
|
71 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Level and options' ),
|
72 |
+
));
|
73 |
+
//$pricing = Mage::getSingleton('core/session')->getPricing();
|
74 |
+
$fieldset->addField ( 'price', 'label', array (
|
75 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Total cost' ),
|
76 |
+
'value' => '-'
|
77 |
+
));
|
78 |
+
/*$fieldset->addField ( 'modifier', 'button', array (
|
79 |
+
'label' => '' ,
|
80 |
+
'value'=>Mage::helper ( 'textmaster' )->__ ('Modifier les propiété du projet');
|
81 |
+
) );*/
|
82 |
+
$fieldset->addField ( 'name', 'label', array (
|
83 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Project\'s name' ),
|
84 |
+
//'value'=>'N mot'
|
85 |
+
));
|
86 |
+
|
87 |
+
/*$fieldset->addField ( 'category', 'label', array (
|
88 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Category' ),
|
89 |
+
//'value'=>'N mot'
|
90 |
+
));*/
|
91 |
+
$fieldset->addField ( 'store_id_origin', 'label', array (
|
92 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Source language' ),
|
93 |
+
//'value'=>'N mot'
|
94 |
+
));
|
95 |
+
if($post['ctype']=='translation'){
|
96 |
+
$fieldset->addField ( 'store_id_translation', 'label', array (
|
97 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Target language' ),
|
98 |
+
|
99 |
+
));
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
$myauthors = $this->getProject()->getMyAuthors();
|
104 |
+
if($myauthors['count']) {
|
105 |
+
$mytextmaster = $fieldset->addField ( 'mytextmaster', 'label', array (
|
106 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Favorite authors' ),
|
107 |
+
'value'=>''
|
108 |
+
));
|
109 |
+
}
|
110 |
+
|
111 |
+
$this->setFormValues();
|
112 |
+
|
113 |
+
return parent::_prepareForm ();
|
114 |
+
}
|
115 |
+
|
116 |
+
public function setFormValues(){
|
117 |
+
$_api = Mage::helper('textmaster')->getApi();
|
118 |
+
|
119 |
+
$post = $this->getProject()->getData();
|
120 |
+
|
121 |
+
$store_from = Mage::getModel('core/store')->load($post['store_id_origin']);
|
122 |
+
$store_to = Mage::getModel('core/store')->load($post['store_id_translation']);
|
123 |
+
$post['ctype'] = ucfirst($post['ctype']);
|
124 |
+
$post['store_id_origin'] = $store_from->getWebsite()->getName().' - '.$store_from->getName();
|
125 |
+
$post['store_id_translation'] = $store_to->getWebsite()->getName().' - '.$store_to->getName();
|
126 |
+
$tarifs = $_api->getPricings();
|
127 |
+
$currency = Mage::getModel('directory/currency')->load($tarifs['code']);
|
128 |
+
|
129 |
+
$userinfo = $_api->getUserInfo();
|
130 |
+
|
131 |
+
if(isset($userinfo['wallet']['current_money']))
|
132 |
+
$credit = (float) $userinfo['wallet']['current_money'];
|
133 |
+
else $credit = 0;
|
134 |
+
|
135 |
+
$project_price = (float) $post['price'];
|
136 |
+
if($post['total_word_count'])
|
137 |
+
$price_per_word = $project_price/$post['total_word_count'];
|
138 |
+
else
|
139 |
+
$price_per_word = 0;
|
140 |
+
$post['price'] = $currency->format($post['price'],array(),false);
|
141 |
+
$html = $post['price'];
|
142 |
+
$html .='<br/><span>'.Mage::helper('textmaster')->__('Crédit disponible :').' '.$currency->format($credit).'</span>';
|
143 |
+
if($project_price>$credit) {
|
144 |
+
$html .='<br/><span style="color:red">'.Mage::helper('textmaster')->__('Crédit manquant :'). $currency->format(($project_price-$credit), array(), false).'</span>';
|
145 |
+
$html .='<br/><a href="'.$_api->getInterfaceUri().'clients/payment_requests/new?project_id='.$this->getProject()->getProjectApiid().'" target="_blank">'.Mage::helper('textmaster')->__('Add credits to my TextMaster account').'</a>';
|
146 |
+
}
|
147 |
+
$this->getForm()->getElement('price')->setAfterElementHtml($html);
|
148 |
+
|
149 |
+
|
150 |
+
|
151 |
+
$post['price'] = '';
|
152 |
+
|
153 |
+
$html = $this->getProject()->getLanguageLevelTexte($post['language_level']).'<br/>';
|
154 |
+
if($post['quality']) {
|
155 |
+
$html .= Mage::helper( 'textmaster' )->__( 'Contrôle qualité (+%s / mot)' ,$currency->format($tarifs['types']['translation']['quality'],array(),false)).'<br/>';
|
156 |
+
}
|
157 |
+
if($post['priority']) {
|
158 |
+
$html .= Mage::helper( 'textmaster' )->__( 'Commande prioritaire (+%s / mot)',$currency->format($tarifs['types']['translation']['priority'],array(),false) ).'<br/>';
|
159 |
+
}
|
160 |
+
if($post['expertise']) {
|
161 |
+
$html .= Mage::helper( 'textmaster' )->__( 'Expertise (+%s / mot)',$currency->format($tarifs['types']['translation']['expertise'],array(),false) ).'<br/>';
|
162 |
+
}
|
163 |
+
$html .= Mage::helper( 'textmaster' )->__('%s/word',$currency->format($price_per_word,array(),false));
|
164 |
+
|
165 |
+
$this->getForm()->getElement('options')->setAfterElementHtml($html);
|
166 |
+
|
167 |
+
|
168 |
+
$post['language_level'] = $this->getProject()->getLanguageLevelTexte($post['language_level']);
|
169 |
+
$post['vocabulary_type'] = $this->getProject()->getVocabularyTypeTexte($post['vocabulary_type']);
|
170 |
+
$post['target_reader_groups'] = $_api->getAudience($post['target_reader_groups']);
|
171 |
+
$post['grammatical_person'] = $_api->getGrammaticalPerson($post['grammatical_person']);
|
172 |
+
|
173 |
+
$post['specific_attachment'] = $post['specific_attachment']?Mage::helper( 'textmaster' )->__( 'Oui' ):Mage::helper( 'textmaster' )->__( 'Non' );
|
174 |
+
$post['priority'] = $post['priority']?Mage::helper( 'textmaster' )->__( 'Oui' ):Mage::helper( 'textmaster' )->__( 'Non' );
|
175 |
+
$post['quality'] = $post['quality']?Mage::helper( 'textmaster' )->__( 'Oui' ):Mage::helper( 'textmaster' )->__( 'Non' );
|
176 |
+
$post['expertise'] = $post['expertise']?Mage::helper( 'textmaster' )->__( 'Oui' ):Mage::helper( 'textmaster' )->__( 'Non' );
|
177 |
+
|
178 |
+
|
179 |
+
$html = ''.Mage::helper( 'textmaster' )->__( 'Textmaster(s) chosen:' ).' ';
|
180 |
+
$textmasters = $this->getProject()->getTextmasters();
|
181 |
+
$authors = $_api->getAuthors();
|
182 |
+
if(is_array($textmasters) && count($textmasters)>0)
|
183 |
+
foreach($textmasters as $t){
|
184 |
+
|
185 |
+
foreach ($authors['my_authors'] as $author){
|
186 |
+
if($author['author_id']==$t)
|
187 |
+
$html .= '<br/>'.$author['description']. ' ( ' . $author['author_ref'] . ' )';
|
188 |
+
}
|
189 |
+
|
190 |
+
}
|
191 |
+
else
|
192 |
+
$html .= Mage::helper( 'textmaster' )->__( 'none' );
|
193 |
+
|
194 |
+
$html .= '<br/><a style="cursor:pointer" id="mytextmasterchoice" onclick="showAuthors(\''.$this->getUrl('*/*/getmyauthors',array('id'=>$this->getProject()->getId())).'\',\''.Mage::helper( 'textmaster' )->__( 'My Textmasters' ).'\')">'.Mage::helper( 'textmaster' )->__( 'Choose your TextMasters' ).'</a>';
|
195 |
+
if($this->getForm()->getElement('mytextmaster'))
|
196 |
+
$this->getForm()->getElement('mytextmaster')->setAfterElementHtml($html);
|
197 |
+
|
198 |
+
if ($post) {
|
199 |
+
$this->getForm()->setValues ( $post );
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
public function setProject($project){
|
204 |
+
$this->_project = $project;
|
205 |
+
return $this;
|
206 |
+
}
|
207 |
+
|
208 |
+
public function getProject(){
|
209 |
+
return $this->_project;
|
210 |
+
}
|
211 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3/Author.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step3_Author extends Mage_Adminhtml_Block_Widget_Form_Container{
|
27 |
+
|
28 |
+
public function __construct() {
|
29 |
+
parent::__construct ();
|
30 |
+
$this->_objectId = 'textmaster_project_id';
|
31 |
+
$this->_controller = 'adminhtml_project';
|
32 |
+
$this->_blockGroup = 'textmaster';
|
33 |
+
|
34 |
+
//$this->_removeButton ( 'save' );
|
35 |
+
$this->_removeButton ( 'delete' );
|
36 |
+
$this->_removeButton ( 'back' );
|
37 |
+
//$this->_removeButton ( 'saveandcontinue' );
|
38 |
+
$this->_removeButton ( 'reset' );
|
39 |
+
//$this->updateButton('save','onclick', 'valideAuthor();')
|
40 |
+
|
41 |
+
}
|
42 |
+
public function getHeaderHtml(){
|
43 |
+
return '<h3>'.Mage::helper('textmaster')->__('Choose your textmaster for the project').'</h3>';
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3/Form/Author.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step3_Form_Author extends Mage_Adminhtml_Block_Widget_Form{
|
27 |
+
|
28 |
+
/*protected function _prepareLayout()
|
29 |
+
{
|
30 |
+
|
31 |
+
return parent::_prepareLayout();
|
32 |
+
}*/
|
33 |
+
private $_project = false;
|
34 |
+
|
35 |
+
protected function _prepareForm() {
|
36 |
+
$_api = Mage::helper('textmaster')->getApi();
|
37 |
+
|
38 |
+
$form = new Varien_Data_Form (array(
|
39 |
+
'id' => 'edit_form',
|
40 |
+
'action' => $this->getUrl('*/*/getmyauthors', array('id' => $this->getProject()->getId())),
|
41 |
+
'method' => 'post',
|
42 |
+
'enctype' => 'multipart/form-data'
|
43 |
+
));
|
44 |
+
|
45 |
+
$form->setUseContainer(true);
|
46 |
+
$this->setForm ( $form );
|
47 |
+
|
48 |
+
$fieldset = $form->addFieldset ( 'project_information', array (
|
49 |
+
'legend' => ''
|
50 |
+
) );
|
51 |
+
$myauthors = $this->getProject()->getMyAuthors();
|
52 |
+
$used_myauthors = explode(',',Mage::getStoreConfig('textmaster/defaultvalue/default_language'));
|
53 |
+
|
54 |
+
|
55 |
+
$myauthorsSelect = array ();
|
56 |
+
if($this->getProject()->getSameAuthorMustDoEntireProject()) {
|
57 |
+
$myauthorsSelect[]= array(
|
58 |
+
'value' => 'aucun',
|
59 |
+
'label' => 'Aucun'
|
60 |
+
);
|
61 |
+
}
|
62 |
+
if(isset($myauthors['my_authors'])) {
|
63 |
+
foreach ($myauthors['my_authors'] as $myauthor) {
|
64 |
+
$myauthorsSelect [] = array(
|
65 |
+
'value' => $myauthor ["author_id"],
|
66 |
+
'label' => $myauthor ["description"] . ' ( ' . $myauthor ["author_ref"] . ' )'
|
67 |
+
);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
if(count($myauthorsSelect)) {
|
71 |
+
if(!$this->getProject()->getSameAuthorMustDoEntireProject()) {
|
72 |
+
$input = $fieldset->addField ( 'textmasters', 'checkboxes', array (
|
73 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'My Textmasters' ),
|
74 |
+
'name' => 'textmasters[]',
|
75 |
+
'values' => $myauthorsSelect
|
76 |
+
) );
|
77 |
+
} else {
|
78 |
+
|
79 |
+
$input = $fieldset->addField ( 'textmasters', 'radios', array (
|
80 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'My Textmasters' ),
|
81 |
+
'name' => 'textmasters',
|
82 |
+
'values' => $myauthorsSelect,
|
83 |
+
) );
|
84 |
+
$input->setSeparator('<br/>');
|
85 |
+
|
86 |
+
}
|
87 |
+
} else {
|
88 |
+
$fieldset->addField ( 'textmasters', 'label', array (
|
89 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'You do not have any authors in your Favorites list' ),
|
90 |
+
));
|
91 |
+
}
|
92 |
+
|
93 |
+
$this->setFormValues();
|
94 |
+
$post = $this->getRequest()->getPost();
|
95 |
+
if(count($post)){
|
96 |
+
$input->setAfterElementHtml('
|
97 |
+
<script>
|
98 |
+
window.top.location.href = window.top.location.href;
|
99 |
+
</script>');
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
return parent::_prepareForm();
|
104 |
+
}
|
105 |
+
public function setFormValues(){
|
106 |
+
$post = $this->getRequest()->getPost();
|
107 |
+
if(count($post)){
|
108 |
+
$this->getForm()->setValues ( $post );
|
109 |
+
return;
|
110 |
+
}
|
111 |
+
$_api = Mage::helper('textmaster')->getApi();
|
112 |
+
$post['textmasters'] = $this->getProject()->getTextmasters();
|
113 |
+
if($this->getProject()->getSameAuthorMustDoEntireProject()) {
|
114 |
+
if(!(empty($post['textmasters']) || count($post['textmasters'])==0)) {
|
115 |
+
$textmasters=$post['textmasters'][0];
|
116 |
+
$post['textmasters']=$textmasters;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
if(empty($post['textmasters']) || count($post['textmasters'])==0){
|
121 |
+
$used_myauthors = explode(',',Mage::getStoreConfig('textmaster/defaultvalue/author'));
|
122 |
+
$myauthors = $this->getProject()->getMyAuthors();
|
123 |
+
$post['textmasters'] = array();
|
124 |
+
foreach($used_myauthors as $author) {
|
125 |
+
foreach($myauthors['my_authors'] as $author_av) {
|
126 |
+
if($author==$author_av['author_id']) $post['textmasters'][]=$author_av['author_id'];
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
if ($post) {
|
131 |
+
$this->getForm()->setValues ( $post );
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
public function setProject($project){
|
137 |
+
$this->_project = $project;
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
|
141 |
+
public function getProject(){
|
142 |
+
return $this->_project;
|
143 |
+
}
|
144 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Summary.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Summary extends Mage_Adminhtml_Block_Widget_Form
|
27 |
+
{
|
28 |
+
protected function _prepareForm()
|
29 |
+
{
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
$form = new Varien_Data_Form(
|
32 |
+
array(
|
33 |
+
'id' => 'edit_form',
|
34 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
35 |
+
'method' => 'post',
|
36 |
+
)
|
37 |
+
);
|
38 |
+
$fieldset = $form->addFieldset ( 'project_pricing', array (
|
39 |
+
'legend' => Mage::helper ( 'textmaster' )->__ ( 'Order Summary' )
|
40 |
+
) );
|
41 |
+
$projetField = $fieldset->addField ( 'projet', 'label', array(
|
42 |
+
'label' => Mage::helper ( 'textmaster' )->__ ('Project'),
|
43 |
+
));
|
44 |
+
$nbmotField = $fieldset->addField ( 'nbmot', 'label', array(
|
45 |
+
'label' => Mage::helper ( 'textmaster' )->__ ('Word count'),
|
46 |
+
));
|
47 |
+
$optionsField = $fieldset->addField ( 'options', 'label', array(
|
48 |
+
'label' => Mage::helper ( 'textmaster' )->__ ('Level and options'),
|
49 |
+
));
|
50 |
+
|
51 |
+
$pricingField = $fieldset->addField ( 'pricing', 'label', array(
|
52 |
+
'label' => Mage::helper ( 'textmaster' )->__ ('Price'),
|
53 |
+
));
|
54 |
+
|
55 |
+
$pricing = $_api->getPricings();
|
56 |
+
$pricing = Mage::helper('core')->jsonEncode($pricing);
|
57 |
+
$projetField->setAfterElementHtml('<span id="textmaster_projet"></span>');
|
58 |
+
$optionsField->setAfterElementHtml('<span id="textmaster_options"></span>');
|
59 |
+
$nbmotField->setAfterElementHtml('<span id="textmaster_nbmot"></span>');
|
60 |
+
$pricingField->setAfterElementHtml('
|
61 |
+
<span id="textmaster_total_price"></span>
|
62 |
+
<script>
|
63 |
+
var textmaster_pricing = '.$pricing.';
|
64 |
+
var textmaster_edit_form_url = \''.$this->getUrl('*/*/edit', array('step' => 2)).'\';
|
65 |
+
</script>');
|
66 |
+
$form->setUseContainer(true);
|
67 |
+
$this->setForm($form);
|
68 |
+
return parent::_prepareForm();
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Nbdocument.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Nbdocument extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getNbDocument();
|
31 |
+
if($row->getStatus()==Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_CREATION) return 'N/A';
|
32 |
+
return ''.$value.'';
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Price.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Price extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getPrice();
|
31 |
+
if($row->getStatus()==Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_CREATION) return 'N/A';
|
32 |
+
return ''.$value.'';
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Progression.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Progression extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getProgression();
|
31 |
+
return ''.$value.'';
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Status.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getStatusTexte();
|
31 |
+
return ''.Mage::helper('textmaster')->__($value).'';
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Store.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Store extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$stores_to = explode(';',$row->getData('store_name_to'));
|
31 |
+
|
32 |
+
$value = '';
|
33 |
+
$storeToIds = array();
|
34 |
+
if(is_array($stores_to)){
|
35 |
+
foreach ($stores_to as $k =>$storeToId){
|
36 |
+
if($storeToId!='' && !in_array($storeToId,$storeToIds)){
|
37 |
+
$icoTo = substr(Mage::getStoreConfig('general/locale/code',$storeToId),0,2);
|
38 |
+
$tmphtml2 = '<img height="10" src="'.$this->getSkinUrl('images/textmaster/'.$icoTo.'.png').'" alt="'.$icoTo.'"/>';
|
39 |
+
$value .= $tmphtml2.' - ';
|
40 |
+
$storeToIds[]=$storeToId;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
if(strlen($value)>3){
|
45 |
+
$value = substr($value,0,-3);
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
return ''.$value.'';
|
50 |
+
return $result;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Renderer/Wordcount.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_Renderer_Wordcount extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getTotalWordCount();
|
31 |
+
if($row->getStatus()==Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_CREATION) return 'N/A';
|
32 |
+
return ''.$value.'';
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_View extends Mage_Adminhtml_Block_Widget_View_Container {
|
27 |
+
|
28 |
+
private $_project;
|
29 |
+
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
parent::__construct();
|
33 |
+
$this->_objectId = 'textmaster_project_view';
|
34 |
+
$this->_controller = 'adminhtml_project';
|
35 |
+
$this->_blockGroup = 'textmaster';
|
36 |
+
|
37 |
+
|
38 |
+
}
|
39 |
+
public function prepareButton()
|
40 |
+
{
|
41 |
+
$this->removeButton('edit');
|
42 |
+
if($this->getProject()->canLaunch()){
|
43 |
+
$this->_addButton ( 'launch', array (
|
44 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
|
45 |
+
'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/view/',array('id'=>$this->getProject()->getId(),'a'=>'launch')).'\'' ,
|
46 |
+
'class' => 'save'
|
47 |
+
), - 100 );
|
48 |
+
}
|
49 |
+
if($this->getProject()->canPause()){
|
50 |
+
$this->_addButton ( 'pause', array (
|
51 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Pause' ),
|
52 |
+
'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/view/',array('id'=>$this->getProject()->getId(),'a'=>'pause')).'\'' ,
|
53 |
+
'class' => ''
|
54 |
+
), - 100 );
|
55 |
+
}
|
56 |
+
if($this->getProject()->canResume()){
|
57 |
+
$this->_addButton ( 'resume', array (
|
58 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Resume' ),
|
59 |
+
'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/view/',array('id'=>$this->getProject()->getId(),'a'=>'resume')).'\'' ,
|
60 |
+
'class' => ''
|
61 |
+
), - 100 );
|
62 |
+
}
|
63 |
+
if($this->getProject()->canComplete()){
|
64 |
+
$this->_addButton ( 'complete', array (
|
65 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Complete' ),
|
66 |
+
'onclick' => 'completeDocuments(\'' . $this->getUrl('*/*/view/',array('id'=>$this->getProject()->getId(),'a'=>'complete')).'\',0)' ,
|
67 |
+
'class' => ''
|
68 |
+
), - 100 );
|
69 |
+
}
|
70 |
+
if($this->getProject()->canCancel()){
|
71 |
+
$this->_addButton ( 'cancel', array (
|
72 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Cancel' ),
|
73 |
+
'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/view/',array('id'=>$this->getProject()->getId(),'a'=>'cancel')).'\'' ,
|
74 |
+
'class' => 'delete'
|
75 |
+
), - 100 );
|
76 |
+
}
|
77 |
+
if($this->getProject()->canTransfert()){
|
78 |
+
$this->_addButton ( 'translate', array (
|
79 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Update product' ),
|
80 |
+
'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/view/',array('id'=>$this->getProject()->getId(),'a'=>'translate')).'\'' ,
|
81 |
+
'class' => 'delete'
|
82 |
+
), - 100 );
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function setProject($project){
|
90 |
+
$this->_project = $project;
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getProject(){
|
94 |
+
return $this->_project;
|
95 |
+
}
|
96 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View/Documents.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_View_Documents extends Mage_Adminhtml_Block_Widget_Grid
|
27 |
+
{
|
28 |
+
private $_is_regex_op = array(
|
29 |
+
'title',
|
30 |
+
'ref'
|
31 |
+
);
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
$this->setDefaultSort('textmaster_document_id');
|
36 |
+
$this->setDefaultDir('DESC');
|
37 |
+
$this->setDefaultLimit(20);
|
38 |
+
$this->setSaveParametersInSession(true);
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function _getStore()
|
43 |
+
{
|
44 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
45 |
+
return Mage::app()->getStore($storeId);
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function _prepareCollection()
|
49 |
+
{
|
50 |
+
$collection = Mage::getModel('textmaster/document')->getCollection()
|
51 |
+
->setLoadApi(true)
|
52 |
+
->setProjectApiId($this->getProject()->getProjectApiid())
|
53 |
+
->addFieldToFilter('textmaster_project_id',$this->getProject()->getId());
|
54 |
+
$this->setCollection($collection);
|
55 |
+
return parent::_prepareCollection();
|
56 |
+
}
|
57 |
+
|
58 |
+
protected function _prepareColumns()
|
59 |
+
{
|
60 |
+
$this->addColumn('textmaster_document_id',
|
61 |
+
array(
|
62 |
+
'header'=> Mage::helper('textmaster')->__('Reference'),
|
63 |
+
'width' => '200px',
|
64 |
+
//'type' => 'number',
|
65 |
+
'index' => 'reference',
|
66 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
67 |
+
));
|
68 |
+
|
69 |
+
|
70 |
+
$this->addColumn('name',
|
71 |
+
array(
|
72 |
+
'header'=> Mage::helper('textmaster')->__('Name'),
|
73 |
+
'index' => 'name',
|
74 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
75 |
+
));
|
76 |
+
|
77 |
+
/*$this->addColumn('type',
|
78 |
+
array(
|
79 |
+
'header'=> Mage::helper('textmaster')->__('Type'),
|
80 |
+
'width' => '60px',
|
81 |
+
'index' => 'type',
|
82 |
+
//'type' => 'options',
|
83 |
+
//'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
|
84 |
+
));*/
|
85 |
+
|
86 |
+
$this->addColumn('status',
|
87 |
+
array(
|
88 |
+
'header'=> Mage::helper('textmaster')->__('Status'),
|
89 |
+
'width' => '70px',
|
90 |
+
'index' => 'status',
|
91 |
+
//'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Document_Renderer_Status',
|
92 |
+
'type' => 'options',
|
93 |
+
'options' => Mage::getSingleton('textmaster/project')->getStatuses(),
|
94 |
+
'filter_condition_callback' => array($this, '_apiFilter'),
|
95 |
+
//'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
|
96 |
+
));
|
97 |
+
$this->addColumn('action',
|
98 |
+
array(
|
99 |
+
'header' => Mage::helper('textmaster')->__('Action'),
|
100 |
+
'width' => '50',
|
101 |
+
'type' => 'action',
|
102 |
+
'getter' => 'getId',
|
103 |
+
'actions' => array(
|
104 |
+
array(
|
105 |
+
'caption' => Mage::helper('textmaster')->__('View'),
|
106 |
+
'url' => array('base'=> '*/*/document'),
|
107 |
+
'field' => 'id'
|
108 |
+
)
|
109 |
+
),
|
110 |
+
'filter' => false,
|
111 |
+
'sortable' => false,
|
112 |
+
'index' => 'stores',
|
113 |
+
'is_system' => true,
|
114 |
+
'align' => 'right',
|
115 |
+
));
|
116 |
+
return parent::_prepareColumns();
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _prepareMassaction()
|
120 |
+
{
|
121 |
+
$this->setMassactionIdField('textmaster_document_id');
|
122 |
+
$this->getMassactionBlock()->setFormFieldName('document_id');
|
123 |
+
|
124 |
+
|
125 |
+
//if($this->getProject()->getStatus()== Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_REVIEW) {
|
126 |
+
$this->getMassactionBlock()->addItem('complete', array(
|
127 |
+
'label'=> Mage::helper('textmaster')->__('Complete file'),
|
128 |
+
'url'=> $this->getUrl('*/*/masscompletedoc',array('id'=>$this->getProject()->getId())),
|
129 |
+
'complete'=>'
|
130 |
+
completeDocuments
|
131 |
+
'
|
132 |
+
));
|
133 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
134 |
+
//}
|
135 |
+
|
136 |
+
return $this;
|
137 |
+
}
|
138 |
+
|
139 |
+
public function getRowUrl($row)
|
140 |
+
{
|
141 |
+
return $this->getUrl('*/*/document', array('id' => $row->getId()));
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
public function getProject()
|
145 |
+
{
|
146 |
+
// return $this->getUrl('aoadmin/catalog_product/edit', array('id' => $row->getId()));
|
147 |
+
return $this->_project;
|
148 |
+
}
|
149 |
+
public function setProject($project)
|
150 |
+
{
|
151 |
+
// return $this->getUrl('aoadmin/catalog_product/edit', array('id' => $row->getId()));
|
152 |
+
$this->_project = $project;
|
153 |
+
return $this;
|
154 |
+
}
|
155 |
+
public function setProjectApiId($id)
|
156 |
+
{
|
157 |
+
// return $this->getUrl('aoadmin/catalog_product/edit', array('id' => $row->getId()));
|
158 |
+
$this->_project_api_id = $id;
|
159 |
+
return $this;
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
|
164 |
+
public function _apiFilter($collection, $column) {
|
165 |
+
if (!$value = $column->getFilter()->getValue()) {
|
166 |
+
return $this;
|
167 |
+
}
|
168 |
+
$index = $column->getIndex();
|
169 |
+
|
170 |
+
$subsitute = $this->getCollection()->getSubstitute();
|
171 |
+
if(isset($subsitute[$index])) $index = $subsitute[$index];
|
172 |
+
else return $this;
|
173 |
+
$filters = array();
|
174 |
+
if($column->getType()=='number' ){
|
175 |
+
if(isset($value['from']))
|
176 |
+
$filters[$index]['$gte'] = $value['from'];
|
177 |
+
if(isset($value['to']))
|
178 |
+
$filters[$index]['$lte'] = $value['to'];
|
179 |
+
} elseif($column->getType()=='datetime' ){
|
180 |
+
//
|
181 |
+
if(isset($value['from']))
|
182 |
+
$filters[$index]['$gte'] = date('Y-m-d',$value['from']->getTimestamp());
|
183 |
+
if(isset($value['to']))
|
184 |
+
$filters[$index]['$lte'] = date('Y-m-d',$value['to']->getTimestamp());
|
185 |
+
} elseif(in_array($index,$this->_is_regex_op)) {
|
186 |
+
$filters[$index]['$regex'] = '/'.$value.'/i';
|
187 |
+
} else {
|
188 |
+
$filters[$index] = $value;
|
189 |
+
}
|
190 |
+
$this->getCollection()->addFiltersApi($filters);
|
191 |
+
return $this;
|
192 |
+
}
|
193 |
+
|
194 |
+
protected function _prepareMassactionColumn()
|
195 |
+
{
|
196 |
+
$columnId = 'massaction';
|
197 |
+
$massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
|
198 |
+
->setData(array(
|
199 |
+
'index' => $this->getMassactionIdField(),
|
200 |
+
'filter_index' => $this->getMassactionIdFilter(),
|
201 |
+
'type' => 'massaction',
|
202 |
+
'name' => $this->getMassactionBlock()->getFormFieldName(),
|
203 |
+
'align' => 'center',
|
204 |
+
'is_system' => true,
|
205 |
+
'filter' => false,
|
206 |
+
'renderer' => 'Textmaster_Textmaster_Block_Adminhtml_Project_View_Grid_Column_Renderer_Massaction'
|
207 |
+
));
|
208 |
+
|
209 |
+
if ($this->getNoFilterMassactionColumn()) {
|
210 |
+
$massactionColumn->setData('filter', false);
|
211 |
+
}
|
212 |
+
|
213 |
+
$massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
|
214 |
+
->setGrid($this)
|
215 |
+
->setId($columnId);
|
216 |
+
|
217 |
+
$oldColumns = $this->_columns;
|
218 |
+
$this->_columns = array();
|
219 |
+
$this->_columns[$columnId] = $massactionColumn;
|
220 |
+
$this->_columns = array_merge($this->_columns, $oldColumns);
|
221 |
+
return $this;
|
222 |
+
}
|
223 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View/Grid/Column/Renderer/Checkbox.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_View_Grid_Column_Renderer_Checkbox extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox {
|
27 |
+
|
28 |
+
protected function _getCheckboxHtml($value, $checked)
|
29 |
+
{
|
30 |
+
|
31 |
+
$html = '<input type="checkbox" ';
|
32 |
+
$html .= 'name="' . $this->getColumn()->getFieldName() . '" ';
|
33 |
+
$html .= 'value="' . $this->escapeHtml($value) . '" ';
|
34 |
+
$html .= 'class="'. ($this->getColumn()->getInlineCss() ? $this->getColumn()->getInlineCss() : 'checkbox') .'"';
|
35 |
+
$html .= $checked . $this->getDisabled() . '/>';
|
36 |
+
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/View/Grid/Column/Renderer/Massaction.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Project_View_Grid_Column_Renderer_Massaction extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox {
|
27 |
+
|
28 |
+
protected function _getCheckboxHtml($value, $checked)
|
29 |
+
{
|
30 |
+
$collection = $this->getColumn()->getGrid()->getCollection();
|
31 |
+
foreach($collection as $document){
|
32 |
+
if($document->getId()==$value){
|
33 |
+
if($document->getStatus()!='in_review'){
|
34 |
+
return '';
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
$html = '<input type="checkbox" name="' . $this->getColumn()->getName() . '" ';
|
39 |
+
$html .= 'value="' . $this->escapeHtml($value) . '" class="massaction-checkbox"' . $checked . '/>';
|
40 |
+
return $html;
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Renderer/Sourcelanguage.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Renderer_Sourcelanguage extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
|
29 |
+
public function render (Varien_Object $row)
|
30 |
+
{
|
31 |
+
$store_id = $row->getData('store_id_origin');
|
32 |
+
$store = Mage::getModel('core/store')->load($store_id);
|
33 |
+
$value = '';
|
34 |
+
if ($store->getId()) {
|
35 |
+
$value = $store->getWebsite()->getName() . ' - ' . $store->getName();
|
36 |
+
}
|
37 |
+
return $value;
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Renderer/Targetlanguage.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Renderer_Targetlanguage extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
|
29 |
+
public function render (Varien_Object $row)
|
30 |
+
{
|
31 |
+
$store_id = $row->getData('store_id_translation');
|
32 |
+
$store = Mage::getModel('core/store')->load($store_id);
|
33 |
+
$value = '';
|
34 |
+
if ($store->getId()) {
|
35 |
+
$value = $store->getWebsite()->getName() . ' - ' . $store->getName();
|
36 |
+
}
|
37 |
+
return $value;
|
38 |
+
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Renderer/UpdatedAt.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_Renderer_UpdatedAt extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
27 |
+
{
|
28 |
+
public function render(Varien_Object $row)
|
29 |
+
{
|
30 |
+
$value = $row->getUpdatedAt();
|
31 |
+
$timestamp = strtotime($value);
|
32 |
+
$formattedDate = Mage::helper('core')->formatDate($value);
|
33 |
+
return ''.$formattedDate.'';
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Briefing.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_System_Config_Form_Field_Briefing extends Mage_Adminhtml_Block_System_Config_Form_Field
|
27 |
+
{
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
29 |
+
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
$languages = $_api->getLanguages();
|
32 |
+
|
33 |
+
$original_name = $element->getName();
|
34 |
+
|
35 |
+
if(strpos($element->getHtmlId(),'translation')!==false){
|
36 |
+
$element_id = 'briefing_message_translation';
|
37 |
+
} else{
|
38 |
+
$element_id = 'briefing_message_proofreading';
|
39 |
+
}
|
40 |
+
|
41 |
+
$html = '';
|
42 |
+
foreach ($languages as $langue){
|
43 |
+
$name = str_replace($element_id,$element_id.'_'.$langue['code'],$original_name);
|
44 |
+
$value = Mage::getStoreConfig('textmaster/defaultvalue/'.$element_id.'_'.$langue['code']);
|
45 |
+
$html .= '<div><textarea name="'.$name.'" id="'.$element_id.'_'.$langue['code'].'" data-label="'.$langue['value'].'" style="display:none;">'.$value.'</textarea></div>';
|
46 |
+
}
|
47 |
+
|
48 |
+
$html .= "<script>
|
49 |
+
var textmaster_breifing_element_id = '".$element_id."';
|
50 |
+
</script>";
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
return $html;
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Creation.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_System_Config_Form_Field_Creation extends Mage_Adminhtml_Block_System_Config_Form_Field
|
27 |
+
{
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
29 |
+
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
|
32 |
+
$_isLog = $_api->getAPIConnection();
|
33 |
+
|
34 |
+
$html = '<input type="text" placeholder="'.Mage::helper('textmaster')->__('Email').'" name="email" id="email" class=" input-text" /><span style="margin-left:10px;"></span><br/>';
|
35 |
+
$html .= '<input type="password" placeholder="'.Mage::helper('textmaster')->__('Password').'" name="create_password" id="create_password" class=" input-text" /><span style="margin-left:10px;"></span><br/>';
|
36 |
+
$html .= '<input type="password" placeholder="'.Mage::helper('textmaster')->__('Confirm password').'" name="create_password2" id="create_password2" class=" input-text" /><span style="margin-left:10px;"></span><br/>';
|
37 |
+
$html .= '<input type="text" placeholder="'.Mage::helper('textmaster')->__('Phone').'" name="tel" id="tel" class="input-text" /><span style="margin-left:10px;"></span><br/>';
|
38 |
+
$html .= '<button type="button" style="margin-top:5px;" class="scalable generate_key" onclick="createAjaxAction()"><span>'.Mage::helper('textmaster')->__('Create your free account').'</span></button><br/>';
|
39 |
+
$html .= '<div id="result2_ajax" style="margin-top:7px;"></div>';
|
40 |
+
$html .= "<script>
|
41 |
+
function createAjaxAction(){
|
42 |
+
|
43 |
+
var reloadurl = '". $this->getUrl('textmaster/adminhtml_ajax/create/')."';
|
44 |
+
new Ajax.Request(reloadurl, {
|
45 |
+
method: 'post',
|
46 |
+
parameters: {
|
47 |
+
login : \$F('email'),
|
48 |
+
password: \$F('create_password'),
|
49 |
+
tel : \$F('tel'),
|
50 |
+
},
|
51 |
+
requestHeaders: {Accept: 'application/json'},
|
52 |
+
|
53 |
+
onLoading: function (transport) {
|
54 |
+
$('result2_ajax').update('".Mage::helper('textmaster')->__('Searching...')."');
|
55 |
+
},
|
56 |
+
onComplete: function(transport) {
|
57 |
+
|
58 |
+
data = transport.responseText.evalJSON();
|
59 |
+
if(data.errors){
|
60 |
+
$('result2_ajax').update(data.errors);
|
61 |
+
} else {
|
62 |
+
$('result2_ajax').update(data.html);
|
63 |
+
window.location = '".$this->getUrl('textmaster/adminhtml_project/index/')."';
|
64 |
+
}
|
65 |
+
}
|
66 |
+
});
|
67 |
+
}
|
68 |
+
</script>";
|
69 |
+
if($_isLog) {
|
70 |
+
//$html .= '<input type="hidden" class="is_textmasterlog" value="1">';
|
71 |
+
} else {
|
72 |
+
$html .= '<input type="hidden" class="is_textmasterlog" value="0">';
|
73 |
+
}
|
74 |
+
return $html;
|
75 |
+
}
|
76 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Islog.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_System_Config_Form_Field_Islog extends Mage_Adminhtml_Block_System_Config_Form_Field
|
27 |
+
{
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
29 |
+
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
|
32 |
+
$_isLog = $_api->getAPIConnection();
|
33 |
+
|
34 |
+
if($_isLog) {
|
35 |
+
$html = '<input type="hidden" name="istextmasterlog" value="1">';
|
36 |
+
$html .= "<script>
|
37 |
+
var textmaster_is_log = true;
|
38 |
+
|
39 |
+
</script>";
|
40 |
+
} else {
|
41 |
+
$html = '<input type="hidden" name="istextmasterlog" value="0">';
|
42 |
+
$html .= "<script>
|
43 |
+
var textmaster_is_log = false;
|
44 |
+
</script>";
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
return $html;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Textmaster/Textmaster/Block/Adminhtml/System/Config/Form/Field/Login.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Block_Adminhtml_System_Config_Form_Field_Login extends Mage_Adminhtml_Block_System_Config_Form_Field
|
27 |
+
{
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
29 |
+
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
|
32 |
+
$_isLog = $_api->getAPIConnection();
|
33 |
+
|
34 |
+
if(!$_isLog){
|
35 |
+
|
36 |
+
$html = '<input type="text" placeholder="'.Mage::helper('textmaster')->__('Login').'" name="login" id="login" class="login" /><span style="margin-left:10px;"></span>';
|
37 |
+
$html .= '<input type="password" placeholder="'.Mage::helper('textmaster')->__('Password').'" name="password" id="password" class="login" /><span style="margin-left:10px;"></span>';
|
38 |
+
$html .= '<button type="button" style="margin-top:5px;" class="scalable generate_key" onclick="loginAjaxAction()"><span>'.Mage::helper('textmaster')->__('Connexion').'</span></button>';
|
39 |
+
$html .= '<div id="result_ajax" style="margin-top:7px;"></div>';
|
40 |
+
$html .= "<script>
|
41 |
+
function loginAjaxAction(){
|
42 |
+
|
43 |
+
var reloadurl = '". $this->getUrl('textmaster/adminhtml_ajax/login/')."';
|
44 |
+
new Ajax.Request(reloadurl, {
|
45 |
+
method: 'post',
|
46 |
+
parameters: {
|
47 |
+
login : \$F('login'),
|
48 |
+
password: \$F('password'),
|
49 |
+
},
|
50 |
+
requestHeaders: {Accept: 'application/json'},
|
51 |
+
|
52 |
+
onLoading: function (transport) {
|
53 |
+
$('result_ajax').update('".Mage::helper('textmaster')->__('Searching...')."');
|
54 |
+
|
55 |
+
},
|
56 |
+
onComplete: function(transport) {
|
57 |
+
|
58 |
+
data = transport.responseText.evalJSON();
|
59 |
+
if(data.errors){
|
60 |
+
$('result_ajax').update(data.errors);
|
61 |
+
} else {
|
62 |
+
$('result_ajax').update(data.html);
|
63 |
+
window.location = '".$this->getUrl('textmaster/adminhtml_project/index/')."';
|
64 |
+
}
|
65 |
+
}
|
66 |
+
});
|
67 |
+
}
|
68 |
+
</script>";
|
69 |
+
}
|
70 |
+
if($_isLog) {
|
71 |
+
$html = '<input type="hidden" class="is_textmasterlog" value="1">';
|
72 |
+
$html .= '<button type="button" style="margin-top:5px;" class="scalable generate_key" onclick="logoutAjaxAction()"><span>'.Mage::helper('textmaster')->__('Logout').'</span></button>';
|
73 |
+
$html .= "<script>
|
74 |
+
function logoutAjaxAction(){
|
75 |
+
|
76 |
+
var reloadurl = '". $this->getUrl('textmaster/adminhtml_ajax/logout/')."';
|
77 |
+
new Ajax.Request(reloadurl, {
|
78 |
+
method: 'post',
|
79 |
+
requestHeaders: {Accept: 'application/json'},
|
80 |
+
|
81 |
+
onLoading: function (transport) {
|
82 |
+
$('result_ajax').update('".Mage::helper('textmaster')->__('Searching...')."');
|
83 |
+
|
84 |
+
},
|
85 |
+
onComplete: function(transport) {
|
86 |
+
|
87 |
+
window.location = window.location;
|
88 |
+
}
|
89 |
+
});
|
90 |
+
}
|
91 |
+
</script>";
|
92 |
+
|
93 |
+
} else {
|
94 |
+
$html .= '<input type="hidden" class="is_textmasterlog" value="0">';
|
95 |
+
}
|
96 |
+
return $html;
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Textmaster/Textmaster/Helper/Data.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Helper_Data extends Mage_Core_Helper_Abstract
|
27 |
+
{
|
28 |
+
|
29 |
+
private $_mot_exclus = array();
|
30 |
+
|
31 |
+
private $_progression_score = array(
|
32 |
+
'in_creation' => 0,
|
33 |
+
'waiting_assignment' => 0.1,
|
34 |
+
'in_progress' => 0.3,
|
35 |
+
'in_review' => 0.7,
|
36 |
+
'incomplete' => 0.,
|
37 |
+
'completed' => 1,
|
38 |
+
'paused' => 0.1,
|
39 |
+
'quality_control' => 0.5,
|
40 |
+
'copyscape' => 0.6,
|
41 |
+
'counting_words' => 0
|
42 |
+
);
|
43 |
+
|
44 |
+
private $_api = false;
|
45 |
+
|
46 |
+
public function countWord ($txt)
|
47 |
+
{
|
48 |
+
$txt = utf8_decode($txt);
|
49 |
+
$aMots = str_word_count($txt, 1,
|
50 |
+
utf8_decode(
|
51 |
+
'ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ'));
|
52 |
+
foreach ($aMots as &$sMot) {
|
53 |
+
if (in_array($sMot, $this->_mot_exclus)) {
|
54 |
+
unset($sMot);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
return count($aMots);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function arrayToStringForApi ($arr)
|
61 |
+
{
|
62 |
+
if (! is_array($arr))
|
63 |
+
return $arr;
|
64 |
+
$r = '';
|
65 |
+
foreach ($arr as $k1 => $niv1) {
|
66 |
+
if (! is_array($niv1))
|
67 |
+
return '';
|
68 |
+
foreach ($niv1 as $k2 => $niv2) {
|
69 |
+
if (is_array($niv2)) {
|
70 |
+
foreach ($niv2 as $k3 => $niv3) {
|
71 |
+
$r .= ($k1 == 0 ? '' : '&') .
|
72 |
+
urlencode($k1 . '[' . $k2 . ']' . '[' . $k3 .
|
73 |
+
']') . '=' . urlencode($niv3);
|
74 |
+
}
|
75 |
+
} else {
|
76 |
+
$r .= urlencode(($k1 == 0 ? '' : '&') . $k1 . '[' . $k2 .
|
77 |
+
']') . '=' . urlencode($niv2);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
return $r;
|
82 |
+
}
|
83 |
+
public function arrayToStringForApi2 ($arr)
|
84 |
+
{
|
85 |
+
if (! is_array($arr))
|
86 |
+
return $arr;
|
87 |
+
$r = '';
|
88 |
+
foreach ($arr as $k1 => $niv1) {
|
89 |
+
if (! is_array($niv1))
|
90 |
+
return '';
|
91 |
+
foreach ($niv1 as $k2 => $niv2) {
|
92 |
+
if (is_array($niv2)) {
|
93 |
+
foreach ($niv2 as $k3 => $niv3) {
|
94 |
+
$r .= ($k1 == 0 ? '' : '&') .
|
95 |
+
($k1 . '[' . $k2 . ']' . '[' . $k3 .
|
96 |
+
']') . '=' . ($niv3);
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
$r .= (($k1 == 0 ? '' : '&') . $k1 . '[' . $k2 .
|
100 |
+
']') . '=' . ($niv2);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
return $r;
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getCallbackUrl ()
|
108 |
+
{
|
109 |
+
// http://aomagento.addonline.devl/textmaster/callback/documentcount/
|
110 |
+
return Mage::getUrl('textmaster/callback/documentcount');
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getCallbackCompletedUrl ()
|
114 |
+
{return Mage::getUrl('textmaster/callback/documentcomplete');
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
public function getCallbackUrlInProgress ()
|
120 |
+
{
|
121 |
+
return Mage::getUrl('textmaster/callback/inprogress');
|
122 |
+
}
|
123 |
+
|
124 |
+
public function getProgression ($documents_statuses)
|
125 |
+
{
|
126 |
+
$nb_docs = 0;
|
127 |
+
$progression = 0;
|
128 |
+
|
129 |
+
foreach ($documents_statuses as $status => $doc) {
|
130 |
+
$nb_docs += (int) $doc;
|
131 |
+
if (isset($this->_progression_score[$status]) && (int) $doc)
|
132 |
+
$progression += ((int) $doc) * $this->_progression_score[$status];
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($nb_docs > 0)
|
136 |
+
$progression = $progression / $nb_docs;
|
137 |
+
return round($progression * 100, 2);
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
public function getApi ()
|
142 |
+
{
|
143 |
+
if ($this->_api === false) {
|
144 |
+
$this->_api = Mage::getSingleton('textmaster/api');
|
145 |
+
}
|
146 |
+
return $this->_api;
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Api.php
ADDED
@@ -0,0 +1,1110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
|
27 |
+
{
|
28 |
+
|
29 |
+
protected $_api_instance;
|
30 |
+
|
31 |
+
protected $_userinfo = false;
|
32 |
+
|
33 |
+
protected $_categories = false;
|
34 |
+
|
35 |
+
protected $_locales = false;
|
36 |
+
|
37 |
+
protected $_languages = false;
|
38 |
+
|
39 |
+
protected $_author = false;
|
40 |
+
|
41 |
+
protected $_authors = false;
|
42 |
+
|
43 |
+
protected $_prices = false;
|
44 |
+
|
45 |
+
protected $_users_me = false;
|
46 |
+
|
47 |
+
const TEXTMASTER_API_VERSION = 'v1';
|
48 |
+
|
49 |
+
const TEXTMASTER_PROD_API_URI = 'http://api.textmaster.com';
|
50 |
+
|
51 |
+
const TEXTMASTER_STAGING_API_URI = 'http://api.staging.textmaster.com';
|
52 |
+
|
53 |
+
const TEXTMASTER_SANDBOX_API_URI = 'http://api.sandbox.textmaster.com';
|
54 |
+
|
55 |
+
const TEXTMASTER_PROD_EU_URI = 'http://eu.textmaster.com';
|
56 |
+
|
57 |
+
const TEXTMASTER_STAGING_EU_URI = 'http://eu.staging.textmaster.com';
|
58 |
+
|
59 |
+
const TEXTMASTER_SANDBOX_EU_URI = 'http://eu.sandbox.textmaster.com';
|
60 |
+
|
61 |
+
const TEXTMASTER_TRACKER_ID = '53e3587bcc39f7000200025c';
|
62 |
+
|
63 |
+
const TEXTMASTER_DEFAULT_LOCALE = 'en-EU';
|
64 |
+
|
65 |
+
const TEXTMASTER_API_TIMEOUT_IN_SECONDS = 30;
|
66 |
+
|
67 |
+
public function __construct ()
|
68 |
+
{
|
69 |
+
$this->_name = 'name_' . rand(1, 1000000);
|
70 |
+
$this->api_key = Mage::getStoreConfig('textmaster/textmaster/api_key');
|
71 |
+
;
|
72 |
+
$this->api_secret = Mage::getStoreConfig(
|
73 |
+
'textmaster/textmaster/api_secret');
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getAPIConnection ()
|
77 |
+
{
|
78 |
+
if ($this->api_key == '' && $this->api_secret == '')
|
79 |
+
return false;
|
80 |
+
if ($this->api_key or $this->api_secret) {
|
81 |
+
if (! $this->isConnected()) {
|
82 |
+
return false;
|
83 |
+
}
|
84 |
+
} else {
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
|
90 |
+
private function _initConnection ($name, $public, $clients,
|
91 |
+
$version = self::TEXTMASTER_API_VERSION)
|
92 |
+
{
|
93 |
+
$date = gmdate('Y-m-d H:i:s');
|
94 |
+
$signature = sha1($this->api_secret . $date);
|
95 |
+
|
96 |
+
$header = array(
|
97 |
+
'Content-Type: application/json',
|
98 |
+
'Accept: application/json',
|
99 |
+
"HTTP_AGENT: tm-magento-app",
|
100 |
+
"apikey: {$this->api_key}",
|
101 |
+
'signature: ' . $signature,
|
102 |
+
"date: $date"
|
103 |
+
);
|
104 |
+
$uri = $this->getApiUri() . ($version ? "/$version" : '') . '/' .
|
105 |
+
($clients ? 'clients/' : '') . ($public ? 'public/' : '') .
|
106 |
+
$name;
|
107 |
+
if (function_exists('curl_init')) {
|
108 |
+
$curl = curl_init();
|
109 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
110 |
+
curl_setopt($curl, CURLOPT_URL, $uri);
|
111 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
|
112 |
+
curl_setopt($curl, CURLOPT_USERAGENT,'tm-magento-app');
|
113 |
+
curl_setopt($curl, CURLOPT_TIMEOUT,
|
114 |
+
self::TEXTMASTER_API_TIMEOUT_IN_SECONDS);
|
115 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
|
116 |
+
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
|
117 |
+
return $curl;
|
118 |
+
} else
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
private function _curlexec ($name, $data, $method = 'post')
|
123 |
+
{
|
124 |
+
$public = false;
|
125 |
+
$clients = true;
|
126 |
+
$version = self::TEXTMASTER_API_VERSION;
|
127 |
+
$command = 'curl -i ';
|
128 |
+
$date = gmdate('Y-m-d H:i:s');
|
129 |
+
$content = '{"project":{"ctype":"translation","options":{"language_level":"regular"},"language_from":"en","language_to":"fr"}}';
|
130 |
+
$signature = sha1($this->api_secret . $date);
|
131 |
+
$command .= '-H "Host: api.sandbox.textmaster.com" ';
|
132 |
+
$command .= '-H "Content-Type: application/json" ';
|
133 |
+
$command .= '-H "HTTP_AGENT: tm-magento-app" ';
|
134 |
+
$command .= '-A "tm-magento-app" ';
|
135 |
+
$command .= '-H "Accept: application/json" ';
|
136 |
+
$command .= '-H "apikey: ' . $this->api_key . '" ';
|
137 |
+
$command .= '-H "signature: ' . $signature . '" ';
|
138 |
+
$command .= '-H "date: ' . $date . '" ';
|
139 |
+
$command .= '-d \'' . $content . '\' ';
|
140 |
+
$uri = $this->getApiUri() . ($version ? "/$version" : '') . '/' .
|
141 |
+
($clients ? 'clients/' : '') . ($public ? 'public/' : '') .
|
142 |
+
$name;
|
143 |
+
|
144 |
+
$command .= $uri;
|
145 |
+
$r1 = exec($command, $m1, $m2);
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
private function _request ($name, $public = false, $clients = false,
|
150 |
+
$version = self::TEXTMASTER_API_VERSION)
|
151 |
+
{
|
152 |
+
if (isset($this->_data[$name]))
|
153 |
+
return $this->_data[$name];
|
154 |
+
$debutlog = microtime(true);
|
155 |
+
$curl = $this->_initConnection($name, $public, $clients, $version);
|
156 |
+
$content = curl_exec($curl);
|
157 |
+
$finlog = microtime(true);
|
158 |
+
Mage::log('Log API ' . $name . ' : ' . ($finlog - $debutlog), null,
|
159 |
+
'textmaster.log');
|
160 |
+
$info = curl_getinfo($curl);
|
161 |
+
if ($info['http_code'] == '500') {
|
162 |
+
$result['error'] = 'WS Indisponible';
|
163 |
+
return $result;
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
curl_close($curl);
|
168 |
+
try {
|
169 |
+
$this->_data[$name] = Mage::helper('core')->jsonDecode($content);
|
170 |
+
} catch (Exception $e) {
|
171 |
+
$result['error'] = 'WS Indisponible';
|
172 |
+
return $result;
|
173 |
+
}
|
174 |
+
return $this->_data[$name];
|
175 |
+
}
|
176 |
+
|
177 |
+
private function _post ($name, $data, $method = 'post')
|
178 |
+
{
|
179 |
+
$debutlog = microtime(true);
|
180 |
+
$curl = $this->_initConnection($name, false, true);
|
181 |
+
|
182 |
+
if ($method == 'put')
|
183 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
184 |
+
elseif ($method == 'delete')
|
185 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
186 |
+
elseif ($method == 'get') {
|
187 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
|
188 |
+
} else
|
189 |
+
curl_setopt($curl, CURLOPT_POST, 1);
|
190 |
+
|
191 |
+
if ($data && $data != null)
|
192 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS,
|
193 |
+
Mage::helper('core')->jsonEncode($data));
|
194 |
+
else
|
195 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS,
|
196 |
+
Mage::helper('core')->jsonEncode(''));
|
197 |
+
$content = curl_exec($curl);
|
198 |
+
|
199 |
+
$result = Mage::helper('core')->jsonDecode($content);
|
200 |
+
$finlog = microtime(true);
|
201 |
+
Mage::log(
|
202 |
+
'Log API ' . $method . ' ' . $name . ' : ' .
|
203 |
+
($finlog - $debutlog), null, 'textmaster.log');
|
204 |
+
|
205 |
+
$info = curl_getinfo($curl);
|
206 |
+
|
207 |
+
Mage::log(Mage::helper('core')->jsonEncode($data),null,'textmaster.log');
|
208 |
+
//Mage::log($info,null,'textmaster.log');
|
209 |
+
|
210 |
+
|
211 |
+
if ($info['http_code'] == '500') {
|
212 |
+
$result['error'] = 'WS Indisponible';
|
213 |
+
$result['type'] = 'error';
|
214 |
+
return $result;
|
215 |
+
}
|
216 |
+
|
217 |
+
if (curl_errno($curl) || $info['http_code'] >= 300) {
|
218 |
+
if (isset($result['message'])) {
|
219 |
+
$result['error'] = (is_array($result['message'])) ? implode(' ',
|
220 |
+
$result['message']) : $result['message'];
|
221 |
+
$result['type'] = 'message';
|
222 |
+
} elseif (isset($result['error'])) {
|
223 |
+
$result['error'] = (is_array($result['error'])) ? implode(' ',
|
224 |
+
$result['error']) : $result['error'];
|
225 |
+
$result['type'] = 'error';
|
226 |
+
} elseif (isset($result['base'])) {
|
227 |
+
$result['error'] = (is_array($result['base'])) ? implode(' ',
|
228 |
+
$result['base']) : $result['base'];
|
229 |
+
$result['type'] = 'base';
|
230 |
+
} else {
|
231 |
+
$error_msg = '';
|
232 |
+
if (is_array($result)) {
|
233 |
+
if (isset($result['errors']) &&
|
234 |
+
isset($result['errors']['base'])) {
|
235 |
+
$result['error'] = reset($result['errors']['base']);
|
236 |
+
$result['type'] = 'base';
|
237 |
+
} elseif (isset($result['errors'])) {
|
238 |
+
$count = count($result);
|
239 |
+
foreach ($result['errors'] as $fieldname => $message)
|
240 |
+
$error_msg .= $fieldname . ' : ' . reset($message) .
|
241 |
+
((-- $count) ? ', ' : '');
|
242 |
+
$result['error'] = $error_msg;
|
243 |
+
$result['type'] = 'error';
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
curl_close($curl);
|
250 |
+
if (isset($result['error'])) {
|
251 |
+
Mage::log($result['error'], null, 'textmaster.log');
|
252 |
+
}
|
253 |
+
return $result;
|
254 |
+
}
|
255 |
+
|
256 |
+
public function getApiUri ()
|
257 |
+
{
|
258 |
+
$sandbox = Mage::getConfig()->getNode('adminhtml/api/sandbox')->asArray();
|
259 |
+
$staging = Mage::getConfig()->getNode('adminhtml/api/staging')->asArray();
|
260 |
+
if ($sandbox) {
|
261 |
+
return self::TEXTMASTER_SANDBOX_API_URI/*.'/'.self::TEXTMASTER_API_VERSION.''*/;
|
262 |
+
} elseif ($staging) {
|
263 |
+
return self::TEXTMASTER_STAGING_API_URI/*.'/'.self::TEXTMASTER_API_VERSION.''*/;
|
264 |
+
} else {
|
265 |
+
return self::TEXTMASTER_PROD_API_URI/*.'/'.self::TEXTMASTER_API_VERSION.''*/;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
public function getInterfaceUri ()
|
270 |
+
{
|
271 |
+
$sandbox = Mage::getConfig()->getNode('adminhtml/api/sandbox')->asArray();
|
272 |
+
$staging = Mage::getConfig()->getNode('adminhtml/api/staging')->asArray();
|
273 |
+
if ($sandbox) {
|
274 |
+
return 'http://eu.app.sandbox.textmaster.com/';
|
275 |
+
} elseif ($staging) {
|
276 |
+
return 'http://eu.app.staging.textmaster.com/';
|
277 |
+
} else {
|
278 |
+
return 'http://eu.app.textmaster.com/';
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
public function getEuUri ()
|
283 |
+
{
|
284 |
+
$sandbox = Mage::getConfig()->getNode('adminhtml/api/sandbox')->asArray();
|
285 |
+
$staging = Mage::getConfig()->getNode('adminhtml/api/staging')->asArray();
|
286 |
+
if ($sandbox) {
|
287 |
+
return self::TEXTMASTER_SANDBOX_EU_URI;
|
288 |
+
} elseif ($staging) {
|
289 |
+
return self::TEXTMASTER_STAGING_EU_URI;
|
290 |
+
} else {
|
291 |
+
return self::TEXTMASTER_PROD_EU_URI;
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
public function getAuth2Token ($email, $password)
|
296 |
+
{
|
297 |
+
if (! function_exists('curl_init')) {
|
298 |
+
Throw new Exception('CURL non activé');
|
299 |
+
return false;
|
300 |
+
}
|
301 |
+
$uri = $this->getEuUri() . '/oauth/token';
|
302 |
+
$header = "grant_type=password" . "&user[email]={$email}" .
|
303 |
+
"&user[password]={$password}" . "&client_id=" .
|
304 |
+
$this->getClientId() . "&client_secret=" .
|
305 |
+
$this->getClientSecret();
|
306 |
+
|
307 |
+
$curl = curl_init();
|
308 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
309 |
+
curl_setopt($curl, CURLOPT_URL, $uri);
|
310 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
|
311 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 10); // timeout in seconds
|
312 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $header);
|
313 |
+
$response = curl_exec($curl);
|
314 |
+
|
315 |
+
try {
|
316 |
+
return Mage::helper('core')->jsonDecode($response);
|
317 |
+
} catch (Exception $e) {
|
318 |
+
Mage::log('Exception : ' . $uri,null,'textmaster.log');
|
319 |
+
Mage::log($header,null,'textmaster.log');
|
320 |
+
Mage::log($response,null,'textmaster.log');
|
321 |
+
return false;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
function getAuth2TokenForCreation ()
|
326 |
+
{
|
327 |
+
$uri = $this->getEuUri() . '/oauth/token';
|
328 |
+
$header = "grant_type=client_credentials" . "&client_id=" .
|
329 |
+
$this->getClientId() . "&client_secret=" .
|
330 |
+
$this->getClientSecret();
|
331 |
+
|
332 |
+
$curl = curl_init();
|
333 |
+
|
334 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
335 |
+
curl_setopt($curl, CURLOPT_URL, $uri);
|
336 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
|
337 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 10); // timeout in seconds
|
338 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $header);
|
339 |
+
$response = curl_exec($curl);
|
340 |
+
try {
|
341 |
+
return Mage::helper('core')->jsonDecode($response);
|
342 |
+
} catch (Exception $e) {
|
343 |
+
Mage::log('Exception : ' . $uri,null,'textmaster.log');
|
344 |
+
Mage::log($header,null,'textmaster.log');
|
345 |
+
Mage::log($response,null,'textmaster.log');
|
346 |
+
return false;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
public function getClientId ()
|
351 |
+
{
|
352 |
+
$sandbox = Mage::getConfig()->getNode('adminhtml/api/sandbox')->asArray();
|
353 |
+
$staging = Mage::getConfig()->getNode('adminhtml/api/staging')->asArray();
|
354 |
+
if ($sandbox) {
|
355 |
+
return '97ff3df474ff8776e346e38e322ab2300e96429a4efc88c305078a6213902f21';
|
356 |
+
} elseif ($staging) {
|
357 |
+
return '97ff3df474ff8776e346e38e322ab2300e96429a4efc88c305078a6213902f21';
|
358 |
+
} else {
|
359 |
+
return '8de45500fd370ed35c0269749ebb872149f8929d0d78cc5b5016bcd584c9058b';
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
public function getClientSecret ()
|
364 |
+
{
|
365 |
+
$sandbox = Mage::getConfig()->getNode('adminhtml/api/sandbox')->asArray();
|
366 |
+
$staging = Mage::getConfig()->getNode('adminhtml/api/staging')->asArray();
|
367 |
+
if ($sandbox) {
|
368 |
+
return 'f089333f59275789afc763e60d436fdd740a03f07fe168bf5569ebed0380b6a6';
|
369 |
+
} elseif ($staging) {
|
370 |
+
return 'f089333f59275789afc763e60d436fdd740a03f07fe168bf5569ebed0380b6a6';
|
371 |
+
} else {
|
372 |
+
return '75324f2849b25c7112d374a1a51a8b442220726639d64583196a7c2385227007';
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
public function getAPIKeys ($oAuthToken)
|
377 |
+
{
|
378 |
+
Mage::log('getAPIKeys', null, 'textmaster.log');
|
379 |
+
$uri = $this->getApiUri() . '/admin/users/me';
|
380 |
+
$header = array(
|
381 |
+
"Authorization: Bearer {$oAuthToken}"
|
382 |
+
);
|
383 |
+
|
384 |
+
$curl = curl_init();
|
385 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
386 |
+
curl_setopt($curl, CURLOPT_URL, $uri);
|
387 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
|
388 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 10); // timeout in seconds
|
389 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
|
390 |
+
$response = curl_exec($curl);
|
391 |
+
try {
|
392 |
+
return Mage::helper('core')->jsonDecode($response);
|
393 |
+
} catch (Exception $e) {
|
394 |
+
Mage::log('Exception',null,'textmaster.log');
|
395 |
+
Mage::log($oAuthToken,null,'textmaster.log');
|
396 |
+
Mage::log($response,null,'textmaster.log');
|
397 |
+
return false;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
function createUser ($token, $email, $password, $phone = null)
|
402 |
+
{
|
403 |
+
$uri = $this->getApiUri() . '/admin/users';
|
404 |
+
|
405 |
+
$header = array(
|
406 |
+
"Content-Type: application/json",
|
407 |
+
"Authorization: Bearer {$token}",
|
408 |
+
"Accept: application/json",
|
409 |
+
"AGENT: tm-magento-app/agent v1.0"
|
410 |
+
);
|
411 |
+
|
412 |
+
$aData = $phone ? array(
|
413 |
+
'user' => array(
|
414 |
+
'locale' => $this->getFullLocale(true),
|
415 |
+
'email' => $email,
|
416 |
+
'password' => $password,
|
417 |
+
'referer_tracker_id' => self::TEXTMASTER_TRACKER_ID,
|
418 |
+
'group' => 'clients',
|
419 |
+
'contact_information_attributes' => array(
|
420 |
+
'phone_number' => $phone
|
421 |
+
)
|
422 |
+
)
|
423 |
+
) : array(
|
424 |
+
'user' => array(
|
425 |
+
'locale' => $this->getFullLocale(true),
|
426 |
+
'email' => $email,
|
427 |
+
'referer_tracker_id' => self::TEXTMASTER_TRACKER_ID,
|
428 |
+
'password' => $password,
|
429 |
+
'group' => 'clients'
|
430 |
+
)
|
431 |
+
);
|
432 |
+
try {
|
433 |
+
$jData = Mage::helper('core')->jsonEncode($aData);
|
434 |
+
} catch (Exception $e) {
|
435 |
+
return false;
|
436 |
+
}
|
437 |
+
|
438 |
+
$curl = curl_init();
|
439 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
440 |
+
curl_setopt($curl, CURLOPT_URL, $uri);
|
441 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
|
442 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 10); // timeout in seconds
|
443 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
|
444 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
|
445 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $jData);
|
446 |
+
$response = curl_exec($curl);
|
447 |
+
try {
|
448 |
+
return Mage::helper('core')->jsonDecode($response);
|
449 |
+
} catch (Exception $e) {
|
450 |
+
Mage::log('Exception : ' . $uri,null,'textmaster.log');
|
451 |
+
Mage::log($header,null,'textmaster.log');
|
452 |
+
Mage::log($response,null,'textmaster.log');
|
453 |
+
return false;
|
454 |
+
}
|
455 |
+
}
|
456 |
+
|
457 |
+
public function getFullLocale ($registration = false)
|
458 |
+
{
|
459 |
+
if (! $registration) {
|
460 |
+
$user_info = $this->getUserInfo();
|
461 |
+
return $user_info['locale'];
|
462 |
+
}
|
463 |
+
|
464 |
+
$locales = $this->getLocales();
|
465 |
+
$admin_locale_code = Mage::getStoreConfig('general/locale/code');
|
466 |
+
foreach ($locales as $locale) {
|
467 |
+
if ($admin_locale_code == str_replace('-', '_', $locale['code'])) {
|
468 |
+
return $locale['code'];
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
return self::TEXTMASTER_DEFAULT_LOCALE;
|
473 |
+
}
|
474 |
+
|
475 |
+
public function getUserInfo ()
|
476 |
+
{
|
477 |
+
// Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
478 |
+
if ($this->_userinfo)
|
479 |
+
return $this->_userinfo;
|
480 |
+
$this->_userinfo = Mage::getSingleton('adminhtml/session')->getTextmasterUserInfos();
|
481 |
+
|
482 |
+
//Mage::log($this->_userinfo, null, 'textmaster.log');
|
483 |
+
|
484 |
+
if ($this->_userinfo && is_array($this->_userinfo) &&
|
485 |
+
! isset($this->_userinfo['error']))
|
486 |
+
return $this->_userinfo;
|
487 |
+
else
|
488 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
489 |
+
|
490 |
+
$this->_userinfo = $this->_request('users/me', false, true);
|
491 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterUserInfos(
|
492 |
+
$this->_userinfo);
|
493 |
+
return $this->_userinfo;
|
494 |
+
}
|
495 |
+
|
496 |
+
public function isUserConnected ()
|
497 |
+
{
|
498 |
+
if ($this->api_key == '' || $this->api_secret == '')
|
499 |
+
return false;
|
500 |
+
|
501 |
+
$user = $this->getUserInfo();
|
502 |
+
$tmp = ( ! isset($user['errors']) && ! empty($user) &&
|
503 |
+
isset($user['email']));
|
504 |
+
|
505 |
+
return $tmp;
|
506 |
+
}
|
507 |
+
|
508 |
+
public function isConnected ()
|
509 |
+
{
|
510 |
+
if (! isset($this->_connection))
|
511 |
+
$this->_connection = $this->testConnection();
|
512 |
+
return $this->_connection;
|
513 |
+
}
|
514 |
+
|
515 |
+
public function testConnection ()
|
516 |
+
{
|
517 |
+
$result = $this->getUserInfo();
|
518 |
+
return ! empty($result) && ! isset($result['errors']);
|
519 |
+
}
|
520 |
+
|
521 |
+
public function getCategories ()
|
522 |
+
{
|
523 |
+
if ($this->_categories)
|
524 |
+
return $this->_categories;
|
525 |
+
|
526 |
+
$this->_categories = Mage::getSingleton('adminhtml/session')->getTextmasterCategories();
|
527 |
+
|
528 |
+
if ($this->_categories && ! isset($this->_categories['error']))
|
529 |
+
return $this->_categories;
|
530 |
+
|
531 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
532 |
+
|
533 |
+
$data = $this->_request(
|
534 |
+
'categories?locale=' . str_replace('_', '-', $locale), true);
|
535 |
+
$this->_categories = $data['categories'];
|
536 |
+
if (! isset($this->_categories['error']))
|
537 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterCategories(
|
538 |
+
$this->_categories);
|
539 |
+
return $this->_categories;
|
540 |
+
}
|
541 |
+
|
542 |
+
public function getCategory ($value)
|
543 |
+
{
|
544 |
+
if (! $this->_categories) {
|
545 |
+
$this->getCategories();
|
546 |
+
}
|
547 |
+
// Mage::log($this->_categories,null,'textmaster.log');
|
548 |
+
foreach ($this->_categories as $cat) {
|
549 |
+
if ($cat['code'] == $value)
|
550 |
+
return $cat['value'];
|
551 |
+
}
|
552 |
+
|
553 |
+
// if(isset($this->_categories[$value])) return
|
554 |
+
// $this->_categories[$value];
|
555 |
+
return $value;
|
556 |
+
}
|
557 |
+
|
558 |
+
public function getLocales ()
|
559 |
+
{
|
560 |
+
if ($this->_locales)
|
561 |
+
return $this->_locales;
|
562 |
+
|
563 |
+
$this->_locales = Mage::getSingleton('adminhtml/session')->getTextmasterLocales();
|
564 |
+
if ($this->_locales && ! isset($this->_locales['error']))
|
565 |
+
return $this->_locales;
|
566 |
+
|
567 |
+
$this->_locales = $this->_request("locales", true);
|
568 |
+
if (! isset($this->_locales['error']))
|
569 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterLocales(
|
570 |
+
$this->_locales);
|
571 |
+
return $this->_locales;
|
572 |
+
}
|
573 |
+
|
574 |
+
public function getLanguages ()
|
575 |
+
{
|
576 |
+
if ($this->_languages)
|
577 |
+
return $this->_languages;
|
578 |
+
|
579 |
+
$this->_languages = Mage::getSingleton('adminhtml/session')->getTextmasterLanguages();
|
580 |
+
if ($this->_languages && ! isset($this->_languages['error']))
|
581 |
+
return $this->_languages;
|
582 |
+
|
583 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
584 |
+
$data = $this->_request(
|
585 |
+
'languages?locale=' . str_replace('_', '-', $locale), true);
|
586 |
+
$textmaster_languages = $data['languages'];
|
587 |
+
|
588 |
+
$this->_languages = $textmaster_languages;
|
589 |
+
if (! isset($this->_languages['error']))
|
590 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterLanguages(
|
591 |
+
$this->_languages);
|
592 |
+
return $this->_languages;
|
593 |
+
}
|
594 |
+
|
595 |
+
public function getLanguage ($value)
|
596 |
+
{
|
597 |
+
if (! $this->_languages) {
|
598 |
+
$this->getLanguages();
|
599 |
+
}
|
600 |
+
if (isset($this->_languages[$value]))
|
601 |
+
return $this->_languages[$value];
|
602 |
+
return $value;
|
603 |
+
}
|
604 |
+
|
605 |
+
public function getAuthor ($id_author)
|
606 |
+
{
|
607 |
+
if (isset($this->_author[$id_author]))
|
608 |
+
return $this->_author[$id_author];
|
609 |
+
$this->_author[$id_author] = $this->_post("my_authors/" . $id_author,
|
610 |
+
null, 'get');
|
611 |
+
return $this->_author[$id_author];
|
612 |
+
}
|
613 |
+
|
614 |
+
public function getAuthors ()
|
615 |
+
{
|
616 |
+
if ($this->_authors)
|
617 |
+
return $this->_authors;
|
618 |
+
$this->_authors = Mage::getSingleton('adminhtml/session')->getTextmasterMyAuthors();
|
619 |
+
if ($this->_authors && ! isset($this->_authors['error']))
|
620 |
+
return $this->_authors;
|
621 |
+
$this->_authors = $this->_request("my_authors", false, true);
|
622 |
+
Mage::log($this->_authors,null,'textmaster.log');
|
623 |
+
if (! isset($this->_authors['error']))
|
624 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterMyAuthors(
|
625 |
+
$this->_authors);
|
626 |
+
return $this->_authors;
|
627 |
+
}
|
628 |
+
|
629 |
+
public function getAuthorsFilter ($data)
|
630 |
+
{
|
631 |
+
$data = array(
|
632 |
+
'project' => $data
|
633 |
+
);
|
634 |
+
return $this->_post("authors", $data, 'get');
|
635 |
+
// return $this->_authors;
|
636 |
+
}
|
637 |
+
|
638 |
+
public function getMyAuthorsByProject ($id_project_api)
|
639 |
+
{
|
640 |
+
if(isset($this->_myauthors)) return $this->_myauthors;
|
641 |
+
$name = "projects/" . $id_project_api . "/my_authors";
|
642 |
+
$this->_myauthors = $this->_request($name, false, true);
|
643 |
+
return $this->_myauthors;
|
644 |
+
}
|
645 |
+
|
646 |
+
public function getServiceLevels ()
|
647 |
+
{
|
648 |
+
if (isset($this->_service_levels))
|
649 |
+
return $this->_service_levels; // return
|
650 |
+
// vocabulary
|
651 |
+
// levels
|
652 |
+
// from
|
653 |
+
// cache
|
654 |
+
// if
|
655 |
+
// exists
|
656 |
+
|
657 |
+
/* put service levels into array */
|
658 |
+
$this->_service_levels = array(
|
659 |
+
'regular' => Mage::helper('textmaster')->__('Regular'),
|
660 |
+
'premium' => Mage::helper('textmaster')->__('Premium')
|
661 |
+
);
|
662 |
+
return $this->_service_levels;
|
663 |
+
}
|
664 |
+
|
665 |
+
public function getServiceLevel ($value)
|
666 |
+
{
|
667 |
+
if (! isset($this->_service_levels)) {
|
668 |
+
$this->getServiceLevels();
|
669 |
+
}
|
670 |
+
if (isset($this->_service_levels[$value]))
|
671 |
+
return $this->_service_levels[$value];
|
672 |
+
return $value;
|
673 |
+
}
|
674 |
+
|
675 |
+
/**
|
676 |
+
* Puts available vocabulary levels into array
|
677 |
+
*
|
678 |
+
* @return Array vocabulary levels
|
679 |
+
*/
|
680 |
+
public function getVocabularyLevels ()
|
681 |
+
{
|
682 |
+
if (isset($this->_vocabulary_levels))
|
683 |
+
return $this->_vocabulary_levels; // return
|
684 |
+
// vocabulary
|
685 |
+
// levels
|
686 |
+
// from
|
687 |
+
// cache
|
688 |
+
// if
|
689 |
+
// exists
|
690 |
+
|
691 |
+
/* put vocabulary levels into cache */
|
692 |
+
$this->_vocabulary_levels = array(
|
693 |
+
'not_specified' => Mage::helper('textmaster')->__(
|
694 |
+
'Not specified'),
|
695 |
+
'popular' => Mage::helper('textmaster')->__('Popular'),
|
696 |
+
'technical' => Mage::helper('textmaster')->__('Technique'),
|
697 |
+
'fictional' => Mage::helper('textmaster')->__('Fictional')
|
698 |
+
);
|
699 |
+
return $this->_vocabulary_levels;
|
700 |
+
}
|
701 |
+
|
702 |
+
public function getVocabularyLevel ($value)
|
703 |
+
{
|
704 |
+
if (! isset($this->_vocabulary_levels)) {
|
705 |
+
$this->getVocabularyLevels();
|
706 |
+
}
|
707 |
+
if (isset($this->_vocabulary_levels[$value]))
|
708 |
+
return $this->_vocabulary_levels[$value];
|
709 |
+
return $value;
|
710 |
+
}
|
711 |
+
|
712 |
+
/**
|
713 |
+
* Puts available grammatical persons into array
|
714 |
+
*
|
715 |
+
* @return Array grammatical persons
|
716 |
+
*/
|
717 |
+
public function getGrammaticalPersons ()
|
718 |
+
{
|
719 |
+
if (isset($this->_grammatical_persons))
|
720 |
+
return $this->_grammatical_persons; // return
|
721 |
+
// grammatical
|
722 |
+
// persons
|
723 |
+
// from
|
724 |
+
// cache
|
725 |
+
// if
|
726 |
+
// exists
|
727 |
+
|
728 |
+
/* put grammatical persons into cache */
|
729 |
+
$this->_grammatical_persons = array(
|
730 |
+
'not_specified' => Mage::helper('textmaster')->__(
|
731 |
+
'Not specified'),
|
732 |
+
'first_person_singular' => Mage::helper('textmaster')->__('I'),
|
733 |
+
'second_person_singular' => Mage::helper('textmaster')->__(
|
734 |
+
'You'),
|
735 |
+
'third_person_singular_masculine' => Mage::helper('textmaster')->__(
|
736 |
+
'He'),
|
737 |
+
'third_person_singular_feminine' => Mage::helper('textmaster')->__(
|
738 |
+
'She'),
|
739 |
+
'third_person_singular_neuter' => Mage::helper('textmaster')->__(
|
740 |
+
'One'),
|
741 |
+
'first_person_plural' => Mage::helper('textmaster')->__('We'),
|
742 |
+
'second_person_plural' => Mage::helper('textmaster')->__('You'),
|
743 |
+
'third_person_plural' => Mage::helper('textmaster')->__('They')
|
744 |
+
);
|
745 |
+
|
746 |
+
return $this->_grammatical_persons;
|
747 |
+
}
|
748 |
+
|
749 |
+
public function getGrammaticalPerson ($value)
|
750 |
+
{
|
751 |
+
if (! isset($this->_grammatical_persons)) {
|
752 |
+
$this->getGrammaticalPersons();
|
753 |
+
}
|
754 |
+
if (isset($this->_grammatical_persons[$value]))
|
755 |
+
return $this->_grammatical_persons[$value];
|
756 |
+
return $value;
|
757 |
+
}
|
758 |
+
|
759 |
+
public function getAudiences ()
|
760 |
+
{
|
761 |
+
if (isset($this->_audiences))
|
762 |
+
return $this->_audiences; // return
|
763 |
+
// audiences
|
764 |
+
// from
|
765 |
+
// cache if
|
766 |
+
// exists
|
767 |
+
|
768 |
+
/* put audieces into cache */
|
769 |
+
$this->_audiences = array(
|
770 |
+
'not_specified' => Mage::helper('textmaster')->__(
|
771 |
+
'Not specified'),
|
772 |
+
'children' => Mage::helper('textmaster')->__(
|
773 |
+
'Children under 14 years old'),
|
774 |
+
'teenager' => Mage::helper('textmaster')->__(
|
775 |
+
'Teenagers > between 14 and 18 years old'),
|
776 |
+
'young_adults' => Mage::helper('textmaster')->__(
|
777 |
+
'Young adults > between 19 and 29 years old'),
|
778 |
+
'adults' => Mage::helper('textmaster')->__(
|
779 |
+
'Adults > between 30 and 59 years old'),
|
780 |
+
'old_adults' => Mage::helper('textmaster')->__(
|
781 |
+
'Seniors > 60 years old and beyond')
|
782 |
+
);
|
783 |
+
return $this->_audiences;
|
784 |
+
}
|
785 |
+
|
786 |
+
public function getAudience ($audience)
|
787 |
+
{
|
788 |
+
if (! isset($this->_audiences)) {
|
789 |
+
$this->getAudiences();
|
790 |
+
}
|
791 |
+
if (isset($this->_audiences[$audience]))
|
792 |
+
return $this->_audiences[$audience];
|
793 |
+
return $audience;
|
794 |
+
}
|
795 |
+
|
796 |
+
public function getPricings ($word_count = 1)
|
797 |
+
{
|
798 |
+
if ($this->_prices)
|
799 |
+
return $this->_prices;
|
800 |
+
|
801 |
+
if($word_count==1) {
|
802 |
+
$this->_prices = Mage::getSingleton('adminhtml/session')->getTextmasterPricings();
|
803 |
+
if ($this->_prices && ! isset($this->_prices['error']))
|
804 |
+
return $this->_prices;
|
805 |
+
}
|
806 |
+
|
807 |
+
$prices = $this->_request("reference_pricings?word_count=$word_count",
|
808 |
+
true);
|
809 |
+
|
810 |
+
$user = $this->getUserInfo();
|
811 |
+
|
812 |
+
foreach ($prices['reference_pricings'] as $pricings) {
|
813 |
+
if ($pricings['locale'] == $user['locale']) {
|
814 |
+
foreach ($pricings['types'] as $type => $params) {
|
815 |
+
foreach ($params as $key => $param) {
|
816 |
+
$pricings['types'][$type][$param['name']] = $param['value'];
|
817 |
+
unset($pricings['types'][$type][$key]);
|
818 |
+
}
|
819 |
+
}
|
820 |
+
|
821 |
+
$this->_prices = $pricings;
|
822 |
+
if($word_count==1 ) {
|
823 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterPricings($this->_prices);
|
824 |
+
}
|
825 |
+
return $this->_prices;
|
826 |
+
}
|
827 |
+
}
|
828 |
+
$this->_prices = array();
|
829 |
+
return $this->_prices;
|
830 |
+
}
|
831 |
+
|
832 |
+
public function getProject ($id_project_api)
|
833 |
+
{
|
834 |
+
|
835 |
+
return $this->_request("projects/$id_project_api", false, true);
|
836 |
+
}
|
837 |
+
|
838 |
+
public function getProjects ($type = false, $filters = array(), $limit = array(0,20), $order = array('created_at','desc'))
|
839 |
+
{
|
840 |
+
$filter_request = 'where='.json_encode($filters['where']);
|
841 |
+
$md5 = md5($type . '#' . $limit[1] . '#' . $limit[0] . '#' . $filter_request.'#'.$order[0].'#'.$order[1]);
|
842 |
+
if (isset($this->{'projects_' . $md5}) && $this->{'projects_' . $type})
|
843 |
+
return $this->{'projects_' . $md5}; // return projects from cache if
|
844 |
+
// exists
|
845 |
+
|
846 |
+
$request = 'projects/filter?order='.($order[1]=='desc'?'-':'').$order[0].'&per_page=' . $limit[1] . '&page=' . $limit[0];
|
847 |
+
|
848 |
+
if (count($filters['where']))
|
849 |
+
$request .= '&' . $filter_request;
|
850 |
+
|
851 |
+
$this->{'projects_' . $md5} = $this->_request($request, false, true);
|
852 |
+
return $this->{'projects_' . $md5};
|
853 |
+
}
|
854 |
+
|
855 |
+
public function addProject ($parameters, $quotation = false)
|
856 |
+
{
|
857 |
+
foreach ($parameters as $field => $value) {
|
858 |
+
if ($value == '')
|
859 |
+
unset($parameters[$field]);
|
860 |
+
}
|
861 |
+
|
862 |
+
$default_project_data = array(
|
863 |
+
'same_author_must_do_entire_project' => 'true',
|
864 |
+
'language_level' => 'regular',
|
865 |
+
'quality' => 'false',
|
866 |
+
'expertise' => 'false',
|
867 |
+
'vocabulary_type' => Mage::getStoreConfig(
|
868 |
+
'textmaster/defaultvalue/type_vocabulary'),
|
869 |
+
'grammatical_person' => Mage::getStoreConfig(
|
870 |
+
'textmaster/defaultvalue/grammatical_person'),
|
871 |
+
'target_reader_groups' => Mage::getStoreConfig(
|
872 |
+
'textmaster/defaultvalue/target_audience')
|
873 |
+
);
|
874 |
+
|
875 |
+
$parameters = array_merge($default_project_data, $parameters); // values,
|
876 |
+
// sent
|
877 |
+
// to
|
878 |
+
// function
|
879 |
+
// overides
|
880 |
+
// the
|
881 |
+
// default
|
882 |
+
// values
|
883 |
+
|
884 |
+
$options = array(
|
885 |
+
'language_level' => $parameters['language_level'],
|
886 |
+
'quality' => $parameters['quality'],
|
887 |
+
'expertise' => $parameters['expertise'],
|
888 |
+
'specific_attachment' => isset(
|
889 |
+
$parameters['specific_attachment']) ? $parameters['specific_attachment'] : 'false',
|
890 |
+
'priority' => $parameters['priority']
|
891 |
+
);
|
892 |
+
|
893 |
+
unset($parameters['language_level'], $parameters['quality'],
|
894 |
+
$parameters['expertise']);
|
895 |
+
|
896 |
+
$parameters['options'] = $options;
|
897 |
+
|
898 |
+
if (isset($parameters['textmasters'])) {
|
899 |
+
if (is_array($parameters['textmasters']) &&
|
900 |
+
count($parameters['textmasters']) == 0)
|
901 |
+
unset($parameters['textmasters']);
|
902 |
+
if (! is_array($parameters['textmasters']))
|
903 |
+
unset($parameters['textmasters']);
|
904 |
+
}
|
905 |
+
|
906 |
+
$data = array(
|
907 |
+
'project' => $parameters,
|
908 |
+
'tracker' => self::TEXTMASTER_TRACKER_ID
|
909 |
+
);
|
910 |
+
|
911 |
+
if ($quotation)
|
912 |
+
return $this->_post('projects/quotation', $data, 'get');
|
913 |
+
return $this->_post('projects', $data);
|
914 |
+
}
|
915 |
+
|
916 |
+
public function updateProject ($id_project_api, $parameters)
|
917 |
+
{
|
918 |
+
foreach ($parameters as $field => $value) {
|
919 |
+
if ($value == '')
|
920 |
+
unset($parameters[$field]);
|
921 |
+
}
|
922 |
+
$options = array(
|
923 |
+
'language_level' => $parameters['language_level'],
|
924 |
+
'quality' => isset($parameters['quality']) ? $parameters['quality'] : '0',
|
925 |
+
'expertise' => isset($parameters['expertise']) ? $parameters['expertise'] : '0',
|
926 |
+
'specific_attachment' => isset(
|
927 |
+
$parameters['specific_attachment']) ? $parameters['specific_attachment'] : '0',
|
928 |
+
'priority' => isset($parameters['priority']) ? $parameters['priority'] : '0'
|
929 |
+
);
|
930 |
+
unset($parameters['language_level'], $parameters['quality'],
|
931 |
+
$parameters['expertise']);
|
932 |
+
$parameters['options'] = $options;
|
933 |
+
if (isset($parameters['textmasters']) && ((is_array(
|
934 |
+
$parameters['textmasters']) &&
|
935 |
+
count($parameters['textmasters']) == 0) ||
|
936 |
+
! is_array($parameters['textmasters']))) {
|
937 |
+
unset($parameters['textmasters']);
|
938 |
+
}
|
939 |
+
$parameters['callback'] = array(
|
940 |
+
'project_in_progress' => array(
|
941 |
+
'url' => Mage::helper('textmaster')->getCallbackUrlInProgress(),
|
942 |
+
"format" => "json"
|
943 |
+
)
|
944 |
+
);
|
945 |
+
|
946 |
+
$data = array(
|
947 |
+
'project' => $parameters,
|
948 |
+
'tracker' => self::TEXTMASTER_TRACKER_ID
|
949 |
+
);
|
950 |
+
|
951 |
+
$result = $this->_post("projects/{$id_project_api}", $data, 'put');
|
952 |
+
return $result;
|
953 |
+
}
|
954 |
+
public function updateProjectTextmasters ($id_project_api, $textmasters)
|
955 |
+
{
|
956 |
+
$data = array(
|
957 |
+
'project' => array('textmasters'=>$textmasters)
|
958 |
+
);
|
959 |
+
$result = $this->_post("projects/{$id_project_api}", $data, 'put');
|
960 |
+
return $result;
|
961 |
+
}
|
962 |
+
|
963 |
+
public function addDocument ($id_project_api, $data)
|
964 |
+
{
|
965 |
+
$data['perform_word_count'] = $this->getUrl('');
|
966 |
+
$data = array(
|
967 |
+
'document' => $textmasters
|
968 |
+
);
|
969 |
+
return $this->_post("projects/$id_project_api/documents", $data);
|
970 |
+
}
|
971 |
+
|
972 |
+
public function addDocuments ($id_project_api, $data)
|
973 |
+
{
|
974 |
+
foreach ($data as &$item) {
|
975 |
+
$item['word_count'] = 0;
|
976 |
+
unset($item['word_count_rule']);
|
977 |
+
$item['perform_word_count'] = true;
|
978 |
+
$item['callback'] = array(
|
979 |
+
'word_count_finished' => array(
|
980 |
+
'url' => Mage::helper('textmaster')->getCallbackUrl(),
|
981 |
+
"format" => "json"
|
982 |
+
),
|
983 |
+
'complete' => array(
|
984 |
+
'url' => Mage::helper('textmaster')->getCallbackCompletedUrl(),
|
985 |
+
"format" => "json"
|
986 |
+
)
|
987 |
+
|
988 |
+
);
|
989 |
+
}
|
990 |
+
|
991 |
+
$data = array(
|
992 |
+
'documents' => $data
|
993 |
+
);
|
994 |
+
$reponse = $this->_post("projects/$id_project_api/batch/documents",
|
995 |
+
$data);
|
996 |
+
return $reponse;
|
997 |
+
}
|
998 |
+
|
999 |
+
public function getDocuments ($id_project_api, $filters,$limit = array(0,20),$order=array('reference','desc'))
|
1000 |
+
{
|
1001 |
+
$filter_request = 'where='.json_encode($filters['where']);
|
1002 |
+
$request = 'projects/'.$id_project_api.'/documents/filter?order='.($order[1]=='desc'?'-':'').$order[0].'&per_page=' . $limit[1] . '&page=' . $limit[0];
|
1003 |
+
if (count($filters['where']))
|
1004 |
+
$request .= '&' . $filter_request;
|
1005 |
+
return $this->_request($request, false, true);
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
public function getDocument ($id_project_api, $id_document_api)
|
1009 |
+
{
|
1010 |
+
return $this->_request(
|
1011 |
+
"projects/$id_project_api/documents/$id_document_api", false,
|
1012 |
+
true);
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
public function launchProject ($id_project_api, $asynchro = true)
|
1016 |
+
{
|
1017 |
+
if ($asynchro) {
|
1018 |
+
$result = $this->_post("projects/$id_project_api/async_launch",
|
1019 |
+
null);
|
1020 |
+
return $result;
|
1021 |
+
}
|
1022 |
+
return $this->_post("projects/$id_project_api/launch", null, 'put');
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
public function pauseProject ($id_project_api)
|
1026 |
+
{
|
1027 |
+
return $this->_post("projects/$id_project_api/pause", null, 'put');
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
public function resumeProject ($id_project_api)
|
1031 |
+
{
|
1032 |
+
return $this->_post("projects/$id_project_api/resume", null, 'put');
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
public function cancelProject ($id_project_api)
|
1036 |
+
{
|
1037 |
+
return $this->_post("projects/$id_project_api/cancel", null, 'put');
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
public function completeProject ($id_project_api)
|
1041 |
+
{
|
1042 |
+
return $this->_post("projects/$id_project_api/complete", null, 'put');
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
public function duplicateProject ($id_project_api)
|
1046 |
+
{
|
1047 |
+
return $this->_post("projects/$id_project_api/duplicate", null, 'post');
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
public function updateDocument ($id_project_api, $id_document_api,
|
1051 |
+
$parameters)
|
1052 |
+
{
|
1053 |
+
$data = array(
|
1054 |
+
'document' => $parameters
|
1055 |
+
);
|
1056 |
+
return $this->_post(
|
1057 |
+
"projects/$id_project_api/documents/{$id_document_api}", $data,
|
1058 |
+
'put');
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
public function deleteDocument ($id_project_api, $id_document_api)
|
1062 |
+
{
|
1063 |
+
return $this->_post(
|
1064 |
+
"projects/$id_project_api/documents/$id_document_api", null,
|
1065 |
+
'delete');
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
public function approveDocument ($id_project_api, $id_document_api)
|
1069 |
+
{
|
1070 |
+
return $this->_post(
|
1071 |
+
"projects/$id_project_api/documents/$id_document_api/complete",
|
1072 |
+
null, 'put');
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
public function commentDocument ($id_project_api, $id_document_api, $message)
|
1076 |
+
{
|
1077 |
+
return $this->_post(
|
1078 |
+
"projects/$id_project_api/documents/$id_document_api/support_messages",
|
1079 |
+
array(
|
1080 |
+
'support_message' => array(
|
1081 |
+
'message' => $message
|
1082 |
+
)
|
1083 |
+
), 'post');
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
public function completeDocument ($id_project_api, $id_document_api,$callback = false,$message = false,$satisfaction = false)
|
1087 |
+
{
|
1088 |
+
$document_ids = array($id_document_api);
|
1089 |
+
return $this->completeDocuments($id_project_api,$document_ids,$callback,$message,$satisfaction);
|
1090 |
+
}
|
1091 |
+
public function completeDocuments ($id_project_api, $document_ids,$callback = false,$message = false,$satisfaction = false)
|
1092 |
+
{
|
1093 |
+
$data = array('documents'=>$document_ids);
|
1094 |
+
if(!empty($message)) {
|
1095 |
+
$data['message'] = $message;
|
1096 |
+
}
|
1097 |
+
if(!empty($satisfaction)) {
|
1098 |
+
$data['satisfaction'] = $satisfaction;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
return $this->_post("projects/$id_project_api/batch/documents/complete", $data, 'post');
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
public function getSupportMessages ($id_project_api, $id_document_api)
|
1105 |
+
{
|
1106 |
+
$name = "projects/" . $id_project_api .
|
1107 |
+
"/documents/$id_document_api/support_messages";
|
1108 |
+
return $this->_request($name, false, true);
|
1109 |
+
}
|
1110 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Document.php
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Document extends Mage_Core_Model_Abstract {
|
27 |
+
|
28 |
+
private $_product = false;
|
29 |
+
|
30 |
+
const DOCUMENT_STATUS_IN_CREATION = "in_creation";
|
31 |
+
const DOCUMENT_STATUS_IN_PROGRESS = "in_progress";
|
32 |
+
const DOCUMENT_STATUS_IN_REVIEW = "in_review";
|
33 |
+
const DOCUMENT_STATUS_CANCEL = "canceled";
|
34 |
+
const DOCUMENT_STATUS_COMPLETED = "completed";
|
35 |
+
const DOCUMENT_STATUS_PAUSED = "paused";
|
36 |
+
|
37 |
+
public function _construct() {
|
38 |
+
parent::_construct ();
|
39 |
+
$this->_init ( 'textmaster/document' );
|
40 |
+
}
|
41 |
+
|
42 |
+
public function send() {
|
43 |
+
if (! $this->getSend ()) {
|
44 |
+
|
45 |
+
$data = $this->prepareData();
|
46 |
+
|
47 |
+
$project = Mage::getModel ( 'textmaster/project' )->load ( $this->getTextmasterProjectId (), null, false );
|
48 |
+
|
49 |
+
$result = Mage::helper('textmaster')->getApi()->addDocument ( $project->getProjectApiid (), $data );
|
50 |
+
if (! isset ( $result ['error'] )) {
|
51 |
+
$this->setDocumentApiId ( $result ['id'] );
|
52 |
+
$this->setSend ( 1 );
|
53 |
+
$this->save ();
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
public function canComplete() {
|
59 |
+
return $this->getStatus()==self::DOCUMENT_STATUS_IN_REVIEW;
|
60 |
+
}
|
61 |
+
|
62 |
+
public function complete(){
|
63 |
+
|
64 |
+
$this->setStatus(self::DOCUMENT_STATUS_COMPLETED);
|
65 |
+
$this->setCompleted(1);
|
66 |
+
$this->setData('encourscomplete',0);
|
67 |
+
$this->save();
|
68 |
+
$this->transfert();
|
69 |
+
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
public function prepareToComplete(){
|
73 |
+
|
74 |
+
$this->setData('encourscomplete',1);
|
75 |
+
$this->setSendforcomplete(1);
|
76 |
+
$this->setCompleted(0);
|
77 |
+
$this->save();
|
78 |
+
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
public function sendToComplete(){
|
82 |
+
|
83 |
+
$result = Mage::helper('textmaster')->getApi()->completeDocument($this->getProject()->getProjectApiid(),$this->getDocumentApiId());
|
84 |
+
if(!isset($result['error'])){
|
85 |
+
$this->prepareToComplete();
|
86 |
+
}
|
87 |
+
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function canTransfert(){
|
92 |
+
return $this->getStatus()==self::DOCUMENT_STATUS_COMPLETED;
|
93 |
+
}
|
94 |
+
public function transfert(){
|
95 |
+
//if($this->canTransfert()) {
|
96 |
+
$translations = $this->getTranslations();
|
97 |
+
Mage::getSingleton('catalog/product_action')->updateAttributes(array($this->getProductId()), $translations, $this->getProject()->getStoreIdTranslation());
|
98 |
+
//}
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
public function getStatusTexte() {
|
103 |
+
// Mage::
|
104 |
+
$statuses = array (
|
105 |
+
'in_creation' => Mage::helper ( 'textmaster' )->__ ( 'In creation' ),
|
106 |
+
'waiting_assignment' => Mage::helper ( 'textmaster' )->__ ( 'Waiting assignment' ),
|
107 |
+
'in_progress' => Mage::helper ( 'textmaster' )->__ ( 'In progress' ),
|
108 |
+
'in_review' => Mage::helper ( 'textmaster' )->__ ( 'In review' ),
|
109 |
+
'completed' => Mage::helper ( 'textmaster' )->__ ( 'Completed' ),
|
110 |
+
'incomplete' => Mage::helper ( 'textmaster' )->__ ( 'Incomplete' ),
|
111 |
+
'paused' => Mage::helper ( 'textmaster' )->__ ( 'Paused' ),
|
112 |
+
'canceled' => Mage::helper ( 'textmaster' )->__ ( 'Cancelled' ),
|
113 |
+
'copyscape' => Mage::helper ( 'textmaster' )->__ ( 'Copyscape' ),
|
114 |
+
'counting_words' => Mage::helper ( 'textmaster' )->__ ( 'Counting words' ),
|
115 |
+
'quality_control' => Mage::helper ( 'textmaster' )->__ ( 'Quality control' )
|
116 |
+
);
|
117 |
+
if (isset ( $statuses [parent::getStatus ()] ))
|
118 |
+
return $statuses [parent::getStatus ()];
|
119 |
+
return $this->getStatus ();
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
public function delete(){
|
124 |
+
if($this->getProject() && $this->getProject()->getProjectApiid()!='' && $this->getDocumentApiId()!=''){
|
125 |
+
Mage::helper('textmaster')->getApi()->deleteDocument($this->getProject()->getProjectApiid(),$this->getDocumentApiId());
|
126 |
+
}
|
127 |
+
return parent::delete();
|
128 |
+
}
|
129 |
+
|
130 |
+
public function load($id, $field = null,$api = true,$project_api=true) {
|
131 |
+
$return = parent::load ( $id, $field = null );
|
132 |
+
$project_api = $project_api && $api;
|
133 |
+
|
134 |
+
$this->setProject(Mage::getModel('textmaster/project')->load($this->getTextmasterProjectId(),null,$project_api));
|
135 |
+
|
136 |
+
if($api && $this->getProject() && $this->getDocumentApiId()!='' && $this->getProject()->getProjectApiid()!='') {
|
137 |
+
$data_api = Mage::helper('textmaster')->getApi()->getDocument($this->getProject()->getProjectApiid(),$this->getDocumentApiId());
|
138 |
+
$this->setStatus($data_api['status']);
|
139 |
+
if(isset($data_api['author_work']))
|
140 |
+
$this->setTranslations($data_api['author_work']);
|
141 |
+
}
|
142 |
+
return $return;
|
143 |
+
}
|
144 |
+
public function loadByApiId($api_id) {
|
145 |
+
$documentId = $this->getResource()->loadByApiId($api_id);
|
146 |
+
|
147 |
+
if ($documentId) {
|
148 |
+
$this->load($documentId);
|
149 |
+
} else {
|
150 |
+
$this->setData(array());
|
151 |
+
}
|
152 |
+
return $this;
|
153 |
+
}
|
154 |
+
public function getSupportMessages(){
|
155 |
+
if($this->_support_message) return $this->_support_message;
|
156 |
+
$this->_support_message = Mage::helper('textmaster')->getApi()->getSupportMessages($this->getProject()->getProjectApiid(),$this->getDocumentApiId());
|
157 |
+
return $this->_support_message;
|
158 |
+
}
|
159 |
+
|
160 |
+
public function prepareData(){
|
161 |
+
$data = $this->getData ();
|
162 |
+
$data ['title'] = $data ['name'];
|
163 |
+
$data ['type'] = 'key_value';
|
164 |
+
unset ( $data ['name'] );
|
165 |
+
|
166 |
+
$attributes = Mage::getModel ( 'textmaster/project_attribute' )->getCollection ()->addFieldToFilter ( 'textmaster_project_id', $this->getTextmasterProjectId () );
|
167 |
+
$product = Mage::getModel ( 'catalog/product' )->setStoreId( $this->getProject()->getStoreIdOrigin() )->load ( $this->getProductId () );
|
168 |
+
$data ['original_content'] = array ();
|
169 |
+
$text = '';
|
170 |
+
foreach ( $attributes as $attr ) {
|
171 |
+
$attribute = Mage::getModel ( 'catalog/resource_eav_attribute' )->load ( $attr->getTextmasterAttributeId () );
|
172 |
+
$text_attr = $product->getData ( $attribute->getName () );
|
173 |
+
$text .= $text_attr . ' ';
|
174 |
+
if (! empty ( $text_attr ))
|
175 |
+
$data ['original_content'] [$attribute->getName ()] = array (
|
176 |
+
'original_phrase' => $text_attr
|
177 |
+
);
|
178 |
+
}
|
179 |
+
|
180 |
+
$data ['word_count'] = Mage::helper ( 'textmaster' )->countWord ( $text );
|
181 |
+
$data ['word_count_rule'] = 1;
|
182 |
+
$data ['instructions'] = '';
|
183 |
+
$data ['keyword_list'] = '';
|
184 |
+
$data ['keywords_repeat_count'] = 0;
|
185 |
+
$data ['id_product'] = $this->getProductId ();
|
186 |
+
|
187 |
+
if(isset( $data ['_project'])) unset ( $data ['_project'] );
|
188 |
+
unset ( $data ['send'] );
|
189 |
+
unset ( $data ['counted'] );
|
190 |
+
unset ( $data ['textmaster_document_id'] );
|
191 |
+
unset ( $data ['product_id'] );
|
192 |
+
unset ( $data ['updated_at'] );
|
193 |
+
unset ( $data ['textmaster_project_id'] );
|
194 |
+
unset ( $data ['created_at'] );
|
195 |
+
unset ( $data ['document_api_id'] );
|
196 |
+
unset ( $data ['original_content'] ['image'] );
|
197 |
+
return $data;
|
198 |
+
}
|
199 |
+
|
200 |
+
public function updateApiData($message){
|
201 |
+
$data = $this->prepareData();
|
202 |
+
|
203 |
+
$project = Mage::getModel ( 'textmaster/project' )->load ( $this->getTextmasterProjectId (), null, false );
|
204 |
+
|
205 |
+
$result = Mage::helper('textmaster')->getApi()->updateDocument ( $project->getProjectApiid (),$this->getProjectApiId(), $data );
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
|
210 |
+
public function setProject($project){
|
211 |
+
$this->_project = $project;
|
212 |
+
return $this;
|
213 |
+
}
|
214 |
+
|
215 |
+
public function getProject(){
|
216 |
+
return $this->_project;
|
217 |
+
}
|
218 |
+
public function getProduct(){
|
219 |
+
if($this->_product) return $this->_product;
|
220 |
+
if(!$this->getProject()){
|
221 |
+
$this->_project = Mage::getModel('textmaster/projet')->load($this->getTextmasterProjectId(),null,false);
|
222 |
+
}
|
223 |
+
$this->_product = Mage::getModel('catalog/product')->setStoreId( $this->getProject()->getStoreIdOrigin())->load($this->getProductId());
|
224 |
+
return $this->_product;
|
225 |
+
}
|
226 |
+
public function getTranslations(){
|
227 |
+
$all_translations = Mage::getSingleton('adminhtml/session')->getTextmasterTranslations();
|
228 |
+
if(isset($all_translations[$this->getId()])) return $all_translations[$this->getId()];
|
229 |
+
|
230 |
+
$translations = $this->getData('translations');
|
231 |
+
if($translations == null){
|
232 |
+
$this->load($this->getId());
|
233 |
+
}
|
234 |
+
|
235 |
+
if($all_translations!=null){
|
236 |
+
$all_translations[$this->getId()] = $translations;
|
237 |
+
} else {
|
238 |
+
$all_translations = array($this->getId()=>$translations);
|
239 |
+
}
|
240 |
+
if($this->canComplete())
|
241 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterTranslations($all_translations);
|
242 |
+
|
243 |
+
return $all_translations[$this->getId()];
|
244 |
+
}
|
245 |
+
public function revision($message){
|
246 |
+
$all_translations = Mage::getSingleton('adminhtml/session')->getTextmasterTranslations();
|
247 |
+
if(isset($all_translations[$this->getId()])){
|
248 |
+
unset($all_translations[$this->getId()]);
|
249 |
+
Mage::getSingleton('adminhtml/session')->setTextmasterTranslations($all_translations);
|
250 |
+
}
|
251 |
+
//if($this->canComplete()){
|
252 |
+
$data = $this->prepareData();
|
253 |
+
$result = Mage::helper('textmaster')->getApi()->commentDocument( $this->getProject()->getProjectApiid (),$this->getDocumentApiId(),$message );
|
254 |
+
if ( isset ( $result ['error'] )) {
|
255 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
|
256 |
+
}
|
257 |
+
//}
|
258 |
+
}
|
259 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Mysql4/Document.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Mysql4_Document extends Mage_Core_Model_Mysql4_Abstract
|
27 |
+
{
|
28 |
+
public function _construct()
|
29 |
+
{
|
30 |
+
$this->_init('textmaster/document', 'textmaster_document_id');
|
31 |
+
// $this->setEntityIdField('textmaster_document_id');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function loadByApiId($api_id) {
|
35 |
+
$adapter = $this->_getReadAdapter();
|
36 |
+
$bind = array('api_id' => $api_id);
|
37 |
+
$select = $adapter->select()
|
38 |
+
->from($this->getTable('document'))
|
39 |
+
->where('document_api_id = :api_id');
|
40 |
+
|
41 |
+
$documentId = $adapter->fetchOne($select, $bind);
|
42 |
+
return $documentId;
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Mysql4/Document/Collection.php
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Mysql4_document_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
27 |
+
|
28 |
+
private $_load_api = false;
|
29 |
+
private $_project_api_id = false;
|
30 |
+
private $_filters_api = array();
|
31 |
+
private $_filters_standard = array();
|
32 |
+
private $_subsitute = array(
|
33 |
+
'name' => 'title',
|
34 |
+
'reference' => 'ref',
|
35 |
+
'status' => 'status',
|
36 |
+
);
|
37 |
+
|
38 |
+
public function addFiltersApi($filters){
|
39 |
+
$this->_filters_api = array_merge($this->_filters_api,$filters);
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
public function addFiltersStandard($filters){
|
44 |
+
$this->_filters_standard = array_merge($this->_filters_standard,$filters);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function _construct() {
|
48 |
+
parent::_construct ();
|
49 |
+
$this->_init ( 'textmaster/document' );
|
50 |
+
}
|
51 |
+
/*protected function _beforeLoad() {
|
52 |
+
|
53 |
+
}*/
|
54 |
+
public function load($printQuery = false, $logQuery = false)
|
55 |
+
{
|
56 |
+
if(!$this->_load_api){
|
57 |
+
return parent::load($printQuery,$logQuery);
|
58 |
+
}
|
59 |
+
if(!$this->_project_api_id){
|
60 |
+
return parent::load($printQuery,$logQuery);
|
61 |
+
}
|
62 |
+
if ($this->isLoaded()) {
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
$this->_renderOrders()
|
68 |
+
->_renderLimit();
|
69 |
+
|
70 |
+
$this->_beforeLoad();
|
71 |
+
|
72 |
+
$_api = Mage::helper('textmaster')->getApi();
|
73 |
+
$this->documents_api_result = $_api->getDocuments($this->_project_api_id,array('where'=>$this->_filters_api),array($this->_end ,$this->_start),isset($this->_order)?array($this->_order,$this->_sens):array('ref','asc'));
|
74 |
+
|
75 |
+
$this->printLogQuery($printQuery, $logQuery);
|
76 |
+
$data = $this->getData();
|
77 |
+
$this->resetData();
|
78 |
+
$this->_totalRecords = $this->documents_api_result['count'];
|
79 |
+
if (is_array($data) && isset($this->documents_api_result['documents'])) {
|
80 |
+
foreach($this->documents_api_result['documents'] as $doc){
|
81 |
+
foreach ($data as $row) {
|
82 |
+
if($doc['id']==$row['document_api_id']){
|
83 |
+
$item = $this->getNewEmptyItem();
|
84 |
+
if ($this->getIdFieldName()) {
|
85 |
+
$item->setIdFieldName($this->getIdFieldName());
|
86 |
+
}
|
87 |
+
$item->addData($row);
|
88 |
+
$item->setAuthor($doc['author_id']);
|
89 |
+
$item->setName($doc['title']);
|
90 |
+
$item->setType($doc['ctype']);
|
91 |
+
$item->setStatus($doc['status']);
|
92 |
+
$item->setReference($doc['reference']);
|
93 |
+
$this->addItem($item);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
$this->_setIsLoaded();
|
100 |
+
$this->_afterLoad();
|
101 |
+
return $this;
|
102 |
+
}
|
103 |
+
|
104 |
+
protected function __afterLoad() {
|
105 |
+
if($this->_load_api && $this->documents_api_result){
|
106 |
+
$i=0;
|
107 |
+
foreach ( $this->_items as $k=>$item ) {
|
108 |
+
$exist = false;
|
109 |
+
foreach($this->documents_api_result['documents'] as $doc){
|
110 |
+
if($doc['id']==$item->getDocumentApiId()){
|
111 |
+
$item->setAuthor($doc['author_id']);
|
112 |
+
$item->setType($doc['ctype']);
|
113 |
+
$item->setStatus($doc['status']);
|
114 |
+
$item->setReference($doc['reference']);
|
115 |
+
$i++;
|
116 |
+
$exist = true;
|
117 |
+
break;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
if(!$exist) {
|
121 |
+
if (is_null($this->_totalRecords)) {
|
122 |
+
$this->getSize();
|
123 |
+
}
|
124 |
+
$this->_totalRecords--;
|
125 |
+
}
|
126 |
+
if($i>($this->getCurPage()-1)*$this->_pageSize && $i<=($this->getCurPage()+0)*$this->_pageSize){
|
127 |
+
} else {
|
128 |
+
$exist = false;
|
129 |
+
}
|
130 |
+
if(!$exist) {
|
131 |
+
unset($this->_items[$k]);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
//Mage ::log('count : '. count($this->_items));
|
135 |
+
}
|
136 |
+
}
|
137 |
+
/*public function getSize(){
|
138 |
+
return count($this->_items);
|
139 |
+
}*/
|
140 |
+
|
141 |
+
protected function _renderOrders()
|
142 |
+
{
|
143 |
+
|
144 |
+
if (!$this->_isOrdersRendered) {
|
145 |
+
foreach ($this->_orders as $field => $direction) {
|
146 |
+
//$this->_select->order(new Zend_Db_Expr($field . ' ' . $direction));
|
147 |
+
if(isset($this->_subsitute[$field])) {
|
148 |
+
$this->_order = $this->_subsitute[$field];
|
149 |
+
$this->_sens = strtolower($direction);
|
150 |
+
$this->_isOrdersRendered = true;
|
151 |
+
return $this;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
return $this;
|
156 |
+
}
|
157 |
+
protected function _renderLimit()
|
158 |
+
{
|
159 |
+
if($this->_pageSize){
|
160 |
+
//$this->_select->limitPage($this->getCurPage(), $this->_pageSize);
|
161 |
+
$page = $this->_curPage ;
|
162 |
+
$rowCount = $this->_pageSize;
|
163 |
+
$page = ($page > 0) ? $page : 1;
|
164 |
+
$rowCount = ($rowCount > 0) ? $rowCount : 1;
|
165 |
+
$this->_start = (int) $rowCount;
|
166 |
+
$this->_end = $page;
|
167 |
+
}
|
168 |
+
return $this;
|
169 |
+
}
|
170 |
+
|
171 |
+
public function setLoadApi($value){
|
172 |
+
$this->_load_api = $value;
|
173 |
+
return $this;
|
174 |
+
}
|
175 |
+
public function setProjectApiId($value){
|
176 |
+
$this->_project_api_id = $value;
|
177 |
+
return $this;
|
178 |
+
}
|
179 |
+
public function getSubstitute(){
|
180 |
+
return $this->_subsitute;
|
181 |
+
}
|
182 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Mysql4/Project.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Mysql4_Project extends Mage_Core_Model_Mysql4_Abstract
|
27 |
+
{
|
28 |
+
public function _construct()
|
29 |
+
{
|
30 |
+
$this->_init('textmaster/project', 'textmaster_project_id');
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Mysql4/Project/Attribute.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Mysql4_Project_Attribute extends Mage_Core_Model_Mysql4_Abstract
|
27 |
+
{
|
28 |
+
public function _construct()
|
29 |
+
{
|
30 |
+
$this->_init('textmaster/project_attribute', 'textmaster_project_attribute_id');
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Mysql4/Project/Attribute/Collection.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Mysql4_Project_Attribute_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
27 |
+
|
28 |
+
public function _construct() {
|
29 |
+
parent::_construct ();
|
30 |
+
$this->_init ( 'textmaster/project_attribute' );
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Mysql4/Project/Collection.php
ADDED
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Mysql4_Project_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
27 |
+
private $_api_loaded = false;
|
28 |
+
private $_all_project = false;
|
29 |
+
private $_api = null;
|
30 |
+
private $_filters_api = array();
|
31 |
+
private $_filters_standard = array();
|
32 |
+
|
33 |
+
private $_subsitute = array(
|
34 |
+
'name' => 'name',
|
35 |
+
'reference' => 'ref',
|
36 |
+
'progression' => 'progress',
|
37 |
+
'level' => 'level_name',
|
38 |
+
'store_id_origin' => 'language_from_code',
|
39 |
+
'store_id_translation' => 'language_to_code',
|
40 |
+
'nb_document' => 'cached_documents_count',
|
41 |
+
'total_word_count' => 'total_word_count',
|
42 |
+
'price' => 'pricing.total_cost_at_launch_time',
|
43 |
+
'updated_at' => 'updated_at',
|
44 |
+
'status' => 'status',
|
45 |
+
);
|
46 |
+
|
47 |
+
public function _construct() {
|
48 |
+
parent::_construct ();
|
49 |
+
$this->_init ( 'textmaster/project' );
|
50 |
+
}
|
51 |
+
|
52 |
+
public function addFiltersApi($filters){
|
53 |
+
$this->_filters_api = array_merge($this->_filters_api,$filters);
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function addFiltersStandard($filters){
|
58 |
+
$this->_filters_standard = array_merge($this->_filters_standard,$filters);
|
59 |
+
return $this;
|
60 |
+
}
|
61 |
+
protected function _beforeLoad() {
|
62 |
+
|
63 |
+
}
|
64 |
+
public function load($printQuery = false, $logQuery = false) {
|
65 |
+
|
66 |
+
if ($this->isLoaded()) {
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
if (! $this->_api_loaded) {
|
71 |
+
$this->_api_loaded = true;
|
72 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
73 |
+
}
|
74 |
+
|
75 |
+
$this->_beforeLoad();
|
76 |
+
|
77 |
+
$this->_renderOrders()
|
78 |
+
->_renderLimit();
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
$this->data_api = $this->_api->getProjects (false,array('where'=>$this->_filters_api),array($this->_end ,$this->_start),isset($this->_order)?array($this->_order,$this->_sens):array('updated_at','desc'));
|
86 |
+
|
87 |
+
if(isset($this->data_api['projects'])){
|
88 |
+
$this->_totalRecords = $this->data_api['count'];
|
89 |
+
$result = array();
|
90 |
+
foreach ($this->data_api['projects'] as $_api_project){
|
91 |
+
$item = $this->getNewEmptyItem();
|
92 |
+
$item->loadByApiData($_api_project);
|
93 |
+
$this->addItem($item);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
$this->_setIsLoaded();
|
98 |
+
$this->_afterLoad();
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
public function getSize()
|
103 |
+
{
|
104 |
+
return intval($this->_totalRecords);
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
public function addItem(Varien_Object $item)
|
110 |
+
{
|
111 |
+
|
112 |
+
$this->_addItem($item);
|
113 |
+
|
114 |
+
return $this;
|
115 |
+
}
|
116 |
+
|
117 |
+
protected function __afterLoad() {
|
118 |
+
parent::_afterLoad ();
|
119 |
+
if (! $this->_api_loaded) {
|
120 |
+
$this->_api_loaded = true;
|
121 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
122 |
+
$data_api = $this->_api->getProjects (false,array('where'=>$this->_filters_api) );
|
123 |
+
|
124 |
+
}
|
125 |
+
$locale = Mage::app()->getLocale();
|
126 |
+
|
127 |
+
$resource = Mage::getSingleton('core/resource');
|
128 |
+
$tabledocument = $resource->getTableName('textmaster_document');
|
129 |
+
$readConnection = $resource->getConnection('core_read');
|
130 |
+
$i=0;
|
131 |
+
$order = $this->getSelect()->getPart('order');
|
132 |
+
|
133 |
+
if(isset($order[0])){
|
134 |
+
if(strpos((string)$order[0],'progression')!==false){
|
135 |
+
if(strpos((string)$order[0],'ASC')!==false){
|
136 |
+
usort($this->_items,array($this,'callbackSortByProgressionAsc'));
|
137 |
+
} else {
|
138 |
+
usort($this->_items,array($this,'callbackSortByProgressionDesc'));
|
139 |
+
}
|
140 |
+
}
|
141 |
+
if(strpos((string)$order[0],'price')!==false){
|
142 |
+
if(strpos((string)$order[0],'ASC')!==false){
|
143 |
+
usort($this->_items,array($this,'callbackSortByPriceAsc'));
|
144 |
+
} else {
|
145 |
+
usort($this->_items,array($this,'callbackSortByPriceDesc'));
|
146 |
+
}
|
147 |
+
}
|
148 |
+
if(strpos((string)$order[0],'total_word_count')!==false){
|
149 |
+
if(strpos((string)$order[0],'ASC')!==false){
|
150 |
+
usort($this->_items,array($this,'callbackSortByWordAsc'));
|
151 |
+
} else {
|
152 |
+
usort($this->_items,array($this,'callbackSortByWordDesc'));
|
153 |
+
}
|
154 |
+
}
|
155 |
+
if(strpos((string)$order[0],'reference')!==false){
|
156 |
+
if(strpos((string)$order[0],'ASC')!==false){
|
157 |
+
usort($this->_items,array($this,'callbackSortByRefAsc'));
|
158 |
+
} else {
|
159 |
+
usort($this->_items,array($this,'callbackSortByRefDesc'));
|
160 |
+
}
|
161 |
+
}if(strpos((string)$order[0],'level')!==false){
|
162 |
+
if(strpos((string)$order[0],'ASC')!==false){
|
163 |
+
usort($this->_items,array($this,'callbackSortByLevelAsc'));
|
164 |
+
} else {
|
165 |
+
usort($this->_items,array($this,'callbackSortByLevelDesc'));
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
foreach ( $this->_items as $k=>&$item ) {
|
170 |
+
$exist = false;
|
171 |
+
if(isset($data_api['projects'])){
|
172 |
+
foreach($data_api['projects'] as $data){
|
173 |
+
if($data['id']==$item->getProjectApiid()){
|
174 |
+
$exist = true;
|
175 |
+
$i++;
|
176 |
+
$item->setReference($data['reference']);
|
177 |
+
if($data['status']!=$item->getStatus()) {
|
178 |
+
$item->setStatus($data['status']);
|
179 |
+
//$item->save();
|
180 |
+
} else {
|
181 |
+
$item->setStatus($data['status']);
|
182 |
+
}
|
183 |
+
$item->setTotalWordCount($data['total_word_count']);
|
184 |
+
if(isset($data['total_costs'][0]['amount'])){
|
185 |
+
$item->setPrice($data['total_costs'][0]['amount']);
|
186 |
+
$item->setCurrency($data['total_costs'][0]['currency']);
|
187 |
+
}
|
188 |
+
elseif(isset($data['cost_in_currency']['amount'])) {
|
189 |
+
$item->setPrice($data['cost_in_currency']['amount']);
|
190 |
+
$item->setCurrency($data['cost_in_currency']['currency']);
|
191 |
+
}
|
192 |
+
if(isset($data['progress']))
|
193 |
+
$item->setProgression(round((float)$data['progress'],0).'%');
|
194 |
+
else $item->setProgression('0%');
|
195 |
+
|
196 |
+
$item->setLevel($data['options']['language_level']);
|
197 |
+
$item->setUpdatedAt($data['updated_at']['full']);
|
198 |
+
|
199 |
+
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
|
205 |
+
foreach($this->_filters_standard as $key => $value){
|
206 |
+
if(is_array($value)){
|
207 |
+
if(isset($value['from'])){
|
208 |
+
if($item->getData($key)<$value['from']) $exist = false;
|
209 |
+
}
|
210 |
+
if(isset($value['to'])){
|
211 |
+
if($item->getData($key)>$value['to']) $exist = false;
|
212 |
+
}
|
213 |
+
} elseif($key=='progression') {
|
214 |
+
$value = str_replace('%','',$value);
|
215 |
+
if(strpos($item->getData($key),$value)===false) $exist = false;
|
216 |
+
} else {
|
217 |
+
if(strpos($item->getData($key),$value)===false) $exist = false;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
if(!$exist) {
|
221 |
+
if (is_null($this->_totalRecords)) {
|
222 |
+
$this->getSize();
|
223 |
+
}
|
224 |
+
$this->_totalRecords--;
|
225 |
+
}
|
226 |
+
if($i>($this->getCurPage()-1)*$this->_pageSize && $i<=($this->getCurPage()+0)*$this->_pageSize){
|
227 |
+
} else {
|
228 |
+
$exist = false;
|
229 |
+
}
|
230 |
+
|
231 |
+
if(!$exist ){
|
232 |
+
$item->setIn(false);
|
233 |
+
if(!$this->_all_project) {
|
234 |
+
$this->removeItemByKey($k);
|
235 |
+
}
|
236 |
+
} else {
|
237 |
+
$item->setIn(true);
|
238 |
+
}
|
239 |
+
|
240 |
+
//$item->setReference ( 'TEST2' );
|
241 |
+
}
|
242 |
+
|
243 |
+
//if($this->getOrder())
|
244 |
+
return $this;
|
245 |
+
}
|
246 |
+
/*public function getSize(){
|
247 |
+
return count($this->_items);
|
248 |
+
}*/
|
249 |
+
|
250 |
+
public function callbackSortByProgressionAsc($a,$b){
|
251 |
+
return $a->getProgression()>$b->getProgression();
|
252 |
+
}
|
253 |
+
|
254 |
+
public function callbackSortByProgressionDesc($a,$b){
|
255 |
+
return $a->getProgression()<$b->getProgression();
|
256 |
+
}
|
257 |
+
|
258 |
+
public function callbackSortByPriceAsc($a,$b){
|
259 |
+
return $a->getPrice()>$b->getPrice();
|
260 |
+
}
|
261 |
+
|
262 |
+
public function callbackSortByPriceDesc($a,$b){
|
263 |
+
return $a->getPrice()<$b->getPrice();
|
264 |
+
}
|
265 |
+
public function callbackSortByWordAsc($a,$b){
|
266 |
+
return $a->getTotalWordCount()>$b->getTotalWordCount();
|
267 |
+
}
|
268 |
+
|
269 |
+
public function callbackSortByWordDesc($a,$b){
|
270 |
+
return $a->getTotalWordCount()<$b->getTotalWordCount();
|
271 |
+
}
|
272 |
+
public function callbackSortByRefAsc($a,$b){
|
273 |
+
return $a->getTotalReferenceCount()>$b->getTotalReferenceCount();
|
274 |
+
}
|
275 |
+
|
276 |
+
public function callbackSortByRefDesc($a,$b){
|
277 |
+
return $a->getTotalReferenceCount()<$b->getTotalReferenceCount();
|
278 |
+
}
|
279 |
+
public function callbackSortByLevelAsc($a,$b){
|
280 |
+
return $a->getLevel()>$b->getLevel();
|
281 |
+
}
|
282 |
+
|
283 |
+
public function callbackSortByLevelDesc($a,$b){
|
284 |
+
return $a->getLevel()<$b->getLevel();
|
285 |
+
}
|
286 |
+
protected function _renderLimit()
|
287 |
+
{
|
288 |
+
if($this->_pageSize){
|
289 |
+
//$this->_select->limitPage($this->getCurPage(), $this->_pageSize);
|
290 |
+
$page = $this->_curPage ;
|
291 |
+
$rowCount = $this->_pageSize;
|
292 |
+
$page = ($page > 0) ? $page : 1;
|
293 |
+
$rowCount = ($rowCount > 0) ? $rowCount : 1;
|
294 |
+
$this->_start = (int) $rowCount;
|
295 |
+
$this->_end = $page;
|
296 |
+
}
|
297 |
+
return $this;
|
298 |
+
}
|
299 |
+
protected function _renderOrders()
|
300 |
+
{
|
301 |
+
|
302 |
+
if (!$this->_isOrdersRendered) {
|
303 |
+
foreach ($this->_orders as $field => $direction) {
|
304 |
+
//$this->_select->order(new Zend_Db_Expr($field . ' ' . $direction));
|
305 |
+
if(isset($this->_subsitute[$field])) {
|
306 |
+
$this->_order = $this->_subsitute[$field];
|
307 |
+
$this->_sens = strtolower($direction);
|
308 |
+
$this->_isOrdersRendered = true;
|
309 |
+
return $this;
|
310 |
+
}
|
311 |
+
}
|
312 |
+
}
|
313 |
+
return $this;
|
314 |
+
}
|
315 |
+
|
316 |
+
public function setAllProject($val){
|
317 |
+
$this->_all_project = $val;
|
318 |
+
return $this;
|
319 |
+
}
|
320 |
+
public function getSubstitute(){
|
321 |
+
return $this->_subsitute;
|
322 |
+
}
|
323 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Observer.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Observer extends Mage_Core_Model_Abstract {
|
27 |
+
|
28 |
+
public function _productCreateBlock(Varien_Event_Observer $observer) {
|
29 |
+
|
30 |
+
$action = Mage::app()->getRequest()->getRequestedActionName();
|
31 |
+
$block = $observer->getEvent()->getBlock();
|
32 |
+
if ($block->getNameInLayout() == 'root') {
|
33 |
+
if (Mage::app()->getRequest()->getControllerName() == 'catalog_product' ) {
|
34 |
+
|
35 |
+
$extendBlock = new Mage_Core_Block_Template();
|
36 |
+
$extendBlock->setTemplate('textmaster/product/edit.phtml');
|
37 |
+
$extendBlock->setIsAnonymous(true);
|
38 |
+
if ($extendBlock) {
|
39 |
+
$block->getChild('content')->insert($extendBlock, '', false, 'TM_Translate_form');
|
40 |
+
}
|
41 |
+
//return $block;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Project.php
ADDED
@@ -0,0 +1,738 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Project extends Mage_Core_Model_Abstract {
|
27 |
+
|
28 |
+
|
29 |
+
const PROJECT_CTYPE_COPYWRITING = "copywriting";
|
30 |
+
const PROJECT_CTYPE_TRANSLATION = "translation";
|
31 |
+
const PROJECT_CTYPE_PROOFREADING = "proofreading";
|
32 |
+
|
33 |
+
const PROJECT_LANGUAGE_LEVEL_REGULAR = "regular";
|
34 |
+
const PROJECT_LANGUAGE_LEVEL_PREMIUM = "premium";
|
35 |
+
|
36 |
+
const PROJECT_STATUS_IN_LAUNCH_PROCESSING = "in_launch_processing";
|
37 |
+
const PROJECT_STATUS_IN_CREATION = "in_creation";
|
38 |
+
const PROJECT_STATUS_IN_PROGRESS = "in_progress";
|
39 |
+
const PROJECT_STATUS_IN_REVIEW = "in_review";
|
40 |
+
const PROJECT_STATUS_CANCEL = "canceled";
|
41 |
+
const PROJECT_STATUS_COMPLETED = "completed";
|
42 |
+
const PROJECT_STATUS_PAUSED = "paused";
|
43 |
+
|
44 |
+
private $_store_name_origin = false;
|
45 |
+
private $_store_name_translation = false;
|
46 |
+
private $_api_loaded = false;
|
47 |
+
private $_load_api = true;
|
48 |
+
private $_api = null;
|
49 |
+
private $_products_id = false;
|
50 |
+
private $_nb_author = 0;
|
51 |
+
private $_authors = array();
|
52 |
+
public $_before_save_api = true;
|
53 |
+
private $_project_loaded = true;
|
54 |
+
|
55 |
+
public function _construct() {
|
56 |
+
parent::_construct ();
|
57 |
+
$this->_init ( 'textmaster/project' );
|
58 |
+
}
|
59 |
+
public function setBeforeSaveApi($val){
|
60 |
+
$this->_before_save_api = $val;
|
61 |
+
}
|
62 |
+
public function getBeforeSaveApi($val){
|
63 |
+
return $this->_before_save_api;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getStoreNameOrigin() {
|
67 |
+
if ($this->_store_name_origin)
|
68 |
+
return $this->_store_name_origin;
|
69 |
+
$store = Mage::getModel ( 'core/store' )->load ( $this->getStoreIdOrigin () );
|
70 |
+
$this->_store_name_origin = $store->getWebsite()->getName().' - '.$store->getName ();
|
71 |
+
return $this->_store_name_origin;
|
72 |
+
|
73 |
+
/* AFFICHE la langue du STORE au lieu du nom
|
74 |
+
* $localecode = Mage::getStoreConfig('general/locale/code', $this->getStoreIdOrigin ());
|
75 |
+
$data = explode('_', $localecode);
|
76 |
+
$localeAdmin = Mage::app()->getLocale();
|
77 |
+
$tmp = $localeAdmin->getTranslation($data[0], 'language', $localeAdmin);
|
78 |
+
|
79 |
+
$tmp = ucwords($tmp);
|
80 |
+
$this->_store_name_origin = $tmp;
|
81 |
+
|
82 |
+
return $this->_store_name_origin;*/
|
83 |
+
}
|
84 |
+
public function getStoreOriginLangCode(){
|
85 |
+
$localecode = Mage::getStoreConfig('general/locale/code', $this->getStoreIdOrigin ());
|
86 |
+
$data = explode('_', $localecode);
|
87 |
+
return $data[0];
|
88 |
+
}
|
89 |
+
public function getStoreTranslationLangCode(){
|
90 |
+
$localecode = Mage::getStoreConfig('general/locale/code', $this->getStoreIdTranslation ());
|
91 |
+
$data = explode('_', $localecode);
|
92 |
+
return $data[0];
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
public function getStoreNameTranslation() {
|
97 |
+
if ($this->_store_name_translation)
|
98 |
+
return $this->_store_name_translation;
|
99 |
+
$store = Mage::getModel ( 'core/store' )->load ( $this->getStoreIdTranslation () );
|
100 |
+
$this->_store_name_translation = $store->getWebsite()->getName().' - '.$store->getName ();
|
101 |
+
return $this->_store_name_translation;
|
102 |
+
|
103 |
+
/* AFFICHE la langue du STORE au lieu du nom
|
104 |
+
* $localecode = Mage::getStoreConfig('general/locale/code', $this->getStoreIdTranslation ());
|
105 |
+
$locale = new Zend_Locale($localecode);
|
106 |
+
$data = explode('_', $localecode);
|
107 |
+
$tmp = $locale->getTranslation($data[0], 'language', $locale);
|
108 |
+
|
109 |
+
$tmp = ucwords($tmp);
|
110 |
+
$this->_store_name_translation = $tmp;
|
111 |
+
|
112 |
+
return $this->_store_name_translation;*/
|
113 |
+
}
|
114 |
+
|
115 |
+
public function load($id, $field = null,$api = true) {
|
116 |
+
$this->_load_api = $api;
|
117 |
+
|
118 |
+
$return = parent::load ( $id, $field = null );
|
119 |
+
if($this->getTextmasters()!='') {
|
120 |
+
$textmaster = $this->getTextmasters();
|
121 |
+
if(!is_array($textmaster)){
|
122 |
+
$serializeData = @unserialize($textmaster);
|
123 |
+
if($serializeData)
|
124 |
+
$this->setTextmasters($serializeData);
|
125 |
+
else
|
126 |
+
$this->setTextmasters(null);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
if($api && $this->getProjectApiid() && !$this->project_loaded) {
|
132 |
+
$data_api = Mage::helper('textmaster')->getApi()->getProject($this->getProjectApiid());
|
133 |
+
//Mage::log ( $data_api,null,'textmaster.log' );
|
134 |
+
if(!isset($data_api['error'])){
|
135 |
+
$this->project_loaded = true;
|
136 |
+
|
137 |
+
if(isset($data_api['options']['language_level']))
|
138 |
+
$this->setLanguageLevel($data_api['options']['language_level']);
|
139 |
+
else
|
140 |
+
$this->setLanguageLevel('regular');
|
141 |
+
if(isset($data_api['reference']))
|
142 |
+
$this->setReference( $data_api['reference'] );
|
143 |
+
|
144 |
+
$this->setCategory($data_api['category']);
|
145 |
+
$this->setCtype($data_api['ctype']);
|
146 |
+
$this->setTemplate($data_api['work_template']['name']);
|
147 |
+
$this->setSameAuthorMustDoEntireProject($data_api['same_author_must_do_entire_project']);
|
148 |
+
$this->setVocabularyType($data_api['vocabulary_type']);
|
149 |
+
$this->setGrammaticalPerson($data_api['grammatical_person']);
|
150 |
+
$this->setTotalWordCount($data_api['total_word_count']);
|
151 |
+
$this->setTargetReaderGroups($data_api['target_reader_groups']);
|
152 |
+
$this->setStatus($data_api['status']);
|
153 |
+
$this->setProjectBriefing($data_api['project_briefing']);
|
154 |
+
|
155 |
+
if(isset($data_api['options']['specific_attachment']))
|
156 |
+
$this->setSpecificAttachment($data_api['options']['specific_attachment']);
|
157 |
+
else
|
158 |
+
$this->setSpecificAttachment(0);
|
159 |
+
|
160 |
+
if(isset($data_api['cost_in_currency'])){
|
161 |
+
$this->setPrice($data_api['cost_in_currency']['amount']);
|
162 |
+
$this->setCurrency($data_api['cost_in_currency']['currency']);
|
163 |
+
} elseif(isset($data_api['total_costs']['0'])){
|
164 |
+
$this->setPrice($data_api['total_costs']['0']['amount']);
|
165 |
+
$this->setCurrency($data_api['total_costs']['0']['currency']);
|
166 |
+
} else {
|
167 |
+
$this->setPrice(0);
|
168 |
+
}
|
169 |
+
if(isset($data_api['options']['priority']))
|
170 |
+
$this->setPriority($data_api['options']['priority']);
|
171 |
+
else {
|
172 |
+
$this->setPriority(0);
|
173 |
+
}
|
174 |
+
if(isset($data_api['options']['quality']))
|
175 |
+
$this->setQuality($data_api['options']['quality']);
|
176 |
+
else {
|
177 |
+
$this->setQuality(0);
|
178 |
+
}
|
179 |
+
if(isset($data_api['options']['expertise']))
|
180 |
+
$this->setExpertise($data_api['options']['expertise']);
|
181 |
+
else {
|
182 |
+
$this->setExpertise(0);
|
183 |
+
}
|
184 |
+
//TODO
|
185 |
+
$this->setIsmytextmaster(0);
|
186 |
+
$this->setTextmasters($data_api['textmasters']);
|
187 |
+
|
188 |
+
} else {
|
189 |
+
throw new Exception('ERREUR chargement data API');
|
190 |
+
}
|
191 |
+
}
|
192 |
+
return $return;
|
193 |
+
}
|
194 |
+
|
195 |
+
protected function _beforeSave(){
|
196 |
+
if(!$this->_before_save_api){
|
197 |
+
return parent::_beforeSave();
|
198 |
+
}
|
199 |
+
if (! $this->_api_loaded) {
|
200 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
201 |
+
}
|
202 |
+
$data = $this->getData();
|
203 |
+
/*if(isset($data['textmasters']) && isset($data['textmasters'][0]) && !strpos($data['textmasters'][0],',')!==false){
|
204 |
+
$data['textmasters'] = explode(',',$data['textmasters'][0]);
|
205 |
+
|
206 |
+
}*/
|
207 |
+
//if(isset($data['textmasters']) && is_)
|
208 |
+
//$this->setTextmasters(serialize($data['textmasters']));
|
209 |
+
|
210 |
+
//Creation
|
211 |
+
if(!$this->getId()){
|
212 |
+
|
213 |
+
//unset($params['_documents']);
|
214 |
+
foreach($data as $k=>$v){
|
215 |
+
if(gettype($v)!='object')
|
216 |
+
$params[$k]=$v;
|
217 |
+
}
|
218 |
+
$this->setTextmasterUser(Mage::getStoreConfig('textmaster/textmaster/api_key'));
|
219 |
+
|
220 |
+
$params['language_from'] = substr(Mage::getStoreConfig('general/locale/code',$params['store_id_origin']),0,2);
|
221 |
+
|
222 |
+
if($params['ctype']!='translation')
|
223 |
+
$params['store_id_translation'] = $params['store_id_origin'];
|
224 |
+
|
225 |
+
$params['language_to'] = substr(Mage::getStoreConfig('general/locale/code',$params['store_id_translation']),0,2);
|
226 |
+
|
227 |
+
|
228 |
+
/*if(!is_array($params['textmasters']) && !empty($params['textmasters']))
|
229 |
+
$params['textmasters'] = explode(',',$params['textmasters']);*/
|
230 |
+
$result = $this->_api->addProject($params);
|
231 |
+
if(!isset($result['error'])){
|
232 |
+
$this->setProjectApiid($result['id']);
|
233 |
+
$this->setStatus($result['status']);
|
234 |
+
} else {
|
235 |
+
throw new Exception($result['error']);
|
236 |
+
}
|
237 |
+
|
238 |
+
|
239 |
+
} else {
|
240 |
+
if($this->getStatus()==self::PROJECT_STATUS_IN_CREATION){
|
241 |
+
//$data = $this->getData();
|
242 |
+
|
243 |
+
//unset($params['_documents']);
|
244 |
+
foreach($data as $k=>$v){
|
245 |
+
if(gettype($v)!='object')
|
246 |
+
$params[$k]=$v;
|
247 |
+
}
|
248 |
+
$params['language_from'] = substr(Mage::getStoreConfig('general/locale/code',$params['store_id_origin']),0,2);
|
249 |
+
$params['language_to'] = substr(Mage::getStoreConfig('general/locale/code',$params['store_id_translation']),0,2);
|
250 |
+
|
251 |
+
$result = $this->_api->updateProject($this->getProjectApiid(),$params);
|
252 |
+
if(!isset($result['error'])){
|
253 |
+
$this->setStatus($result['status']);
|
254 |
+
} else {
|
255 |
+
throw new Exception($result['error']);
|
256 |
+
}
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
return parent::_beforeSave();
|
261 |
+
}
|
262 |
+
|
263 |
+
public function getStatusTexte(){
|
264 |
+
//Mage::
|
265 |
+
$statuses = array(
|
266 |
+
'in_creation' => Mage::helper('textmaster')->__('In creation'),
|
267 |
+
'waiting_assignment'=> Mage::helper('textmaster')->__('Waiting assignment'),
|
268 |
+
'in_progress' => Mage::helper('textmaster')->__('In progress'),
|
269 |
+
'in_review' => Mage::helper('textmaster')->__('In review'),
|
270 |
+
'completed' => Mage::helper('textmaster')->__('Completed'),
|
271 |
+
'incomplete' => Mage::helper('textmaster')->__('Incomplete'),
|
272 |
+
'paused' => Mage::helper('textmaster')->__('Paused'),
|
273 |
+
'canceled' => Mage::helper('textmaster')->__('Cancelled'),
|
274 |
+
'copyscape' => Mage::helper('textmaster')->__('Copyscape'),
|
275 |
+
'counting_words' => Mage::helper('textmaster')->__('Counting words'),
|
276 |
+
'quality_control' => Mage::helper('textmaster')->__('Quality control'));
|
277 |
+
if(isset($statuses[parent::getStatus()])) return $statuses[parent::getStatus()];
|
278 |
+
return $this->getStatus();
|
279 |
+
}
|
280 |
+
public function getStatuses(){
|
281 |
+
$statuses = array(
|
282 |
+
'in_creation' => Mage::helper('textmaster')->__('In creation'),
|
283 |
+
'waiting_assignment'=> Mage::helper('textmaster')->__('Waiting assignment'),
|
284 |
+
'in_progress' => Mage::helper('textmaster')->__('In progress'),
|
285 |
+
'in_review' => Mage::helper('textmaster')->__('In review'),
|
286 |
+
'completed' => Mage::helper('textmaster')->__('Completed'),
|
287 |
+
'incomplete' => Mage::helper('textmaster')->__('Incomplete'),
|
288 |
+
'paused' => Mage::helper('textmaster')->__('Paused'),
|
289 |
+
'canceled' => Mage::helper('textmaster')->__('Cancelled'),
|
290 |
+
'copyscape' => Mage::helper('textmaster')->__('Copyscape'),
|
291 |
+
'counting_words' => Mage::helper('textmaster')->__('Counting words'),
|
292 |
+
'quality_control' => Mage::helper('textmaster')->__('Quality control'));
|
293 |
+
return $statuses;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function getPrice(){
|
297 |
+
$currency = Mage::getModel('directory/currency')->load($this->getCurrency());
|
298 |
+
return $currency->format($this->getData('price'),array(),false);
|
299 |
+
}
|
300 |
+
|
301 |
+
public function getVocabularyTypeTexte(){
|
302 |
+
if(!$this->_api){
|
303 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
304 |
+
}
|
305 |
+
return Mage::helper ( 'textmaster' )->__ ($this->_api->getVocabularyLevel($this->getVocabularyType()));
|
306 |
+
}
|
307 |
+
|
308 |
+
public function getGrammaticalPersonTexte(){
|
309 |
+
if(!$this->_api){
|
310 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
311 |
+
}
|
312 |
+
return Mage::helper ( 'textmaster' )->__ ($this->_api->getGrammaticalPerson($this->getGrammaticalPerson()));
|
313 |
+
}
|
314 |
+
|
315 |
+
public function getLanguageLevelTexte(){
|
316 |
+
if(!$this->_api){
|
317 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
318 |
+
}
|
319 |
+
return Mage::helper ( 'textmaster' )->__ ($this->_api->getServiceLevel($this->getLanguageLevel()));
|
320 |
+
}
|
321 |
+
|
322 |
+
public function getCategoryTexte(){
|
323 |
+
if(!$this->_api){
|
324 |
+
$this->_api = Mage::helper('textmaster')->getApi();
|
325 |
+
}
|
326 |
+
return Mage::helper ( 'textmaster' )->__ ($this->_api->getCategory($this->getCategory()));
|
327 |
+
}
|
328 |
+
|
329 |
+
protected function _afterSave(){
|
330 |
+
if(!$this->_before_save_api){
|
331 |
+
return parent::_afterSave();
|
332 |
+
}
|
333 |
+
if($this->getTextmasters()!='') {
|
334 |
+
|
335 |
+
$this->setTextmasters(unserialize($this->getTextmasters()));
|
336 |
+
}
|
337 |
+
return parent::_afterSave();
|
338 |
+
}
|
339 |
+
public function saveTextmasters($textmasters){
|
340 |
+
if($textmasters[0]=="aucun"){
|
341 |
+
$textmasters= array();
|
342 |
+
}
|
343 |
+
$r = Mage::helper('textmaster')->getApi()->updateProjectTextmasters($this->getProjectApiid(),$textmasters);
|
344 |
+
}
|
345 |
+
|
346 |
+
public function setDocuments($documents){
|
347 |
+
$this->_documents = $documents;
|
348 |
+
}
|
349 |
+
|
350 |
+
public function getDocuments(){
|
351 |
+
if(!isset($this->_documents)){
|
352 |
+
$this->_documents = Mage::getModel('textmaster/document')->getCollection()->setLoadApi($this->_api_loaded)->addFieldToFilter('textmaster_project_id',$this->getId());
|
353 |
+
|
354 |
+
foreach($this->_documents as $doc){
|
355 |
+
//$doc->get
|
356 |
+
if(!isset($this->_authors[$doc->getAuthor()])){
|
357 |
+
$this->_authors[$doc->getAuthor()] = $doc->getAuthor();
|
358 |
+
}
|
359 |
+
$doc->setProject($this);
|
360 |
+
}
|
361 |
+
}
|
362 |
+
return $this->_documents;
|
363 |
+
}
|
364 |
+
public function getAuthor(){
|
365 |
+
$this->getDocuments();
|
366 |
+
return $this->_authors;
|
367 |
+
}
|
368 |
+
public function getMyAuthors(){
|
369 |
+
return Mage::helper('textmaster')->getApi()->getMyAuthorsByProject($this->getProjectApiid());
|
370 |
+
}
|
371 |
+
|
372 |
+
public function getNbAuthor(){
|
373 |
+
$this->getDocuments();
|
374 |
+
return count($this->_authors);
|
375 |
+
}
|
376 |
+
public function getDocumentsNotSend(){
|
377 |
+
if(isset($this->_documents_not_send)) return $this->_documents_not_send;
|
378 |
+
$this->_documents_not_send = Mage::getModel('textmaster/document')->getCollection()->setLoadApi($this->_api_loaded)
|
379 |
+
->addFieldToFilter('textmaster_project_id',$this->getId())
|
380 |
+
->addFieldToFilter('send',0);
|
381 |
+
foreach($this->_documents_not_send as $doc){
|
382 |
+
$doc->setProject($this);
|
383 |
+
}
|
384 |
+
|
385 |
+
return $this->_documents_not_send;
|
386 |
+
}
|
387 |
+
public function getDocumentsNotCount(){
|
388 |
+
if(isset($this->_documents_not_count)) return $this->_documents_not_count;
|
389 |
+
$this->_documents_not_count = Mage::getModel('textmaster/document')->getCollection()->setLoadApi($this->_api_loaded)
|
390 |
+
->addFieldToFilter('textmaster_project_id',$this->getTextmasterProjectId())
|
391 |
+
->addFieldToFilter('counted',0);
|
392 |
+
foreach($this->_documents_not_count as $doc){
|
393 |
+
$doc->setProject($this);
|
394 |
+
}
|
395 |
+
return $this->_documents_not_count;
|
396 |
+
}
|
397 |
+
public function getDocumentsSendToCompleted(){
|
398 |
+
if(isset($this->_documents_send_tocompleted)) return $this->_documents_send_tocompleted;
|
399 |
+
$this->_documents_send_tocompleted = Mage::getModel('textmaster/document')->getCollection()->setLoadApi($this->_api_loaded)
|
400 |
+
->addFieldToFilter('textmaster_project_id',$this->getTextmasterProjectId())
|
401 |
+
->addFieldToFilter('encourscomplete',1)
|
402 |
+
->addFieldToFilter('sendforcomplete',1)
|
403 |
+
;
|
404 |
+
foreach($this->_documents_send_tocompleted as $doc){
|
405 |
+
$doc->setProject($this);
|
406 |
+
}
|
407 |
+
return $this->_documents_send_tocompleted;
|
408 |
+
}
|
409 |
+
public function getDocumentsSendNotCompleted(){
|
410 |
+
if(isset($this->_documents_send_notcompleted)) return $this->_documents_send_notcompleted;
|
411 |
+
$this->_documents_send_notcompleted = Mage::getModel('textmaster/document')->getCollection()->setLoadApi($this->_api_loaded)
|
412 |
+
->addFieldToFilter('textmaster_project_id',$this->getTextmasterProjectId())
|
413 |
+
->addFieldToFilter('encourscomplete',1)
|
414 |
+
->addFieldToFilter('sendforcomplete',1)
|
415 |
+
->addFieldToFilter('completed',0);
|
416 |
+
foreach($this->_documents_send_notcompleted as $doc){
|
417 |
+
$doc->setProject($this);
|
418 |
+
}
|
419 |
+
|
420 |
+
return $this->_documents_send_notcompleted;
|
421 |
+
}
|
422 |
+
public function sendDocuments(){
|
423 |
+
if($this->hasDocumentsNotSend()){
|
424 |
+
$nbDocumentToSend = Mage::getConfig()->getNode('adminhtml/api/documents/send/nb')->asArray();
|
425 |
+
$i=0;
|
426 |
+
$dataToSend = array();
|
427 |
+
$documents = $this->getDocumentsNotSend();
|
428 |
+
foreach ($documents as $document){
|
429 |
+
if($nbDocumentToSend<=$i) break;
|
430 |
+
$dataToSend[] = $document->prepareData();
|
431 |
+
$i++;
|
432 |
+
}
|
433 |
+
$error = 0;
|
434 |
+
$_api = Mage::helper('textmaster')->getApi();
|
435 |
+
$result = $_api->addDocuments($this->getProjectApiid(),$dataToSend);
|
436 |
+
$i=0;
|
437 |
+
foreach ($documents as $k=>$document){
|
438 |
+
if($nbDocumentToSend<=$i) break;
|
439 |
+
if (! isset ( $result[$i]['error'] )) {
|
440 |
+
$document->setDocumentApiId ( $result[$i] ['id'] );
|
441 |
+
$document->setSend ( 1 );
|
442 |
+
$document->save();
|
443 |
+
} else {
|
444 |
+
$error = 1;
|
445 |
+
//$document->setStatus ( 'in_error' );
|
446 |
+
$document->delete();
|
447 |
+
}
|
448 |
+
$i++;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
return $this;
|
452 |
+
}
|
453 |
+
public function hasDocumentsNotSend(){
|
454 |
+
$docs = $this->getDocumentsNotSend();
|
455 |
+
return count($docs)>0;
|
456 |
+
}
|
457 |
+
|
458 |
+
public function hasDocumentsNotCount(){
|
459 |
+
// Est ce qu'un document n'a pas été compté
|
460 |
+
$docs = $this->getDocumentsNotCount();
|
461 |
+
return count($docs)>0;
|
462 |
+
}
|
463 |
+
|
464 |
+
public function getProductIds(){
|
465 |
+
if($this->_products_id) return $this->_products_id;
|
466 |
+
$this->_products_id = array();
|
467 |
+
if(isset($this->_documents)){
|
468 |
+
foreach($this->_documents as $document){
|
469 |
+
$this->_products_id[] = $document->getProductId();
|
470 |
+
}
|
471 |
+
} else {
|
472 |
+
$table = Mage::getSingleton('core/resource')->getTableName('textmaster_document');
|
473 |
+
$results = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll("SELECT DISTINCT product_id FROM $table WHERE textmaster_project_id = ".$this->getId());
|
474 |
+
|
475 |
+
foreach ($results as $result){
|
476 |
+
$this->_products_id[] = $result['product_id'];
|
477 |
+
}
|
478 |
+
}
|
479 |
+
return $this->_products_id;
|
480 |
+
}
|
481 |
+
|
482 |
+
public function getAttributes(){
|
483 |
+
if(!isset($this->_attributes)){
|
484 |
+
$this->_attributes = Mage::getModel('textmaster/project_attribute')->getCollection()->addFieldToFilter('textmaster_project_id',$this->getId());
|
485 |
+
foreach($this->_attributes as $attribute){
|
486 |
+
$attribute->setProject($this);
|
487 |
+
}
|
488 |
+
}
|
489 |
+
return $this->_attributes;
|
490 |
+
}
|
491 |
+
public function getAttributesFull(){
|
492 |
+
if(!isset($this->_attributes_full)){
|
493 |
+
$this->_attributes_full = Mage::getModel('textmaster/project_attribute')->getCollection()->addFieldToFilter('textmaster_project_id',$this->getId());
|
494 |
+
$this->_attributes_full->getSelect()->joinInner(array('attribute'=>'eav_attribute'),'main_table.textmaster_attribute_id = attribute.attribute_id');
|
495 |
+
foreach($this->_attributes_full as $attribute){
|
496 |
+
$attribute->setProject($this);
|
497 |
+
}
|
498 |
+
}
|
499 |
+
return $this->_attributes_full;
|
500 |
+
}
|
501 |
+
|
502 |
+
public function canLaunch() {
|
503 |
+
if($this->getStatus()==self::PROJECT_STATUS_IN_CREATION){
|
504 |
+
$user_info = Mage::helper('textmaster')->getApi()->getUserInfo();
|
505 |
+
if($user_info['wallet']['current_money']>=$this->getPrice()){
|
506 |
+
return true;
|
507 |
+
}
|
508 |
+
return false;
|
509 |
+
}
|
510 |
+
return false;
|
511 |
+
}
|
512 |
+
|
513 |
+
public function delete(){
|
514 |
+
foreach ($this->getDocuments() as $doc){
|
515 |
+
$doc->delete();
|
516 |
+
}
|
517 |
+
foreach($this->getAttributes() as $attr){
|
518 |
+
$attr->delete();
|
519 |
+
}
|
520 |
+
return parent::delete();
|
521 |
+
}
|
522 |
+
|
523 |
+
public function duplicate(){
|
524 |
+
$newProject = Mage::getModel('textmaster/project');
|
525 |
+
$data = $this->getData();
|
526 |
+
if(isset($data['id'])){
|
527 |
+
unset($data['id']);
|
528 |
+
}
|
529 |
+
if(isset($data['textmaster_project_id'])){
|
530 |
+
unset($data['textmaster_project_id']);
|
531 |
+
}
|
532 |
+
if(isset($data['reference'])){
|
533 |
+
unset($data['reference']);
|
534 |
+
}
|
535 |
+
if(isset($data['project_apiid'])){
|
536 |
+
unset($data['project_apiid']);
|
537 |
+
}
|
538 |
+
$newProject->setData($data);
|
539 |
+
$newProject->setBeforeSaveApi(false);
|
540 |
+
$newProject->save();
|
541 |
+
if($newProject->getId()) {
|
542 |
+
|
543 |
+
$result = Mage::helper('textmaster')->getApi()->duplicateProject($this->getProjectApiid());
|
544 |
+
if(isset($result['id'])) {
|
545 |
+
$newProject->setProjectApiid($result['id']);
|
546 |
+
$newProject->save();
|
547 |
+
}
|
548 |
+
}
|
549 |
+
|
550 |
+
|
551 |
+
|
552 |
+
//return parent::delete();
|
553 |
+
}
|
554 |
+
|
555 |
+
public function launch(){
|
556 |
+
if($this->canLaunch()) {
|
557 |
+
$result = Mage::helper('textmaster')->getApi()->launchProject($this->getProjectApiid());
|
558 |
+
if(!isset($result['error'])){
|
559 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
560 |
+
$this->setStatus(self::PROJECT_STATUS_IN_LAUNCH_PROCESSING);
|
561 |
+
$this->save();
|
562 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('launch'));
|
563 |
+
return true;
|
564 |
+
} else {
|
565 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
|
566 |
+
}
|
567 |
+
}
|
568 |
+
return false;
|
569 |
+
}
|
570 |
+
|
571 |
+
public function canPause() {
|
572 |
+
return $this->getStatus()==self::PROJECT_STATUS_IN_PROGRESS;
|
573 |
+
}
|
574 |
+
|
575 |
+
public function pause(){
|
576 |
+
//if($this->canPause()) {
|
577 |
+
$result = Mage::helper('textmaster')->getApi()->pauseProject($this->getProjectApiid());
|
578 |
+
if(!isset($result['error'])){
|
579 |
+
$this->setStatus(self::PROJECT_STATUS_PAUSED);
|
580 |
+
$this->save();
|
581 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('paused'));
|
582 |
+
} else {
|
583 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
|
584 |
+
}
|
585 |
+
//}
|
586 |
+
}
|
587 |
+
|
588 |
+
public function canResume() {
|
589 |
+
return $this->getStatus()==self::PROJECT_STATUS_PAUSED;
|
590 |
+
}
|
591 |
+
|
592 |
+
public function resume(){
|
593 |
+
//if($this->canResume()) {
|
594 |
+
$result = Mage::helper('textmaster')->getApi()->resumeProject($this->getProjectApiid());
|
595 |
+
if(!isset($result['error'])){
|
596 |
+
$this->setStatus(self::PROJECT_STATUS_IN_PROGRESS);
|
597 |
+
$this->save();
|
598 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('resumed'));
|
599 |
+
} else {
|
600 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
|
601 |
+
}
|
602 |
+
//}
|
603 |
+
}
|
604 |
+
|
605 |
+
public function canCancel() {
|
606 |
+
return $this->getStatus()!=self::PROJECT_STATUS_IN_REVIEW && $this->getStatus()!=self::PROJECT_STATUS_COMPLETED;
|
607 |
+
}
|
608 |
+
|
609 |
+
public function cancel(){
|
610 |
+
//if($this->canCancel()) {
|
611 |
+
$result = Mage::helper('textmaster')->getApi()->cancelProject($this->getProjectApiid());
|
612 |
+
if(!isset($result['error'])){
|
613 |
+
$this->setStatus(self::PROJECT_STATUS_CANCEL);
|
614 |
+
$this->save();
|
615 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('canceled'));
|
616 |
+
} else {
|
617 |
+
Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
|
618 |
+
}
|
619 |
+
//}
|
620 |
+
}
|
621 |
+
|
622 |
+
public function canComplete() {
|
623 |
+
if(isset($this->_canComplete)) return $this->_canComplete;
|
624 |
+
$this->_canComplete = false;
|
625 |
+
if($this->getStatus()==self::PROJECT_STATUS_IN_REVIEW) {
|
626 |
+
$this->_canComplete = true;
|
627 |
+
foreach($this->getDocuments() as $document){
|
628 |
+
if($document->getStatus()!=Textmaster_Textmaster_Model_Document::DOCUMENT_STATUS_COMPLETED){
|
629 |
+
$this->_canComplete = false;
|
630 |
+
}
|
631 |
+
}
|
632 |
+
}
|
633 |
+
return $this->_canComplete;
|
634 |
+
}
|
635 |
+
|
636 |
+
public function canTransfert(){
|
637 |
+
if($this->getStatus()==self::PROJECT_STATUS_COMPLETED && $this->getDocumentTransfert()==0) {
|
638 |
+
|
639 |
+
}
|
640 |
+
}
|
641 |
+
public function complete(){
|
642 |
+
if($this->canComplete()) {
|
643 |
+
$this->setStatus(self::PROJECT_STATUS_COMPLETED);
|
644 |
+
$this->transfert();
|
645 |
+
$this->save();
|
646 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('completed'));
|
647 |
+
}
|
648 |
+
return $this;
|
649 |
+
}
|
650 |
+
public function transfert(){
|
651 |
+
if($this->canTransfert()){
|
652 |
+
foreach($this->getDocuments() as $doc){
|
653 |
+
if($doc->canComplete()){
|
654 |
+
$doc->complete();
|
655 |
+
} elseif($doc->canTransfert()) {
|
656 |
+
$doc->transfert();
|
657 |
+
}
|
658 |
+
}
|
659 |
+
$this->setDocumentsTransfert(1);
|
660 |
+
$this->setBeforeSaveApi(false);
|
661 |
+
$this->save();
|
662 |
+
}
|
663 |
+
return $this;
|
664 |
+
}
|
665 |
+
/*
|
666 |
+
* NON UTILISER
|
667 |
+
* */
|
668 |
+
public function getTranslation(){
|
669 |
+
$documents = $this->getDocuments();
|
670 |
+
$tr = array();
|
671 |
+
foreach($documents as $document){
|
672 |
+
$document->load($document->getId());
|
673 |
+
$tr[$document->getProductId()] = $document->getTranslation();
|
674 |
+
}
|
675 |
+
return $tr;
|
676 |
+
}
|
677 |
+
public function loadByApiData($data){
|
678 |
+
$_subsitute = array(
|
679 |
+
'name' => 'name',
|
680 |
+
'reference' => 'ref',
|
681 |
+
'progression' => 'progress',
|
682 |
+
'level' => 'level_name',
|
683 |
+
'store_id_origin' => 'language_from_code',
|
684 |
+
'store_id_translation' => 'language_to_code',
|
685 |
+
'nb_document' => 'cached_documents_count',
|
686 |
+
'total_word_count' => 'total_word_count',
|
687 |
+
'price' => 'pricing.total_cost_at_launch_time',
|
688 |
+
'updated_at' => 'updated_at',
|
689 |
+
'status' => 'status',
|
690 |
+
);
|
691 |
+
$_subsitute = array_flip($_subsitute);
|
692 |
+
$this->_getResource()->load($this, $data['id'], 'project_apiid');
|
693 |
+
|
694 |
+
if($this->getId()==0) {
|
695 |
+
$this->setName($data['name']);
|
696 |
+
$this->setData('store_id_origin',null) ;
|
697 |
+
$this->setData('store_id_translation',null);
|
698 |
+
|
699 |
+
}
|
700 |
+
|
701 |
+
$this->setReference($data['reference']);
|
702 |
+
if($data['status']!=$this->getStatus()) {
|
703 |
+
$this->setStatus($data['status']);
|
704 |
+
//$this->save();
|
705 |
+
} else {
|
706 |
+
$this->setStatus($data['status']);
|
707 |
+
}
|
708 |
+
//Nombre de document
|
709 |
+
|
710 |
+
$nb_document = 0;
|
711 |
+
if(isset($data['documents_statuses'])) {
|
712 |
+
foreach ($data['documents_statuses'] as $nb) {
|
713 |
+
$nb_document += $nb;
|
714 |
+
}
|
715 |
+
}
|
716 |
+
|
717 |
+
$this->setNbDocument($nb_document);
|
718 |
+
$this->setTotalWordCount($data['total_word_count']);
|
719 |
+
if(isset($data['total_costs'][0]['amount'])){
|
720 |
+
$this->setPrice($data['total_costs'][0]['amount']);
|
721 |
+
$this->setCurrency($data['total_costs'][0]['currency']);
|
722 |
+
}
|
723 |
+
elseif(isset($data['cost_in_currency']['amount'])) {
|
724 |
+
$this->setPrice($data['cost_in_currency']['amount']);
|
725 |
+
$this->setCurrency($data['cost_in_currency']['currency']);
|
726 |
+
}
|
727 |
+
if(isset($data['progress']))
|
728 |
+
$this->setProgression(round((float)$data['progress'],0).'%');
|
729 |
+
else $this->setProgression('0%');
|
730 |
+
|
731 |
+
if(isset($data['options']['language_level']))
|
732 |
+
$this->setLevel($data['options']['language_level']);
|
733 |
+
|
734 |
+
$this->setUpdatedAt($data['updated_at']['full']);
|
735 |
+
|
736 |
+
}
|
737 |
+
|
738 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Project/Attribute.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Project_Attribute extends Mage_Core_Model_Abstract {
|
27 |
+
public function _construct()
|
28 |
+
{
|
29 |
+
parent::_construct();
|
30 |
+
$this->_init('textmaster/project_attribute');
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Audience.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Audience{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$vocs = Mage::helper('textmaster')->getApi()->getAudiences();
|
31 |
+
$aOptions = array();
|
32 |
+
foreach ($vocs as $k=>$voc){
|
33 |
+
$aOptions[] = array('value'=>$k, 'label'=>$voc);
|
34 |
+
}
|
35 |
+
return $aOptions ;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Author.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Author{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
$aOptions = array();
|
32 |
+
|
33 |
+
if(!$_api->isUserConnected()) return $aOptions;
|
34 |
+
|
35 |
+
$aAuthors = $_api->getAuthors();
|
36 |
+
if(!isset($aAuthors['errors'])){
|
37 |
+
foreach ($aAuthors['my_authors'] as $_item){
|
38 |
+
$aOptions[] = array('value'=>$_item['author_id'], 'label'=>$_item['description'].' ('.$_item['author_ref'].')');
|
39 |
+
}
|
40 |
+
}
|
41 |
+
return $aOptions;
|
42 |
+
}
|
43 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Category.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Category{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
$aOptions = array();
|
32 |
+
|
33 |
+
if(!$_api->isUserConnected()) return $aOptions;
|
34 |
+
|
35 |
+
$aCategories = $_api->getCategories();
|
36 |
+
foreach ($aCategories as $_item){
|
37 |
+
$aOptions[] = array('value'=>$_item['code'], 'label'=>$_item['value']);
|
38 |
+
}
|
39 |
+
return $aOptions;
|
40 |
+
}
|
41 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Grammatical.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Grammatical{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$vocs = Mage::helper('textmaster')->getApi()->getGrammaticalPersons();
|
31 |
+
$aOptions = array();
|
32 |
+
foreach ($vocs as $k=>$voc){
|
33 |
+
$aOptions[] = array('value'=>$k, 'label'=>$voc);
|
34 |
+
}
|
35 |
+
return $aOptions ;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Lang.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Lang{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
$aOptions = array();
|
32 |
+
|
33 |
+
if(!$_api->isUserConnected()) return $aOptions;
|
34 |
+
|
35 |
+
$aLanguages = $_api->getLanguages();
|
36 |
+
foreach ($aLanguages as $_item){
|
37 |
+
$aOptions[] = array('value'=>$_item['code'], 'label'=>$_item['value']);
|
38 |
+
}
|
39 |
+
return $aOptions;
|
40 |
+
}
|
41 |
+
public function toOptions(){
|
42 |
+
Mage::getModel('core/store')->getCollection()->toOptionHash();
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Type.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Type{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
|
31 |
+
return array(
|
32 |
+
0 => array(
|
33 |
+
'value'=>'translate',
|
34 |
+
'label'=> Mage::helper('textmaster')->__('Translate'),
|
35 |
+
),
|
36 |
+
1 => array(
|
37 |
+
'value'=>'proofreading',
|
38 |
+
'label'=> Mage::helper('textmaster')->__('Proofreading'),
|
39 |
+
)
|
40 |
+
);
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Textmaster/Textmaster/Model/Source/Api/Vocabulary.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Model_Source_Api_Vocabulary{
|
27 |
+
|
28 |
+
public function toOptionArray()
|
29 |
+
{
|
30 |
+
$vocs = Mage::helper('textmaster')->getApi()->getVocabularyLevels();
|
31 |
+
$aOptions = array();
|
32 |
+
foreach ($vocs as $k=>$voc){
|
33 |
+
$aOptions[] = array('value'=>$k, 'label'=>$voc);
|
34 |
+
}
|
35 |
+
return $aOptions ;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Textmaster/Textmaster/controllers/Adminhtml/AjaxController.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Adminhtml_AjaxController extends Mage_Adminhtml_Controller_action
|
27 |
+
{
|
28 |
+
public function loginAction(){
|
29 |
+
|
30 |
+
$_api = Mage::helper('textmaster')->getApi();
|
31 |
+
$email = $this->getRequest()->getPost('login');
|
32 |
+
$password = $this->getRequest()->getPost('password');
|
33 |
+
|
34 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
35 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterMyAuthors();
|
36 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterCategories();
|
37 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterLanguages();
|
38 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterPricings();
|
39 |
+
|
40 |
+
$result = $_api->getAuth2Token($email,$password);
|
41 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
42 |
+
|
43 |
+
|
44 |
+
if (!isset($result['access_token'])){
|
45 |
+
$html = Mage::helper('textmaster')->__('Wrong login / password');
|
46 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
$result = $_api->getAPIKeys($result['access_token']);
|
52 |
+
|
53 |
+
if (!isset($result['api_info']['api_key']) || !isset($result['api_info']['api_secret'])) {
|
54 |
+
Mage::log('Could not get API key / secret',null,'textmaster.log');
|
55 |
+
$html = Mage::helper('textmaster')->__('Could not get API key / secret');
|
56 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
Mage::getConfig()->saveConfig('textmaster/textmaster/api_key',$result['api_info']['api_key']);
|
61 |
+
Mage::getConfig()->saveConfig('textmaster/textmaster/api_secret',$result['api_info']['api_secret']);
|
62 |
+
Mage::app()->cleanCache('config');
|
63 |
+
$this->getResponse()->setBody( Mage::helper('core')->jsonEncode(array('html'=> '<div class="success" style="padding:2px 8px;background:#EFF5EA ;border:1px solid #95A486;color:#3D6611;font-weight:bold">'.Mage::helper('textmaster')->__('Connected to textmaster').'</div>')));
|
64 |
+
|
65 |
+
}
|
66 |
+
public function logoutAction(){
|
67 |
+
Mage::getConfig()->saveConfig('textmaster/textmaster/api_key','');
|
68 |
+
Mage::getConfig()->saveConfig('textmaster/textmaster/api_secret','');
|
69 |
+
Mage::app()->cleanCache('config');
|
70 |
+
|
71 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
72 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterMyAuthors();
|
73 |
+
|
74 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
75 |
+
}
|
76 |
+
|
77 |
+
public function createAction(){
|
78 |
+
|
79 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
80 |
+
$_api = Mage::helper('textmaster')->getApi();
|
81 |
+
|
82 |
+
$email = $this->getRequest()->getPost('login');
|
83 |
+
$post = $this->getRequest()->getPost();
|
84 |
+
$password = $this->getRequest()->getParam('password');
|
85 |
+
$phone = $this->getRequest()->getParam('tel');
|
86 |
+
|
87 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
88 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterMyAuthors();
|
89 |
+
|
90 |
+
if (!Zend_Validate::is($email, 'EmailAddress')) {
|
91 |
+
$html = Mage::helper('textmaster')->__('Email invalid');
|
92 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
93 |
+
}
|
94 |
+
if ($password == ''){
|
95 |
+
$html = Mage::helper('textmaster')->__('Password mandatory');
|
96 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
97 |
+
}
|
98 |
+
if(isset($html)){
|
99 |
+
return ;
|
100 |
+
}
|
101 |
+
|
102 |
+
$token = $_api->getAuth2TokenForCreation();
|
103 |
+
if (!isset($token['access_token'])){
|
104 |
+
$html = Mage::helper('textmaster')->__('Could not get access token');
|
105 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
|
109 |
+
//CREATION DU CLIENT
|
110 |
+
$aUserInfo = $_api->createUser($token['access_token'], $email, $password,$phone?$phone:null);
|
111 |
+
if (isset($aUserInfo['errors'])){
|
112 |
+
$html = '';
|
113 |
+
foreach ($aUserInfo['errors'] AS $key => $error)
|
114 |
+
foreach ($error AS $error_key => $value)
|
115 |
+
$html .= $key.' - '.$value.'<br/>';
|
116 |
+
$html = '<div class="success" style="padding:2px 8px;background:#FFEEEE ;border:1px solid #FF9999;color:#CC0000;font-weight:bold">'.$html.'</div>';
|
117 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
if (!isset($aUserInfo['api_info']['api_key']) || !isset($aUserInfo['api_info']['api_secret'])) {
|
122 |
+
Mage::log('Could not get API key / secret',null,'textmaster.log');
|
123 |
+
$html = '<div class="success" style="padding:2px 8px;background:#FFEEEE ;border:1px solid #FF9999;color:#CC0000;font-weight:bold">'.Mage::helper('textmaster')->__('Could not get API key / secret').'</div>';
|
124 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('errors'=>$html)));
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
Mage::getModel('core/config')->saveConfig('textmaster/textmaster/api_key',$aUserInfo['api_info']['api_key']);
|
128 |
+
Mage::getModel('core/config')->saveConfig('textmaster/textmaster/api_secret',$aUserInfo['api_info']['api_secret']);
|
129 |
+
Mage::app()->cleanCache('config');
|
130 |
+
$this->getResponse()->setBody( Mage::helper('core')->jsonEncode(array('html'=>'<div class="success" style="padding:2px 8px;background:#EFF5EA ;border:1px solid #95A486;color:#3D6611;font-weight:bold">'.Mage::helper('textmaster')->__('Your account has been successfully created.').'</div>')));
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
public function indexAction()
|
135 |
+
{
|
136 |
+
$this->loadLayout();
|
137 |
+
$this->renderLayout();
|
138 |
+
}
|
139 |
+
}
|
app/code/community/Textmaster/Textmaster/controllers/Adminhtml/ApiController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Adminhtml_ApiController extends Mage_Core_Controller_Front_Action
|
27 |
+
{
|
28 |
+
public function documentaddAction(){
|
29 |
+
$projectId = $this->getRequest()->getParam('id');
|
30 |
+
$project = Mage::getModel('textmaster/project')->load($projectId);
|
31 |
+
$project->sendDocument();
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Textmaster/Textmaster/controllers/Adminhtml/ProjectController.php
ADDED
@@ -0,0 +1,643 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_Adminhtml_ProjectController extends Mage_Adminhtml_Controller_Action
|
27 |
+
{
|
28 |
+
protected function _initAction() {
|
29 |
+
$this->loadLayout()
|
30 |
+
->_setActiveMenu('textmaster/project');
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function indexAction()
|
35 |
+
{
|
36 |
+
$api_key = Mage::getStoreConfig('textmaster/textmaster/api_key');;
|
37 |
+
$api_secret = Mage::getStoreConfig('textmaster/textmaster/api_secret');
|
38 |
+
$user = Mage::helper('textmaster')->getApi()->getUserInfo();
|
39 |
+
if(!isset($user['email'])) {
|
40 |
+
$this->_redirect('*/*/login');
|
41 |
+
} else {
|
42 |
+
$this->_initAction()->renderLayout();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
public function loginAction()
|
46 |
+
{
|
47 |
+
$this->_initAction()->renderLayout();
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
public function editAction()
|
52 |
+
{
|
53 |
+
/*$projectId = $this->getRequest()->getParam('id');
|
54 |
+
$projectModel = Mage::getModel('textmaster/project')->load($projectId);*/
|
55 |
+
|
56 |
+
if (/*$projectModel->getId() || $projectId == 0*/1)
|
57 |
+
{
|
58 |
+
$step = $this->getRequest()->getParam("step");
|
59 |
+
|
60 |
+
//Mage::register('project_data', $projectModel);
|
61 |
+
//$this->loadLayout();
|
62 |
+
$this->_initAction();
|
63 |
+
|
64 |
+
|
65 |
+
$ongletBlock = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets')->assign('step', $step);
|
66 |
+
$ongletBlock->setTemplate('textmaster/onglet.phtml');
|
67 |
+
|
68 |
+
$step1Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step1');
|
69 |
+
$step2Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step2');
|
70 |
+
$step3Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step3');
|
71 |
+
|
72 |
+
$this->_addContent($ongletBlock);
|
73 |
+
switch ($step){
|
74 |
+
default:
|
75 |
+
case 1:
|
76 |
+
$project_id = Mage::getSingleton('core/session')->getProjectId();
|
77 |
+
$project = Mage::getModel('textmaster/project');
|
78 |
+
if($project_id && is_numeric($project_id)){
|
79 |
+
$project->load($project_id);
|
80 |
+
$docs = $project->getDocuments();
|
81 |
+
$pids = array();
|
82 |
+
foreach($docs as $doc){
|
83 |
+
$pids[] = $doc->getProductId();
|
84 |
+
}
|
85 |
+
|
86 |
+
$this->getRequest()->setParam('internal_products_id',implode(',',$pids));
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
$ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven\'t been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.'));
|
91 |
+
|
92 |
+
|
93 |
+
$this->_addContent($step1Block);
|
94 |
+
break;
|
95 |
+
case 2:
|
96 |
+
$project_id = Mage::getSingleton('core/session')->getProjectId();
|
97 |
+
$project = Mage::getModel('textmaster/project');
|
98 |
+
if($project_id && is_numeric($project_id)){
|
99 |
+
$project->load($project_id);
|
100 |
+
$step2Block->setProject($project);
|
101 |
+
}
|
102 |
+
|
103 |
+
$summary = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_summary');
|
104 |
+
$ongletBlock->setChild('textmaster.step2',$step2Block);
|
105 |
+
$ongletBlock->setChild('textmaster.summary',$summary);
|
106 |
+
//$this->_addContent($step2Block);
|
107 |
+
$ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)'));
|
108 |
+
|
109 |
+
|
110 |
+
break;
|
111 |
+
case 3:
|
112 |
+
$project_id = Mage::getSingleton('core/session')->getProjectId();
|
113 |
+
$post = Mage::app()->getRequest()->getPost();
|
114 |
+
if($post && count($post)){
|
115 |
+
$project = Mage::getModel('textmaster/project')->load($project_id,null,false);
|
116 |
+
$r = $project->launch();
|
117 |
+
if(!isset($r['error'])) {
|
118 |
+
$this->_redirect('*/*/');
|
119 |
+
} else {
|
120 |
+
Mage::getSingleton('adminhtml/session')->addError($r['error']);
|
121 |
+
$this->_redirect('*/*/edit', array("step" => 3));
|
122 |
+
}
|
123 |
+
return ;
|
124 |
+
}
|
125 |
+
Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
|
126 |
+
|
127 |
+
|
128 |
+
$project = Mage::getModel('textmaster/project')->load($project_id);
|
129 |
+
if($project->hasDocumentsNotCount()){
|
130 |
+
$this->_redirect('*/*/edit', array("step" => 2));
|
131 |
+
}
|
132 |
+
$ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com'));
|
133 |
+
$products_id = Mage::getSingleton('core/session')->getSelectedProducts();
|
134 |
+
if(empty($products_id)){
|
135 |
+
$products_id = array();
|
136 |
+
$documents = $project->getDocuments();
|
137 |
+
foreach($documents as $document){
|
138 |
+
$products_id[] = $document->getProductId();
|
139 |
+
}
|
140 |
+
Mage::getSingleton('core/session')->setSelectedProducts($products_id);
|
141 |
+
}
|
142 |
+
|
143 |
+
if($project->canLaunch()){
|
144 |
+
$ongletBlock->addButton ( 'save', array (
|
145 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
|
146 |
+
'onclick' => 'editForm.submit();',
|
147 |
+
'class' => 'save',
|
148 |
+
), - 100 );
|
149 |
+
} else {
|
150 |
+
$ongletBlock->addButton ( 'save', array (
|
151 |
+
'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
|
152 |
+
'onclick' => 'editForm.submit();',
|
153 |
+
'class' => 'save',
|
154 |
+
'disabled'=>'disabled'
|
155 |
+
|
156 |
+
), - 100 );
|
157 |
+
}
|
158 |
+
|
159 |
+
$step3Block->setProject($project);
|
160 |
+
|
161 |
+
$ongletBlock->insert($step3Block);
|
162 |
+
|
163 |
+
$this->_addContent($step3Block);
|
164 |
+
|
165 |
+
break;
|
166 |
+
}
|
167 |
+
|
168 |
+
$this->renderLayout();
|
169 |
+
}
|
170 |
+
else
|
171 |
+
{
|
172 |
+
Mage::getSingleton('adminhtml/session')
|
173 |
+
->addError(Mage::helper('textmaster')->__('Project does not exist'));
|
174 |
+
$this->_redirect('*/*/');
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
public function newAction()
|
179 |
+
{
|
180 |
+
Mage::getSingleton('core/session')->setSelectedProducts(array());
|
181 |
+
Mage::getSingleton('core/session')->setProjectId(0);
|
182 |
+
Mage::getSingleton('core/session')->setProjectInfo(array());
|
183 |
+
$this->_redirect('*/*/edit');
|
184 |
+
}
|
185 |
+
|
186 |
+
public function massAddAction()
|
187 |
+
{
|
188 |
+
$products = $this->getRequest()->getParam('products_id');
|
189 |
+
if(!is_array($products) || !count($products) || empty($products[0])) {
|
190 |
+
$this->_redirect('*/*/edit', array("step" => 1));
|
191 |
+
return;
|
192 |
+
}
|
193 |
+
Mage::getSingleton('core/session')->setSelectedProducts($products);
|
194 |
+
|
195 |
+
|
196 |
+
$this->_redirect('*/*/edit', array("step" => 2));
|
197 |
+
}
|
198 |
+
public function createprojectfromproductAction(){
|
199 |
+
Mage::getSingleton('core/session')->setSelectedProducts(array());
|
200 |
+
Mage::getSingleton('core/session')->setProjectId(0);
|
201 |
+
Mage::getSingleton('core/session')->setProjectInfo(array());
|
202 |
+
|
203 |
+
$product = $this->getRequest()->getParam('id');
|
204 |
+
Mage::getSingleton('core/session')->setSelectedProducts(array($product));
|
205 |
+
$this->_redirect('*/*/edit', array("step" => 2));
|
206 |
+
}
|
207 |
+
|
208 |
+
public function massSendAction()
|
209 |
+
{
|
210 |
+
$docs = $this->getRequest()->getParam('document_id');
|
211 |
+
|
212 |
+
//$projectId = $this->getRequest()->getParam('id');
|
213 |
+
//Mage::getSingleton('core/session')->setSelectedProducts($products);
|
214 |
+
foreach($docs as $doc){
|
215 |
+
|
216 |
+
Mage::getModel('textmaster/document')->load($doc)->send();
|
217 |
+
$projectId = Mage::getModel('textmaster/document')->load($doc)->getTextmasterProjectId();
|
218 |
+
}
|
219 |
+
|
220 |
+
$this->_redirect('*/*/view', array("id" => $projectId));
|
221 |
+
}
|
222 |
+
|
223 |
+
public function viewAction() {
|
224 |
+
$projectId = $this->getRequest()->getParam('id');
|
225 |
+
$projectModel = Mage::getModel('textmaster/project')->load($projectId);
|
226 |
+
if ($projectModel->getId()) {
|
227 |
+
if($projectModel->getStatus() == Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_CREATION){
|
228 |
+
Mage::getSingleton('core/session')->setProjectId($projectModel->getId());
|
229 |
+
if(count($projectModel->getDocuments()))
|
230 |
+
$this->_redirect('*/*/edit',array('step'=>'3'));
|
231 |
+
elseif($projectModel->hasDocumentsNotCount())
|
232 |
+
$this->_redirect('*/*/edit',array('step'=>'2'));
|
233 |
+
else
|
234 |
+
$this->_redirect('*/*/edit',array('step'=>'1'));
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
|
238 |
+
//ACTIONS
|
239 |
+
$action = $this->getRequest()->getParam('a');
|
240 |
+
if($action && is_callable(array($projectModel,$action))){
|
241 |
+
call_user_func(array($projectModel,$action));
|
242 |
+
}
|
243 |
+
|
244 |
+
$this->_initAction();
|
245 |
+
$viewBlock = $this->getLayout()->getBlock('project.view');
|
246 |
+
$viewBlock->setProject($projectModel);
|
247 |
+
$viewBlock->prepareButton();
|
248 |
+
$documentsBlock = $this->getLayout()->getBlock('project.view.documents');
|
249 |
+
$documentsBlock->setProject($projectModel);
|
250 |
+
|
251 |
+
$this->_addContent($documentsBlock);
|
252 |
+
|
253 |
+
|
254 |
+
|
255 |
+
$this->renderLayout();
|
256 |
+
} else {
|
257 |
+
Mage::getSingleton('adminhtml/session')
|
258 |
+
->addError(Mage::helper('textmaster')->__('Project does not exist'));
|
259 |
+
$this->_redirect('*/*/');
|
260 |
+
}
|
261 |
+
}
|
262 |
+
public function masscompletedocAction() {
|
263 |
+
|
264 |
+
$projectId = $this->getRequest()->getParam('id');
|
265 |
+
$project = Mage::getModel('textmaster/project')->load($projectId,null,false);
|
266 |
+
$docs = $this->getRequest()->getParam('document_id');
|
267 |
+
$doc_api_ids = array();
|
268 |
+
foreach($docs as $doc_id){
|
269 |
+
$document = Mage::getModel('textmaster/document')->load($doc_id,null,false);
|
270 |
+
$document->prepareToComplete();
|
271 |
+
$doc_api_ids[]=$document->getDocumentApiId();
|
272 |
+
}
|
273 |
+
|
274 |
+
Mage::helper('textmaster')->getApi()->completeDocuments($project->getProjectApiid(),$doc_api_ids);
|
275 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
276 |
+
$this->getResponse()->setBody( Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/doccompleteready',array('id'=>$projectId)))));
|
277 |
+
//$this->_redirect('*/*/view',array('id'=>$projectId));
|
278 |
+
}
|
279 |
+
public function doccompleteAction() {
|
280 |
+
$documentId = $this->getRequest()->getParam('id');
|
281 |
+
$document = Mage::getModel('textmaster/document')->load($documentId,null,false);
|
282 |
+
if ($document->getId()){
|
283 |
+
$document->sendToComplete();
|
284 |
+
$json = Mage::helper('core')->jsonEncode(
|
285 |
+
array('counturl' => $this->getUrl('*/*/doccompleteready',array('id'=>$document->getTextmasterProjectId())))
|
286 |
+
);
|
287 |
+
} else {
|
288 |
+
$json = Mage::helper('core')->jsonEncode(
|
289 |
+
array()
|
290 |
+
);
|
291 |
+
}
|
292 |
+
|
293 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
294 |
+
$this->getResponse()->setBody($json);
|
295 |
+
//$this->_redirect('*/*/document/',array('id'=>$documentId));
|
296 |
+
}
|
297 |
+
public function doccompletereadyAction() {
|
298 |
+
$timetosleed = 2;
|
299 |
+
sleep($timetosleed);
|
300 |
+
|
301 |
+
|
302 |
+
$projectId = $this->getRequest()->getParam('id');
|
303 |
+
$project = Mage::getModel('textmaster/project');
|
304 |
+
$project->load($projectId,null,false);
|
305 |
+
$docs_all = $project->getDocumentsSendToCompleted();
|
306 |
+
$docs_notcomp = $project->getDocumentsSendNotCompleted();
|
307 |
+
$ndocc = count($docs_notcomp);
|
308 |
+
|
309 |
+
|
310 |
+
if($ndocc!=0) {
|
311 |
+
$ndoc = count($docs_all);
|
312 |
+
|
313 |
+
|
314 |
+
$nd = ($ndoc-$ndocc) / $ndoc;
|
315 |
+
$r = round($nd,2)*100;
|
316 |
+
echo $r;
|
317 |
+
exit;
|
318 |
+
}
|
319 |
+
echo $this->getUrl('*/*/view',array('id'=>$projectId));
|
320 |
+
exit;
|
321 |
+
}
|
322 |
+
public function revisionAction() {
|
323 |
+
$documentId = $this->getRequest()->getParam('id');
|
324 |
+
$message = $this->getRequest()->getParam('message');
|
325 |
+
$document = Mage::getModel('textmaster/document')->load($documentId,null,false);
|
326 |
+
if ($document->getId()){
|
327 |
+
$documents = $document->revision($message);
|
328 |
+
}
|
329 |
+
|
330 |
+
$this->_redirect('*/*/document/',array('id'=>$documentId));
|
331 |
+
}
|
332 |
+
public function documentAction() {
|
333 |
+
$docId = $this->getRequest()->getParam('id');
|
334 |
+
$document = Mage::getModel('textmaster/document')->load($docId,null,true,false);
|
335 |
+
|
336 |
+
if ($document->getId()){
|
337 |
+
$this->_initAction();
|
338 |
+
$documentBlock = $this->getLayout()->getBlock('project.document.view');
|
339 |
+
$documentBlock->setDocument($document);
|
340 |
+
$supporttBlock = $this->getLayout()->getBlock('project.document.supportmessage');
|
341 |
+
$supporttBlock->setDocument($document);
|
342 |
+
$this->renderLayout();
|
343 |
+
} else {
|
344 |
+
$this->_redirect('*/*/');
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
public function massLaunchAction() {
|
349 |
+
$projects = $this->getRequest()->getParam('project_id');
|
350 |
+
foreach($projects as $project_id){
|
351 |
+
Mage::getModel('textmaster/project')->load($project_id,null,false)->launch();
|
352 |
+
}
|
353 |
+
$this->_redirect('*/*/index');
|
354 |
+
}
|
355 |
+
public function massPauseAction() {
|
356 |
+
$projects = $this->getRequest()->getParam('project_id');
|
357 |
+
foreach($projects as $project_id){
|
358 |
+
Mage::getModel('textmaster/project')->load($project_id)->pause();
|
359 |
+
}
|
360 |
+
$this->_redirect('*/*/index');
|
361 |
+
}
|
362 |
+
public function massResumeAction() {
|
363 |
+
$projects = $this->getRequest()->getParam('project_id');
|
364 |
+
foreach($projects as $project_id){
|
365 |
+
Mage::getModel('textmaster/project')->load($project_id)->resume();
|
366 |
+
}
|
367 |
+
$this->_redirect('*/*/index');
|
368 |
+
}
|
369 |
+
public function massCancelAction() {
|
370 |
+
$projects = $this->getRequest()->getParam('project_id');
|
371 |
+
foreach($projects as $project_id){
|
372 |
+
Mage::getModel('textmaster/project')->load($project_id)->cancel();
|
373 |
+
}
|
374 |
+
$this->_redirect('*/*/index');
|
375 |
+
}
|
376 |
+
public function massCompleteAction() {
|
377 |
+
$projects = $this->getRequest()->getParam('project_id');
|
378 |
+
foreach($projects as $project_id){
|
379 |
+
Mage::getModel('textmaster/project')->load($project_id)->complete();
|
380 |
+
}
|
381 |
+
$this->_redirect('*/*/index');
|
382 |
+
}
|
383 |
+
public function massDuplicateAction(){
|
384 |
+
$projects = $this->getRequest()->getParam('project_id');
|
385 |
+
foreach($projects as $project_id){
|
386 |
+
Mage::getModel('textmaster/project')->load($project_id)->duplicate();
|
387 |
+
}
|
388 |
+
$this->_redirect('*/*/index');
|
389 |
+
}
|
390 |
+
|
391 |
+
|
392 |
+
public function createprojectreadyAction(){
|
393 |
+
|
394 |
+
//echo $project->hasDocumentsNotSend()?'0':$this->getUrl('*/*/edit',array('step'=>3));
|
395 |
+
$timetosleed = 2;
|
396 |
+
sleep($timetosleed);
|
397 |
+
|
398 |
+
$projectId = $this->getRequest()->getParam('id');
|
399 |
+
$project = Mage::getModel('textmaster/project');
|
400 |
+
$project->load($projectId,null,false);
|
401 |
+
$docs_all = $project->getDocuments();
|
402 |
+
$docs_notcount = $project->getDocumentsNotCount();
|
403 |
+
|
404 |
+
|
405 |
+
|
406 |
+
if($project->hasDocumentsNotCount()) {
|
407 |
+
$ndoc = count($docs_all);
|
408 |
+
$ndocc = count($docs_notcount);
|
409 |
+
|
410 |
+
/*
|
411 |
+
* Ceinture de sécurité : au cas où l'appel à $project->sendDocuments()
|
412 |
+
* n'ai pas été déjà fait dans le callBack, on le relance ici
|
413 |
+
* */
|
414 |
+
$docs_notsend = $project->getDocumentsNotSend();
|
415 |
+
$ndocs = count($docs_notsend);
|
416 |
+
if($ndocc==$ndocs)
|
417 |
+
$project->sendDocuments();
|
418 |
+
|
419 |
+
|
420 |
+
$nd = $ndoc-$ndocc;
|
421 |
+
$nd = $nd / $ndoc;
|
422 |
+
$r = round($nd,2)*100;
|
423 |
+
echo $r;
|
424 |
+
exit;
|
425 |
+
}
|
426 |
+
//echo '100';
|
427 |
+
echo $this->getUrl('*/*/edit',array('step'=>3));
|
428 |
+
exit;
|
429 |
+
}
|
430 |
+
public function addprojectAction(){
|
431 |
+
$project_id = Mage::getSingleton('core/session')->getProjectId();
|
432 |
+
$project = Mage::getModel('textmaster/project');
|
433 |
+
if($project_id && is_numeric($project_id)){
|
434 |
+
$project->load($project_id);
|
435 |
+
}
|
436 |
+
|
437 |
+
$post = Mage::app()->getRequest()->getPost();
|
438 |
+
|
439 |
+
|
440 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
441 |
+
if($post && count($post)){
|
442 |
+
Mage::getSingleton('core/session')->setProjectInfo($post);
|
443 |
+
$products_id = Mage::getSingleton('core/session')->getSelectedProducts();
|
444 |
+
$text = '';
|
445 |
+
foreach($products_id as $id){
|
446 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
447 |
+
if(isset($post['attribute'])) {
|
448 |
+
foreach($post['attribute'] as $attr){
|
449 |
+
$attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attr);
|
450 |
+
$text .= $product->getData($attribute->getName ()).' ';
|
451 |
+
}
|
452 |
+
}
|
453 |
+
}
|
454 |
+
$word_count = Mage::helper('textmaster')->countWord($text);
|
455 |
+
//$pricing = Mage::helper('textmaster')->getApi()->getPricings($word_count);
|
456 |
+
//$project_id = Mage::getSingleton('core/session')->getProjectId();
|
457 |
+
|
458 |
+
$update = false;
|
459 |
+
if($project_id && is_numeric($project_id)){
|
460 |
+
$project->load($project_id);
|
461 |
+
$project->setName($post['name']);
|
462 |
+
$project->setProjectBriefing($post['project_briefing']);
|
463 |
+
$project->setCtype($post['ctype']);
|
464 |
+
$project->setCategory($post['category']);
|
465 |
+
$project->setStoreIdOrigin($post['store_id_origin']);
|
466 |
+
|
467 |
+
if($post['ctype']=='translation')
|
468 |
+
$project->setStoreIdTranslation($post['store_id_translation']);
|
469 |
+
else
|
470 |
+
$project->setStoreIdTranslation($post['store_id_origin']);
|
471 |
+
|
472 |
+
$project->setLanguageLevel($post['language_level']);
|
473 |
+
if(isset($post['specific_attachment']))
|
474 |
+
$project->setSpecificAttachment($post['specific_attachment']);
|
475 |
+
$project->setPriority($post['priority']);
|
476 |
+
if(!isset($post['quality'])) $post['quality'] = 0;
|
477 |
+
$project->setQuality($post['quality']);
|
478 |
+
$project->setExpertise($post['expertise']);
|
479 |
+
$project->setSameAuthorMustDoEntireProject($post['same_author_must_do_entire_project']);
|
480 |
+
if(isset($post['ismytextmaster']))
|
481 |
+
$project->setIsmytextmaster($post['ismytextmaster']);
|
482 |
+
if(isset($post['mytextmaster'])) {
|
483 |
+
$project->setTextmasters($post['mytextmaster']);
|
484 |
+
}
|
485 |
+
|
486 |
+
$update = true;
|
487 |
+
|
488 |
+
$documents = $project->getDocuments();
|
489 |
+
$products_id = Mage::getSingleton('core/session')->getSelectedProducts();
|
490 |
+
foreach($documents as $document){
|
491 |
+
$document->delete();
|
492 |
+
}
|
493 |
+
$project_attributes = $project->getAttributes();
|
494 |
+
foreach($project_attributes as $project_attribute){
|
495 |
+
$project_attribute->delete();
|
496 |
+
}
|
497 |
+
|
498 |
+
} else {
|
499 |
+
if($post['ctype']!='translation')
|
500 |
+
$post['store_id_translation'] = $post['store_id_origin'];
|
501 |
+
$project->setData($post);
|
502 |
+
}
|
503 |
+
|
504 |
+
try {
|
505 |
+
$project->save();
|
506 |
+
if($project->getId()){
|
507 |
+
Mage::getSingleton('core/session')->setProjectId($project->getId());
|
508 |
+
if(is_array($post['attribute'])) {
|
509 |
+
foreach($post['attribute'] as $attr){
|
510 |
+
$project_attribute = Mage::getModel('textmaster/project_attribute');
|
511 |
+
$project_attribute->setTextmasterAttributeId($attr);
|
512 |
+
$project_attribute->setTextmasterProjectId($project->getId());
|
513 |
+
$project_attribute->save();
|
514 |
+
}
|
515 |
+
}
|
516 |
+
$products_id = Mage::getSingleton('core/session')->getSelectedProducts();
|
517 |
+
|
518 |
+
|
519 |
+
$documents = array();
|
520 |
+
$nbsend = 0;
|
521 |
+
foreach($products_id as $id){
|
522 |
+
$product = Mage::getModel('catalog/product')->setStoreId( $project->getStoreIdOrigin() )->load($id);
|
523 |
+
$document = Mage::getModel('textmaster/document');
|
524 |
+
$document->setProject($project);
|
525 |
+
$document->setName($product->getName());
|
526 |
+
$document->setProductId($id);
|
527 |
+
$document->setTextmasterProjectId($project->getId());
|
528 |
+
$document->setSend(0);
|
529 |
+
$document->save();
|
530 |
+
$documents[]=$document;
|
531 |
+
$nbsend++;
|
532 |
+
}
|
533 |
+
|
534 |
+
$project->sendDocuments();
|
535 |
+
|
536 |
+
$json = Mage::helper('core')->jsonEncode(
|
537 |
+
array(
|
538 |
+
'url'=>$this->getUrl('*/*/edit',array('step'=>3)),
|
539 |
+
'counturl' => $this->getUrl('*/*/createprojectready',array('id'=>$project->getId()))
|
540 |
+
|
541 |
+
)
|
542 |
+
);
|
543 |
+
$this->getResponse()->setBody($json);
|
544 |
+
} else {
|
545 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('textmaster')->__('Project creation error'));
|
546 |
+
$json = Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/edit',array('step'=>2))));
|
547 |
+
$this->getResponse()->setBody($json);
|
548 |
+
}
|
549 |
+
} catch (Exception $e){
|
550 |
+
Mage::getSingleton('core/session')->addError($e->getMessage());
|
551 |
+
$json = Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/edit',array('step'=>2,'reload'=>1))));
|
552 |
+
$this->getResponse()->setBody($json);
|
553 |
+
}
|
554 |
+
|
555 |
+
return;
|
556 |
+
}
|
557 |
+
$json = Mage::helper('core')->jsonEncode(array('erreur'=>$e->getMessage()));
|
558 |
+
//throw new Exception('Project creation error');
|
559 |
+
$this->getResponse()->setBody('NO POST');
|
560 |
+
}
|
561 |
+
|
562 |
+
|
563 |
+
|
564 |
+
public function authorAction (){
|
565 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
566 |
+
$post = Mage::app()->getRequest()->getPost();
|
567 |
+
if($post && count($post)==10){
|
568 |
+
$post['options'] = array(
|
569 |
+
'language_level' => $post['language_level'],
|
570 |
+
//'quality' => $post['quality'],
|
571 |
+
//'priority' => $post['priority'],
|
572 |
+
//'expertise' => $post['expertise'],
|
573 |
+
//'specific_attachment' => $post['specific_attachment'],
|
574 |
+
);
|
575 |
+
//$post['total_word_count'] = $post['word_count'];
|
576 |
+
unset($post['language_level']);
|
577 |
+
unset($post['quality']);
|
578 |
+
unset($post['priority']);
|
579 |
+
unset($post['expertise']);
|
580 |
+
unset($post['specific_attachment']);
|
581 |
+
unset($post['form_key']);
|
582 |
+
unset($post['word_count']);
|
583 |
+
|
584 |
+
$post['language_from'] = substr(Mage::getStoreConfig('general/locale/code',$post['language_from']),0,2);
|
585 |
+
|
586 |
+
if($post['ctype']!='translation') {
|
587 |
+
unset($post['language_to']);
|
588 |
+
} else {
|
589 |
+
$post['language_to'] = substr(Mage::getStoreConfig('general/locale/code',$post['language_to']),0,2);
|
590 |
+
}
|
591 |
+
try{
|
592 |
+
$authors = Mage::helper('textmaster')->getApi()->getAuthorsFilter($post);
|
593 |
+
if(isset($authors['error'])){
|
594 |
+
throw new Exception($authors['error']);
|
595 |
+
}
|
596 |
+
$result['authors'] = $authors['authors'];
|
597 |
+
|
598 |
+
} catch (Exception $e){
|
599 |
+
$result['error'] = $e->getMessage();
|
600 |
+
}
|
601 |
+
|
602 |
+
|
603 |
+
} else {
|
604 |
+
$result['error'] = Mage::helper('textmaster')->__('No post');
|
605 |
+
}
|
606 |
+
$json = Mage::helper('core')->jsonEncode($result);
|
607 |
+
$this->getResponse()->setBody($json);
|
608 |
+
}
|
609 |
+
|
610 |
+
|
611 |
+
public function getmyauthorsAction(){
|
612 |
+
|
613 |
+
$projectId = $this->getRequest()->getParam('id');
|
614 |
+
$projectModel = Mage::getModel('textmaster/project')->load($projectId);
|
615 |
+
if ($projectModel->getId()) {
|
616 |
+
$this->loadLayout();
|
617 |
+
$d = $projectModel->getData();
|
618 |
+
$post = Mage::app()->getRequest()->getPost();
|
619 |
+
if(count($post) && !isset($post['textmasters'])) $post['textmasters']=array();
|
620 |
+
try{
|
621 |
+
if($post && count($post) && isset($post['textmasters'])){
|
622 |
+
if(is_array($post['textmasters'])){
|
623 |
+
$projectModel->saveTextmasters($post['textmasters']);
|
624 |
+
} elseif(is_string($post['textmasters'])){
|
625 |
+
$projectModel->saveTextmasters(array($post['textmasters']));
|
626 |
+
}
|
627 |
+
|
628 |
+
Mage::getSingleton('adminhtml/session')
|
629 |
+
->addSuccess(Mage::helper('textmaster')->__('Textmasters saved'));
|
630 |
+
}
|
631 |
+
} catch (Exception $e){
|
632 |
+
Mage::log(__LINE__.' : '.$e->getMessage(), null, 'textmaster.log');
|
633 |
+
}
|
634 |
+
$viewBlock = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step3_form_author');
|
635 |
+
$viewBlock->setProject($projectModel);
|
636 |
+
$this->getLayout()->getBlock('step3_author')->setChild('form',$viewBlock);;
|
637 |
+
$this->renderLayout();
|
638 |
+
return ;
|
639 |
+
}
|
640 |
+
exit;
|
641 |
+
}
|
642 |
+
//ster/adminhtml_project/getmyauthors/id/53/key/bed5288e3b1f1d075710db7ab5b6a207/
|
643 |
+
}
|
app/code/community/Textmaster/Textmaster/controllers/CallbackController.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_CallbackController extends Mage_Core_Controller_Front_Action
|
27 |
+
{
|
28 |
+
public function indexAction()
|
29 |
+
{
|
30 |
+
$this->loadLayout();
|
31 |
+
$this->renderLayout();
|
32 |
+
}
|
33 |
+
public function documentcountAction()
|
34 |
+
{
|
35 |
+
$params = $this->getRequest()->getParams();
|
36 |
+
$postData = $this->getRequest()->getPost();
|
37 |
+
|
38 |
+
$postData = json_decode(file_get_contents('php://input'));
|
39 |
+
// recupere les donnée poster en JSON
|
40 |
+
Mage::log('Callback documentcount '.(isset($postData->id)?$postData->id:'id inconnu'),null,'textmaster.log');
|
41 |
+
|
42 |
+
if(is_object($postData) && isset($postData->id) && strlen($postData->id)==24) {
|
43 |
+
$document = Mage::getModel('textmaster/document')->loadByApiId($postData->id);
|
44 |
+
if($document->getId()) {
|
45 |
+
$document->setCounted(1);
|
46 |
+
$document->save();
|
47 |
+
|
48 |
+
//On renvoie un batch de 20 documents si il en reste à envoyer sur le projet
|
49 |
+
//quand on a "compté" tous ceux qui ont déjà été envoyé
|
50 |
+
$project = $document->getProject();
|
51 |
+
$docs_notsend = $project->getDocumentsNotSend();
|
52 |
+
|
53 |
+
if($project->hasDocumentsNotSend()) {
|
54 |
+
$docs_notcount = $project->getDocumentsNotCount();
|
55 |
+
$ndocc = count($docs_notcount);
|
56 |
+
$ndocs = count($docs_notsend);
|
57 |
+
if($ndocc==$ndocs) {
|
58 |
+
$project->sendDocuments();
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
}
|
64 |
+
$this->loadLayout();
|
65 |
+
$this->renderLayout();
|
66 |
+
}
|
67 |
+
public function documentcompleteAction()
|
68 |
+
{
|
69 |
+
$params = $this->getRequest()->getParams();
|
70 |
+
$postData = $this->getRequest()->getPost();
|
71 |
+
|
72 |
+
$postData = json_decode(file_get_contents('php://input'));
|
73 |
+
// recupere les donnée poster en JSON
|
74 |
+
Mage::log('Callback documentcomplete '.(isset($postData->id)?$postData->id:'id inconnu'),null,'textmaster.log');
|
75 |
+
|
76 |
+
if(is_object($postData) && isset($postData->id) && strlen($postData->id)==24) {
|
77 |
+
$document = Mage::getModel('textmaster/document')->loadByApiId($postData->id);
|
78 |
+
if($document->getId()) {
|
79 |
+
$document->complete();
|
80 |
+
} else {
|
81 |
+
//Mage::log('not loaded',null,'textmaster.log');
|
82 |
+
}
|
83 |
+
} else {
|
84 |
+
}
|
85 |
+
$this->loadLayout();
|
86 |
+
$this->renderLayout();
|
87 |
+
}
|
88 |
+
public function inprogressAction(){
|
89 |
+
$postData = json_decode(file_get_contents('php://input'));
|
90 |
+
Mage::log('CALLBACK IN PROGRESS',null,'textmaster.log');
|
91 |
+
Mage::log($postData,null,'textmaster.log');
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Textmaster/Textmaster/controllers/IndexController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Textmaster_Textmaster_IndexController extends Mage_Core_Controller_Front_Action
|
27 |
+
{
|
28 |
+
public function indexAction()
|
29 |
+
{
|
30 |
+
$this->loadLayout();
|
31 |
+
$this->renderLayout();
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Textmaster/Textmaster/etc/config.xml
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 Textmaster
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Textmaster_Textmaster
|
14 |
+
* @copyright Copyright (c) 2014 Textmaster
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Textmaster_Textmaster
|
21 |
+
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Textmaster_Textmaster
|
24 |
+
* @copyright Copyright (c) 2014 Textmaster
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
|
30 |
+
<modules>
|
31 |
+
<Textmaster_Textmaster>
|
32 |
+
<version>0.1.0</version>
|
33 |
+
</Textmaster_Textmaster>
|
34 |
+
</modules>
|
35 |
+
<global>
|
36 |
+
<helpers>
|
37 |
+
<textmaster><class>Textmaster_Textmaster_Helper</class></textmaster>
|
38 |
+
</helpers>
|
39 |
+
<blocks>
|
40 |
+
<textmaster><class>Textmaster_Textmaster_Block</class></textmaster>
|
41 |
+
<adminhtml>
|
42 |
+
<rewrite>
|
43 |
+
<catalog_product_grid>Textmaster_Textmaster_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
|
44 |
+
</rewrite>
|
45 |
+
</adminhtml>
|
46 |
+
</blocks>
|
47 |
+
<models>
|
48 |
+
<textmaster>
|
49 |
+
<class>Textmaster_Textmaster_Model</class>
|
50 |
+
<resourceModel>textmaster_mysql4</resourceModel>
|
51 |
+
</textmaster>
|
52 |
+
<textmaster_mysql4>
|
53 |
+
<class>Textmaster_Textmaster_Model_Mysql4</class>
|
54 |
+
<entities>
|
55 |
+
<project>
|
56 |
+
<table>textmaster_project</table>
|
57 |
+
</project>
|
58 |
+
<document>
|
59 |
+
<table>textmaster_document</table>
|
60 |
+
</document>
|
61 |
+
<project_attribute>
|
62 |
+
<table>textmaster_project_attribute</table>
|
63 |
+
</project_attribute>
|
64 |
+
</entities>
|
65 |
+
</textmaster_mysql4>
|
66 |
+
</models>
|
67 |
+
<resources>
|
68 |
+
<textmaster_setup>
|
69 |
+
<setup>
|
70 |
+
<module>Textmaster_Textmaster</module>
|
71 |
+
</setup>
|
72 |
+
<connection>
|
73 |
+
<use>core_setup</use>
|
74 |
+
</connection>
|
75 |
+
</textmaster_setup>
|
76 |
+
<textmaster_write>
|
77 |
+
<connection>
|
78 |
+
<use>core_write</use>
|
79 |
+
</connection>
|
80 |
+
</textmaster_write>
|
81 |
+
<textmaster_read>
|
82 |
+
<connection>
|
83 |
+
<use>core_read</use>
|
84 |
+
</connection>
|
85 |
+
</textmaster_read>
|
86 |
+
</resources>
|
87 |
+
<events>
|
88 |
+
<adminhtml_block_html_before>
|
89 |
+
<observers>
|
90 |
+
<textmaster_product_translate_hook>
|
91 |
+
<type>singleton</type>
|
92 |
+
<class>textmaster/observer</class>
|
93 |
+
<method>_productCreateBlock</method>
|
94 |
+
</textmaster_product_translate_hook>
|
95 |
+
</observers>
|
96 |
+
</adminhtml_block_html_before>
|
97 |
+
</events>
|
98 |
+
</global>
|
99 |
+
<admin>
|
100 |
+
<routers>
|
101 |
+
<textmaster>
|
102 |
+
<use>admin</use>
|
103 |
+
<args>
|
104 |
+
<module>Textmaster_Textmaster</module>
|
105 |
+
<frontName>textmaster</frontName>
|
106 |
+
</args>
|
107 |
+
</textmaster>
|
108 |
+
</routers>
|
109 |
+
</admin>
|
110 |
+
<adminhtml>
|
111 |
+
<menu>
|
112 |
+
<textmaster translate="title" module="textmaster">
|
113 |
+
<title>TextMaster</title>
|
114 |
+
<sort_order>100</sort_order>
|
115 |
+
<children>
|
116 |
+
<projet translate="title" module="textmaster">
|
117 |
+
<title>Manage Projects</title>
|
118 |
+
<action>textmaster/adminhtml_project</action>
|
119 |
+
</projet>
|
120 |
+
<config translate="title" module="textmaster">
|
121 |
+
<title>Configuration</title>
|
122 |
+
<action>adminhtml/system_config/edit/section/textmaster</action>
|
123 |
+
</config>
|
124 |
+
</children>
|
125 |
+
</textmaster>
|
126 |
+
</menu>
|
127 |
+
<acl>
|
128 |
+
<resources>
|
129 |
+
<all>
|
130 |
+
<title>Allow Everything</title>
|
131 |
+
</all>
|
132 |
+
<admin>
|
133 |
+
<children>
|
134 |
+
<textmaster translate="title" module="textmaster">
|
135 |
+
<title>Textmaster</title>
|
136 |
+
<sort_order>65</sort_order>
|
137 |
+
<children>
|
138 |
+
<projet translate="title">
|
139 |
+
<title>Manage Projects</title>
|
140 |
+
</projet>
|
141 |
+
<config translate="title">
|
142 |
+
<title>Configuration</title>
|
143 |
+
</config>
|
144 |
+
</children>
|
145 |
+
</textmaster>
|
146 |
+
<system>
|
147 |
+
<children>
|
148 |
+
<config>
|
149 |
+
<children>
|
150 |
+
<textmaster translate="title">
|
151 |
+
<title>textmaster section</title>
|
152 |
+
<sort_order>100</sort_order>
|
153 |
+
</textmaster>
|
154 |
+
</children>
|
155 |
+
</config>
|
156 |
+
</children>
|
157 |
+
</system>
|
158 |
+
</children>
|
159 |
+
</admin>
|
160 |
+
</resources>
|
161 |
+
</acl>
|
162 |
+
<layout>
|
163 |
+
<updates>
|
164 |
+
<textmaster>
|
165 |
+
<file>textmaster.xml</file>
|
166 |
+
</textmaster>
|
167 |
+
</updates>
|
168 |
+
</layout>
|
169 |
+
<api>
|
170 |
+
<documents>
|
171 |
+
<send>
|
172 |
+
<nb>20</nb>
|
173 |
+
</send>
|
174 |
+
</documents>
|
175 |
+
<sandbox>0</sandbox>
|
176 |
+
<staging>0</staging>
|
177 |
+
</api>
|
178 |
+
<translate>
|
179 |
+
<modules>
|
180 |
+
<Textmaster_Textmaster>
|
181 |
+
<files>
|
182 |
+
<default>Textmaster_Textmaster.csv</default>
|
183 |
+
</files>
|
184 |
+
</Textmaster_Textmaster>
|
185 |
+
</modules>
|
186 |
+
</translate>
|
187 |
+
</adminhtml>
|
188 |
+
<frontend>
|
189 |
+
<routers>
|
190 |
+
<textmaster>
|
191 |
+
<use>standard</use>
|
192 |
+
<args>
|
193 |
+
<module>Textmaster_Textmaster</module>
|
194 |
+
<frontName>textmaster</frontName>
|
195 |
+
</args>
|
196 |
+
</textmaster>
|
197 |
+
</routers>
|
198 |
+
</frontend>
|
199 |
+
<default>
|
200 |
+
<textmaster>
|
201 |
+
<defaultvalue>
|
202 |
+
<category>C019</category><!-- Commerce -->
|
203 |
+
</defaultvalue>
|
204 |
+
</textmaster>
|
205 |
+
</default>
|
206 |
+
</config>
|
app/code/community/Textmaster/Textmaster/etc/jstranslator.xml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 Textmaster
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Textmaster_Textmaster
|
14 |
+
* @copyright Copyright (c) 2014 Textmaster
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Textmaster_Textmaster
|
21 |
+
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Textmaster_Textmaster
|
24 |
+
* @copyright Copyright (c) 2014 Textmaster
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<jstranslator>
|
29 |
+
<textmaster_control_quality translate="message" module="textmaster">
|
30 |
+
<message>Control Quality</message>
|
31 |
+
</textmaster_control_quality>
|
32 |
+
<textmaster_priority translate="message" module="textmaster">
|
33 |
+
<message>Priority</message>
|
34 |
+
</textmaster_priority>
|
35 |
+
<textmaster_expertise translate="message" module="textmaster">
|
36 |
+
<message>Expertise</message>
|
37 |
+
</textmaster_expertise>
|
38 |
+
<textmaster_word translate="message" module="textmaster">
|
39 |
+
<message>word</message>
|
40 |
+
</textmaster_word>
|
41 |
+
<textmaster_word translate="message" module="textmaster">
|
42 |
+
<message>word</message>
|
43 |
+
</textmaster_word>
|
44 |
+
|
45 |
+
</jstranslator>
|
app/code/community/Textmaster/Textmaster/etc/system.xml
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 Textmaster
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Textmaster_Textmaster
|
14 |
+
* @copyright Copyright (c) 2014 Textmaster
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Textmaster_Textmaster
|
21 |
+
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Textmaster_Textmaster
|
24 |
+
* @copyright Copyright (c) 2014 Textmaster
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<tabs>
|
30 |
+
<addonline translate="label">
|
31 |
+
<label>Addonline config</label>
|
32 |
+
<sort_order>203</sort_order>
|
33 |
+
</addonline>
|
34 |
+
</tabs>
|
35 |
+
<sections>
|
36 |
+
<textmaster translate="label">
|
37 |
+
<label>Textmaster</label>
|
38 |
+
<tab>addonline</tab>
|
39 |
+
<active>true</active>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>150</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<groups>
|
46 |
+
<textmaster translate="label" module="textmaster">
|
47 |
+
<label>TextMaster Login</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>18</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
<fields>
|
54 |
+
<istextmasterlog>
|
55 |
+
<label></label>
|
56 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
57 |
+
<frontend_model>textmaster/adminhtml_system_config_form_field_islog</frontend_model>
|
58 |
+
<sort_order>100</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</istextmasterlog>
|
63 |
+
<login translate="label">
|
64 |
+
<label>Login</label>
|
65 |
+
<frontend_model>textmaster/adminhtml_system_config_form_field_login</frontend_model>
|
66 |
+
<sort_order>10</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
<depends><istextmasterlog>0</istextmasterlog></depends>
|
71 |
+
</login>
|
72 |
+
<creation translate="label">
|
73 |
+
<label>Create your account</label>
|
74 |
+
<frontend_model>textmaster/adminhtml_system_config_form_field_creation</frontend_model>
|
75 |
+
<sort_order>15</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
<depends><istextmasterlog>0</istextmasterlog></depends>
|
80 |
+
</creation>
|
81 |
+
<api_key translate="label">
|
82 |
+
<label>API Key</label>
|
83 |
+
<frontend_type>text</frontend_type>
|
84 |
+
<sort_order>25</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
<depends><istextmasterlog>1</istextmasterlog></depends>
|
89 |
+
</api_key>
|
90 |
+
<api_secret translate="label">
|
91 |
+
<label>API secret</label>
|
92 |
+
<frontend_type>text</frontend_type>
|
93 |
+
<sort_order>30</sort_order>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>1</show_in_store>
|
97 |
+
<depends><istextmasterlog>1</istextmasterlog></depends>
|
98 |
+
</api_secret>
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
</fields>
|
103 |
+
</textmaster>
|
104 |
+
<defaultvalue translate="label" module="textmaster">
|
105 |
+
<label>Default values</label>
|
106 |
+
<frontend_type>text</frontend_type>
|
107 |
+
<sort_order>19</sort_order>
|
108 |
+
<show_in_default>1</show_in_default>
|
109 |
+
<show_in_website>1</show_in_website>
|
110 |
+
<show_in_store>1</show_in_store>
|
111 |
+
<fields>
|
112 |
+
|
113 |
+
<default_type translate="label">
|
114 |
+
<label>Activities</label>
|
115 |
+
<frontend_type>select</frontend_type>
|
116 |
+
<source_model>textmaster/source_api_type</source_model>
|
117 |
+
<sort_order>5</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
|
122 |
+
</default_type>
|
123 |
+
<default_language translate="label">
|
124 |
+
<label>Product Default Language</label>
|
125 |
+
<frontend_type>select</frontend_type>
|
126 |
+
<source_model>textmaster/source_api_lang</source_model>
|
127 |
+
<sort_order>10</sort_order>
|
128 |
+
<show_in_default>1</show_in_default>
|
129 |
+
<show_in_website>1</show_in_website>
|
130 |
+
<show_in_store>1</show_in_store>
|
131 |
+
|
132 |
+
</default_language>
|
133 |
+
<briefing_message_translation translate="label">
|
134 |
+
<label>Briefing message for translation</label>
|
135 |
+
<frontend_model>textmaster/adminhtml_system_config_form_field_briefing</frontend_model>
|
136 |
+
<sort_order>15</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
|
141 |
+
</briefing_message_translation>
|
142 |
+
<briefing_message_proofreading translate="label">
|
143 |
+
<label>Briefing message for proofreading</label>
|
144 |
+
<frontend_model>textmaster/adminhtml_system_config_form_field_briefing</frontend_model>
|
145 |
+
<sort_order>16</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
|
150 |
+
</briefing_message_proofreading>
|
151 |
+
<category translate="label">
|
152 |
+
<label>Category</label>
|
153 |
+
<frontend_type>select</frontend_type>
|
154 |
+
<source_model>textmaster/source_api_category</source_model>
|
155 |
+
<sort_order>25</sort_order>
|
156 |
+
<show_in_default>1</show_in_default>
|
157 |
+
<show_in_website>1</show_in_website>
|
158 |
+
<show_in_store>1</show_in_store>
|
159 |
+
|
160 |
+
</category>
|
161 |
+
<single_author translate="label">
|
162 |
+
<label>Single author</label>
|
163 |
+
<frontend_type>select</frontend_type>
|
164 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
165 |
+
<sort_order>30</sort_order>
|
166 |
+
<show_in_default>1</show_in_default>
|
167 |
+
<show_in_website>1</show_in_website>
|
168 |
+
<show_in_store>1</show_in_store>
|
169 |
+
|
170 |
+
</single_author>
|
171 |
+
<author translate="label">
|
172 |
+
<label>Favorite authors</label>
|
173 |
+
<frontend_type>multiselect</frontend_type>
|
174 |
+
<source_model>textmaster/source_api_author</source_model>
|
175 |
+
<sort_order>35</sort_order>
|
176 |
+
<show_in_default>1</show_in_default>
|
177 |
+
<show_in_website>1</show_in_website>
|
178 |
+
<show_in_store>1</show_in_store>
|
179 |
+
|
180 |
+
</author>
|
181 |
+
<type_vocabulary translate="label">
|
182 |
+
<label>Type of vocabulary</label>
|
183 |
+
<frontend_type>select</frontend_type>
|
184 |
+
<source_model>textmaster/source_api_vocabulary</source_model>
|
185 |
+
<sort_order>40</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>1</show_in_website>
|
188 |
+
<show_in_store>1</show_in_store>
|
189 |
+
|
190 |
+
</type_vocabulary>
|
191 |
+
<target_audience translate="label">
|
192 |
+
<label>Target audience</label>
|
193 |
+
<frontend_type>select</frontend_type>
|
194 |
+
<source_model>textmaster/source_api_audience</source_model>
|
195 |
+
<sort_order>45</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>1</show_in_store>
|
199 |
+
|
200 |
+
</target_audience>
|
201 |
+
<grammatical_person translate="label">
|
202 |
+
<label>Grammatical Person</label>
|
203 |
+
<frontend_type>select</frontend_type>
|
204 |
+
<source_model>textmaster/source_api_grammatical</source_model>
|
205 |
+
<sort_order>50</sort_order>
|
206 |
+
<show_in_default>1</show_in_default>
|
207 |
+
<show_in_website>1</show_in_website>
|
208 |
+
<show_in_store>1</show_in_store>
|
209 |
+
|
210 |
+
</grammatical_person>
|
211 |
+
<expertise translate="label">
|
212 |
+
<label>Expertise</label>
|
213 |
+
<frontend_type>select</frontend_type>
|
214 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
215 |
+
<sort_order>55</sort_order>
|
216 |
+
<show_in_default>1</show_in_default>
|
217 |
+
<show_in_website>1</show_in_website>
|
218 |
+
<show_in_store>1</show_in_store>
|
219 |
+
|
220 |
+
</expertise>
|
221 |
+
</fields>
|
222 |
+
</defaultvalue>
|
223 |
+
</groups>
|
224 |
+
</textmaster>
|
225 |
+
</sections>
|
226 |
+
</config>
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
$installer = $this;
|
31 |
+
$installer->startSetup();
|
32 |
+
|
33 |
+
$installer->run("
|
34 |
+
DROP TABLE IF EXISTS `{$this->getTable('textmaster_document')}`;
|
35 |
+
CREATE TABLE `{$this->getTable('textmaster_document')}` (
|
36 |
+
`textmaster_document_id` int(11) NOT NULL auto_increment,
|
37 |
+
`textmaster_project_id` int(11) NOT NULL,
|
38 |
+
`product_id` int(10) unsigned NOT NULL,
|
39 |
+
`document_api_id` varchar(60) default NULL,
|
40 |
+
`name` varchar(45) default NULL,
|
41 |
+
`send` tinyint(1) default '0',
|
42 |
+
`updated_at` datetime default NULL,
|
43 |
+
`created_at` datetime default NULL,
|
44 |
+
`counted` tinyint(1) default '0',
|
45 |
+
PRIMARY KEY (`textmaster_document_id`),
|
46 |
+
KEY `fk_textmaster_document_textmaster_project1_idx` (`textmaster_project_id`),
|
47 |
+
KEY `fk_textmaster_document_catalog_product_entity1_idx` (`product_id`),
|
48 |
+
CONSTRAINT `fk_textmaster_document_catalog_product_entity1` FOREIGN KEY (`product_id`) REFERENCES `{$this->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
49 |
+
CONSTRAINT `fk_textmaster_document_textmaster_project1` FOREIGN KEY (`textmaster_project_id`) REFERENCES `{$this->getTable('textmaster_project')}` (`textmaster_project_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
50 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;"
|
51 |
+
);
|
52 |
+
|
53 |
+
$installer->run("
|
54 |
+
DROP TABLE IF EXISTS `{$this->getTable('textmaster_project_attribute')}`;
|
55 |
+
CREATE TABLE `{$this->getTable('textmaster_project_attribute')}` (
|
56 |
+
`textmaster_project_attribute_id` int(11) NOT NULL auto_increment,
|
57 |
+
`textmaster_attribute_id` int(11) default NULL,
|
58 |
+
`textmaster_project_id` int(11) default NULL,
|
59 |
+
PRIMARY KEY (`textmaster_project_attribute_id`)
|
60 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
61 |
+
");
|
62 |
+
|
63 |
+
$installer->run("
|
64 |
+
DROP TABLE IF EXISTS `{$this->getTable('textmaster_project')}`;
|
65 |
+
CREATE TABLE `{$this->getTable('textmaster_project')}` (
|
66 |
+
`textmaster_project_id` int(11) NOT NULL auto_increment,
|
67 |
+
`store_id_origin` smallint(5) unsigned NOT NULL,
|
68 |
+
`store_id_translation` smallint(5) unsigned NOT NULL,
|
69 |
+
`name` varchar(45) default NULL,
|
70 |
+
`status` varchar(45) default NULL,
|
71 |
+
`project_apiid` varchar(50) default NULL,
|
72 |
+
`textmasters` text,
|
73 |
+
`documents_transfert` tinyint(1) default '0',
|
74 |
+
PRIMARY KEY (`textmaster_project_id`),
|
75 |
+
KEY `fk_textmaster_project_core_store1_idx` (`store_id_origin`),
|
76 |
+
KEY `fk_textmaster_project_core_store2_idx` (`store_id_translation`),
|
77 |
+
CONSTRAINT `fk_textmaster_project_core_store1` FOREIGN KEY (`store_id_origin`) REFERENCES `{$this->getTable('core_store')}` (`store_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
78 |
+
CONSTRAINT `fk_textmaster_project_core_store2` FOREIGN KEY (`store_id_translation`) REFERENCES `{$this->getTable('core_store')}` (`store_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
79 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
80 |
+
");
|
81 |
+
|
82 |
+
// Configation par defaut des category
|
83 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/category', 'path');
|
84 |
+
$configData->setPath('textmaster/defaultvalue/category')
|
85 |
+
->setValue('C019')
|
86 |
+
->save();
|
87 |
+
|
88 |
+
|
89 |
+
//configuration par defaut du briefing
|
90 |
+
$admin_locale_code = Mage::getStoreConfig('general/locale/code');
|
91 |
+
if(substr($admin_locale_code,0,2)=='fr') {
|
92 |
+
$t1 = "Bonjour, Merci de traduire aussi fidèlement que possible le texte fourni en veillant à bien adapter les tournures et phrases dans votre langue maternelle pour garantir une bonne fluidité du texte. Merci aussi de conserver la mise en forme et les balises HTML.";
|
93 |
+
$t2 = "Bonjour, Merci de corriger le texte fourni en veillant à conserver la structure du contenu. Vous devez corriger toutes les fautes d'orthographe, de grammaire (etc.) sans modifier l'organisation des phrases. Merci aussi de conserver la mise en forme et les balises HTML.";
|
94 |
+
} else {
|
95 |
+
$t1 = "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.";
|
96 |
+
$t2 = "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";
|
97 |
+
}
|
98 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/briefing_message_translation', 'path');
|
99 |
+
$configData->setPath('textmaster/defaultvalue/briefing_message_translation')
|
100 |
+
->setValue($t1)
|
101 |
+
->save();
|
102 |
+
|
103 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/briefing_message_proofreading', 'path');
|
104 |
+
$configData->setPath('textmaster/defaultvalue/briefing_message_proofreading')
|
105 |
+
->setValue($t2)
|
106 |
+
->save();
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.1-0.0.2.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
|
31 |
+
$installer = $this;
|
32 |
+
$installer->startSetup();
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
$installer->run("ALTER TABLE `{$this->getTable('textmaster_project')}`
|
37 |
+
ADD COLUMN `textmaster_user` VARCHAR(45) NULL AFTER `documents_transfert`;
|
38 |
+
");
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.2-0.0.3.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
30 |
+
*/
|
31 |
+
|
32 |
+
$installer = $this;
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
$admin_locale_code = Mage::getStoreConfig('general/locale/code');
|
36 |
+
if(substr($admin_locale_code,0,2)=='fr') {
|
37 |
+
$t1 = "Bonjour, Merci de traduire aussi fidèlement que possible le texte fourni en veillant à bien adapter les tournures et phrases dans votre langue maternelle pour garantir une bonne fluidité du texte. Merci aussi de conserver la mise en forme et les balises HTML.";
|
38 |
+
$t2 = "Bonjour, Merci de corriger le texte fourni en veillant à conserver la structure du contenu. Vous devez corriger toutes les fautes d'orthographe, de grammaire (etc.) sans modifier l'organisation des phrases. Merci aussi de conserver la mise en forme et les balises HTML.";
|
39 |
+
} else {
|
40 |
+
$t1 = "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.";
|
41 |
+
$t2 = "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";
|
42 |
+
}
|
43 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/briefing_message_translation', 'path');
|
44 |
+
$configData->setPath('textmaster/defaultvalue/briefing_message_translation')
|
45 |
+
->setValue($t1)
|
46 |
+
->save();
|
47 |
+
|
48 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/briefing_message_proofreading', 'path');
|
49 |
+
$configData->setPath('textmaster/defaultvalue/briefing_message_proofreading')
|
50 |
+
->setValue($t2)
|
51 |
+
->save();
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.3-0.0.4.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
$installer = $this;
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
$installer->run("ALTER TABLE `{$this->getTable('textmaster_document')}`
|
38 |
+
ADD COLUMN `sendforcomplete` TINYINT(1) NULL AFTER `counted`,
|
39 |
+
ADD COLUMN `completed` TINYINT(1) NULL AFTER `sendforcomplete`;
|
40 |
+
");
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.4-0.0.5.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
$installer = $this;
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
$installer->run("ALTER TABLE `{$this->getTable('textmaster_document')}`
|
38 |
+
ADD COLUMN `encourscomplete` TINYINT(1) NULL AFTER `completed`;
|
39 |
+
");
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.5-0.0.6.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
$installer = $this;
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
$_api = Mage::helper('textmaster')->getApi();
|
36 |
+
$languages = $_api->getLanguages();
|
37 |
+
|
38 |
+
foreach ($languages as $langue){
|
39 |
+
$admin_locale_code = $langue['code'];
|
40 |
+
if(substr($admin_locale_code,0,2)=='fr') {
|
41 |
+
$t1 = "Bonjour, Merci de traduire aussi fidèlement que possible le texte fourni en veillant à bien adapter les tournures et phrases dans votre langue maternelle pour garantir une bonne fluidité du texte. Merci aussi de conserver la mise en forme et les balises HTML.";
|
42 |
+
$t2 = "Bonjour, Merci de corriger le texte fourni en veillant à conserver la structure du contenu. Vous devez corriger toutes les fautes d'orthographe, de grammaire (etc.) sans modifier l'organisation des phrases. Merci aussi de conserver la mise en forme et les balises HTML.";
|
43 |
+
} else {
|
44 |
+
$t1 = "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.";
|
45 |
+
$t2 = "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";
|
46 |
+
}
|
47 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/briefing_message_translation_'.$admin_locale_code, 'path');
|
48 |
+
$configData->setPath('textmaster/defaultvalue/briefing_message_translation_'.$admin_locale_code)
|
49 |
+
->setValue($t1)
|
50 |
+
->save();
|
51 |
+
|
52 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/briefing_message_proofreading_'.$admin_locale_code, 'path');
|
53 |
+
$configData->setPath('textmaster/defaultvalue/briefing_message_proofreading_'.$admin_locale_code)
|
54 |
+
->setValue($t2)
|
55 |
+
->save();
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.6-0.0.7.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
$installer = $this;
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
|
36 |
+
$documents = Mage::getModel('textmaster/document')->getCollection();
|
37 |
+
foreach($documents as $document) {
|
38 |
+
$project = Mage::getModel('textmaster/project')->load($document->getTextmasterProjectId(),null,false);
|
39 |
+
$document->setProject($project);
|
40 |
+
$product = Mage::getModel('catalog/product')->setStoreId( $project->getStoreIdOrigin() )->load($document->getProductId());
|
41 |
+
$document->setName($product->getName());
|
42 |
+
$document->save();
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
$installer->endSetup();
|
app/code/community/Textmaster/Textmaster/sql/textmaster_setup/mysql4-upgrade-0.0.7-0.0.8.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Textmaster_Textmaster
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Textmaster_Textmaster
|
23 |
+
* @copyright Copyright (c) 2014 Textmaster
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
$installer = $this;
|
33 |
+
$installer->startSetup();
|
34 |
+
|
35 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/type_vocabulary', 'path');
|
36 |
+
$configData->setPath('textmaster/defaultvalue/type_vocabulary')
|
37 |
+
->setValue('not_specified')
|
38 |
+
->save();
|
39 |
+
|
40 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/target_audience', 'path');
|
41 |
+
$configData->setPath('textmaster/defaultvalue/target_audience')
|
42 |
+
->setValue('not_specified')
|
43 |
+
->save();
|
44 |
+
|
45 |
+
$configData = Mage::getModel('core/config_data')->load('textmaster/defaultvalue/grammatical_person', 'path');
|
46 |
+
$configData->setPath('textmaster/defaultvalue/grammatical_person')
|
47 |
+
->setValue('not_specified')
|
48 |
+
->save();
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/textmaster.xml
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 Textmaster
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Textmaster
|
13 |
+
* @package Textmaster_Textmaster
|
14 |
+
* @copyright Copyright (c) 2014 Textmaster
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Addonline_Textmaster
|
21 |
+
*
|
22 |
+
* @category Addonline
|
23 |
+
* @package Addonline_Textmaster
|
24 |
+
* @copyright Copyright (c) 2014 Textmaster
|
25 |
+
* @author Addonline (http://www.addonline.fr)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<layout version="0.1.0">
|
29 |
+
|
30 |
+
<default>
|
31 |
+
<reference name="head">
|
32 |
+
<action method="addItem"><type>skin_js</type><name>js/textmaster/script.js</name></action>
|
33 |
+
</reference>
|
34 |
+
</default>
|
35 |
+
<textmaster_adminhtml_project_index>
|
36 |
+
<reference name="head">
|
37 |
+
<action method="addCss">
|
38 |
+
<name>css/textmaster/styles.css</name>
|
39 |
+
</action>
|
40 |
+
|
41 |
+
|
42 |
+
</reference>
|
43 |
+
<reference name="content">
|
44 |
+
<block type="textmaster/adminhtml_credit" name="credit" template="textmaster/credit.phtml" />
|
45 |
+
<block type="textmaster/adminhtml_project" template="textmaster/grid/container.phtml" name="project" />
|
46 |
+
</reference>
|
47 |
+
</textmaster_adminhtml_project_index>
|
48 |
+
<textmaster_adminhtml_project_login>
|
49 |
+
<reference name="content">
|
50 |
+
<block type="core/template" name="credit" template="textmaster/login.phtml" />
|
51 |
+
|
52 |
+
</reference>
|
53 |
+
</textmaster_adminhtml_project_login>
|
54 |
+
<textmaster_adminhtml_project_edit>
|
55 |
+
<reference name="head">
|
56 |
+
<action method="addJs"><script>prototype/window.js</script></action>
|
57 |
+
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
58 |
+
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
|
59 |
+
<action method="addCss">
|
60 |
+
<name>css/textmaster/styles.css</name>
|
61 |
+
</action>
|
62 |
+
<action method="addCss">
|
63 |
+
<name>css/textmaster/styles.css</name>
|
64 |
+
</action>
|
65 |
+
|
66 |
+
|
67 |
+
</reference>
|
68 |
+
<reference name="content">
|
69 |
+
<block type="textmaster/adminhtml_credit" name="credit" template="textmaster/credit.phtml" />
|
70 |
+
</reference>
|
71 |
+
<reference name="root">
|
72 |
+
<action method="setTemplate"><template>textmaster/page.phtml</template></action>
|
73 |
+
</reference>
|
74 |
+
|
75 |
+
</textmaster_adminhtml_project_edit>
|
76 |
+
<textmaster_adminhtml_project_view>
|
77 |
+
<reference name="head">
|
78 |
+
<action method="addCss">
|
79 |
+
<name>css/textmaster/styles.css</name>
|
80 |
+
</action>
|
81 |
+
|
82 |
+
</reference>
|
83 |
+
<reference name="content">
|
84 |
+
<block type="textmaster/adminhtml_credit" name="credit" template="textmaster/credit.phtml" />
|
85 |
+
<block type="textmaster/adminhtml_project_view" template="textmaster/view.phtml" name="project.view">
|
86 |
+
<block type="textmaster/adminhtml_project_view_documents" name="project.view.documents"></block>
|
87 |
+
</block>
|
88 |
+
</reference>
|
89 |
+
<reference name="root">
|
90 |
+
<action method="setTemplate"><template>textmaster/page.phtml</template></action>
|
91 |
+
</reference>
|
92 |
+
</textmaster_adminhtml_project_view>
|
93 |
+
<textmaster_adminhtml_project_document>
|
94 |
+
|
95 |
+
<reference name="content">
|
96 |
+
<block type="textmaster/adminhtml_credit" name="credit" template="textmaster/credit.phtml" />
|
97 |
+
<block type="textmaster/adminhtml_document_view" template="textmaster/document/view.phtml" name="project.document.view">
|
98 |
+
</block>
|
99 |
+
<block type="textmaster/adminhtml_document_supportmessage" template="textmaster/document/support_messages.phtml" name="project.document.supportmessage">
|
100 |
+
</block>
|
101 |
+
</reference>
|
102 |
+
<reference name="head">
|
103 |
+
<action method="addJs"><script>prototype/window.js</script></action>
|
104 |
+
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
|
105 |
+
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
|
106 |
+
<action method="addCss">
|
107 |
+
<name>css/textmaster/styles.css</name>
|
108 |
+
</action>
|
109 |
+
<action method="addCss">
|
110 |
+
<name>css/textmaster/styles.css</name>
|
111 |
+
</action>
|
112 |
+
<action method="addItem"><type>skin_js</type><name>js/textmaster/script.js</name></action>
|
113 |
+
</reference>
|
114 |
+
<reference name="root">
|
115 |
+
<action method="setTemplate"><template>textmaster/page.phtml</template></action>
|
116 |
+
</reference>
|
117 |
+
</textmaster_adminhtml_project_document>
|
118 |
+
|
119 |
+
<textmaster_adminhtml_project_getmyauthors>
|
120 |
+
<remove name="menu" />
|
121 |
+
<remove name="notifications" />
|
122 |
+
<remove name="header" />
|
123 |
+
<remove name="footer" />
|
124 |
+
<reference name="head">
|
125 |
+
<action method="addCss">
|
126 |
+
<name>css/textmaster/popin.css</name>
|
127 |
+
</action>
|
128 |
+
</reference>
|
129 |
+
<reference name="content">
|
130 |
+
<block type="textmaster/adminhtml_project_onglets_step3_author" name="step3_author" as="step3_author">
|
131 |
+
</block>
|
132 |
+
</reference>
|
133 |
+
|
134 |
+
</textmaster_adminhtml_project_getmyauthors>
|
135 |
+
</layout>
|
app/design/adminhtml/default/default/template/textmaster/credit.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<div class="textmaster-info">
|
19 |
+
<span class="textmaster-email">
|
20 |
+
<?php echo Mage::helper('textmaster')->__('Textmaster account'); ?> <?php echo $this->getEmail(); ?>
|
21 |
+
</span>
|
22 |
+
<span class="textmaster-credit">
|
23 |
+
<?php echo Mage::helper('textmaster')->__('Credits:'); ?> <?php echo $this->getCredit(); ?>
|
24 |
+
<a href="http://textmaster.com/clients/payment_requests/new" target="_blank" ><?php echo Mage::helper('textmaster')->__('Buy credits'); ?></a>
|
25 |
+
</span>
|
26 |
+
|
27 |
+
</div>
|
app/design/adminhtml/default/default/template/textmaster/document/support_messages.phtml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
$_support_messages = $this->getDocument()->getSupportMessages();
|
19 |
+
|
20 |
+
if(isset($_support_messages['support_messages']) && count($_support_messages['support_messages'])) :
|
21 |
+
?>
|
22 |
+
<div class="entry-edit">
|
23 |
+
<div class="entry-edit-head">
|
24 |
+
<h4 class="icon-head head-customer-view"><?php echo Mage::helper('textmaster')->__('Support messages'); ?></h4>
|
25 |
+
</div>
|
26 |
+
<br/>
|
27 |
+
<?php foreach($_support_messages['support_messages'] as $message) : ?>
|
28 |
+
<fieldset>
|
29 |
+
<?php if($message['written_by_you']) : ?>
|
30 |
+
<strong><?php echo Mage::helper('textmaster')->__('Written by %s ',Mage::helper('textmaster')->__('you'));?> <?php echo $this->formatTime($message['created_at']['full'], Mage_Core_Model_Locale::FORMAT_TYPE_SHORT,true);?></strong><br/>
|
31 |
+
<?php else :?>
|
32 |
+
<strong><?php echo Mage::helper('textmaster')->__('Written by %s ',$message['author_ref']);?> <?php echo $this->formatTime($message['created_at']['full'], Mage_Core_Model_Locale::FORMAT_TYPE_SHORT,true);?></strong><br/>
|
33 |
+
<?php endif; ?>
|
34 |
+
<?php echo $message['message']?>
|
35 |
+
</fieldset>
|
36 |
+
|
37 |
+
<?php endforeach; ?>
|
38 |
+
|
39 |
+
</div>
|
40 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/textmaster/document/view.phtml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
$_document = $this->getDocument();
|
19 |
+
$_helper = Mage::helper('textmaster');
|
20 |
+
$_translations = $_document->getTranslations();
|
21 |
+
?>
|
22 |
+
<div class="content-header">
|
23 |
+
<table cellspacing="0">
|
24 |
+
<tr>
|
25 |
+
<td><h3 class="icon-head head-products"><?php echo $_document->getName(); ?></h3></td>
|
26 |
+
<td class="form-buttons">
|
27 |
+
<?php echo $this->getButtonsHtml() ?>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</div>
|
32 |
+
<div class="textmaster-introduction">
|
33 |
+
<?php echo $this->getIntroHtml() ?>
|
34 |
+
<?php echo $_helper->__("Text intro document view")?>
|
35 |
+
</div>
|
36 |
+
<div class="entry-edit">
|
37 |
+
<div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo $_helper->__('File information') ?></h4></div>
|
38 |
+
<fieldset>
|
39 |
+
<table cellspacing="2" width="100%">
|
40 |
+
<tr>
|
41 |
+
<th width="20%"><?php echo $_helper->__('Elements'); ?></th>
|
42 |
+
<th width="40%"><?php echo $_helper->__('Text source'); ?></th>
|
43 |
+
<th width="40%"><?php echo $_helper->__('Translated text'); ?></th>
|
44 |
+
</tr>
|
45 |
+
<?php foreach($_document->getProject()->getAttributesFull() as $attribute) : ?>
|
46 |
+
<tr>
|
47 |
+
<td><?php $att = Mage::getModel('catalog/product')->getResource()->getAttribute($attribute->getAttributeCode());echo Mage::helper('catalog')->__($att->getFrontend()->getLabel()); ?></td>
|
48 |
+
<td><?php echo $_document->getProduct()->getData($attribute->getAttributeCode()); ?></td>
|
49 |
+
<td><?php echo isset($_translations[$attribute->getAttributeCode()])?$_translations[$attribute->getAttributeCode()]:'-'; ?></td>
|
50 |
+
</tr>
|
51 |
+
<?php endforeach; ?>
|
52 |
+
|
53 |
+
</table>
|
54 |
+
</fieldset>
|
55 |
+
</div>
|
56 |
+
<script type="text/javascript">// <![CDATA[
|
57 |
+
var message_completed_document = '<?php echo addslashes($_helper->__('Your product description is being approved, this will take a few moments. You can use Magento in the meantime and then come back to your project to finish it.')); ?>';
|
58 |
+
function showCompare(url) {
|
59 |
+
winCompare = new Window({title:'<?php echo addslashes( $_helper->__('Message to author for revision')); ?>',width:820,height:160,minimizable:false,maximizable:false,showEffectOptions:{duration:0.4},hideEffectOptions:{duration:0.4}});
|
60 |
+
winCompare.setZIndex(100);
|
61 |
+
winCompare.getContent().update('<textarea class="textarea" id="messageRevision" style="width: 98%;height:100px;margin:10px 0px;" name="message"></textarea><button id="sendMessage" onclick="sendRevision();"><?php echo Mage::helper('textmaster')->__('Send'); ?></button>');
|
62 |
+
winCompare.showCenter(true);
|
63 |
+
|
64 |
+
}
|
65 |
+
<?php
|
66 |
+
$_project = $_document->getProject();
|
67 |
+
$docs_all = $_project->getDocumentsSendToCompleted();
|
68 |
+
$docs_notcomp = $_project->getDocumentsSendNotCompleted();
|
69 |
+
$ndocc = count($docs_notcomp);
|
70 |
+
$ndoc = count($docs_all);
|
71 |
+
|
72 |
+
if($docs_all && $ndocc) :
|
73 |
+
$nd = ($ndoc-$ndocc) / $ndoc;
|
74 |
+
$r = round($nd,2)*100;
|
75 |
+
?>
|
76 |
+
var jQueryCall = function($){
|
77 |
+
html = '<?php echo $r; ?>%'+'<span class="progress-cadre"><span class="progress" style="width:'+<?php echo $r; ?>+'%"></span></span>';
|
78 |
+
html += '<span class="message">'+message_completed_document+'</span>';
|
79 |
+
$('#loading_mask_loader_message').html(html);
|
80 |
+
$('#loading_mask_loader_message').show(0);
|
81 |
+
jQuery('body > .wrapper > .header').css({position:'relative',zIndex:600});
|
82 |
+
jQuery('body > .wrapper > .header a').click(function(e){
|
83 |
+
if(jQuery(this).attr('href')!='') {
|
84 |
+
e.preventDefault();
|
85 |
+
if(typeof ajax_request.transport!='undefined')
|
86 |
+
ajax_request.transport.abort();
|
87 |
+
window.location = jQuery(this).attr('href');
|
88 |
+
|
89 |
+
}
|
90 |
+
});
|
91 |
+
iscomplete('<?php echo $this->getUrl('*/*/doccompleteready',array('id'=>$_project->getId())); ?>');
|
92 |
+
};
|
93 |
+
<?php endif; ?>
|
94 |
+
|
95 |
+
function sendRevision (){
|
96 |
+
url = '<?php echo $this->getUrl('*/*/revision',array('id'=>$this->getDocument()->getId()));?>message/'+$('messageRevision').getValue();
|
97 |
+
//console.log(url);
|
98 |
+
window.location=url;
|
99 |
+
}
|
100 |
+
// ]]></script>
|
101 |
+
<?php
|
102 |
+
|
app/design/adminhtml/default/default/template/textmaster/form/container.phtml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<?php
|
19 |
+
/**
|
20 |
+
* @see Mage_Adminhtml_Block_Widget_Form_Container
|
21 |
+
*/
|
22 |
+
?>
|
23 |
+
<?php echo $this->getFormInitScripts() ?>
|
24 |
+
<div class="content-header">
|
25 |
+
<?php echo $this->getHeaderHtml() ?>
|
26 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('header') ?></p>
|
27 |
+
</div>
|
28 |
+
<div class="textmaster-introduction">
|
29 |
+
<?php echo $this->getIntroHtml() ?>
|
30 |
+
Lorem ipsum dolor sit amet, labores alienum pri ex.
|
31 |
+
No pri idque molestiae temporibus, eam quando detraxit at.
|
32 |
+
Usu maiestatis sadipscing ad, sea te graece mnesarchum, nisl nemore denique ei his.
|
33 |
+
Eu quo decore malorum omnesque, ne utroque lucilius vel. Mea solet pericula ut. Per ludus invenire te.
|
34 |
+
</div>
|
35 |
+
<?php echo $this->getFormHtml() ?>
|
36 |
+
<?php if ($this->hasFooterButtons()): ?>
|
37 |
+
<div class="content-footer">
|
38 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('footer') ?></p>
|
39 |
+
</div>
|
40 |
+
<?php endif; ?>
|
41 |
+
<script type="text/javascript">
|
42 |
+
editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl() ?>');
|
43 |
+
</script>
|
44 |
+
<?php echo $this->getFormScripts() ?>
|
app/design/adminhtml/default/default/template/textmaster/grid/container.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<div class="content-header">
|
19 |
+
<table cellspacing="0">
|
20 |
+
<tr>
|
21 |
+
<td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
|
22 |
+
<td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
|
23 |
+
</tr>
|
24 |
+
</table>
|
25 |
+
</div>
|
26 |
+
<div class="textmaster-introduction">
|
27 |
+
<?php echo $this->getIntroHtml() ?>
|
28 |
+
<?php echo Mage::helper('textmaster')->__('The list below shows all of your TextMaster translation and proofreading projects.'); ?>
|
29 |
+
<br/>
|
30 |
+
<?php echo Mage::helper('textmaster')->__("To see a project's details, click on ''View'' in the last column. To start a translation project or to proofread your product descriptions, click on the ''New Project'' button."); ?>
|
31 |
+
</div>
|
32 |
+
<div>
|
33 |
+
<?php echo $this->getGridHtml() ?>
|
34 |
+
</div>
|
app/design/adminhtml/default/default/template/textmaster/login.phtml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<p>
|
19 |
+
<?php
|
20 |
+
echo Mage::helper('textmaster')->__('You need to be logged in to use this plugin.');
|
21 |
+
?>
|
22 |
+
<br/>
|
23 |
+
<a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/textmaster'); ?>">
|
24 |
+
<?php
|
25 |
+
echo Mage::helper('textmaster')->__('Click here to log in or to create a TextMaster account.');
|
26 |
+
?>
|
27 |
+
</a>
|
28 |
+
</p>
|
app/design/adminhtml/default/default/template/textmaster/onglet.phtml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
$step = (isset($step)) ? $step : 1;
|
19 |
+
|
20 |
+
$selectedProducts = Mage::getSingleton('core/session')->getSelectedProducts();
|
21 |
+
|
22 |
+
$steps = array(
|
23 |
+
1 => array("label" => Mage::helper('textmaster')->__("Select products")),
|
24 |
+
2 => array("label" => Mage::helper('textmaster')->__("Propriétés du projet")),
|
25 |
+
3 => array("label" => Mage::helper('textmaster')->__("Project Summary"))
|
26 |
+
);
|
27 |
+
?>
|
28 |
+
<?php echo $this->getFormInitScripts() ?>
|
29 |
+
<div class="content-header">
|
30 |
+
<h3><?php echo Mage::helper("textmaster")->__('Nouveau projet')?></h3>
|
31 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('header') ?></p>
|
32 |
+
</div>
|
33 |
+
<div class="textmaster-introduction">
|
34 |
+
<?php echo $this->getIntroHtml() ?>
|
35 |
+
</div>
|
36 |
+
<ol class="steps_project">
|
37 |
+
<?php for($i = 1; $i <=3 ; $i++){
|
38 |
+
$class = ($i == $step) ? "current" : (($i > $step) ? "disabled" : "");
|
39 |
+
?>
|
40 |
+
<li class="step<?php echo $i;?> <?php echo $class; ?>">
|
41 |
+
<span>
|
42 |
+
<?php if($i < $step){?>
|
43 |
+
<a href="<?php echo Mage::helper("adminhtml")->getUrl("textmaster/adminhtml_project/edit" , array('step' => $i , '_query' => array('internal_products_id' => implode("," , $selectedProducts))));?>">
|
44 |
+
<?php echo $steps[$i]["label"];?>
|
45 |
+
</a>
|
46 |
+
<?php } else {
|
47 |
+
echo $steps[$i]["label"];
|
48 |
+
}?>
|
49 |
+
</span>
|
50 |
+
</li>
|
51 |
+
<?php } ?>
|
52 |
+
</ol>
|
53 |
+
<table width="100%">
|
54 |
+
<tr>
|
55 |
+
<td width="67%"><?php echo $this->getChildHtml('textmaster.step2'); ?></td>
|
56 |
+
<td width="3%"> </td>
|
57 |
+
<td width="30%"><?php echo $this->getChildHtml('textmaster.summary'); ?></td>
|
58 |
+
</tr>
|
59 |
+
</table>
|
60 |
+
|
61 |
+
|
app/design/adminhtml/default/default/template/textmaster/onglet/popinauthors.phtml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<script type="text/javascript">// <![CDATA[
|
19 |
+
|
20 |
+
function showAuthors(url) {
|
21 |
+
winCompare = new Window({title:'<?php echo $_helper->__('Message to author for revision'); ?>',width:820,height:160,minimizable:false,maximizable:false,showEffectOptions:{duration:0.4},hideEffectOptions:{duration:0.4}});
|
22 |
+
winCompare.setZIndex(100);
|
23 |
+
//winCompare.getContent().update('<textarea class="textarea" id="messageRevision" style="width: 98%;height:100px;margin:10px 0px;" name="message"></textarea><button id="sendMessage" onclick="sendRevision();">Send</button>');
|
24 |
+
winCompare.showCenter(true);
|
25 |
+
|
26 |
+
}
|
27 |
+
function sendRevision (){
|
28 |
+
url = '<?php echo $this->getUrl('*/*/revision',array('id'=>$this->getDocument()->getId()));?>message/'+$('messageRevision').getValue();
|
29 |
+
//console.log(url);
|
30 |
+
window.location=url;
|
31 |
+
}
|
32 |
+
// ]]></script>
|
app/design/adminhtml/default/default/template/textmaster/page.phtml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
19 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
|
20 |
+
<head>
|
21 |
+
<?php echo $this->getChildHtml('head') ?>
|
22 |
+
</head>
|
23 |
+
|
24 |
+
<body id="html-body"<?php echo $this->getBodyClass() ? ' class="' . $this->getBodyClass() . '"' : ''; ?>>
|
25 |
+
<?php echo $this->getChildHtml('notification_window'); ?>
|
26 |
+
<div class="wrapper">
|
27 |
+
<?php echo $this->getChildHtml('global_notices') ?>
|
28 |
+
<div class="header">
|
29 |
+
<?php echo $this->getChildHtml('header') ?>
|
30 |
+
<div class="clear"></div>
|
31 |
+
<?php echo $this->getChildHtml('menu') ?>
|
32 |
+
</div>
|
33 |
+
<?php echo $this->getChildHtml('notifications'); ?>
|
34 |
+
<div class="middle" id="anchor-content">
|
35 |
+
<div id="page:main-container">
|
36 |
+
<?php if($this->getChildHtml('left')): ?>
|
37 |
+
|
38 |
+
<div class="columns <?php echo $this->getContainerCssClass() ?>">
|
39 |
+
<div class="side-col" id="page:left">
|
40 |
+
<?php echo $this->getChildHtml('left') ?>
|
41 |
+
</div>
|
42 |
+
<div class="main-col" id="content">
|
43 |
+
<div class="main-col-inner">
|
44 |
+
<div id="messages"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
|
45 |
+
<?php echo $this->getChildHtml('content') ?>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<?php else: ?>
|
51 |
+
<div id="messages"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
|
52 |
+
<?php echo $this->getChildHtml('content') ?>
|
53 |
+
<?php endif; ?>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
<div class="footer">
|
57 |
+
<?php echo $this->getChildHtml('footer') ?>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<?php echo $this->getChildHtml('js') ?>
|
61 |
+
<?php echo $this->getChildHtml('profiler') ?>
|
62 |
+
<div id="loading-mask" style="display:none">
|
63 |
+
<p class="loader textmasterloading" id="loading_mask_loader"><img src="<?php echo $this->getSkinUrl('images/ajax-loader-tr.gif') ?>" alt="<?php echo Mage::helper('adminhtml')->__('Loading...') ?>"/><br/><span id="loading_mask_loader_message"><?php echo Mage::helper('adminhtml')->__('Please wait...') ?></span></p>
|
64 |
+
</div>
|
65 |
+
<?php echo $this->getChildHtml('before_body_end') ?>
|
66 |
+
|
67 |
+
</body>
|
68 |
+
</html>
|
app/design/adminhtml/default/default/template/textmaster/product/edit.phtml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Addonline_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<div class="content-header">
|
19 |
+
<h3 class="icon-head head-products"><?php echo Mage::helper('textmaster')->__('Translations');?></h3>
|
20 |
+
</div>
|
21 |
+
<?php
|
22 |
+
$user = Mage::helper('textmaster')->getApi()->getUserInfo();
|
23 |
+
if(!isset($user['email'])) {
|
24 |
+
?>
|
25 |
+
<?php echo Mage::helper('textmaster')->__('Veuillez configurer le module Textmaster afin de traduire votre produit');
|
26 |
+
return; ?>
|
27 |
+
<?php } ?>
|
28 |
+
<?php
|
29 |
+
if (!$this->getRequest()->getParam('store')) {
|
30 |
+
?>
|
31 |
+
<ul class="messages" style="margin-bottom: 20px;"><li class="notice-msg"><?php echo $this->__('You are viewing default/website values. Please select a store view (from left) to see translation options.') ?></li></ul><?php
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
?>
|
35 |
+
<div style="margin-bottom: 30px;font-size:13px;"><a href="<?php echo Mage::helper("adminhtml")->getUrl('textmaster/adminhtml_project/createprojectfromproduct',array('id'=>Mage::app()->getRequest()->getParam('id'))); ?>"><?php echo Mage::helper('textmaster')->__('Translate product');?></a></div>
|
app/design/adminhtml/default/default/template/textmaster/view.phtml
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 Textmaster
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Textmaster
|
12 |
+
* @package Textmaster_Textmaster
|
13 |
+
* @copyright Copyright (c) 2014 Textmaster
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
$_project = $this->getProject();
|
19 |
+
$_helper = Mage::helper('textmaster');
|
20 |
+
|
21 |
+
?>
|
22 |
+
<div class="content-header">
|
23 |
+
<table cellspacing="0">
|
24 |
+
<tr>
|
25 |
+
<td><h3 class="icon-head head-products"><?php echo $_project->getName(); ?></h3></td>
|
26 |
+
<td class="form-buttons">
|
27 |
+
<?php echo $this->getButtonsHtml() ?>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
</table>
|
31 |
+
</div>
|
32 |
+
<div class="textmaster-introduction">
|
33 |
+
<?php echo $this->getIntroHtml() ?>
|
34 |
+
<?php echo Mage::helper('textmaster')->__('Vous pouvez suivre le statut de chaque fiche de votre projet. Si votre fiche est en cours de révision, cliquez sur "voir" pour consulter le texte soumis par l\'auteur. Vous avez en tout 7 jours pour valider une fiche ou demander une révision une fois celle-ci traitée par l\'auteur.');?>
|
35 |
+
</div>
|
36 |
+
<div class="entry-edit">
|
37 |
+
<div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo $_helper->__('Project Information') ?></h4></div>
|
38 |
+
<fieldset>
|
39 |
+
<table cellspacing="2" class="box-left">
|
40 |
+
<tr>
|
41 |
+
<td width="200"><?php echo $_helper->__('Type of project:'); ?></td>
|
42 |
+
<td><?php echo $_helper->__($_project->getCtype()); ?></td>
|
43 |
+
</tr>
|
44 |
+
<tr>
|
45 |
+
<td><?php echo $_helper->__('Source language:'); ?></td>
|
46 |
+
<td><?php echo $_project->getStoreNameOrigin(); ?></td>
|
47 |
+
</tr>
|
48 |
+
<tr>
|
49 |
+
<td><?php echo $_helper->__('Word count:'); ?></td>
|
50 |
+
<td><?php echo (int)$_project->getTotalWordCount(); ?></td>
|
51 |
+
</tr>
|
52 |
+
<tr>
|
53 |
+
<td><?php echo $_helper->__('Level:'); ?></td>
|
54 |
+
<td><?php echo $_project->getLanguageLevelTexte(); ?></td>
|
55 |
+
</tr>
|
56 |
+
<tr>
|
57 |
+
<td><?php echo $_helper->__('Single author:'); ?></td>
|
58 |
+
<td><?php echo $_project->getSameAuthorMustDoEntireProject()?$_helper->__('Yes'):$_helper->__('No'); ?></td>
|
59 |
+
</tr>
|
60 |
+
<tr>
|
61 |
+
<td><?php echo $_helper->__('Briefing:'); ?></td>
|
62 |
+
<td><?php echo $_project->getProjectBriefing(); ?></td>
|
63 |
+
</tr>
|
64 |
+
|
65 |
+
|
66 |
+
</table>
|
67 |
+
<table cellspacing="2" class="box-right">
|
68 |
+
<tr>
|
69 |
+
<td width="200"><?php echo $_helper->__('Status:'); ?></td>
|
70 |
+
<td><?php echo $_project->getStatusTexte(); ?></td>
|
71 |
+
</tr>
|
72 |
+
|
73 |
+
<tr>
|
74 |
+
<td><?php echo $_helper->__('Target language:'); ?></td>
|
75 |
+
<td><?php echo $_project->getStoreNameTranslation(); ?></td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td><?php echo $_helper->__('Price:'); ?></td>
|
79 |
+
<td><?php echo $_project->getPrice(); ?></td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<td><?php echo $_helper->__('Reference:'); ?></td>
|
83 |
+
<td><?php echo $_project->getReference(); ?></td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td><?php echo $_helper->__('Nombre de textmasters :'); ?></td>
|
87 |
+
<td><?php echo count($_project->getTextmasters()); ?></td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td><?php echo $_helper->__('Options:'); ?></td>
|
91 |
+
<td>
|
92 |
+
<?php echo $_project->getQuality()?Mage::helper( 'textmaster' )->__( 'Quality control' ).'<br/>':''; ?>
|
93 |
+
<?php echo $_project->getPriority()?Mage::helper( 'textmaster' )->__( 'Priority order' ).'<br/>':''; ?>
|
94 |
+
<?php echo $_project->getExpertise()?Mage::helper( 'textmaster' )->__( 'Expertise' ).'<br/>':''; ?>
|
95 |
+
</td>
|
96 |
+
</tr>
|
97 |
+
</table>
|
98 |
+
|
99 |
+
</fieldset>
|
100 |
+
</div>
|
101 |
+
<div class="content-header">
|
102 |
+
<h3 class="icon-head head-products"><?php echo $_helper->__('Documents'); ?></h3>
|
103 |
+
</div>
|
104 |
+
|
105 |
+
<?php
|
106 |
+
echo $this->getChildrenHtml('project.view.documents'); ?>
|
107 |
+
<script type="text/javascript">// <![CDATA[
|
108 |
+
var message_completed_document = '<?php echo addslashes($_helper->__('Your product descriptions are being approved. This will take a few minutes if you have many. You can use Magento in the meantime and then come back to your project to finish it.')); ?>';
|
109 |
+
|
110 |
+
var jQueryCall = function($){
|
111 |
+
<?php echo $this->getChild('project.view.documents')->getId().'_massactionJsObject'?>.setUseAjax(true);
|
112 |
+
<?php
|
113 |
+
$docs_all = $_project->getDocumentsSendToCompleted();
|
114 |
+
$docs_notcomp = $_project->getDocumentsSendNotCompleted();
|
115 |
+
$ndocc = count($docs_notcomp);
|
116 |
+
$ndoc = count($docs_all);
|
117 |
+
|
118 |
+
if($docs_all && $ndocc) :
|
119 |
+
$nd = ($ndoc-$ndocc) / $ndoc;
|
120 |
+
$r = round($nd,2)*100;
|
121 |
+
?>
|
122 |
+
html = '<?php echo $r; ?>%'+'<span class="progress-cadre"><span class="progress" style="width:'+<?php echo $r; ?>+'%"></span></span>';
|
123 |
+
html += '<span class="message">'+message_completed_document+'</span>';
|
124 |
+
$('#loading_mask_loader_message').html(html);
|
125 |
+
$('#loading_mask_loader_message').show(0);
|
126 |
+
jQuery('body > .wrapper > .header').css({position:'relative',zIndex:600});
|
127 |
+
jQuery('body > .wrapper > .header a').click(function(e){
|
128 |
+
if(jQuery(this).attr('href')!='') {
|
129 |
+
e.preventDefault();
|
130 |
+
if(typeof ajax_request.transport!='undefined')
|
131 |
+
ajax_request.transport.abort();
|
132 |
+
window.location = jQuery(this).attr('href');
|
133 |
+
|
134 |
+
}
|
135 |
+
});
|
136 |
+
iscomplete('<?php echo $this->getUrl('*/*/doccompleteready',array('id'=>$_project->getId())); ?>');
|
137 |
+
<?php endif; ?>
|
138 |
+
};
|
139 |
+
//]]></script>
|
140 |
+
<?php
|
141 |
+
//var_dump($this->getChild('project.view.documents')->debug());
|
142 |
+
//foreach($this->getChild('project.view.documents')->getChild() as $child) var_dump($child->debug());
|
143 |
+
?>
|
app/etc/modules/Textmaster_Textmaster.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Textmaster_Textmaster>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Textmaster_Textmaster>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/Textmaster_Textmaster.csv
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
My Projects,My Projects
|
2 |
+
New Project,New Project
|
3 |
+
Update file,Update file
|
4 |
+
Put in revision,Put in revision
|
5 |
+
Name,Name
|
6 |
+
Reference,Reference
|
7 |
+
Source language,Source language
|
8 |
+
Langue de destination,Target language
|
9 |
+
Level,Level
|
10 |
+
Number of documents,Number of documents
|
11 |
+
Total word count,Total word count
|
12 |
+
Progression,Progression
|
13 |
+
Status,Status
|
14 |
+
Last change,Last change
|
15 |
+
Actions,Actions
|
16 |
+
Launch,Order
|
17 |
+
Pause,Pause
|
18 |
+
Resume,Resume
|
19 |
+
Complete,Complete
|
20 |
+
Complete file,Complete file
|
21 |
+
Duplicate,Duplicate
|
22 |
+
Continue,Continue
|
23 |
+
Update product,Update product
|
24 |
+
Type,Type
|
25 |
+
Traduction manquante :,Missing translation
|
26 |
+
Traduction existante,Existing translation
|
27 |
+
Project,Project
|
28 |
+
Fields to translate,Fields to translate
|
29 |
+
Product informations,Product informations
|
30 |
+
Select all,Select all
|
31 |
+
Deselect all,Deselect all
|
32 |
+
Nouveau message variable,Your project is being created. This will take a few minutes if you have many product descriptions. You can use Magento in the meantime and then come back to your project to finish it.
|
33 |
+
Your product descriptions are being approved. This will take a few minutes if you have many. You can use Magento in the meantime and then come back to your project to finish it.,Your product descriptions are being approved. This will take a few minutes if you have many. You can use Magento in the meantime and then come back to your project to finish it.
|
34 |
+
Languages,Languages
|
35 |
+
Select a language,Select a language
|
36 |
+
Pricing options,Pricing options
|
37 |
+
Service level,Service level
|
38 |
+
Regular (%s/word): native-speaking translator for word-for-word translations of short texts.,Regular (%s/word): native-speaking translator for word-for-word translations of short texts.
|
39 |
+
Premium (%s/word): experienced translator; suitable for business use.,Premium (%s/word): experienced translator; suitable for business use.
|
40 |
+
Enterprise (%s/word): professional translator specialized in a specific field; suitable for technical or complex content.,Enterprise (%s/word): professional translator specialized in a specific field; suitable for technical or complex content.
|
41 |
+
Quality Control (+%s/word),Quality Control (+%s/word)
|
42 |
+
No,No
|
43 |
+
Yes,Yes
|
44 |
+
The translator's work will be proofread and corrected by TextMaster,The translator's work will be proofread and corrected by TextMaster
|
45 |
+
Priority Order (+%s/word),Priority Order (+%s/word)
|
46 |
+
Your project will be assigned a higher priority status.,Your project will be assigned a higher priority status.
|
47 |
+
Expertise (+%s/word),Expertise (+%s/word)
|
48 |
+
We provide you with an expert in the selected category.,We provide you with an expert in the selected category.
|
49 |
+
Instructions du projet,Project Instructions
|
50 |
+
Briefing,Briefing
|
51 |
+
Select a category,Select a category
|
52 |
+
Category (optional),Category (optional)
|
53 |
+
Single Author (Assign the entire project to a single TextMaster),Single Author (Assign the entire project to a single TextMaster)
|
54 |
+
"Ensures better continuity, but longer turnaround time","Ensures better continuity, but longer turnaround time"
|
55 |
+
Project Summary,Project Summary
|
56 |
+
Type of project,Type of project
|
57 |
+
Total word count,Total word count
|
58 |
+
Total cost,Total cost
|
59 |
+
Level and options,Level and options
|
60 |
+
Project's name,Project's name
|
61 |
+
Favorite authors,Favorite authors
|
62 |
+
Add credits to my TextMaster account,Add credits to my TextMaster account
|
63 |
+
%s/word,%s/word
|
64 |
+
Textmaster(s) chosen:,Textmaster(s) chosen:
|
65 |
+
none,none
|
66 |
+
My Textmasters,My Textmasters
|
67 |
+
Choose your TextMasters,Choose your TextMasters
|
68 |
+
Order Summary,Order Summary
|
69 |
+
Project,Project
|
70 |
+
Word count,Word count
|
71 |
+
Level and options,Level and options
|
72 |
+
Price,Price
|
73 |
+
Choose your textmaster for the project,Choose your TextMasters for the project
|
74 |
+
Action,Action
|
75 |
+
Wrong login / password,Wrong login / password
|
76 |
+
Could not get API key / secret,Could not get API key / secret
|
77 |
+
Connected to textmaster,Connected to TextMaster
|
78 |
+
Email invalid,Email invalid
|
79 |
+
Password mandatory,Password mandatory
|
80 |
+
Could not get access token,Could not get access token
|
81 |
+
Your account has been successfully created.,Your account has been successfully created.
|
82 |
+
"Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven't been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.","Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven't been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation."
|
83 |
+
"Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)","Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)"
|
84 |
+
"Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com","Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com"
|
85 |
+
Project creation error,Project creation error
|
86 |
+
No post,No post
|
87 |
+
Regular,Regular
|
88 |
+
Premium,Premium
|
89 |
+
Not specified,Not specified
|
90 |
+
Popular,Popular
|
91 |
+
Technique,Technical
|
92 |
+
Fictional,Fictional
|
93 |
+
I,I
|
94 |
+
You,You
|
95 |
+
He,He
|
96 |
+
She,She
|
97 |
+
One,One
|
98 |
+
We,We
|
99 |
+
They,They
|
100 |
+
Children under 14 years old,Children under 14 years old
|
101 |
+
Teenagers > between 14 and 18 years old,Teenagers > between 14 and 18 years old
|
102 |
+
Young adults > between 19 and 29 years old,Young adults > between 19 and 29 years old
|
103 |
+
Adults > between 30 and 59 years old,Adults > between 30 and 59 years old
|
104 |
+
Seniors > 60 years old and beyond,Seniors > 60 years old and beyond
|
105 |
+
completed,completed
|
106 |
+
In creation,In creation
|
107 |
+
Waiting assignment,Waiting assignment
|
108 |
+
In progress,In progress
|
109 |
+
In review,In review
|
110 |
+
Completed,Completed
|
111 |
+
Incomplete,Incomplete
|
112 |
+
Paused,Paused
|
113 |
+
Cancelled,canceled
|
114 |
+
Copyscape,Copyscape
|
115 |
+
Counting words,Counting words
|
116 |
+
Quality control,Quality control
|
117 |
+
Control Quality,Quality control
|
118 |
+
Expertise,Expertise
|
119 |
+
Priority,Priority
|
120 |
+
launch,Order
|
121 |
+
paused,paused
|
122 |
+
resumed,resumed
|
123 |
+
canceled,canceled
|
124 |
+
soit,
|
125 |
+
word,word
|
126 |
+
You need to be logged in to use this plugin.,You need to be logged in to use this plugin.
|
127 |
+
Click here to log in or to create a TextMaster account.,Click here to log in or to create a TextMaster account.
|
128 |
+
Project Information,Project Information
|
129 |
+
Type of project:,Type of project:
|
130 |
+
Source language:,Source language:
|
131 |
+
Word count:,Word count:
|
132 |
+
Level,Level
|
133 |
+
Level:,Level:
|
134 |
+
Single author::,Single author:
|
135 |
+
Briefing :,Briefing:
|
136 |
+
Status:,Status:
|
137 |
+
Target language,Target language
|
138 |
+
Target language:,Target language:
|
139 |
+
Price:,Price:
|
140 |
+
Reference:,Reference:
|
141 |
+
Nombre de textmasters :,Number of TextMasters:
|
142 |
+
Options:,Options:
|
143 |
+
Quality control,Quality control
|
144 |
+
Priority order,Priority order
|
145 |
+
Expertise,Expertise
|
146 |
+
Documents,Documents
|
147 |
+
Support messages,Support messages
|
148 |
+
Written by %s ,Written by %s
|
149 |
+
Text intro document view,"You can view the file submitted by the author below. If you are satisfied with the content, click on \""Update file\"". Otherwise, you can ask the author for a revision by explaining what elements need to be changed."
|
150 |
+
File information,File information
|
151 |
+
Elements,Elements
|
152 |
+
Text source,Source text
|
153 |
+
Translated text,Translated text
|
154 |
+
Message to author for revision,Message to author for revision
|
155 |
+
Translations,Translations
|
156 |
+
You are viewing default/website values. Please select a store view (from left) to see translation options.,You are viewing default/website values. Please select a store view (from left) to see translation options.
|
157 |
+
Translate product,Translate product
|
158 |
+
TextMaster Login,TextMaster Login
|
159 |
+
Create your account,Create your account
|
160 |
+
The list below shows all of your TextMaster translation and proofreading projects.,The list below shows all of your TextMaster translation and proofreading projects.
|
161 |
+
"To see a project's details, click on ''View'' in the last column. To start a translation project or to proofread your product descriptions, click on the ''New Project'' button.","To see a project's details, click on ''View'' in the last column. To start a translation project or to proofread your product descriptions, click on the ''New Project'' button."
|
162 |
+
Crédit disponible :,Available credits:
|
163 |
+
Crédit manquant :,Missing credits:
|
164 |
+
Credits:,Credits:
|
165 |
+
Textmaster account,Textmaster account:
|
166 |
+
word(s),word(s)
|
167 |
+
translation,translation
|
168 |
+
proofreading,proofreading
|
169 |
+
Translation,Translation
|
170 |
+
Proofreading,Proofreading
|
171 |
+
Select products,Select product
|
172 |
+
Propriétés du projet,Project settings
|
173 |
+
Textmasters saved,TextMasters saved
|
174 |
+
You do not have any authors in your Favorites list,You do not have any authors in your Favorites list
|
175 |
+
Project does not exist,Project does not exist
|
176 |
+
Buy credits,Buy credits
|
177 |
+
Manage Projects,Manage Projects
|
178 |
+
Activities,Activities
|
179 |
+
Product Default Language,Product Default Language
|
180 |
+
Briefing message for proofreading,Briefing message for proofreading
|
181 |
+
Briefing message for translation,Briefing message for translation
|
182 |
+
Category,Category
|
183 |
+
Type of vocabulary,Type of vocabulary
|
184 |
+
Target audience,Target audience
|
185 |
+
Grammatical Person,Grammatical Person
|
186 |
+
Default values,Default values
|
187 |
+
Email,Email
|
188 |
+
Password,Password
|
189 |
+
Confirm password,Confirm password
|
190 |
+
Phone,Phone
|
191 |
+
Create your free account,Create your free account
|
192 |
+
Connexion,Connexion
|
193 |
+
Login,Login
|
194 |
+
Searching...,Searching...
|
195 |
+
Logout,Logout
|
app/locale/fr_FR/Textmaster_Textmaster.csv
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
My Projects,Mes projets
|
2 |
+
New Project,Nouveau projet
|
3 |
+
Update file,Mettre à jour la fiche
|
4 |
+
Put in revision,Demander une révision
|
5 |
+
Name,Nom
|
6 |
+
Reference,Référence
|
7 |
+
Source language,Langue source
|
8 |
+
Langue de destination,Langue de destination
|
9 |
+
Level,Level
|
10 |
+
Number of documents,Nombre de fiches produit
|
11 |
+
Total word count,Nombre de mots total
|
12 |
+
Progression,Progression
|
13 |
+
Status,Statut
|
14 |
+
Last change,Dernière modification
|
15 |
+
Actions,Actions
|
16 |
+
Launch,Lancer
|
17 |
+
Pause,Pause
|
18 |
+
Resume,Resume
|
19 |
+
Complete,Completer
|
20 |
+
Complete file,Valider la fiche
|
21 |
+
Duplicate,Dupliquer
|
22 |
+
Continue,Continuer
|
23 |
+
Update product,Mettre à jour la fiche produit
|
24 |
+
Type,Type
|
25 |
+
Traduction manquante :,Traduction manquante :
|
26 |
+
Traduction existante,Traduction existante
|
27 |
+
Project,Projet
|
28 |
+
Fields to translate,Champs à traduire
|
29 |
+
Product informations,Product informations
|
30 |
+
Select all,Sélectionner tout
|
31 |
+
Deselect all,Déselectionner tout
|
32 |
+
Nouveau message variable,Votre projet est en cours de création. Cela prendre quelques minutes s'il contient beaucoup de fiches produits. Vous pouvez continuer votre navigation dans Magento et revenir ensuite finaliser votre projet.
|
33 |
+
Your product descriptions are being approved. This will take a few minutes if you have many. You can use Magento in the meantime and then come back to your project to finish it.,Vos fiches sont en cours de validation. Cela prendre quelques minutes s'il contient beaucoup de fiches produits. Vous pouvez continuer votre navigation dans Magento et revenir ensuite finaliser votre projet.
|
34 |
+
Languages,Langues
|
35 |
+
Select a language,Sélectionner une langue
|
36 |
+
Pricing options,Options tarifaires
|
37 |
+
Service level,Niveau de qualité
|
38 |
+
Regular (%s/word): native-speaking translator for word-for-word translations of short texts.,"Regular (0.04 € / mot) : traducteur natif, traduction litérale adaptée pour des textes très courts."
|
39 |
+
Premium (%s/word): experienced translator; suitable for business use.,"Premium (0.07 € / mot) : traducteur expérimenté, adapté pour un usage professionnel."
|
40 |
+
Enterprise (%s/word): professional translator specialized in a specific field; suitable for technical or complex content.,"Enterprise (0.13 € / mot) : traducteur professionnel spécialisé, adapté pour des contenus techniques et complexes."
|
41 |
+
Quality Control (+%s/word),Contrôle qualité (+0.04 € / mot)
|
42 |
+
No,Non
|
43 |
+
Yes,Oui
|
44 |
+
The translator's work will be proofread and corrected by TextMaster,Le travail de l'auteur sera relu et corrigé par TextMaster.
|
45 |
+
Priority Order (+%s/word),Commande prioritaire (+ 0.04 € / mot)
|
46 |
+
Your project will be assigned a higher priority status.,Votre projet sera mis en avant et placé en haut de liste.
|
47 |
+
Expertise (+%s/word),Expertise (+0.05 € / mot)
|
48 |
+
We provide you with an expert in the selected category.,Nous vous trouvons un expert dans le domaine de votre choix.
|
49 |
+
Instructions du projet,Instructions du projet
|
50 |
+
Briefing,Briefing
|
51 |
+
Select a category,Sélectionner une catégorie
|
52 |
+
Category (optional),Catégorie (optionnel)
|
53 |
+
Single Author (Assign the entire project to a single TextMaster),Auteur unique (l'ensemble du projet sera traité par un seul auteur)
|
54 |
+
"Ensures better continuity, but longer turnaround time",Meilleure homogénéité éditoriale mais temps de traitement plus long
|
55 |
+
Project Summary,Récapitulatif du projet
|
56 |
+
Type of project,Type de projet
|
57 |
+
Total word count,Nombre total de mot
|
58 |
+
Total cost,Coût total du projet
|
59 |
+
Level and options,Niveau et options
|
60 |
+
Project's name,Nom du projet
|
61 |
+
Favorite authors,Auteurs favoris
|
62 |
+
Add credits to my TextMaster account,Commander des crédits manquants
|
63 |
+
%s/word,Soit %s / mot
|
64 |
+
Textmaster(s) chosen:,Textmaster(s) choisie(s) :
|
65 |
+
none,aucun
|
66 |
+
My Textmasters,Mes Textmasters
|
67 |
+
Choose your TextMasters,Sélectionner des TextMasters
|
68 |
+
Order Summary,Récapitulatif de la commande
|
69 |
+
Project,Projet
|
70 |
+
Word count,Nombre de mots
|
71 |
+
Level and options,Niveau et options
|
72 |
+
Price,Prix
|
73 |
+
Choose your textmaster for the project,Choisissez votre TextMaster pour le projet
|
74 |
+
Action,Action
|
75 |
+
Wrong login / password,Mauvais identifiant / mot de passe
|
76 |
+
Could not get API key / secret,Impossible de récupérer votre clé API
|
77 |
+
Connected to textmaster,Connecter à TextMaster
|
78 |
+
Email invalid,Email invalide
|
79 |
+
Password mandatory,Mot de passe obligatoire
|
80 |
+
Could not get access token,Impossible de récupérer le token d'accès
|
81 |
+
Your account has been successfully created.,Votre compte a été créé avec succès.
|
82 |
+
"Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven't been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.","Sélectionnez la liste des produits à traduire ou a corriger. Utiliser le filtre dans la dernière colonne pour sélectionner les fiches produits qui n'ont pas encore été traduites. Si la fiche produit a déjà été traduite sur Textmaster, un drapeau apparaît pour chaque traduction effectuée."
|
83 |
+
"Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)","Définissez les propriétés de votre projet ainsi que le niveau de qualité souhaité et les options à la carte. Enfin, précisez vos instructions au traducteur ou au correcteur (termes spécifiques, instructions de mise en forme, etc.)."
|
84 |
+
"Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com","Vérifiez les informations de votre projet avant de lancer votre commande. Si votre solde de crédit TextMaster est insuffisant, ciiquez sur le lien ci-deesous pour créditer votre compte sur TextMaster.com"
|
85 |
+
Project creation error,Erreur lors de la création du projet
|
86 |
+
No post,Pas de post
|
87 |
+
Regular,Regular
|
88 |
+
Premium,Premium
|
89 |
+
Not specified,Non spécifié
|
90 |
+
Popular,Populaire
|
91 |
+
Technique,Technique
|
92 |
+
Fictional,Fictional
|
93 |
+
I,Je
|
94 |
+
You,Vous
|
95 |
+
He,Il
|
96 |
+
She,Elle
|
97 |
+
One,Un
|
98 |
+
We,Nous
|
99 |
+
They,Ils
|
100 |
+
Children under 14 years old,Enfants en dessous de 14 ans
|
101 |
+
Teenagers > between 14 and 18 years old,Adolescents entre 14 et 18 ans
|
102 |
+
Young adults > between 19 and 29 years old,Jeunes adultes de 19 à 29 ans
|
103 |
+
Adults > between 30 and 59 years old,Adultes en 30 et 59 ans
|
104 |
+
Seniors > 60 years old and beyond,Seniors au dessus de 60 ans
|
105 |
+
completed,Terminé
|
106 |
+
In creation,En création
|
107 |
+
Waiting assignment,En attente d'attribution
|
108 |
+
In progress,In progress
|
109 |
+
In review,Revue en cours
|
110 |
+
Completed,Terminé
|
111 |
+
Incomplete,Incomplet
|
112 |
+
Paused,En pause
|
113 |
+
Cancelled,Annulé
|
114 |
+
Copyscape,Copyscape
|
115 |
+
Counting words,Counting words
|
116 |
+
Quality control,Contrôle qualité
|
117 |
+
Control Quality,Contrôle qualité
|
118 |
+
Expertise,Expertise
|
119 |
+
Priority,Prioritaire
|
120 |
+
launch,Lancer
|
121 |
+
paused,En pause
|
122 |
+
resumed,Reprendre
|
123 |
+
canceled,Annulé
|
124 |
+
soit,soit
|
125 |
+
word,mot
|
126 |
+
You need to be logged in to use this plugin.,Vous devez être connecté pour utiliser le module.
|
127 |
+
Click here to log in or to create a TextMaster account.,Cliquer ici pour vous identifier ou créer un compte TextMaster
|
128 |
+
Project Information,Informations sur le projet
|
129 |
+
Type of project:,Type de projet :
|
130 |
+
Source language:,Langue source :
|
131 |
+
Word count:,Nombre de mots :
|
132 |
+
Level,Niveau
|
133 |
+
Level:,Niveau :
|
134 |
+
Single author:,Auteur unique :
|
135 |
+
Single author,Auteur unique
|
136 |
+
Briefing :,Briefing :
|
137 |
+
Status:,Statut :
|
138 |
+
Target language,Langue de destination
|
139 |
+
Target language:,Langue de destination :
|
140 |
+
Price:,Prix :
|
141 |
+
Reference:,Référence :
|
142 |
+
Nombre de textmasters :,Nombre de textmasters :
|
143 |
+
Options:,Options :
|
144 |
+
Quality control,Contrôle qualité
|
145 |
+
Priority order,Commande prioritaire
|
146 |
+
Expertise,Expertise
|
147 |
+
Documents,Documents
|
148 |
+
Support messages,Support messages
|
149 |
+
Written by %s ,Ecrit par %s le
|
150 |
+
Text intro document view,"Vous pouvez consulter la fiche traitée par l'auteur ci-dessous. Si le contenu vous convient, cliquez sur Mettre à jour la fiche. Sinon vous pouvez demander une révision à l'auteur en précisant les élements à modifier ou adapter."""
|
151 |
+
File information,Informations sur la fiche
|
152 |
+
Elements,Eléments
|
153 |
+
Text source,Texte source
|
154 |
+
Translated text,Texte traduit
|
155 |
+
Message to author for revision,Message pour l'auteur en vue d'une revision
|
156 |
+
Translations,Translations
|
157 |
+
You are viewing default/website values. Please select a store view (from left) to see translation options.,Veuillez sélectionner la langue dans la liste “store view” sur la gauche pour démarrer la traduction de votre produit.
|
158 |
+
Translate product,Traduire le produit
|
159 |
+
TextMaster Login,Login TextMaster
|
160 |
+
Create your account,Créer votre compte
|
161 |
+
The list below shows all of your TextMaster translation and proofreading projects.,La liste ci-dessous rassemble tous vos projets de traduction ou de correction lancés sur TextMaster.
|
162 |
+
"To see a project's details, click on ''View'' in the last column. To start a translation project or to proofread your product descriptions, click on the ''New Project'' button.","Pour entrer dans le détail d'un de vos projets, cliquez sur ''Voir'' dans la dernière colonne du tableau. Pour commencer à traduire ou faire corriger vos fiches produits, cliquer sur le bouton ''Nouveau projet''. "
|
163 |
+
Crédit disponible :,Crédits disponibles :
|
164 |
+
Crédit manquant :,Crédits manquants :
|
165 |
+
Credits:,Crédits :
|
166 |
+
Textmaster account,Compte TextMaster :
|
167 |
+
word(s),mot(s)
|
168 |
+
translation,traduction
|
169 |
+
proofreading,rédaction
|
170 |
+
Translation,Traduction
|
171 |
+
Translate,Traduction
|
172 |
+
Proofreading,Rédaction
|
173 |
+
Select products,Sélectioner les produits
|
174 |
+
Propriétés du projet,Propriétés du projet
|
175 |
+
Send,Envoyer
|
176 |
+
you,vous
|
177 |
+
Textmasters saved,TextMasters sauvegardés
|
178 |
+
You do not have any authors in your Favorites list,Vous n'avez pas d'auteurs favoris.
|
179 |
+
Project does not exist,Le projet n'existe pas
|
180 |
+
"Your product description is being approved, this will take a few moments. You can use Magento in the meantime and then come back to your project to finish it.","Cette fiche est en cours de validation, cela prendra quelques instants. Vous pouvez continuer votre navigation dans Magento et revenir ensuite finaliser votre projet."
|
181 |
+
Buy credits,Acheter des crédits
|
182 |
+
Manage Projects,Gérer les projets
|
183 |
+
Activities,Type de projet
|
184 |
+
Product Default Language,Langages par défaut des produits
|
185 |
+
Briefing message for proofreading,Briefing par défaut pour la rédaction
|
186 |
+
Briefing message for translation,Briefing par défaut pour la traduction
|
187 |
+
Category,Catégorie
|
188 |
+
Type of vocabulary,Type de vocabulaire
|
189 |
+
Target audience,Audience ciblé
|
190 |
+
Grammatical Person,Personne grammaticale
|
191 |
+
Default values,Valeurs par défaut
|
192 |
+
Email,Email
|
193 |
+
Password,Mot de passe
|
194 |
+
Confirm password,Confirmer votre mot de passe
|
195 |
+
Phone,Téléphone
|
196 |
+
Create your free account,Créez votre compte gratuitement
|
197 |
+
Connexion,Connexion
|
198 |
+
Login,Identifiant
|
199 |
+
Searching...,Searching...
|
200 |
+
Logout,Déconnexion
|
201 |
+
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Textmaster_Textmaster</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Get your product descriptions translated or corrected by professionals directly through Magento. </summary>
|
10 |
+
<description>TextMaster makes it easy to translate (or proofread) your entire product catalog by professionals in over 15 languages. Open your doors to new markets in just a few clicks by using our intuitive extension to make your store multilingual.</description>
|
11 |
+
<notes>Module textmaster</notes>
|
12 |
+
<authors><author><name>TextMaster</name><user>TextMaster</user><email>elizaveta@textmaster.com</email></author></authors>
|
13 |
+
<date>2014-10-08</date>
|
14 |
+
<time>10:30:04</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Textmaster"><dir name="Textmaster"><dir name="Block"><dir name="Adminhtml"><file name="Credit.php" hash="d6a923cfaf5279e4adf27986c87362b0"/><dir name="Document"><dir name="Renderer"><file name="Status.php" hash="f42270298a953c47ed05008dc17ffbe3"/></dir><file name="Supportmessage.php" hash="3de2c98e34072d8036fbb3baf51fc680"/><file name="View.php" hash="d52005ea467d779bf80a428f3e3f24da"/></dir><dir name="Project"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Checkbox.php" hash="8f57ab35ad7704ef05012d219ca0323d"/><file name="Massaction.php" hash="62dadad96a7548df68e3f3c627e94589"/></dir></dir></dir><file name="Grid.php" hash="3a8293430513271d1ee3f44b0c3120f8"/><dir name="Onglets"><file name="Form.php" hash="e686e8cfdac33fa21c86e26fe93a6a07"/><file name="Step1.php" hash="4a7713f1d3206b8f0f640dda3b1859c1"/><file name="Step2.php" hash="b00a6191667f8be5b2745e1f3a73249f"/><dir name="Step3"><file name="Author.php" hash="7ec92925a374885bfff851d8abf24787"/><dir name="Form"><file name="Author.php" hash="b965e02d28139d9c7f6e58fbb15e8e1b"/></dir></dir><file name="Step3.php" hash="29d7141fdc9af7c7590474581fb65d43"/><file name="Summary.php" hash="ed4dd8dcb8f1acdcc366b405f840570c"/></dir><file name="Onglets.php" hash="309dd49d8d65bf1c71247ce0647ffe20"/><dir name="Renderer"><file name="Nbdocument.php" hash="244d668e3f8a01c21208fdd2a71d0080"/><file name="Price.php" hash="a21b198258a81bb9b411f638e6b5f5e7"/><file name="Progression.php" hash="2e7c43d38b5640b463963a30239225c9"/><file name="Status.php" hash="782007cbd27b4ccc4200e87e34789ee2"/><file name="Store.php" hash="d92ccafcec2ad102b85bcb6bd3131779"/><file name="Wordcount.php" hash="d4714582d744a718e20d5c1444393c8a"/></dir><dir name="View"><file name="Documents.php" hash="48ab17be73308883855cf5ec0d51ce2b"/><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Checkbox.php" hash="89c7d2afed7e6b031237b8d57194aae8"/><file name="Massaction.php" hash="e39a40293de5764fc41c49fa54964026"/></dir></dir></dir></dir><file name="View.php" hash="6bf35aa21fc9761c5edf5a21f36dcba7"/></dir><file name="Project.php" hash="1919358b2d024822775ec1dbc9f92d2b"/><dir name="Renderer"><file name="Sourcelanguage.php" hash="61ade1d391fc882d3483b68612f1b784"/><file name="Targetlanguage.php" hash="2defedb3f9b57a2c34e05a30533074e1"/><file name="UpdatedAt.php" hash="2543e1ecaf1431966321031d09147c11"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Briefing.php" hash="f1ae93b9d2c02ca12aa93694e070232e"/><file name="Creation.php" hash="fad41de891ad9edadc2a6ffde2fcbd64"/><file name="Islog.php" hash="eae9171d420538775256cedf6387d546"/><file name="Login.php" hash="2298acda584281bc123ad1b922b83a14"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7ba1ec089a51747436b915ee4174b494"/></dir><dir name="Model"><file name="Api.php" hash="0d20d53108cab44ade7b7890b2e06f80"/><file name="Document.php" hash="ba6204c001d2d8c13d6040c9dde893c6"/><dir name="Mysql4"><dir name="Document"><file name="Collection.php" hash="6253cce06c8b2d65305770e4cc0faf34"/></dir><file name="Document.php" hash="b7c143dec4b9c9d131a25fe85e76c686"/><dir name="Project"><dir name="Attribute"><file name="Collection.php" hash="2873221c4cceef621c2920696ca9f937"/></dir><file name="Attribute.php" hash="f997d919bbc5bd47ad840d522ce1de15"/><file name="Collection.php" hash="44c097d5d7edf4509a373b1abedd6245"/></dir><file name="Project.php" hash="c78db4c76e2ce2f6ebf1cf8a48c723ef"/></dir><file name="Observer.php" hash="2f5778ed0c4fb579ccfd1e3f5c5bcff0"/><dir name="Project"><file name="Attribute.php" hash="e824699895626069cae908b5a7894c4d"/></dir><file name="Project.php" hash="5c7471e5b2e1c375acdf6660909806ec"/><dir name="Source"><dir name="Api"><file name="Audience.php" hash="d9bcdf66964436b1efbc96af0a2e2e40"/><file name="Author.php" hash="758fd2e35aa096eacd2995088da64267"/><file name="Category.php" hash="358defa5cf859af62c68f675809b47eb"/><file name="Grammatical.php" hash="dcb73d6ac8cd93f73b6af08ec3ffb057"/><file name="Lang.php" hash="2f7c65d8c9d2247364bab2b3a26cd638"/><file name="Type.php" hash="9cff2f1385ac6e5bafb8c986152c4c08"/><file name="Vocabulary.php" hash="494ed3154a1c8dbe492da5a32f2dbad7"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="04dc105d3f7914eb9862ce888d9f4d4f"/><file name="ApiController.php" hash="1231743abbc6d20f56a909ed73753e7e"/><file name="ProjectController.php" hash="e19d8eba952ef869df8bfc34668be923"/></dir><file name="CallbackController.php" hash="a4013078eb1e813bef1c426b8d373411"/><file name="IndexController.php" hash="7588d1f1a9918834837e0215569ab560"/></dir><dir name="etc"><file name="config.xml" hash="07b343d74bfd52ccfa94036fd995e146"/><file name="jstranslator.xml" hash="46ddfe751dc4e1f34bc95dbc09263eee"/><file name="system.xml" hash="981d732eac4d47ed82e12795fea71d16"/></dir><dir name="sql"><dir name="textmaster_setup"><file name="mysql4-install-0.0.1.php" hash="162032e7872f14cc0049c73b79fdb7e7"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="d0e9ddeb6f62e36747e1f7df4fe99db1"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="8e3cad04b99df0c2a1e3369bd7c432ee"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="1d5f415b61fd5ef6b4c352cd9f2ba75e"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="791ca3e154ba7249478339b98c40eb94"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="865aac8301b8afe668590ec81b08877e"/><file name="mysql4-upgrade-0.0.6-0.0.7.php" hash="22238b586ef7acbfc8e72b60ad19eff2"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="57c692e4a1357794af92e884b7316047"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="textmaster"><file name="credit.phtml" hash="c89b6836429a831be59d7718c1b6600f"/><dir name="document"><file name="support_messages.phtml" hash="718d4b88147a88dd3a4a79ee937cfb0b"/><file name="view.phtml" hash="3c4164c1c0a8b651f8b799fafd869a00"/></dir><dir name="form"><file name="container.phtml" hash="a178289bb54908698de0423a04f925f3"/></dir><dir name="grid"><file name="container.phtml" hash="3a46640e22f5458ba1bb43abcd50fb31"/></dir><file name="login.phtml" hash="6d32209da30745ee73f9d89e18662792"/><dir name="onglet"><file name="popinauthors.phtml" hash="88755e5187349b78cace1b922a00d310"/></dir><file name="onglet.phtml" hash="f19b8e5eb8e0f67fee9eb451db6597d0"/><file name="page.phtml" hash="5dfa6347708268bf5108186a1145e530"/><dir name="product"><file name="edit.phtml" hash="df650e19786fc14bf570c10eeaad2762"/></dir><file name="view.phtml" hash="422ad35864499f679027e3dbfdee6bde"/></dir></dir><dir name="layout"><file name="textmaster.xml" hash="b5464624e62899af321bc13c2720631b"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="textmaster"><file name="popin.css" hash="b9624ff6924adf24302b2a9ce73704fb"/><file name="styles.css" hash="61e33a529634ed22fd2e0f56d3647caf"/></dir></dir><dir name="images"><dir name="textmaster"><file name="ad.png" hash="4d3bfa60fb52ee8f9ce3c0f3934a0e08"/><file name="ae.png" hash="f3838d0ca01d7a76de74249ff2b514c7"/><file name="af.png" hash="a44bb210f25bafca92627b1187b0996d"/><file name="ag.png" hash="7b00bd7c2754618d57b78c407d6b542a"/><file name="al.png" hash="3f8b9ccd82877835192c5235e84ea543"/><file name="am.png" hash="f1f48cdf20af82bd4e708f40a844c08e"/><file name="ao.png" hash="13dd9ec64e95578da89ac092ea6bc49d"/><file name="ar.png" hash="e2a2372c9190c58e450d563c857cf932"/><file name="at.png" hash="0ed42d4df345bbe1a9eacc40a1ba9891"/><file name="au.png" hash="95609fc7efb05fab769b08c567dcafe3"/><file name="az.png" hash="82ee424e37625aa0bc6f0f2e2798ff33"/><file name="ba.png" hash="098a79c08cd07a7940affe818d8108d2"/><file name="bb.png" hash="237f1706a74e31a1f0f40080285af716"/><file name="bd.png" hash="5dd17c6db835d0e611b582a9aab36a69"/><file name="be.png" hash="140b16e73953d41b172e5a13106d96d7"/><file name="bf.png" hash="8bf9167bd4d4c8ab177590a03f18cb3a"/><file name="bg.png" hash="5f21946772326567c3bc2eb62693862d"/><file name="bh.png" hash="40acbad63f1ebb842cac8225198caa80"/><file name="bi.png" hash="ef7a1794da922df0876811e673795b40"/><file name="bj.png" hash="e776d8d30d79c46196bf63cf3698a005"/><file name="bn.png" hash="6f8378e8492e6d65297a878000d86cdd"/><file name="bo.png" hash="42addc49c770236532fb3425c39e855e"/><file name="br.png" hash="5820e89cdd217f41a8160611c2772450"/><file name="bs.png" hash="f10c1553ab9d8d3f50fa50789a0ec14d"/><file name="bt.png" hash="edced8a66c05b17cb3a66f4edab81537"/><file name="bw.png" hash="87ad8d31999e9f3dcf4af9b4002bd198"/><file name="by.png" hash="74271a2d533cf0f010f684527506a1b7"/><file name="bz.png" hash="3e6e3a59ea76dd361dd44c59e878cce1"/><file name="ca.png" hash="bde2e7c28a15fef7c21023d0d42e0af6"/><file name="cd.png" hash="43c7041408a403b5a5bff6ee5c486dcb"/><file name="cf.png" hash="8b0f9b4821681f89adc2a05cc9cb93f8"/><file name="cg.png" hash="69fc1655e73b91d5de5e526eb77a25dd"/><file name="ch.png" hash="4bd0882fe41076facbed622f45f5fe12"/><file name="ci.png" hash="33d6b8f53b17b291c82ba89268cc33c3"/><file name="cl.png" hash="97ac63f223ad9b8c9c89ede5a463fe16"/><file name="cm.png" hash="3a02cc8fd12eb3d46785b043eb1b4843"/><file name="cn.png" hash="7d8619cadee5b9bc776bee8c7c0d9bff"/><file name="co.png" hash="01799343910800de170f5bd2842f8610"/><file name="cr.png" hash="a261c45d21511884d98938746a88cda9"/><file name="cu.png" hash="6374430cbe6044d27a1e873982cb0e76"/><file name="cv.png" hash="ad5a8d21169eaa192fed00d022f3e970"/><file name="cy.png" hash="394575dc8ccea26e40ceb8059ed32140"/><file name="cz.png" hash="a25b0e8335083286931938e0b9203176"/><file name="de.png" hash="d5af4cc2395e7221e0fc625f892b44fb"/><file name="dj.png" hash="ad81ed92212c8118daf1227547fa672f"/><file name="dk.png" hash="d4a4b2d8804d713a687690e8d5d86b0d"/><file name="dm.png" hash="3d0dcb98ba84de45ba9f95f829530e75"/><file name="do.png" hash="579619d7a624dd7ee8d01ac1f2128a1e"/><file name="dz.png" hash="d798915a98660a226bb0418c6cf3ef4f"/><file name="ec.png" hash="84126d2520a0d9f993d3237725a7f907"/><file name="ee.png" hash="9d6bb07ed60ff800bb61f5bb0aaad99a"/><file name="eg.png" hash="984c617fe29427198dcbf7d41170e94b"/><file name="eh.png" hash="703d4e948c1f575016157e657d16b4f1"/><file name="en.png" hash="ffdfe557dee5d9f7ff9744708762bf67"/><file name="er.png" hash="847e75043e54c4aa95c219dd05605880"/><file name="es.png" hash="38970876b2bfb01c903419f91f026878"/><file name="et.png" hash="a7838af033c27a4d5d81e5e964dd45f5"/><file name="fi.png" hash="d64cea1ef1a5994aadcc6380bc3f33d6"/><file name="fj.png" hash="5f0f59be9e403329fa7059ab48609118"/><file name="flags-mini.zip" hash="7221658c2d26144a361403723d278205"/><file name="fm.png" hash="437654b1e67bbf1f90e971222fab6974"/><file name="fr.png" hash="6a705fd57e522b3644597d03606d3e17"/><file name="ga.png" hash="619b7bd8cbd79d04949f86b8fef80bc6"/><file name="gd.png" hash="722b7d1192b950ee6d93a02d2a5e4ba7"/><file name="ge.png" hash="930de4a6c9eab9cae548938903500d28"/><file name="gh.png" hash="ad81a6bdafb414b363d08180caf6a8e3"/><file name="gm.png" hash="f16737716084f29a9d9ba01501fb8732"/><file name="gn.png" hash="b36b8a91e876b1d9b11d020c81a2b806"/><file name="gq.png" hash="20bb217c3333a4a0a361581d84ca5326"/><file name="gr.png" hash="2841baa87ea947e5e3bc80278627d5da"/><file name="gt.png" hash="ef388b528291fd6f7742d3b4b0cd3800"/><file name="gw.png" hash="27e732fe984241041a09315ac235a923"/><file name="gy.png" hash="c2083c5428dec76473780cc97f7449a1"/><file name="hn.png" hash="b630fa10ad4fa8762215dc9e716c5466"/><file name="hr.png" hash="e8c7e75fa9eed2ae2b2ba34dd73e56e6"/><file name="ht.png" hash="d125e54a88ac04211b61d49a7fc0cc70"/><file name="hu.png" hash="96db67ede070c6a86a778660d80e7e26"/><file name="id.png" hash="63199df1f7136f80ca81d95190899db7"/><file name="ie.png" hash="d0088733cda1245823726ecf8018ab69"/><file name="il.png" hash="15b6e79abb6f553938b24d949fea1ffd"/><file name="in.png" hash="11addda3b86a7f8fc55abfd80a38f7a5"/><file name="iq.png" hash="35ee00f1ec3e5815ec3890ff397f2ba0"/><file name="ir.png" hash="a0db2ed68e2e29cc366e019e4c676262"/><file name="is.png" hash="1a39e1dec42eb5c8e5cc98bcb6e71c37"/><file name="it.png" hash="502d044737b407caa56138bc8235e55a"/><file name="jm.png" hash="fb67cd9833b430b1081b68d8bea97a4e"/><file name="jo.png" hash="ded495d673605aca3ddb9bd5cc6e2ca3"/><file name="jp.png" hash="64a5be7e6bdc94ba6866bab79b44eabc"/><file name="ke.png" hash="6f58b731e1f6dd7b13cb659e8ff04154"/><file name="kg.png" hash="229cf7889548451a8d467b85d06c212a"/><file name="kh.png" hash="1cd4d9aeaed32e129f54408cb2cda3d7"/><file name="ki.png" hash="b0596385cffbe421730b16f4a2e0d290"/><file name="km.png" hash="657977b976bcbf8c03bcac268814d020"/><file name="kn.png" hash="f89b4a2d2fd0b44e22b4281a7740e4c7"/><file name="kp.png" hash="fd794d0813a3da085113804070ec89e1"/><file name="kr.png" hash="cf0e98be60de5bf10f6dcff1ea224720"/><file name="ks.png" hash="9cb1c058d614957a6c3f04bb8384d672"/><file name="kw.png" hash="2f9130a5d176b54f632f7bb08860f28e"/><file name="kz.png" hash="288a3b09f8dd0b6b251c2a9759ff61e1"/><file name="la.png" hash="07f807a8c739bead3997a11ed6c741b1"/><file name="lb.png" hash="23b9b946942bc2c3ac2242e5675d810f"/><file name="lc.png" hash="2e7aba2fb74c757f79f500dea57fc69c"/><file name="li.png" hash="e826167750c88d94c5eb43c043ba3907"/><file name="lk.png" hash="4463604a10b4b7a3679bd45c76b56dd1"/><file name="lr.png" hash="2cb94086e7fcc2042435c7b69f1e6438"/><file name="ls.png" hash="86bc8c806555483bfa59cfc36d485f66"/><file name="lt.png" hash="35dfa78cf04b6571cc82e7a356641f1b"/><file name="lu.png" hash="329ad84226aacd1e22695cb72c2822cd"/><file name="lv.png" hash="ba99fb872543c7d4853b50f788e2fda0"/><file name="ly.png" hash="1d232daa96e0f7ca7e1ecdec5e6d8371"/><file name="ma.png" hash="006f06311e103a2efb9618f485685300"/><file name="mc.png" hash="6abe8119c30e760986c705c361211fc6"/><file name="md.png" hash="b5904d63976ccfe9985238b76e8b49e0"/><file name="me.png" hash="b7bf90515ff08512425929ff2734f5a5"/><file name="mg.png" hash="896adcfd3afa8f292e25ecaf5e57956e"/><file name="mh.png" hash="50165a2514b035e3482d6d2f4876d8ec"/><file name="mk.png" hash="1016d35de15d82434e06bffda64d421b"/><file name="ml.png" hash="9b3b0773ec50db0f0d775c9776e74c04"/><file name="mm.png" hash="cdafdf2162e5cb1c8b8e312b9f4cfec8"/><file name="mn.png" hash="faa28969f96cae1085cc6c8d9234dbe4"/><file name="mr.png" hash="d83fb1097bcb99133d9d224d06207d71"/><file name="mt.png" hash="ac23976d3a0d2873b7fb72c8503018bf"/><file name="mu.png" hash="bda1ed19036d5716a1aea8ddd23f5b24"/><file name="mv.png" hash="a5e4d4f9d846ba2df572f7855e5d153c"/><file name="mw.png" hash="73ce56eeac955942ab87f6714c2b2f1c"/><file name="mx.png" hash="515daf584560866ba82458a2841b2c5c"/><file name="my.png" hash="ec302b316857c5a655e9d0838a7299bf"/><file name="mz.png" hash="b1a305321450ff8cfacb7b51ef54702e"/><file name="na.png" hash="6b1782b56d5607651fd8467a3282becf"/><file name="ne.png" hash="fd7a4ac6a5b0bfcd11e19b59e4eb9491"/><file name="ng.png" hash="fbdc831cab445407014a8be0cd9d1f9b"/><file name="ni.png" hash="87be5b122aaafed59e42a1c94472f4ca"/><file name="nl.png" hash="b7d65809e5c02d8d36c01a08adc32ee4"/><file name="no.png" hash="87f804f26166303a42d85ceba925ff82"/><file name="np.png" hash="6e43bb94985c756a15b7ad47e1be25a9"/><file name="nr.png" hash="01771f576a6a73750637796ca4f9b1d1"/><file name="nz.png" hash="a37276b951a51d5b4cbf5169b3fbe899"/><file name="om.png" hash="2c13864af6fa36541fc66a6e8f3af91e"/><file name="pa.png" hash="b79104676e49981ca9937015349c63e0"/><file name="pe.png" hash="80a714541ee3a84286f79f31abef7232"/><file name="pg.png" hash="0fd60c1657cf591650ea7672ce1189af"/><file name="ph.png" hash="47942dfa29448f707cc8aea171d120bf"/><file name="pk.png" hash="047cccacc9290dd94a3d5febc0499cf8"/><file name="pl.png" hash="7b8a0298dac0a7f273d5e6b741f8038f"/><file name="pt.png" hash="3141bfbda3235bc2f950243981753a23"/><file name="pw.png" hash="6eaebbe7b69c3bf9c3c50f4c3cc9100f"/><file name="py.png" hash="948dc594390295dc43a22bb228ff8296"/><file name="qa.png" hash="237556d7031c9d09e86e8b806310eef3"/><file name="ro.png" hash="5508a42870fb98d3dc1281133e36908e"/><file name="rs.png" hash="e81f589284efdc070501b676cbf2440a"/><file name="ru.png" hash="46378f0d5a6e8339db251971fa05acc8"/><file name="rw.png" hash="4afb87332945b130e463fc5b7706caf8"/><file name="sa.png" hash="2cf7460d937ea6ac4aa80c84722ff127"/><file name="sb.png" hash="ec4690d32d683027cab5475fbc6817eb"/><file name="sc.png" hash="6b232689798b91d278928c5f8db684b6"/><file name="sd.png" hash="3ec6b86188d06cc95af59a4401fa51c1"/><file name="se.png" hash="34ca8036ec0d98e5b8f0972e7c3b690c"/><file name="sg.png" hash="0df385a93794a40b8927d9b6fe8c8ab4"/><file name="si.png" hash="7c0304b3da174716cb637e559ba30462"/><file name="sk.png" hash="f1192c4beac2189817b990302d6023c0"/><file name="sl.png" hash="dded38a2eedec2575e7200753a8d2c0c"/><file name="sm.png" hash="fce953adb78a308692ae504f8bc68a03"/><file name="sn.png" hash="dee77d596acc5a7045db7c0eca9996e6"/><file name="so.png" hash="a88729fc16aa813315a7edc1374e34e5"/><file name="sr.png" hash="6cd104e7e702c0f17a80be2da797b2c2"/><file name="st.png" hash="ac34029ffd9ab8b0f14669295f838a92"/><file name="sv.png" hash="87de653ebd702dc2c1908bdad6b5e07d"/><file name="sy.png" hash="2c0f028a239914970be87e691bcd3907"/><file name="sz.png" hash="06cf5b39e7ade92fa9d29619f69fa0e6"/><file name="td.png" hash="323ae3550138d0054343f3d75367bfb1"/><file name="tg.png" hash="bf0360afe91efa96d766bc9de7b4726d"/><file name="th.png" hash="7c7f53c225be44fc2897dd007549245b"/><file name="tj.png" hash="472b4679950b9562d3618b9c9ef518d5"/><file name="tl.png" hash="7197fb1849ba9c8c7f9b1e240e37b85b"/><file name="tm.png" hash="177489fdf6e6380131c2f989a1467b24"/><file name="tn.png" hash="162105faa75e6ceb9f0e5b982343a07c"/><file name="to.png" hash="a96505c14820af79abb3567056abca39"/><file name="tr.png" hash="8307e3e68476fe75f0a396b8e96761d3"/><file name="tt.png" hash="304a6848ef200b4d3cde0b1d5cc5523e"/><file name="tv.png" hash="ed5ffe4560b8b651b0d321bc6f6875c7"/><file name="tw.png" hash="56d7df67199ebcce42d70cea202b8a36"/><file name="tz.png" hash="1675509852611fabc2d11966274f5617"/><file name="ua.png" hash="dc3eb73822683ea9980711d34cc01d68"/><file name="ug.png" hash="e7ef297a425c8ac105b5e52c2e338794"/><file name="us.png" hash="1fac8f33d3c11a92fc7913f27df16339"/><file name="uy.png" hash="e00ba3948043a99ab07db91db8dd94f3"/><file name="uz.png" hash="2cb5bc704b35ef438b92824dd1cb7c83"/><file name="va.png" hash="4e3061c712414e91d312ca5a587ea24c"/><file name="vc.png" hash="0ee195323c3613d5e5d635a445c922df"/><file name="ve.png" hash="019c86c82fe6a1ad59ec5d800db3a66f"/><file name="vn.png" hash="d33f6ad2504d1559b10e0f6f084cbe59"/><file name="vu.png" hash="fe3acbd24eb0e11f45cdc3cd6b2a22ea"/><file name="ws.png" hash="bd859467d80a0740bb5ab950def621f2"/><file name="ye.png" hash="47036485a58d485f9cbbc8c661daf8d3"/><file name="za.png" hash="6d0a8ef2e6bdd3325e86b2fe9ec74cf9"/><file name="zm.png" hash="cc14e520271994baccd073ffb852d144"/><file name="zw.png" hash="16b7534269b89084bbdab36c8da5da2e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Textmaster_Textmaster.xml" hash="c7189ff759aac7e98638198ba1b59e96"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Textmaster_Textmaster.csv" hash="446e4803276a66339989c219bc7cc548"/></dir><dir name="en_US"><file name="Textmaster_Textmaster.csv" hash="6ca63589043e2ef58500bb62cbc13a72"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/css/textmaster/popin.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2014 Textmaster
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* It is available through the world-wide-web at this URL:
|
8 |
+
* http://opensource.org/licenses/osl-3.0.php
|
9 |
+
*
|
10 |
+
* @category Addonline
|
11 |
+
* @package Addonline_Textmaster
|
12 |
+
* @copyright Copyright (c) 2014 Textmaster
|
13 |
+
* @author Addonline (http://www.addonline.fr)
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
.wrapper {
|
17 |
+
min-width: 460px !important;
|
18 |
+
}
|
19 |
+
.middle {
|
20 |
+
min-height: initial !important;
|
21 |
+
__height:100%;
|
22 |
+
}
|
skin/adminhtml/default/default/css/textmaster/styles.css
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2014 Textmaster
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* It is available through the world-wide-web at this URL:
|
8 |
+
* http://opensource.org/licenses/osl-3.0.php
|
9 |
+
*
|
10 |
+
* @category Addonline
|
11 |
+
* @package Addonline_Textmaster
|
12 |
+
* @copyright Copyright (c) 2014 Textmaster
|
13 |
+
* @author Addonline (http://www.addonline.fr)
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
ol.steps_project {
|
17 |
+
list-style: none;
|
18 |
+
margin: 0 0 20px;
|
19 |
+
padding: 0;
|
20 |
+
overflow: hidden;
|
21 |
+
font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'DejaVu Sans', 'Bitstream Vera Sans', 'Liberation Sans', Verdana, 'Verdana Ref', sans-serif;
|
22 |
+
font-size: 13px;
|
23 |
+
line-height: 20px;
|
24 |
+
font-weight: bold;
|
25 |
+
counter-reset: li;
|
26 |
+
}
|
27 |
+
|
28 |
+
ol.steps_project > li {
|
29 |
+
float: left;
|
30 |
+
list-style-image: none;
|
31 |
+
list-style-type: none;
|
32 |
+
margin-left: 0;
|
33 |
+
text-align: center;
|
34 |
+
color: #3a3a3a;
|
35 |
+
background: #FAFAFA;
|
36 |
+
position: relative;
|
37 |
+
margin-left: 43px;
|
38 |
+
}
|
39 |
+
|
40 |
+
ol.steps_project > li.disabled{
|
41 |
+
color : #AAA;
|
42 |
+
}
|
43 |
+
|
44 |
+
ol.steps_project > li:after {
|
45 |
+
position: absolute;
|
46 |
+
top: 50%;
|
47 |
+
left: 100%;
|
48 |
+
content: " ";
|
49 |
+
height: 0;
|
50 |
+
width: 0;
|
51 |
+
pointer-events: none;
|
52 |
+
border: solid transparent;
|
53 |
+
border-left-color: #FAFAFA;
|
54 |
+
border-width: 19px;
|
55 |
+
margin-top: -19px;
|
56 |
+
}
|
57 |
+
|
58 |
+
ol.steps_project > li:first-child {
|
59 |
+
margin-left: 0;
|
60 |
+
}
|
61 |
+
|
62 |
+
ol.steps_project > li:first-child span {
|
63 |
+
padding: 9px;
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
ol.steps_project > li:first-child span:after {
|
68 |
+
border: none;
|
69 |
+
}
|
70 |
+
|
71 |
+
ol.steps_project > li:last-child:after {
|
72 |
+
border-width: 0;
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
ol.steps_project > li span {
|
77 |
+
display: block;
|
78 |
+
padding: 9px 28px 9px 9px;
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
ol.steps_project > li span:after {
|
83 |
+
position: absolute;
|
84 |
+
top: 50%;
|
85 |
+
right: 100%;
|
86 |
+
content: " ";
|
87 |
+
height: 0;
|
88 |
+
width: 0;
|
89 |
+
pointer-events: none;
|
90 |
+
border: solid #FAFAFA;
|
91 |
+
border-left-color: transparent;
|
92 |
+
border-width: 19px;
|
93 |
+
margin-top: -19px;
|
94 |
+
}
|
95 |
+
|
96 |
+
ol.steps_project > li span::before {
|
97 |
+
content: counter(li) ") ";
|
98 |
+
counter-increment: li;
|
99 |
+
}
|
100 |
+
|
101 |
+
ol.steps_project > li.current {
|
102 |
+
color: #fff;
|
103 |
+
background: #6F8992;
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
+
ol.steps_project > li.current:after {
|
108 |
+
border-left-color: #6F8992;
|
109 |
+
}
|
110 |
+
|
111 |
+
ol.steps_project > li.current span:after {
|
112 |
+
border-color: #6F8992;
|
113 |
+
border-left-color: transparent;
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
li.step1 {
|
118 |
+
z-index: 3;
|
119 |
+
}
|
120 |
+
li.step2 {
|
121 |
+
z-index: 2;
|
122 |
+
}
|
123 |
+
li.step3 {
|
124 |
+
z-index: 1;
|
125 |
+
}
|
126 |
+
.textmaster-info{
|
127 |
+
background:#F6F6F6;
|
128 |
+
border:1px solid #EFEFEF;
|
129 |
+
padding: 5px 17px 5px 17px;
|
130 |
+
margin-bottom: 10px;
|
131 |
+
font-weight:bold;
|
132 |
+
}
|
133 |
+
.textmaster-info .textmaster-credit{
|
134 |
+
display:block;
|
135 |
+
float:right;
|
136 |
+
}
|
137 |
+
.textmaster-introduction{
|
138 |
+
margin-bottom:16px;
|
139 |
+
}
|
140 |
+
.progress-cadre{
|
141 |
+
display:block;
|
142 |
+
width:240px;
|
143 |
+
height:20px;
|
144 |
+
border:1px solid #f1af73;
|
145 |
+
}
|
146 |
+
.progress{
|
147 |
+
width:0;
|
148 |
+
display:block;
|
149 |
+
height:20px;
|
150 |
+
line-height:20px;
|
151 |
+
background: #ffac47 url("../../images/btn_bg.gif") repeat-x scroll 0 100% ;
|
152 |
+
}
|
153 |
+
#loading-mask .textmasterloading{
|
154 |
+
margin-left: -145px;
|
155 |
+
width:250px;
|
156 |
+
}
|
157 |
+
#loading-mask .textmasterloading .message{
|
158 |
+
display:block;
|
159 |
+
padding:10px 0 0 0;
|
160 |
+
font-size: 0.85em;
|
161 |
+
line-height:1.1em;
|
162 |
+
font-weight: normal;
|
163 |
+
}
|
164 |
+
tr.text-disable{
|
165 |
+
cursor: not-allowed !important;
|
166 |
+
}
|
167 |
+
tr.text-disable td{
|
168 |
+
/*background:#DDD;*/
|
169 |
+
color:#CCC;
|
170 |
+
font-style:italic;
|
171 |
+
|
172 |
+
|
173 |
+
}
|
174 |
+
tr.text-disable td a {
|
175 |
+
display:none;
|
176 |
+
}
|
skin/adminhtml/default/default/images/textmaster/ad.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ae.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/af.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ag.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/al.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/am.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ao.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ar.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/at.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/au.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/az.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ba.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bb.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bd.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/be.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bf.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bh.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bi.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bj.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bo.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/br.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bs.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bt.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/by.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/bz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ca.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cd.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cf.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ch.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ci.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cl.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/co.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cu.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cv.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cy.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/cz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/de.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/dj.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/dk.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/dm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/do.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/dz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ec.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ee.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/eg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/eh.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/en.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/er.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/es.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/et.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/fi.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/fj.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/flags-mini.zip
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/fm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/fr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ga.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gd.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ge.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gh.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gq.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gt.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/gy.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/hn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/hr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ht.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/hu.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/id.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ie.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/il.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/in.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/iq.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ir.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/is.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/it.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/jm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/jo.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/jp.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ke.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kh.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ki.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/km.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kp.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ks.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/kz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/la.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lb.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lc.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/li.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lk.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ls.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lt.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lu.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/lv.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ly.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ma.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mc.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/md.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/me.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mh.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mk.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ml.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mt.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mu.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mv.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mx.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/my.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/mz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/na.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ne.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ng.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ni.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/nl.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/no.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/np.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/nr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/nz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/om.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pa.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pe.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ph.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pk.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pl.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pt.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/pw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/py.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/qa.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ro.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/rs.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ru.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/rw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sa.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sb.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sc.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sd.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/se.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/si.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sk.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sl.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/so.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/st.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sv.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sy.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/sz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/td.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tg.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/th.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tj.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tl.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/to.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tr.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tt.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tv.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tw.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/tz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ua.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ug.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/us.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/uy.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/uz.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/va.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/vc.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ve.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/vn.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/vu.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ws.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/ye.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/za.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/zm.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/textmaster/zw.png
ADDED
Binary file
|