$output = ''; if (!empty($subTitle)) { $titleParts = array('mainTitle' => $nameTools, 'subTitle' => $subTitle); } else { $titleParts = $nameTools; } Claroline::getDisplay()->body->appendContent(claro_html_tool_title($titleParts, null, $cmdList)); Claroline::getDisplay()->body->appendContent($dialogBox->render()); /** * FORM TO FILL OR MODIFY AN ANNOUNCEMENT */ if ($displayForm) { // DISPLAY ADD ANNOUNCEMENT COMMAND // Ressource linker if ($_REQUEST['cmd'] == 'rqEdit') { ResourceLinker::setCurrentLocator(ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $_REQUEST['id']))); } $template = new ModuleTemplate($tlabelReq, 'form.tpl.php'); $template->assign('formAction', Url::Contextualize($_SERVER['PHP_SELF'])); $template->assign('relayContext', claro_form_relay_context()); $template->assign('cmd', $formCmd); $template->assign('announcement', $announcement); Claroline::getDisplay()->body->appendContent($template->render()); } /** * ANNOUNCEMENTS LIST */ if ($displayList) { // Get notification date if (claro_is_user_authenticated()) { $date = $claro_notifier->get_notification_date(claro_get_current_user_id());
// Instanciate dialog box $dialogBox = new DialogBox(); $toolIntroForm = ''; if (isset($cmd) && $isAllowedToEdit) { // Set linker's params if ($id) { $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $id)); } else { $currentLocator = null; } // CRUD if ($cmd == 'rqAdd') { $toolIntro = new ToolIntro(); $toolIntroForm = $toolIntro->renderForm(); } elseif ($cmd == 'rqEd') { ResourceLinker::setCurrentLocator($currentLocator); $toolIntro = new ToolIntro($id); if ($toolIntro->load()) { $toolIntroForm = $toolIntro->renderForm(); } } elseif ($cmd == 'exAdd') { $toolIntro = new ToolIntro(); $toolIntro->handleForm(); //TODO inputs validation // Manage ressources if ($toolIntro->save()) { $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $toolIntro->getId())); $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array(); ResourceLinker::updateLinkList($currentLocator, $resourceList); $dialogBox->success(get_lang('Introduction added')); // Notify that the introsection has been created