YaWK  24.1
Yet another WebKit
faq-edit.php
Go to the documentation of this file.
1 <?php
2 // check if language is set
3 if (!isset($language) || (!isset($lang)))
4 { // inject (add) language tags to core $lang array
5  $lang = \YAWK\language::inject(@$lang, "../system/plugins/faq/language/");
6 }
7 include '../system/plugins/faq/classes/faq-backend.php';
8 /* page content start here */
9 if (!isset($faq))
10 { // create object, if its not set
11  $faq = new \YAWK\PLUGINS\FAQ\faq();
12 }
13 if (!isset($db))
14 { // include database
15  include '../system/classes/db.php';
16 }
17 // load faq properties
18 $faq->loadItemProperties($db, $_GET['id']);
19 
20 // if user clicked on save
21 if (isset($_POST['save']))
22 { // escape post vars
23  $faq->id = $db->quote($_GET['id']);
24  $faq->sort = $db->quote($_POST['sort']);
25  $faq->question = $db->quote($_POST['question']);
26  $faq->answer = $db->quote($_POST['answer']);
27 
28  if ($faq->save($db))
29  { // success
30  echo YAWK\alert::draw("success", "$lang[SUCCESS]", "$lang[FAQ_SAVE_OK]","plugin=faq","2000");
31  exit;
32  }
33  else
34  { // save faq item failed, throw error
35  echo YAWK\alert::draw("danger", "$lang[ERROR]", "$lang[FAQ_SAVE_FAILED] : " . $faq->question . " ", "","4200");
36  exit;
37  }
38 }
39 
40 // TEMPLATE WRAPPER - HEADER & breadcrumbs
41 echo "
42 <!-- Content Wrapper. Contains page content -->
43 <div class=\"content-wrapper\" id=\"content-FX\">
44  <!-- Content Header (Page header) -->
45  <section class=\"content-header\">";
46  /* draw Title on top */
47  echo \YAWK\backend::getTitle($lang['FAQ'], $lang['FAQ_SUBTEXT']);
48  echo"<ol class=\"breadcrumb\">
49  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
50  <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
51  <li><a href=\"index.php?plugin=faq\" title=\"$lang[FAQ]\"> $lang[FAQ]</a></li>
52  <li class=\"active\"><a href=\"index.php?plugin=faq&pluginpage=faq-edit\" title=\"$lang[EDIT_QUESTION]\"> $lang[EDIT_QUESTION]</a></li>
53  </ol>
54  </section>
55  <!-- Main content -->
56  <section class=\"content\">";
57 ?>
58 
59 <form action="index.php?plugin=faq&pluginpage=faq-edit&id=<?php echo $_GET['id']; ?>" role="form" method="POST"
60  xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
61  <div class="box box-default">
62  <div class="box-header with-border">
63  <h3 class="box-title"><?php echo "$lang[FAQ] <small>$lang[EDIT]"; ?></h3>
64  </div>
65  <div class="box-body">
66  <input name="create" value="faq-create" type="hidden">
67  <input type="text" name="sort" class="form-control" value="<?php echo $faq->sort; ?>"><br>
68  <textarea class="form-control" cols="55" rows="1" name="question"><?php echo $faq->question; ?></textarea><br>
69  <textarea class="form-control" cols="55" rows="4" name="answer"><?php echo $faq->answer; ?></textarea><br>
70  <input id="savebutton" class="btn btn-success" type="submit" name="save" value="<?php echo $lang['FAQ_EDIT_BTN']; ?>">&nbsp;
71  <br><br>
72  </div>
73  </div>
74 </form>
$faq
Definition: faq.php:69
print $lang['FILEMAN_UPLOAD']
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
type
Definition: menu-new.php:35
exit
print $_GET['id']
Definition: page-edit.php:357
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name