$m->setFormInputData($o); } } else { if (isset($_POST['submit'])) { // 入力確認 $o =& $m->getObject($_POST); // check $check =& $o->getChecker(); $check->checkAll(); if ($check->getErrorCount() == 0) { // ログインIDチェック $loginId = $o->getField('login_id')->getValue(); $count = $m->getCountLoginId($loginId); if ($count == 0) { // セッション保存 $core->setSession('new_client', $o); // 確認ページへ移動 $core->movePage('new_conf.php'); } else { // エラー表示 $smarty->assign('error_title', 'ログインID'); $smarty->assign('error', '入力されたログインIDは既に使われています。'); $m->setFormInputData($o); } } else { // エラー表示 $smarty->assign('error_title', '入力が間違っています。'); $smarty->assign('error', $check->getErrorMessage()); $m->setFormInputData($o); } }
<?php require_once '../../conf/config.php'; require_once 'AlladinCore.php'; $core = new AlladinCore(); $smarty =& $core->getSmarty(); // モデル取得 $m =& $core->getModel('media/edit_model'); // セッションから取得 $o =& $core->getSession('new_media'); // フォーム初期化 $m->initFormData(); try { if ($o != null) { // DB保存 $m->insert($o); $m->setFormTextData($o); $core->setSession('new_media', null); } else { // セッションから取得できません。 $e = new DataObjectNotFoundException('セッションからデータを取得できません。'); $e->display($smarty); } } catch (AlladinException $e) { $e->display($smarty); } // テンプレート設定 $smarty->assign('action', 'new'); $smarty->assign('step', 'end'); $smarty->assign($m->getFormData()); $smarty->display($core->getTmplName('media/detail'));
} else { if (isset($_POST['submit'])) { // 入力確認 $o =& $m->getObject($_POST); // check $check =& $o->getChecker(); $check->checkAll(); //入力OKの場合 if ($check->getErrorCount() == 0) { // 案件IDチェック $ankenId = $o->getField('anken_id')->getValue(); $count = $m->getCountAnkenId($ankenId); //案件ID重複しないの場合 if ($count == 0) { // セッション保存 $core->setSession('new_site', $o); // 確認ページへ移動 $core->movePage('site_new_conf.php'); //案件ID重複の場合、エラー表示 } else { // エラー表示 $smarty->assign('error_title', '案件ID'); $smarty->assign('error', '入力された案件IDは既にサイトを設定されています。'); $m->setFormInputData($o); } //入力NGの場合、エラーを表示する } else { // エラー表示 $smarty->assign('error_title', '入力が間違っています。'); $smarty->assign('error', $check->getErrorMessage()); $m->setFormInputData($o);
/////////////////////////////////////// // セッションから取得できません。 /////////////////////////////////////// $e = new DataObjectNotFoundException('セッションからデータを取得できません。'); $e->display($smarty); } /////////////////////////// // 変更の差分を取得 /////////////////////////// $merged =& $m->createMergedObject($old, $new); if ($merged != null) { /////////////////////////// // セッション変数入れ替え /////////////////////////// $name = "new_media_{$mediaId}"; $core->setSession($name, $merged); /////////////////////////// // 確認画面表示 /////////////////////////// $m->setFormTextDataHLChanged($merged); /////////////////////////// // テンプレート設定 /////////////////////////// // 変更項目数を取得 $smarty->assign('change_count', $merged->getChangedCount()); $smarty->assign('form_action_url', 'edit_end.php'); $smarty->assign('action', 'edit'); $smarty->assign('step', 'conf'); $smarty->assign($m->getFormData()); $smarty->display($core->getTmplName('media/detail')); } else {