本文整理汇总了PHP中I18n::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP I18n::fetch方法的具体用法?PHP I18n::fetch怎么用?PHP I18n::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I18n
的用法示例。
在下文中一共展示了I18n::fetch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEdit
public function actionEdit()
{
$message = "";
$lang = CatLang::fetchAll();
if (!empty($_POST["trans"])) {
for ($n = 0; $n < sizeof($lang); $n++) {
$trans = $_POST["trans"][$n];
if ($trans["id"] > 0 || $trans["translation"]) {
if ($trans["id"] > 0) {
$model = I18nTranslate::fetch($trans->id);
} else {
$model = new I18nTranslate();
}
$model->setAttributesFromArray($trans);
$model->i18n_id = $this->id;
if (!$model->save()) {
print_r($model->getErrors());
}
}
}
}
$list = array();
if (!empty($this->id)) {
$item = I18n::fetch($this->id);
$list = I18nTranslate::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("i18n_id=:id")->setParams(array(":id" => $item->id))->setLimit(-1)->setCache(0));
} else {
$item = new I18n();
}
$this->render('edit', array('form' => $item, 'list' => $list, 'lang' => $lang, 'message' => $message));
}
示例2: actionDelete
/**
* Deletes a particular model.
* If deletion is successful, the browser will be redirected to the 'admin' page.
* @param integer $id the ID of the model to be deleted
*/
public function actionDelete()
{
if ($this->id > 0) {
$item = I18n::fetch($this->id);
if ($item->id > 0) {
$item->delete();
$itemTranslate = I18nTranslate::fetch($this->id);
$itemTranslate->delete();
$this->redirect(SiteHelper::createUrl("/console/variable"));
}
}
$this->redirect(SiteHelper::createUrl("/console/variable"));
}