public function findByIcName($IC_NAME) { $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(IsoCountryPeer::IC_UID); $oCriteria->addSelectColumn(IsoCountryPeer::IC_NAME); $oCriteria->add(IsoCountryPeer::IC_NAME, $IC_NAME . '%', Criteria::LIKE); $oDataset = IsoCountryPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); return $oDataset->getRow(); }
/** * Implementation for 'GET' method for Rest API * * @param mixed $icUid Primary key * * @return array $result Returns array within multiple records or a single record depending if * a single selection was requested passing id(s) as param */ protected function get($icUid = null) { $result = array(); try { $noArguments = true; $argumentList = func_get_args(); foreach ($argumentList as $arg) { if (!is_null($arg)) { $noArguments = false; } } if ($noArguments) { $criteria = new Criteria('workflow'); $criteria->addSelectColumn(IsoCountryPeer::IC_UID); $criteria->addSelectColumn(IsoCountryPeer::IC_NAME); $criteria->addSelectColumn(IsoCountryPeer::IC_SORT_ORDER); $dataset = AppEventPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($dataset->next()) { $result[] = $dataset->getRow(); } } else { $record = IsoCountryPeer::retrieveByPK($icUid); if ($record) { $result = $record->toArray(BasePeer::TYPE_FIELDNAME); } else { $paramValues = ""; foreach ($argumentList as $arg) { $paramValues .= strlen($paramValues) ? ', ' : ''; if (!is_null($arg)) { $paramValues .= "{$arg}"; } else { $paramValues .= "NULL"; } } throw new RestException(417, "table IsoCountry ({$paramValues})"); } } } catch (RestException $e) { throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } return $result; }
<?php global $RBAC; switch ($_POST['action']) { case 'countryList': require_once "classes/model/IsoCountry.php"; $c = new Criteria(); $c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL); $countries = IsoCountryPeer::doSelect($c); foreach ($countries as $rowid => $row) { $oData[] = array('IC_UID' => $row->getICUid(), 'IC_NAME' => $row->getICName()); } print G::json_encode($oData); break; case 'stateList': require_once "classes/model/IsoSubdivision.php"; $c = new Criteria(); $country = $_POST['IC_UID']; $c->add(IsoSubdivisionPeer::IC_UID, $country, Criteria::EQUAL); $locations = IsoSubdivisionPeer::doSelect($c); $oData = array(); foreach ($locations as $rowid => $row) { if ($row->getISUid() != '' && $row->getISName() != '') { $oData[] = array('IS_UID' => $row->getISUid(), 'IS_NAME' => $row->getISName()); } } print G::json_encode($oData); break; case 'locationList': require_once "classes/model/IsoLocation.php"; $c = new Criteria();
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(IsoCountryPeer::IC_UID, $pks, Criteria::IN); $objs = IsoCountryPeer::doSelect($criteria, $con); } return $objs; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = IsoCountryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setIcUid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setIcName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setIcSortOrder($arr[$keys[2]]); } }
public function getAllInformation($userUid) { if (!isset($userUid) || $userUid == "") { throw new Exception("{$userUid} is empty."); } try { require_once "classes/model/IsoCountry.php"; require_once "classes/model/IsoLocation.php"; require_once "classes/model/IsoSubdivision.php"; require_once "classes/model/Language.php"; G::LoadClass("calendar"); $aFields = $this->load($userUid); $c = new Criteria("workflow"); $c->add(IsoCountryPeer::IC_UID, $aFields["USR_COUNTRY"]); $rs = IsoCountryPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $rowC = $rs->getRow(); $c->clearSelectColumns(); $c->add(IsoSubdivisionPeer::IC_UID, $aFields["USR_COUNTRY"]); $c->add(IsoSubdivisionPeer::IS_UID, $aFields["USR_CITY"]); $rs = IsoSubdivisionPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $rowS = $rs->getRow(); $c->clearSelectColumns(); $c->add(IsoLocationPeer::IC_UID, $aFields["USR_COUNTRY"]); $c->add(IsoLocationPeer::IL_UID, $aFields["USR_LOCATION"]); $rs = IsoLocationPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $rowL = $rs->getRow(); //Calendar $calendar = new Calendar(); $calendarInfo = $calendar->getCalendarFor($userUid, $userUid, $userUid); $aFields["USR_CALENDAR"] = $calendarInfo["CALENDAR_APPLIED"] != "DEFAULT" ? $calendarInfo["CALENDAR_UID"] : ""; //Photo $pathPhoto = PATH_IMAGES_ENVIRONMENT_USERS . $userUid . ".gif"; if (!file_exists($pathPhoto)) { $pathPhoto = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif"; } //Data $arrayData = array(); $arrayData["username"] = $aFields["USR_USERNAME"]; $arrayData["firstname"] = $aFields["USR_FIRSTNAME"]; $arrayData["lastname"] = $aFields["USR_LASTNAME"]; $arrayData["mail"] = $aFields["USR_EMAIL"]; $arrayData["address"] = $aFields["USR_ADDRESS"]; $arrayData["zipcode"] = $aFields["USR_ZIP_CODE"]; $arrayData["country"] = $rowC["IC_NAME"]; $arrayData["state"] = $rowS["IS_NAME"]; $arrayData["location"] = $rowL["IL_NAME"]; $arrayData["phone"] = $aFields["USR_PHONE"]; $arrayData["fax"] = $aFields["USR_FAX"]; $arrayData["cellular"] = $aFields["USR_CELLULAR"]; $arrayData["birthday"] = $aFields["USR_BIRTHDAY"]; $arrayData["position"] = $aFields["USR_POSITION"]; $arrayData["replacedby"] = $aFields["USR_REPLACED_BY"]; $arrayData["duedate"] = $aFields["USR_DUE_DATE"]; $arrayData["calendar"] = $aFields["USR_CALENDAR"]; $arrayData["status"] = $aFields["USR_STATUS"]; $arrayData["department"] = $aFields["DEP_UID"]; $arrayData["reportsto"] = $aFields["USR_REPORTS_TO"]; $arrayData["userexperience"] = $aFields["USR_UX"]; $arrayData["photo"] = $pathPhoto; return $arrayData; } catch (Exception $e) { throw $e; } }
function getAllInformation($UsrUid) { if (!isset($UsrUid) or $UsrUid == '') { throw new Exception('$UsrUid is empty.'); } try { require_once 'classes/model/IsoCountry.php'; require_once 'classes/model/IsoLocation.php'; require_once 'classes/model/IsoSubdivision.php'; require_once 'classes/model/Language.php'; $aFields = $this->load($UsrUid); $c = new Criteria('workflow'); $c->add(IsoCountryPeer::IC_UID, $aFields['USR_COUNTRY']); $rs = IsoCountryPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $Crow = $rs->getRow(); $c->clearSelectColumns(); $c->add(IsoSubdivisionPeer::IC_UID, $aFields['USR_COUNTRY']); $c->add(IsoSubdivisionPeer::IS_UID, $aFields['USR_CITY']); $rs = IsoSubdivisionPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $Srow = $rs->getRow(); $aRet['username'] = $aFields['USR_USERNAME']; $aRet['firstname'] = $aFields['USR_FIRSTNAME']; $aRet['lastname'] = $aFields['USR_LASTNAME']; $aRet['mail'] = $aFields['USR_EMAIL']; $aRet['status'] = $aFields['USR_STATUS']; $aRet['address'] = $aFields['USR_ADDRESS']; $aRet['phone'] = $aFields['USR_PHONE']; $aRet['fax'] = $aFields['USR_FAX']; $aRet['cellular'] = $aFields['USR_CELLULAR']; $aRet['birthday'] = $aFields['USR_BIRTHDAY']; $aRet['position'] = $aFields['USR_POSITION']; $aRet['duedate'] = $aFields['USR_DUE_DATE']; $aRet['country'] = $Crow['IC_NAME']; $aRet['city'] = $Srow['IS_NAME']; return $aRet; } catch (Exception $oException) { throw $oException; } }
/** * Validate the data if they are invalid (INSERT and UPDATE) * * @param string $userUid Unique id of User * @param array $arrayData Data * * return void Throw exception if data has an invalid value */ public function throwExceptionIfDataIsInvalid($userUid, array $arrayData) { try { //Set variables $arrayUserData = ($userUid == "")? array() : $this->getUser($userUid, true); $flagInsert = ($userUid == "")? true : false; $arrayFinalData = array_merge($arrayUserData, $arrayData); //Verify data - Field definition. $process = new \ProcessMaker\BusinessModel\Process(); $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert); //Verify data if (isset($arrayData["USR_USERNAME"])) { $this->throwExceptionIfExistsName($arrayData["USR_USERNAME"], $this->arrayFieldNameForException["usrUsername"], $userUid); } if (isset($arrayData["USR_EMAIL"])) { if (!filter_var($arrayData["USR_EMAIL"], FILTER_VALIDATE_EMAIL)) { throw new \Exception($this->arrayFieldNameForException["usrEmail"] . ": " . \G::LoadTranslation("ID_INCORRECT_EMAIL")); } } if (isset($arrayData["USR_NEW_PASS"])) { $this->throwExceptionIfPasswordIsInvalid($arrayData["USR_NEW_PASS"], $this->arrayFieldNameForException["usrNewPass"]); } if (isset($arrayData["USR_REPLACED_BY"]) && $arrayData["USR_REPLACED_BY"] != "") { $obj = \UsersPeer::retrieveByPK($arrayData["USR_REPLACED_BY"]); if (is_null($obj)) { throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array($this->arrayFieldNameForException["usrReplacedBy"], $arrayData["USR_REPLACED_BY"]))); } } if (isset($arrayData["USR_DUE_DATE"])) { $arrayUserDueDate = explode("-", $arrayData["USR_DUE_DATE"]); if (ctype_digit($arrayUserDueDate[0])) { if (!checkdate($arrayUserDueDate[1], $arrayUserDueDate[2], $arrayUserDueDate[0])) { throw new \Exception($this->arrayFieldNameForException["usrDueDate"] . ": " . \G::LoadTranslation("ID_MSG_ERROR_DUE_DATE")); } } else { throw new \Exception($this->arrayFieldNameForException["usrDueDate"] . ": " . \G::LoadTranslation("ID_MSG_ERROR_DUE_DATE")); } } if (isset($arrayData["USR_ROLE"])) { require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Roles.php"); $criteria = new \Criteria("rbac"); $criteria->add(\RolesPeer::ROL_CODE, $arrayData["USR_ROLE"]); $rsCriteria = \RolesPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($this->arrayFieldNameForException["usrRole"]))); } } if (isset($arrayData["USR_COUNTRY"]) && $arrayData["USR_COUNTRY"] != "") { $obj = \IsoCountryPeer::retrieveByPK($arrayData["USR_COUNTRY"]); if (is_null($obj)) { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($this->arrayFieldNameForException["usrCountry"]))); } } if (isset($arrayData["USR_CITY"]) && $arrayData["USR_CITY"] != "") { if (!isset($arrayFinalData["USR_COUNTRY"]) || $arrayFinalData["USR_COUNTRY"] == "") { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($this->arrayFieldNameForException["usrCountry"]))); } $obj = \IsoSubdivisionPeer::retrieveByPK($arrayFinalData["USR_COUNTRY"], $arrayData["USR_CITY"]); if (is_null($obj)) { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($this->arrayFieldNameForException["usrCity"]))); } } if (isset($arrayData["USR_LOCATION"]) && $arrayData["USR_LOCATION"] != "") { if (!isset($arrayFinalData["USR_COUNTRY"]) || $arrayFinalData["USR_COUNTRY"] == "") { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($this->arrayFieldNameForException["usrCountry"]))); } $obj = \IsoLocationPeer::retrieveByPK($arrayFinalData["USR_COUNTRY"], $arrayData["USR_LOCATION"]); if (is_null($obj)) { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($this->arrayFieldNameForException["usrLocation"]))); } } if (isset($arrayData["USR_CALENDAR"]) && $arrayData["USR_CALENDAR"] != "") { $obj = \CalendarDefinitionPeer::retrieveByPK($arrayData["USR_CALENDAR"]); if (is_null($obj)) { throw new \Exception(\G::LoadTranslation("ID_CALENDAR_DOES_NOT_EXIST", array($this->arrayFieldNameForException["usrCalendar"], $arrayData["USR_CALENDAR"]))); } } if (isset($arrayData["DEP_UID"]) && $arrayData["DEP_UID"] != "") { $department = new \Department(); if (!$department->existsDepartment($arrayData["DEP_UID"])) { throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($this->arrayFieldNameForException["depUid"], $arrayData["DEP_UID"]))); } } } catch (\Exception $e) { throw $e; } }
function run_create_poedit_file($task, $args) { // the environment for poedit always is Development define('G_ENVIRONMENT', G_DEV_ENV); //the output language .po file $lgOutId = isset($args[0]) ? $args[0] : 'en'; $countryOutId = isset($args[1]) ? strtoupper($args[1]) : 'US'; $verboseFlag = isset($args[2]) ? $args[2] == true : false; require_once "propel/Propel.php"; require_once "classes/model/Translation.php"; require_once "classes/model/Language.php"; require_once "classes/model/IsoCountry.php"; Propel::init(PATH_CORE . "config/databases.php"); $configuration = Propel::getConfiguration(); $connectionDSN = $configuration['datasources']['propel']['connection']; printf("using DSN Connection %s \n", pakeColor::colorize($connectionDSN, 'INFO')); printf("checking Language table \n"); $c = new Criteria(); $c->add(LanguagePeer::LAN_ENABLED, "1"); $c->addor(LanguagePeer::LAN_ENABLED, "0"); $languages = LanguagePeer::doSelect($c); $langs = array(); $lgIndex = 0; $findLang = false; $langDir = 'english'; $langId = 'en'; foreach ($languages as $rowid => $row) { $lgIndex++; $langs[$row->getLanId()] = $row->getLanName(); if ($lgOutId != '' && $lgOutId == $row->getLanId()) { $findLang = true; $langDir = strtolower($row->getLanName()); $langId = $row->getLanId(); } } printf("read %s entries from language table\n", pakeColor::colorize($lgIndex, 'INFO')); printf("checking iso_country table \n"); $c = new Criteria(); $c->add(IsoCountryPeer::IC_UID, NULL, Criteria::ISNOTNULL); $countries = IsoCountryPeer::doSelect($c); $countryIndex = 0; $findCountry = false; $countryDir = 'UNITED STATES'; $countryId = 'US'; foreach ($countries as $rowid => $row) { $countryIndex++; if ($countryOutId != '' && $countryOutId == $row->getICUid()) { $findCountry = true; $countryDir = strtoupper($row->getICName()); $countryId = $row->getICUid(); } } printf("read %s entries from iso_country table\n", pakeColor::colorize($countryIndex, 'INFO')); if ($findLang == false && $lgOutId != '') { printf("%s \n", pakeColor::colorize("'{$lgOutId}' is not a valid language ", 'ERROR')); die; } else { printf("language: %s\n", pakeColor::colorize($langDir, 'INFO')); } if ($findCountry == false && $countryOutId != '') { printf("%s \n", pakeColor::colorize("'{$countryOutId}' is not a valid country ", 'ERROR')); die; } else { printf("country: [%s] %s\n", pakeColor::colorize($countryId, 'INFO'), pakeColor::colorize($countryDir, 'INFO')); } if ($findCountry && $countryId != '') { $poeditOutFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $langDir . PATH_SEP . MAIN_POFILE . '.' . $langId . '_' . $countryId . '.po'; } else { $poeditOutFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $langDir . PATH_SEP . MAIN_POFILE . '.' . $langId . '.po'; } printf("poedit file: %s\n", pakeColor::colorize($poeditOutFile, 'INFO')); $poeditOutPathInfo = pathinfo($poeditOutFile); G::verifyPath($poeditOutPathInfo['dirname'], true); $lf = "\n"; $fp = fopen($poeditOutFile, 'w'); fprintf($fp, "msgid \"\" \n"); fprintf($fp, "msgstr \"\" \n"); fprintf($fp, "\"Project-Id-Version: %s\\n\"\n", PO_SYSTEM_VERSION); fprintf($fp, "\"POT-Creation-Date: \\n\"\n"); fprintf($fp, "\"PO-Revision-Date: %s \\n\"\n", date('Y-m-d H:i+0100')); fprintf($fp, "\"Last-Translator: Fernando Ontiveros<*****@*****.**>\\n\"\n"); fprintf($fp, "\"Language-Team: Colosa Developers Team <*****@*****.**>\\n\"\n"); fprintf($fp, "\"MIME-Version: 1.0 \\n\"\n"); fprintf($fp, "\"Content-Type: text/plain; charset=utf-8 \\n\"\n"); fprintf($fp, "\"Content-Transfer_Encoding: 8bit\\n\"\n"); fprintf($fp, "\"X-Poedit-Language: %s\\n\"\n", ucwords($langDir)); fprintf($fp, "\"X-Poedit-Country: %s\\n\"\n", $countryDir); fprintf($fp, "\"X-Poedit-SourceCharset: utf-8\\n\"\n"); printf("checking translation table\n"); $c = new Criteria(); $c->add(TranslationPeer::TRN_LANG, "en"); $translation = TranslationPeer::doSelect($c); $trIndex = 0; $trError = 0; $langIdOut = $langId; //the output language, later we'll include the country too. $arrayLabels = array(); foreach ($translation as $rowid => $row) { $keyid = 'TRANSLATION/' . $row->getTrnCategory() . '/' . $row->getTrnId(); if (trim($row->getTrnValue()) == '') { printf("warning the key %s is empty.\n", pakeColor::colorize($keyid, 'ERROR')); $trError++; } else { $trans = TranslationPeer::retrieveByPK($row->getTrnCategory(), $row->getTrnId(), $langIdOut); if (is_null($trans)) { $msgStr = $row->getTrnValue(); } else { $msgStr = $trans->getTrnValue(); } $msgid = $row->getTrnValue(); if (in_array($msgid, $arrayLabels)) { $newMsgid = '[' . $row->getTrnCategory() . '/' . $row->getTrnId() . '] ' . $msgid; printf("duplicated key %s is renamed to %s.\n", pakeColor::colorize($msgid, 'ERROR'), pakeColor::colorize($newMsgid, 'INFO')); $trError++; $msgid = $newMsgid; } $arrayLabels[] = $msgid; sort($arrayLabels); $trIndex++; fprintf($fp, "\n"); fprintf($fp, "#: %s \n", $keyid); //fprintf ( $fp, "#, php-format \n" ); fprintf($fp, "# %s \n", strip_quotes($keyid)); fprintf($fp, "msgid \"%s\" \n", strip_quotes($msgid)); fprintf($fp, "msgstr \"%s\" \n", strip_quotes($msgStr)); } } printf("checking xmlform\n"); printf("using directory %s \n", pakeColor::colorize(PATH_XMLFORM, 'INFO')); G::LoadThirdParty('pear/json', 'class.json'); G::LoadThirdParty('smarty/libs', 'Smarty.class'); G::LoadSystem('xmlDocument'); G::LoadSystem('xmlform'); G::LoadSystem('xmlformExtension'); G::LoadSystem('form'); $langIdOut = $langId; //the output language, later we'll include the country too. $exceptionFields = array('javascript', 'hidden', 'phpvariable', 'private', 'toolbar', 'xmlmenu', 'toolbutton', 'cellmark', 'grid'); $xmlfiles = pakeFinder::type('file')->name('*.xml')->in(PATH_XMLFORM); $xmlIndex = 0; $xmlError = 0; $fieldsIndexTotal = 0; $exceptIndexTotal = 0; foreach ($xmlfiles as $xmlfileComplete) { $xmlIndex++; $xmlfile = str_replace(PATH_XMLFORM, '', $xmlfileComplete); //english version of dynaform $form = new Form($xmlfile, '', 'en'); $englishLabel = array(); foreach ($form->fields as $nodeName => $node) { if (trim($node->label) != '') { $englishLabel[$node->name] = $node->label; } } unset($form->fields); unset($form->tree); unset($form); //in this second pass, we are getting the target language labels $form = new Form($xmlfile, '', $langIdOut); $fieldsIndex = 0; $exceptIndex = 0; foreach ($form->fields as $nodeName => $node) { if (is_object($node) && isset($englishLabel[$node->name])) { $msgid = trim($englishLabel[$node->name]); $node->label = trim(str_replace(chr(10), '', $node->label)); } else { $msgid = ''; } if (trim($msgid) != '' && !in_array($node->type, $exceptionFields)) { //$msgid = $englishLabel [ $node->name ]; $keyid = $xmlfile . '?' . $node->name; if (in_array($msgid, $arrayLabels)) { $newMsgid = '[' . $keyid . '] ' . $msgid; if ($verboseFlag) { printf("duplicated key %s is renamed to %s.\n", pakeColor::colorize($msgid, 'ERROR'), pakeColor::colorize($newMsgid, 'INFO')); } $xmlError++; $msgid = $newMsgid; } $arrayLabels[] = $msgid; sort($arrayLabels); $comment1 = $xmlfile; $comment2 = $node->type . ' - ' . $node->name; fprintf($fp, "\n"); fprintf($fp, "#: %s \n", $keyid); // fprintf ( $fp, "#, php-format \n" ); fprintf($fp, "# %s \n", strip_quotes($comment1)); fprintf($fp, "# %s \n", strip_quotes($comment2)); fprintf($fp, "msgid \"%s\" \n", strip_quotes($msgid)); fprintf($fp, "msgstr \"%s\" \n", strip_quotes($node->label)); //fprintf ( $fp, "msgstr \"%s\" \n", strip_quotes( utf8_encode( trim($node->label) ) )); $fieldsIndex++; $fieldsIndexTotal++; } else { if (is_object($node) && !in_array($node->type, $exceptionFields)) { if (isset($node->value) && strpos($node->value, 'G::LoadTranslation') !== false) { $exceptIndex++; //print ($node->value); } else { printf("Error: xmlform %s has no english definition for %s [%s]\n", pakeColor::colorize($xmlfile, 'ERROR'), pakeColor::colorize($node->name, 'INFO'), pakeColor::colorize($node->type, 'INFO')); $xmlError++; } } else { $exceptIndex++; if ($verboseFlag) { printf("%s %s in %s\n", $node->type, pakeColor::colorize($node->name, 'INFO'), pakeColor::colorize($xmlfile, 'INFO')); } } } } unset($form->fields); unset($form->tree); unset($form); printf("xmlform: %s has %s fields and %s exceptions \n", pakeColor::colorize($xmlfile, 'INFO'), pakeColor::colorize($fieldsIndex, 'INFO'), pakeColor::colorize($exceptIndex, 'INFO')); $exceptIndexTotal += $exceptIndex; } fclose($fp); printf("added %s entries from translation table\n", pakeColor::colorize($trIndex, 'INFO')); printf("added %s entries from %s xmlforms \n", pakeColor::colorize($fieldsIndexTotal, 'INFO'), pakeColor::colorize($xmlIndex, 'INFO')); if ($trError > 0) { printf("there are %s errors in tranlation table\n", pakeColor::colorize($trError, 'ERROR')); } if ($xmlError > 0) { printf("there are %s errors and %s exceptions in xmlforms\n", pakeColor::colorize($xmlError, 'ERROR'), pakeColor::colorize($exceptIndexTotal, 'ERROR')); } exit(0); //to do: leer los html templates }