} $interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("Doc")); $nameTools = get_lang("OogieConversionPowerPoint"); Display::display_header($nameTools); $message = get_lang("WelcomeOogieConverter"); if (!empty($errorMessage)) { echo Display::return_message($errorMessage, 'warning', false); } $div_upload_limit = get_lang('UploadMaxSize') . ' : ' . ini_get('post_max_size'); $form = new FormValidator('upload_ppt', 'POST', '', ''); $form->addElement('header', get_lang("WelcomeOogieSubtitle")); $form->addElement('html', Display::return_message($message, 'info', false)); $form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit)); $form->addElement('checkbox', 'take_slide_name', '', get_lang('TakeSlideName')); if (api_get_setting('search.search_enabled') == 'true') { require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; $specific_fields = get_specific_field_list(); $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); foreach ($specific_fields as $specific_field) { $form->addElement('text', $specific_field['code'], $specific_field['name'] . ' : '); } } $form->addButtonUpload(get_lang('ConvertToLP'), 'convert'); $form->addElement('hidden', 'ppt2lp', 'true'); $form->add_real_progress_bar(md5(rand(0, 10000)), 'user_file', 1, true); $defaults = array('take_slide_name' => 'checked="checked"', 'index_document' => 'checked="checked"'); $form->setDefaults($defaults); // display the form $form->display(); Display::display_footer();
$form->addElement('html', '<div class="label">' . get_lang('SearchFeatureDocumentLanguage') . '</div>'); $form->addLabel(get_lang('Language'), api_get_languages_combo()); $form->addElement('html', '</div><div class="sub-form">'); $specific_fields = get_specific_field_list(); foreach ($specific_fields as $specific_field) { $form->addElement('text', $specific_field['code'], $specific_field['name']); } $form->addElement('html', '</div>'); } $form->addElement('radio', 'if_exists', get_lang('UplWhatIfFileExists'), get_lang('UplDoNothing'), 'nothing'); $form->addElement('radio', 'if_exists', '', get_lang('UplOverwriteLong'), 'overwrite'); $form->addElement('radio', 'if_exists', '', get_lang('UplRenameLong'), 'rename'); // Close the java script and avoid the footer up $form->addElement('html', '</div>'); // Button upload document $form->addButtonSend(get_lang('SendDocument'), 'submitDocument'); $form->add_real_progress_bar('DocumentUpload', 'file'); $fileExistsOption = api_get_setting('document.if_file_exists_option'); $defaultFileExistsOption = 'rename'; if (!empty($fileExistsOption)) { $defaultFileExistsOption = $fileExistsOption; } $defaults = array('index_document' => 'checked="checked"', 'if_exists' => $defaultFileExistsOption); $form->setDefaults($defaults); $simple_form = $form->returnForm(); $url = api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?' . api_get_cidreq() . '&a=upload_file&curdirpath=' . $path; $multipleForm = new FormValidator('drag_drop', 'post', '#', array('enctype' => 'multipart/form-data')); $multipleForm->addMultipleUpload($url); $headers = array(get_lang('Upload'), get_lang('Upload') . ' (' . get_lang('Simple') . ')'); echo Display::tabs($headers, array($multipleForm->returnForm(), $form->returnForm()), 'tabs'); Display::display_footer();
?> </td> </tr> </table> </div> </div> <div id="divUpload" style="display: none"> <?php include_once api_get_path(LIBRARY_PATH) . 'formvalidator/FormValidator.class.php'; $form = new FormValidator('frmUpload', 'POST', '', 'UploadWindow', 'id="frmUpload" enctype="multipart/form-data" onSubmit="javascript:return CheckUpload();"'); $form->addElement('html', '<table cellspacing="1" cellpadding="1" border="0" width="90%" align="center">'); $form->addElement('html', '<tr><td> </td><tr><td>'); $form->addElement('file', 'NewFile', '', 'id="txtUploadFile" size="40"'); $form->addElement('html', '</td></tr>'); $form->addElement('html', '<tr><td>'); //$renderer = & $form->defaultRenderer(); //$renderer->setElementTemplate('<div style="margin-left:-4px;">{element} {label}</div>', 'autostart'); $form->addElement('checkbox', 'autostart', '', ' ' . api_convert_encoding(get_lang('FckMp3Autostart'), 'UTF-8', $charset), array('id' => 'autostart')); $form->addElement('html', '</td></tr>'); $form->addElement('html', '<tr><td>'); $form->addElement('submit', '', 'Send it to the Server', 'id="btnUpload" fckLang="DlgLnkBtnUpload"'); $form->addElement('html', '</td></tr></table>'); $form->addElement('html', '<iframe name="UploadWindow" style="display: none" src="../../fckblank.html"></iframe>'); $form->add_real_progress_bar('fckMP3', 'NewFile'); $form->display(); ?> </div> <script type="text/javascript">window_onload(tab_to_select);</script> </body> </html>
/** * @param FormValidator $form * @param int $uploadFormType */ function setWorkUploadForm($form, $uploadFormType = 0) { $form->addElement('header', get_lang('UploadADocument')); $form->addElement('hidden', 'contains_file', 0, array('id'=>'contains_file_id')); $form->addElement('hidden', 'active', 1); $form->addElement('hidden', 'accepted', 1); $form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload', 'class' => 'span4')); $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); switch ($uploadFormType) { case 0: // File and text. $form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"'); $form->add_real_progress_bar('uploadWork', 'file'); $form->add_html_editor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar()); break; case 1: // Only text. $form->add_html_editor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar()); $form->addRule('description', get_lang('ThisFieldIsRequired'), 'required'); break; case 2: // Only file. $form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"'); $form->add_real_progress_bar('uploadWork', 'file'); $form->addRule('file', get_lang('ThisFieldIsRequired'), 'required'); break; } $form->addElement('style_submit_button', 'submitWork', get_lang('Send'), array('class'=> 'upload', 'value' => "submitWork")); }
* Just display the form needed to upload a SCORM and give its settings */ $nameTools = get_lang("FileUpload"); $interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("ToolLearnpath")); Display::display_header($nameTools, "Path"); require_once api_get_path(SYS_CODE_PATH) . 'newscorm/content_makers.inc.php'; require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; echo '<div class="actions">'; echo '<a href="../newscorm/lp_controller.php?cidReq=' . $_course['sysCode'] . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; $form = new FormValidator('', 'POST', 'upload.php', '', 'id="upload_form" enctype="multipart/form-data" style="background-image: url(\'../img/scorm.jpg\'); background-repeat: no-repeat; background-position: 620px;"'); $form->addElement('header', '', $nameTools); $form->addElement('hidden', 'curdirpath', $path); $form->addElement('hidden', 'tool', $my_tool); $form->addElement('file', 'user_file', get_lang('FileToUpload')); $form->add_real_progress_bar('uploadScorm', 'user_file'); $form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required'); /*unset($content_origins[0]); unset($content_origins[1]);*/ if (api_get_setting('search_enabled') == 'true') { $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); $specific_fields = get_specific_field_list(); foreach ($specific_fields as $specific_field) { $form->addElement('text', $specific_field['code'], $specific_field['name'] . ' : '); } } if (api_is_platform_admin()) { $form->addElement('checkbox', 'use_max_score', null, get_lang('UseMaxScore100')); } $form->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"'); $form->addElement('html', '<br /><br /><br />');
$group_id = api_get_group_id(); if (empty($workId)) { api_not_allowed(true); } protectWork($courseInfo, $workId); $workInfo = get_work_data_by_id($workId); $student_can_edit_in_session = api_is_allowed_to_session_edit(false, true); $homework = get_work_assignment_by_id($workInfo['id']); $validationStatus = getWorkDateValidationStatus($homework); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'work/work.php?' . api_get_cidreq(), 'name' => get_lang('StudentPublications')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'work/work_list.php?' . api_get_cidreq() . '&id=' . $workId, 'name' => $workInfo['title']); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UploadCorrections')); $form = new FormValidator('form', 'POST', api_get_self() . "?" . api_get_cidreq() . "&id=" . $workId, '', array('enctype' => "multipart/form-data")); $form->addElement('header', get_lang('UploadCorrections')); $form->addElement('file', 'file', get_lang('UploadADocument')); $form->add_real_progress_bar('uploadWork', 'file'); $form->addRule('file', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('hidden', 'id', $workId); $form->addButtonUpload(get_lang('Upload')); $error_message = null; $succeed = false; if ($form->validate()) { $values = $form->getSubmitValues(); $upload = process_uploaded_file($_FILES['file'], false); if ($upload) { $zip = new PclZip($_FILES['file']['tmp_name']); // Check the zip content (real size and file extension) $zipFileList = (array) $zip->listContent(); $realSize = 0; foreach ($zipFileList as &$this_content) { $realSize += $this_content['size'];