This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-03-24 16:15:19 -04:00
parent 5234de3135
commit 996dd83c26
2 changed files with 24 additions and 2 deletions

View File

@@ -14,6 +14,8 @@ class pmDynaform
public $fields = null;
public $record = null;
public $credentials = null;
public $lang = null;
public $langs = null;
public function __construct($fields)
{
@@ -38,6 +40,7 @@ class pmDynaform
}
$a = new Criteria("workflow");
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
$a->addSelectColumn(DynaformPeer::PRO_UID);
$a->addSelectColumn(DynaformPeer::DYN_UID);
@@ -47,6 +50,7 @@ class pmDynaform
$ds->next();
$row = $ds->getRow();
$this->record = isset($row) ? $row : null;
$this->langs = ($this->record["DYN_LABEL"] !== "" && $this->record["DYN_LABEL"] !== null) ? G::json_decode($this->record["DYN_LABEL"]) : null;
return $this->record;
}
@@ -189,6 +193,24 @@ class pmDynaform
$json->data = $rows;
}
}
//languages
if ($this->lang === null && $key === "language" && isset($json->language)) {
$this->lang = $json->language;
}
if ($key === "label" && isset($json->label) && $this->langs !== null && isset($this->langs->{$this->lang})) {
$langs = $this->langs->{$this->lang}->Labels;
foreach ($langs as $langsValue) {
if ($json->label === $langsValue->msgid)
$json->label = $langsValue->msgstr;
}
}
if ($key === "title" && isset($json->title) && $this->langs !== null && isset($this->langs->{$this->lang})) {
$langs = $this->langs->{$this->lang}->Labels;
foreach ($langs as $langsValue) {
if ($json->title === $langsValue->msgid)
$json->title = $langsValue->msgstr;
}
}
}
}
}
@@ -407,4 +429,4 @@ class pmDynaform
return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS);
}
}
}

View File

@@ -1190,7 +1190,7 @@ class DynaForm
$name = $_FILES["LANGUAGE"]["name"];
$name = explode(".", $name);
$content = $i18n->getHeaders();
$content["File-Name"] = $name;
$content["File-Name"] = $_FILES["LANGUAGE"]["name"];
$content["Labels"] = $translation;
$dynaForm = new \Dynaform();