Code Duplication    Length = 28-28 lines in 4 locations

src/filters/create.php 2 locations

@@ 296-323 (lines=28) @@
293
294
// generate project selector
295
296
if ($form == 'projectform')
297
{
298
    $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
299
          . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>'
300
          . '<combobox>'
301
          . '<listitem value="0">' . get_html_resource(RES_ALL_PROJECTS_ID) . '</listitem>';
302
303
    $rs = dal_query('records/plist2.sql', $_SESSION[VAR_USERID]);
304
305
    while (($row = $rs->fetch()))
306
    {
307
        $xml .= '<listitem value="' . $row['project_id'] . '">'
308
              . ustr2html($row['project_name'])
309
              . '</listitem>';
310
    }
311
312
    $xml .= '</combobox>'
313
          . '</control>';
314
}
315
elseif (isset($project_id))
316
{
317
    $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
318
          . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>'
319
          . '<combobox>'
320
          . '<listitem value="' . $project_id . '">' . ustr2html($project_name) . '</listitem>'
321
          . '</combobox>'
322
          . '</control>';
323
}
324
325
// generate template selector
326
@@ 327-354 (lines=28) @@
324
325
// generate template selector
326
327
if ($form == 'templateform')
328
{
329
    $xml .= '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
330
          . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>'
331
          . '<combobox>'
332
          . '<listitem value="0">' . get_html_resource(RES_ALL_TEMPLATES_ID) . '</listitem>';
333
334
    $rs = dal_query('records/tlist2.sql', $_SESSION[VAR_USERID], $project_id);
335
336
    while (($row = $rs->fetch()))
337
    {
338
        $xml .= '<listitem value="' . $row['template_id'] . '">'
339
              . ustr2html($row['template_name'])
340
              . '</listitem>';
341
    }
342
343
    $xml .= '</combobox>'
344
          . '</control>';
345
}
346
elseif (isset($template_name))
347
{
348
    $xml .= '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
349
          . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>'
350
          . '<combobox>'
351
          . '<listitem value="' . $template_id . '">' . ustr2html($template_name) . '</listitem>'
352
          . '</combobox>'
353
          . '</control>';
354
}
355
356
// generate filter name and other common options
357

src/subscriptions/create.php 2 locations

@@ 226-253 (lines=28) @@
223
224
// generate project selector
225
226
if ($form == 'projectform')
227
{
228
    $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
229
          . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>'
230
          . '<combobox>'
231
          . '<listitem value="0">' . get_html_resource(RES_ALL_PROJECTS_ID) . '</listitem>';
232
233
    $rs = dal_query('records/plist2.sql', $_SESSION[VAR_USERID]);
234
235
    while (($row = $rs->fetch()))
236
    {
237
        $xml .= '<listitem value="' . $row['project_id'] . '">'
238
              . ustr2html($row['project_name'])
239
              . '</listitem>';
240
    }
241
242
    $xml .= '</combobox>'
243
          . '</control>';
244
}
245
elseif (isset($project_id))
246
{
247
    $xml .= '<control name="project" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
248
          . '<label>' . get_html_resource(RES_PROJECT_ID) . '</label>'
249
          . '<combobox>'
250
          . '<listitem value="' . $project_id . '">' . ustr2html($project_name) . '</listitem>'
251
          . '</combobox>'
252
          . '</control>';
253
}
254
255
// generate template selector
256
@@ 257-284 (lines=28) @@
254
255
// generate template selector
256
257
if ($form == 'templateform')
258
{
259
    $xml .= '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
260
          . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>'
261
          . '<combobox>'
262
          . '<listitem value="0">' . get_html_resource(RES_ALL_TEMPLATES_ID) . '</listitem>';
263
264
    $rs = dal_query('records/tlist2.sql', $_SESSION[VAR_USERID], $project_id);
265
266
    while (($row = $rs->fetch()))
267
    {
268
        $xml .= '<listitem value="' . $row['template_id'] . '">'
269
              . ustr2html($row['template_name'])
270
              . '</listitem>';
271
    }
272
273
    $xml .= '</combobox>'
274
          . '</control>';
275
}
276
elseif (isset($template_id))
277
{
278
    $xml .= '<control name="template" required="' . get_html_resource(RES_REQUIRED3_ID) . '">'
279
          . '<label>' . get_html_resource(RES_TEMPLATE_ID) . '</label>'
280
          . '<combobox>'
281
          . '<listitem value="' . $template_id . '">' . ustr2html($template_name) . '</listitem>'
282
          . '</combobox>'
283
          . '</control>';
284
}
285
286
// generate other subscription attributes
287