/** *This function create de select box to choose categories * * @author - < Benoît Muret > * @param - elem array : the faculties * @param - father string : the father of the faculty * @param - $editFather string : the faculty editing * @param - $space string : space to the bom of the faculty * @return - void * * @desc : create de select box categories */ function build_select_faculty($elem, $father, $editFather, $space) { if ($elem) { $space .= " "; foreach ($elem as $one_faculty) { if (!strcmp($one_faculty["code_P"], $father)) { echo "<option value=\"" . $one_faculty['code'] . "\" " . ($one_faculty['code'] == $editFather ? "selected " : "") . "> " . $space . $one_faculty['code'] . " </option>\n "; build_select_faculty($elem, $one_faculty["code"], $editFather, $space); } } } }
/** *This function create de select box categories * * @author Benoît Muret * @param $elem array the categories * @param $father string the father of the category * @param $editFather string the category editing * @param $space string space to the bom of the category * @return void * */ function build_select_faculty($elem, $father, $editFather, $space) { $html = ''; if ($elem) { $space .= ' '; foreach ($elem as $one_faculty) { if (!strcmp($one_faculty['code_P'], $father)) { $html .= '<option value="' . $one_faculty['code'] . '" ' . ($one_faculty['code'] == $editFather ? 'selected="selected" ' : '') . '> ' . $space . $one_faculty['code'] . ' </option>'; $html .= build_select_faculty($elem, $one_faculty['code'], $editFather, $space); } } } return $html; }
} $form .= ' value="1" />' . "\n" . ' ' . "\n" . '<label for="canHaveCoursesChild_1">' . get_lang('Yes') . '</label>' . "\n" . '' . "\n" . '<input type="radio" name="canHaveCoursesChild" id="canHaveCoursesChild_0" '; if (isset($editedCat_CanHaveCoursesChild)) { $form .= !strcmp($editedCat_CanHaveCoursesChild, 'FALSE') ? 'checked' : ''; } $form .= ' value="0" />' . "\n" . '<label for="canHaveCoursesChild_0">' . get_lang('No') . '</label>' . "\n" . '<br /><br />' . "\n" . '<span class="required">*</span> ' . get_lang('Denotes required fields') . '<br />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>' . "\n"; $dialogBox->form($form); break; case DISP_FORM_MOVE: /** * Display information to change root of the category */ $dialogBox->title(get_lang("Change parent's category of %catCode", array('%catCode' => $editedCat_Code))); $form = '<form action=" ' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="id" value="' . $editedCat_Id . '" />' . "\n" . '<input type="hidden" name="cmd" value="exChange" />' . "\n" . '<input type="hidden" name="nameCat" value="' . $editedCat_Name . '" />' . "\n" . '<input type="hidden" name="codeCat" value="' . $editedCat_Code . '" />' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<label for="fatherCat"> ' . get_lang('Parent category') . ' </label >' . "\n" . '<select name="fatherCat">' . "\n" . '<option value="NULL" > ' . get_conf('siteName') . ' </option>' . "\n"; //Display each category in the select $form .= build_select_faculty($categories, NULL, $editFather, ''); $form .= '</select><br /><br />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>' . "\n"; $dialogBox->form($form); break; default: // } /** * Output */ $out = ''; $out .= claro_html_tool_title($nameTools); $out .= $dialogBox->render(); /** * Command and list */