Add LSattr_html::select_box
authorBenjamin Renard <brenard@easter-eggs.com>
Tue, 17 Jun 2014 22:15:50 +0000 (00:15 +0200)
committerBenjamin Renard <brenard@easter-eggs.com>
Tue, 17 Jun 2014 22:15:50 +0000 (00:15 +0200)
public_html/includes/class/class.LSattr_html_select_box.php [new file with mode: 0644]
public_html/includes/class/class.LSformElement_select_box.php [new file with mode: 0644]
public_html/templates/default/LSformElement_select_box.tpl [new file with mode: 0644]

diff --git a/public_html/includes/class/class.LSattr_html_select_box.php b/public_html/includes/class/class.LSattr_html_select_box.php
new file mode 100644 (file)
index 0000000..bd295ae
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/*******************************************************************************
+ * Copyright (C) 2007 Easter-eggs
+ * http://ldapsaisie.labs.libre-entreprise.org
+ *
+ * Author: See AUTHORS file in top-level directory.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+******************************************************************************/
+
+LSsession :: loadLSclass('LSattr_html_select_list');
+
+/**
+ * HTML attribute type select_box
+ *
+ * Same as LSattr_html_select_list but using <input> type checkbox
+ * for multiple values selection and type radio for single value
+ * selection.
+ * 
+ * @author Benjamin Renard <brenard@easter-eggs.com>
+ */
+class LSattr_html_select_box extends LSattr_html_select_list {
+
+  var $LSformElement_type = 'select_box';
+  
+}
diff --git a/public_html/includes/class/class.LSformElement_select_box.php b/public_html/includes/class/class.LSformElement_select_box.php
new file mode 100644 (file)
index 0000000..c72a27e
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/*******************************************************************************
+ * Copyright (C) 2007 Easter-eggs
+ * http://ldapsaisie.labs.libre-entreprise.org
+ *
+ * Author: See AUTHORS file in top-level directory.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+******************************************************************************/
+
+LSsession :: loadLSclass('LSformElement_select');
+
+/**
+ * Select box form element for LdapSaisie
+ *
+ * This class define select box form element.
+ * It's an extention of LSformElement_select class.
+ *
+ * @author Benjamin Renard <brenard@easter-eggs.com>
+ */
+
+class LSformElement_select_box extends LSformElement_select {
+
+  var $template = 'LSformElement_select_box.tpl';
+  var $fieldTemplate = 'LSformElement_select_box.tpl';
+
+}
diff --git a/public_html/templates/default/LSformElement_select_box.tpl b/public_html/templates/default/LSformElement_select_box.tpl
new file mode 100644 (file)
index 0000000..d97e5ac
--- /dev/null
@@ -0,0 +1,19 @@
+<ul class='LSform' id='{$attr_name}'>
+{if $freeze}
+  {foreach from=$values item=value}
+    {if array_key_exists($value,$possible_values)}
+    <li>{$possible_values.$value}</li>
+    {else}
+    <li class='LSform-errors'>{getFData format=$unrecognized_value_label_format data=$value}</li>
+    {/if}
+  {foreachelse}
+    <li>{$noValueTxt}</li>
+  {/foreach}
+{else}
+    {foreach from=$possible_values item=label key=value name=LSformElement_selectbox}
+      <li>
+        <input type='{if $multiple}checkbox{else}radio{/if}' name='{$attr_name}[]' class='LSformElement_selectbox' id='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}' value="{$value}" {if in_array($value,$values)}checked{/if}/> <label for='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}'>{tr msg=$label}</label>
+      </li>
+    {/foreach}
+{/if}
+</ul>