CMS  Version 3.9
snippet_picker.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("html_editor");
3 
4 $snippet_id = checkNumeric($_GET["snippet_id"]);
5 
6 $snippets = Query::create(Snippet, "WHERE user_id=:u OR shared=1 ORDER BY snippet_name")
7  ->bind(":u", $user->getPrimaryKeyValue())
8  ->execute();
9 
10 $panel = new Panel("snippet_panel", "/action/html_editor/snippet_panel?snippet_id=$snippet_id");
11 
12 ?>
13 <label for='snippet_id'>Select Snippet </label>
14 <select id='snippet_id' onchange="new SnippetManager().updateSnippetPanel(this.value); return false;">
15  <option value='0'>Select a Snippet...</option>
16 <?
17 foreach($snippets as $snippet)
18 {
19  option($snippet->snippet_id, $snippet->snippet_name, $snippet_id);
20 }
21 ?>
22 </select>
23 <br/>
24 <?
25 $panel->draw();
26 ?>
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
Panel provides a reloadable panel tied to an action handler.
Definition: panel.inc:51
global $user
$snippet
Definition: snippet.inc:7
$panel
$snippet_id
$snippets