$sql .= " AND schema.tpl_id = :tpl_id AND v_tpl.grp_id = :grp_id"; $params = array(); $params[':tpl_id'] = $tpl_id; $params[':grp_id'] = $grp_id; $stmt = $db->prepare($sql); $stmt->execute($params); $schema = null; foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { $schema = $row; } $schema_id = (int) $schema['schema_id']; $schema_type = (int) $schema['schema_type']; $param_obj->schema_id = $schema_id; $param_obj->schema_type = $schema_type; // --- 表示コンテンツ取得 $config = ""; if ($schema_type == $SCHEMA_TYPE_SRC) { $file_path = $schema['file_path']; $config = str_replace(array("\r\n", "\r", "\n", "\t"), '', file_get_contents($file_path)); $config = \Sop\Form::replaceFormInjectionTag($config, $tpl_id, $file_id, true); } if ($schema_type == $SCHEMA_TYPE_TBL) { $config = getSchemaVcfgForTouch($db, $schema_id, $div, $file_id); } // --------------------------- // 出力 // --------------------------- $db = null; header("Content-type:application/json; charset=utf-8"); echo json_encode(array('success' => true, 'config' => $config, 'hdn_params' => json_encode($param_obj), 'user_id_2' => $user_id_2)); exit;
// --------------------------- // データ取得 // --------------------------- // --- 関連付く schema を全て取得 $sql = getSQLBaseForSchemaList(); $sql .= " AND `schema`.tpl_id = :tpl_id"; $params = array(); $params[':tpl_id'] = $tpl_id; $stmt = $db->prepare($sql); $stmt->execute($params); $schema_list = array(); foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { $schema = $row; if ($schema['schema_type'] == $SCHEMA_TYPE_SRC) { $html = str_replace(array("\r\n", "\r", "\n", "\t"), '', file_get_contents($schema['file_path'])); $html = \Sop\Form::replaceFormInjectionTag($html, $tpl_id); $schema['config'] = $html; } if ($schema['schema_type'] == $SCHEMA_TYPE_TBL) { $schema['config'] = getSchemaVcfgForExt($db, $schema['schema_id']); } array_push($schema_list, $schema); } if (count($schema_list) == 0) { \Sop\Log::warning(__FILE__, __LINE__, 'There is not associated schema.'); $msg002 = "There is not the schema information."; // スキーマ情報が存在しません \Sop\Api::exitWithError(array($msg002)); } // --------------------------- // 終了処理