本文整理汇总了PHP中TranslationPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationPeer::retrieveByPK方法的具体用法?PHP TranslationPeer::retrieveByPK怎么用?PHP TranslationPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslationPeer
的用法示例。
在下文中一共展示了TranslationPeer::retrieveByPK方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete()
{
$ids = explode(',', $_POST['IDS']);
$category = 'LABEL';
try {
foreach ($ids as $id) {
$tr = TranslationPeer::retrieveByPK($category, $id, 'en');
if (is_object($tr) && get_class($tr) == 'Translation') {
$tr->delete();
}
}
$result->success = true;
$result->msg = 'Deleted Successfully!';
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
示例2: explode
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//to do: improve the way to pass two or more parameters in the paged-table ( link )
$aux = explode('|', $_GET['id']);
$category = str_replace('"', '', $aux[0]);
$id = str_replace('"', '', $aux[1]);
require_once "classes/model/Translation.php";
//if exists the row in the database propel will update it, otherwise will insert.
$tr = TranslationPeer::retrieveByPK($category, $id, 'en');
if (is_object($tr) && get_class($tr) == 'Translation') {
$tr->delete();
}
// else
G::Header('location: translations');
示例3: delete
/**
* Implementation for 'DELETE' method for Rest API
*
* @param mixed $trnCategory, $trnId, $trnLang 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 delete($trnCategory, $trnId, $trnLang)
{
$conn = Propel::getConnection(TranslationPeer::DATABASE_NAME);
try {
$conn->begin();
$obj = TranslationPeer::retrieveByPK($trnCategory, $trnId, $trnLang);
if (!is_object($obj)) {
throw new RestException(412, 'Record does not exist.');
}
$obj->delete();
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw new RestException(412, $e->getMessage());
}
}
示例4: remove
function remove($sCategory, $sId, $sLang)
{
$oTranslation = TranslationPeer::retrieveByPK($sCategory, $sId, $sLang);
if (is_object($oTranslation) && get_class($oTranslation) == 'Translation') {
$oTranslation->delete();
}
}
示例5: delete
/**
* Implementation for 'DELETE' method for Rest API
*
* @param mixed $trnCategory, $trnId, $trnLang 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 delete($trnCategory, $trnId, $trnLang)
{
$conn = Propel::getConnection(TranslationPeer::DATABASE_NAME);
try {
$conn->begin();
$obj = TranslationPeer::retrieveByPK($trnCategory, $trnId, $trnLang);
if (!is_object($obj)) {
throw new RestException(412, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
}
$obj->delete();
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw new RestException(412, $e->getMessage());
}
}
示例6: run_create_poedit_file
//.........这里部分代码省略.........
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<fernando@colosa.com>\\n\"\n");
fprintf($fp, "\"Language-Team: Colosa Developers Team <developers@colosa.com>\\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;