Source for file input_helpers.php
Documentation is available at input_helpers.php
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
* Génére une select-box pour les thèmes
* @param string $field_name
* @param integer $current_theme
* @return string $select_theme
function ThemeSelectBox($data, $field_name, $current_theme = - 1, $URL = - 1)
for ($i = 0;$i < count($data);$i++ ) {
if ($data[$i]['sdtheme_id'] != $current_sdtheme) {
$current_sdtheme = $data[$i]['sdtheme_id'];
$theme_list .= $close . "<optgroup label=\"" . $current_sdtheme_display . "\">\n";
$close = "</optgroup>\n";
if ($data[$i]['theme_id'] == $current_theme) {
$mask = " selected=\"selected\"";
if ($URL <> - 1)$theme_list .= "<option value=\"" . $URL . $data[$i]['theme_id'] . "\"" . $mask . ">" . $current_theme_display . "</option>\n";
else $theme_list .= "<option value=\"" . $data[$i]['theme_id'] . "\"" . $mask . ">" . $current_theme_display . "</option>\n";
$theme_list .= "</optgroup>\n";
$select_theme = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" onchange=\"ChangeLocation(this)\" class=\"textfield\">\n";
$select_theme .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_theme = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">\n";
$select_theme .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_theme .= $theme_list;
$select_theme .= "</select>\n";
* Génére une select-box pour les thèmes Développement Durable
* @param string $field_name
* @param integer $current_sdtheme
* @return string $select_sdtheme
for($i = 0; $i < count($data); $i++ ) {
if ($data[$i]['sdtheme_id'] == $current_sdtheme) $mask = " selected=\"selected\"";
$sdtheme_list .= "<option value=\"" . $data[$i]['sdtheme_id'] . "\"" . $mask . ">" . $sdtheme_display . "</option>\n";
$select_sdtheme = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">";
$select_sdtheme .= "<option value=\"-1\">" . _t('divers','select_choice2') . "</option>";
$select_sdtheme .= $sdtheme_list;
$select_sdtheme .= "</select>";
* Génére une select-box pour les échelles
* @param string $field_name
* @param integer $current_level
* @return string $select_level
for ($i = 0;$i < count($data);$i++ ) {
if ($data[$i]['level_id'] == $current_level) {
$mask = " selected=\"selected\"";
$level_list .= "<option value=\"" . $data[$i]['level_id'] . "\"" . $mask . ">" . $level_display . "</option>\n";
$select_level = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">\n";
$select_level .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_level .= $level_list;
$select_level .= "</select>\n";
* Génére une select-box pour les échelles
* @param string $field_name
* @param integer $current_scale
* @return string $select_scale
function ScaleSelectBox($data, $field_name, $current_scale = - 1, $URL = - 1)
for ($i = 0;$i < count($data);$i++ ) {
if ($data[$i]['scale_id'] == $current_scale) {
$mask = " selected=\"selected\"";
if ($URL <> - 1)$scale_list .= "<option value=\"" . $URL . $data[$i]['scale_id'] . "\"" . $mask . ">" . $scale_display . "</option>\n";
else $scale_list .= "<option value=\"" . $data[$i]['scale_id'] . "\"" . $mask . ">" . $scale_display . "</option>\n";
$select_scale = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" onchange=\"ChangeLocation(this)\">\n";
$select_scale .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_scale = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">\n";
$select_scale .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_scale .= $scale_list;
$select_scale .= "</select>\n";
* Génére une select-box pour les priorités
* @param string $field_name
* @param integer $current_priority
* @return string $select_priority
for ($i = 0;$i < count($data);$i++ ) {
if ($data[$i]['priority_id'] == $current_priority) {
$mask = " selected=\"selected\"";
if ($URL <> - 1) $priority_list .= "<option value=\"" . $URL . $data[$i]['priority_id'] . "\"" . $mask . ">" . $priority_display . "</option>\n";
else $priority_list .= "<option value=\"" . $data[$i]['priority_id'] . "\"" . $mask . ">" . $priority_display . "</option>\n";
$select_priority = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" onchange=\"ChangeLocation(this)\">\n";
$select_priority .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_priority = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">\n";
$select_priority .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select_priority .= $priority_list;
$select_priority .= "</select>\n";
* Génére une select-box pour les projets
* @param string $field_name
* @param integer $current_project
* @return string $select_project
function ProjectSelectBox($data, $field_name, $current_project = - 1, $URL = - 1, $exclude= array())
for ($i = 0;$i < count($data);$i++ ) {
if(!in_array($data[$i]['project_id'], $exclude)) {
if ($data[$i]['project_id'] == $current_project) {
$mask = " selected=\"selected\"";
if ($URL <> - 1) $project_list .= "<option value=\"" . $URL . $data[$i]['project_id'] . "\"" . $mask . ">" . $project_display . "</option>\n";
else $project_list .= "<option value=\"" . $data[$i]['project_id'] . "\"" . $mask . ">" . $project_display . "</option>\n";
$select_project = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" onchange=\"ChangeLocation(this)\">\n";
$select_project .= "<option value=\"-1\">" . _t('divers','none') . "</option>\n";
$select_project = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">\n";
$select_project .= "<option value=\"-1\">" . _t('divers','none') . "</option>\n";
$select_project .= $project_list;
$select_project .= "</select>\n";
* Generate a workshop select-box
* @param string $field_name
* @param integer $current_level
* @return string $select_level
for ($i = 0;$i < count($data);$i++ ) {
if ($data[$i]['workshop_id'] == $current) {
$mask = " selected=\"selected\"";
if($data[$i]['workshop_id'] <> "") $list .= "<option value=\"" . $data[$i]['workshop_id'] . "\"" . $mask . ">" . $display . "</option>\n";
$select = "<select name=\"" . $field_name . "\" id=\"" . $field_name . "\" class=\"textfield\">\n";
$select .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select .= "</select>\n";
* Generate a SDI multiple select-box
* @param string $field_name
* @param integer $current
for ($i = 0;$i < count($data);$i++ ) {
if (in_array ($data[$i]['sdii_id'], $current)) {
$mask = " selected=\"selected\"";
$list .= "<option value=\"" . $data[$i]['sdii_id'] . "\"" . $mask . ">" . $display . "</option>\n";
$select = "<select name=\"" . $field_name . "[]\" id=\"" . $field_name . "\" multiple=\"multiple\">\n";
//$select .= "<option value=\"-1\">" . _t('divers','select_choice') . "</option>\n";
$select .= "</select>\n";
* Return Workgroups checkboxes
* @param string $field_name
* @param integer $current
* @return string $content
if($data == 0) return '<div>'. _t('divers', 'none') . '</div>' . END_LINE;
for ($i = 0; $i < count($data);$i++ ) {
if (in_array($data[$i]['id'],$current)) {
$mask = ' checked="checked"';
$wg_id = $data[$i]['id'];
$content .= '<input type="checkbox" name="'. $field_name. '" id="wg_'. $wg_id. '" value="' . $wg_id . '"' . $mask . ' />' . END_LINE;
$content .= '<label for="wg_'. $wg_id. '">'. $wg_name. '</label><br />' . END_LINE;
* Generate a select-box with available languages
* @param string $field_name
foreach($array as $culture => $value) {
if ($culture == $current) {
$mask = ' selected="selected"';
if(isset ($value['Country'])) $str.= ' ('. ucfirst($value['Country']). ')';
$list .= '<option value="' . $culture . '"' . $mask . '>' . $str . '</option>'. END_LINE;
$select = '<select name="' . $field_name . '" id="' . $field_name . '">'. END_LINE;
* depending on DATE_FORMAT
* @return string $content
if(DATE_FORMAT == 'dd-mm-yyyy')
$content.= '<input name="date_d" type="text" class="" size="2" id="date_d" maxlength="2" value="'. $d. '" />'. END_LINE;
$content.= '<input name="date_m" type="text" class="" size="2" id="date_m" maxlength="2" value="'. $m. '" />'. END_LINE;
$content.= '<input name="date_y" type="text" class="" size="4" id="date_y" maxlength="4" value="'. $y. '" />'. END_LINE;
elseif(DATE_FORMAT == 'yyyy-mm-dd')
$content.= '<input name="date_y" type="text" class="" size="4" id="date_y" maxlength="4" value="'. $y. '" />'. END_LINE;
$content.= '<input name="date_m" type="text" class="" size="2" id="date_m" maxlength="2" value="'. $m. '" />'. END_LINE;
$content.= '<input name="date_d" type="text" class="" size="2" id="date_d" maxlength="2" value="'. $d. '" />'. END_LINE;
|