当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_QuickForm::setMaxFileSize方法代码示例

本文整理汇总了PHP中HTML_QuickForm::setMaxFileSize方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::setMaxFileSize方法的具体用法?PHP HTML_QuickForm::setMaxFileSize怎么用?PHP HTML_QuickForm::setMaxFileSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML_QuickForm的用法示例。


在下文中一共展示了HTML_QuickForm::setMaxFileSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cleanup_phone

function cleanup_phone($phone)
{
    $phone = str_replace(' ', '', $phone);
    $phone = str_replace('(', '', $phone);
    $phone = str_replace(')', '', $phone);
    $phone = str_replace('-', '', $phone);
    $phone = str_replace('.', '', $phone);
    return $phone;
}
require_once 'HTML/QuickForm.php';
$uploadForm = new HTML_QuickForm('upload_form', 'post');
$uploadForm->setRequiredNote('<span style="color:#ff0000;">*</span> = campos requeridos.');
$uploadForm->addElement('header', 'MyHeader', 'Importar alumnos desde una planilla');
$uploadForm->addElement('hidden', 'action', 'alumno_import');
$file =& $uploadForm->addElement('file', 'filename', 'Archivo:');
$uploadForm->setMaxFileSize(5120000);
$uploadForm->addRule('filename', 'Debe seleccionar un archivo', 'uploadedfile');
$uploadForm->addElement('submit', 'btnUpload', 'Cargar Base');
$field_names_ok = array('legajo', 'nombre', 'doc_nro', 'email', 'telefono', 'orientacion', 'notas');
if ($uploadForm->validate()) {
    unset($params);
    $params['time0'] = time();
    $uploaded_file = $_FILES['filename']['tmp_name'];
    $handle = fopen($uploaded_file, 'r');
    if (!$handle) {
        die('Error al abrir el archivo ' . $uploaded_file);
    }
    // get field names in the first line
    $field_names = fgetcsv($handle, 4096, chr(9));
    // check field names
    $field_diff = array_diff($field_names_ok, $field_names);
开发者ID:sergiokessler,项目名称:perio,代码行数:31,代码来源:alumno_import.php

示例2: array

$form->addElement('static', 'note', _FORCEDOWNLOADFILEINFO);
$form->setDefaults(array('folders_to_hierarchy' => true));
//$form -> addElement('select', 'import_method', _IMPORTMETHOD, array(_UPLOADFILE, _FROMURL, _FROMPATH), 'onchange = "selectBox(this);"');
$form->addElement('file', 'import_file[0]', _IMPORTFILE);
for ($i = 1; $i < 10; $i++) {
    $form->addElement('file', "import_file[{$i}]", null);
}
$form->addElement('text', "import_url[0]", _IMPORTFROMURL, 'class = "inputText"');
for ($i = 1; $i < 10; $i++) {
    $form->addElement('text', "import_url[{$i}]", null, 'class = "inputText"');
}
$form->addElement('text', "import_path[0]", _IMPORTFROMPATH, 'class = "inputText"');
for ($i = 1; $i < 10; $i++) {
    $form->addElement('text', "import_path[{$i}]", null, 'class = "inputText"');
}
$form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
//getUploadMaxSize returns size in KB
$form->addElement('submit', 'import_submit', _IMPORT, 'class = "flatButton"');
if ($form->isSubmitted() && $form->validate()) {
    try {
        $values = $form->exportValues();
        $errors = $uploadedFiles = array();
        //Create, if it does not exist, the folder where the files will be uploaded
        //is_dir($uploadDir = $currentUser -> getDirectory().'temp/') OR mkdir($uploadDir, 0755);
        $uploadDir = $currentLesson->getDirectory();
        $filesystem = new FileSystemTree($uploadDir, true);
        //Perform any direct file uploads
        foreach ($_FILES['import_file']['name'] as $key => $name) {
            if (!in_array($name, $uploadedFiles)) {
                //This way we bypass duplicates
                try {
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:import.php

示例3: admin_display


//.........这里部分代码省略.........
            $form->setDefaults($row);
            $form->applyFilter('name', 'trim');
            $form->applyFilter('description', 'trim');
            $form->applyFilter('team_size', 'trim');
            $form->addRule('name', 'Contest name is required.', 'required', null, 'client');
            $form->addRule('manager', 'Contest manager is required.', 'required', null, 'client');
            $form->addRule('team_size', 'Team size is required.', 'required', null, 'client');
            // validate or display form
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $data['show_time'] = form2sql_datetime($data['show_time']);
                $data['begin_time'] = form2sql_datetime($data['begin_time']);
                $data['end_time'] = form2sql_datetime($data['end_time']);
                $db->autoExecute('contests', $data, DB_AUTOQUERY_UPDATE, 'contest_id=' . $_GET['id']);
                if (PEAR::isError($res)) {
                    error($db->toString());
                }
                redirect('index.php?view=admin&task=contests');
            } else {
                $form->display();
            }
            break;
        case 'shell':
            $form = new HTML_QuickForm('shellForm', 'post', selflink());
            $field =& $form->addElement('text', 'command', 'Command:');
            $field->setSize(100);
            $ifield =& $form->addElement('textarea', 'input', 'Standard Input:');
            $ifield->setRows(10);
            $ifield->SetCols(80);
            $form->addElement('submit', null, 'Submit');
            $form->display();
            if ($form->validate()) {
                // Write std input file
                $iname = tempnam("/tmp", "in");
                $ifile = fopen($iname, 'w');
                fwrite($ifile, $form->getSubmitValue('input'));
                fclose($ifile);
                $cmd = $form->getSubmitValue('command');
                echo "<pre class=\"shell_output\">";
                echo "<b>\$ " . html_escape($cmd) . "</b>\n";
                exec("{$cmd} 2>&1 < {$iname}", $out, $ret);
                foreach ($out as $line) {
                    echo html_escape($line) . "\n";
                }
                echo "</pre>\n";
                echo "<p>Command returned: {$ret}</p>\n";
            }
            break;
        case 'uploader':
            // Get list of directories to which files can be uploaded
            $dirs = subdir_list('.');
            array_unshift($dirs, './');
            $form = new HTML_QuickForm('uploaderForm', 'post', selflink());
            $form->addElement('header', null, 'Upload a File:');
            $file =& $form->addElement('file', 'file', 'File:');
            $form->addElement('select', 'dir', 'Destination:', $dirs);
            $form->addElement('submit', 'upload', 'Upload');
            $form->addRule('file', 'Please select file to upload.', 'required', null, 'client');
            $form->setMaxFileSize(10485760);
            // try 10 MB max file size
            if ($form->validate()) {
                if ($file->isUploadedFile()) {
                    $dir = $dirs[$form->getSubmitValue('dir')];
                    if ($file->moveUploadedFile($dir)) {
                        echo "<p>File uploaded successfully to {$dir}.</p>";
                    } else {
                        echo "<p>Failed to save uploaded file to {$dir} (insufficient permissions?).</p>";
                    }
                } else {
                    echo "<p>File upload did not finish successfully</p>";
                }
            }
            $form->display();
            echo "<p><b>Note:</b> Any previous file with the same name will be replaced.</p>";
            echo "<hr />";
            $form = new HTML_QuickForm('mkdirForm', 'post', selflink());
            $form->addElement('header', null, 'Create a Directory:');
            $form->addElement('text', 'name', 'Name:');
            $form->addElement('select', 'dir', 'Destination:', $dirs);
            $form->addElement('submit', 'mkdir', 'Mkdir');
            $form->addRule('name', 'Please enter directory name.', 'required', null, 'client');
            if ($form->validate()) {
                $path = $dirs[$form->getSubmitValue('dir')] . '/' . $form->getSubmitValue('name');
                if (file_exists($path)) {
                    echo "<p><b>Warning:</b> File or directory {$path} already exists.</p>";
                } else {
                    if (mkdir($path)) {
                        echo "<p>Directory {$path} created.</p>";
                    } else {
                        echo "<p>Failed to create directory {$path}. Make sure parent directory permissions allow it.</p>";
                    }
                }
            }
            $form->display();
            break;
        case 'phpinfo':
            phpinfo();
            break;
    }
}
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:101,代码来源:admin.php

示例4: getModule

 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     $dir = $this->moduleBaseDir . 'assets/';
     if (!is_dir($dir)) {
         mkdir($dir, 0755);
     }
     if ($_SESSION['s_type'] == 'administrator') {
         try {
             $form = new HTML_QuickForm("upload_files_form", "post", $this->moduleBaseUrl . '&tab=upload', "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('file', 'file', _UPLOADFILE);
             if (G_VERSIONTYPE == 'enterprise') {
                 $tree = new EfrontBranchesTree();
                 $pathString = $tree->toPathString();
                 //$result = eF_getTableData("module_hcd_branch", "*", "url is not null and url !=''");
                 $handle = '<img id = "busy" src = "images/16x16/clock.png" style = "display:none;" alt = "{$smarty.const._LOADING}" title = "{$smarty.const._LOADING}"/><div id = "autocomplete_leaflet_branches" class = "autocomplete"></div>&nbsp;&nbsp;&nbsp;';
                 $form->addElement('static', 'sidenote', $handle);
                 $form->addElement('text', 'leaflet_branch_autoselect', _BRANCH, 'class = "autoCompleteTextBox" id = "autocomplete"');
                 $form->addElement('hidden', 'leaflet_branch', '', 'id = "leaflet_branch_value"');
             }
             $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
             $form->addElement('submit', 'submit_upload', _UPLOAD, 'class = "flatButton"');
             if ($form->isSubmitted() && $form->validate()) {
                 $values = $form->exportValues();
                 try {
                     if ($values['leaflet_branch'] && eF_checkParameter($values['leaflet_branch'], 'id')) {
                         $branch = new EfrontBranch($values['leaflet_branch']);
                         if (!$branch->branch['url']) {
                             throw new Exception("You must assign a url to the selected branch to upload files for it");
                         }
                         $dir = $this->moduleBaseDir . 'assets/' . $branch->branch['url'];
                         mkdir($dir, 0755);
                     }
                     $filesystem = new FileSystemTree($dir);
                     $file = $filesystem->uploadFile("file", $dir);
                 } catch (Exception $e) {
                     $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
                     $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
                     $message_type = failure;
                     $this->setMessageVar($message, $message_type);
                 }
             }
             $smarty->assign('T_UPLOAD_FORM', $form->toArray());
             $url = $this->moduleBaseUrl;
             $basedir = $dir;
             $options = array('zip' => false, 'upload' => false, 'create_folder' => false, 'folders' => true);
             /**The file manager*/
             include "file_manager.php";
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
             $this->setMessageVar($message, $message_type);
         }
     } else {
         if (defined('G_BRANCH_URL') && G_BRANCH_URL) {
             try {
                 $assets_path = $root_path = $this->moduleBaseDir . 'assets/' . G_BRANCH_URL;
             } catch (Exception $e) {
                 //do nothing here if the directory doesn't exist
             }
         } else {
             $assets_path = $root_path = $this->moduleBaseDir . 'assets/';
         }
         $files = array();
         if (!empty($_GET['folder'])) {
             $folder = urldecode($_GET['folder']);
             if (is_dir($assets_path . $folder)) {
                 $folder = new EfrontDirectory($assets_path . $folder);
                 if (strpos(realpath($folder['path']), $root_path) === false) {
                     throw new Exception("Invalid folder");
                 }
                 $parent_folder = dirname($folder['path']);
                 $url = urlencode(str_replace($root_path, '', $folder['path']));
                 $assets_path = $folder['path'];
                 $parent_url = $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', dirname($folder['path']) . '/'));
                 $parent_url or $parent_url = $this->moduleBaseUrl . 'assets/';
                 $files[] = array('text' => '.. (Up one level)', 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $parent_url);
             }
         }
         //pr($url);pr($parent_url);
         //
         $filesystem = new FileSystemTree($assets_path, true);
         foreach ($filesystem->tree as $key => $value) {
             if ($value instanceof EfrontDirectory) {
                 $files[] = array('text' => basename($key), 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', $value['path'] . '/')));
             }
         }
         foreach ($filesystem->tree as $key => $value) {
//.........这里部分代码省略.........
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:module_info_kiosk.class.php

示例5: EfrontFile

 if ($projectUser['professor_upload_filename']) {
     try {
         $projectFile = new EfrontFile($projectUser['professor_upload_filename']);
         $smarty->assign("T_PROFESSOR_FILE", $projectFile);
     } catch (EfrontFileException $e) {
         $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
         $message = _SOMEPROBLEMOCCURED . ': ' . $e->getMessage() . ' &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
         $message_type = 'failure';
     }
 }
 $form = new HTML_QuickForm("upload_project_form", "post", basename($_SERVER['PHP_SELF']) . '?ctg=projects&view_project=' . $_GET['view_project'], "", null, true);
 if (!$projectFile) {
     $file = $form->addElement('file', 'filename', _FILE);
     $maxFileSize = FileSystemTree::getUploadMaxSize();
     $form->addRule('filename', _THEFIELD . ' "' . _FILE . '" ' . _ISMANDATORY, 'required', null, 'client');
     $form->setMaxFileSize($maxFileSize * 1024);
     $form->addElement('submit', 'submit_upload_project', _SENDPROJECT, 'class = "flatButton"');
 }
 $smarty->assign("T_MAX_FILE_SIZE", $maxFileSize);
 if ($form->isSubmitted() && $form->validate() && !$currentProject->expired) {
     try {
         $projectDirectory = G_UPLOADPATH . $currentUser->user['login'] . '/projects';
         if (!is_dir($projectDirectory)) {
             EfrontDirectory::createDirectory($projectDirectory);
         }
         $projectDirectory = G_UPLOADPATH . $currentUser->user['login'] . '/projects/' . $currentProject->project['id'];
         if (!is_dir($projectDirectory)) {
             EfrontDirectory::createDirectory($projectDirectory);
         }
         $filesystem = new FileSystemTree($projectDirectory);
         $uploadedFile = $filesystem->uploadFile('filename', $projectDirectory);
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:projects.php

示例6: getUploadForm

    /**
     * Get an upload form
     *
     * This function is responsible for creating an "upload file"
     * form, as well as the equivalent HTML code.
     * <br/>Example:
     * <code>
     * $basedir    = G_LESSONSPATH.'test/';
     * $filesystem = new FileSystemTree($basedir);									//Set the base directory that the file manager displayes
     * $url        = 'administrator.php?ctg=file_manager';			//Set the url where file manager resides
     * $uploadForm         = new HTML_QuickForm("upload_file_form", "post", $url, "", "", true);
     * $uploadFormString   = $filesystem -> getUploadForm($uploadForm);
     * echo $uploadFormString;
     * </code>
     *
     * @param HTML_QuickForm $form The form to populate
     * @return string The HTML code of the form
     * @since 3.5.0
     * @access public
     */
    public function getUploadForm(&$form)
    {
        $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
        //Register this rule for checking user input with our function, eF_checkParameter
        $form->addElement('file', 'file_upload[0]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[1]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[2]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[3]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[4]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[5]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[6]', null, 'class = "inputText"');
        $form->addElement('text', 'url_upload', null, 'id = "url_upload" class = "inputText"');
        $form->addElement('hidden', 'upload_current_directory', null, 'id = "upload_current_directory" class = "inputText"');
        $form->addElement('submit', 'submit_upload_file', _UPLOAD, 'class = "flatButton" onclick = "$(\'uploading_image\').show()"');
        $form->setMaxFileSize($this->getUploadMaxSize() * 1024);
        //getUploadMaxSize returns size in KB
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
        $form->accept($renderer);
        $formArray = $renderer->toArray();
        $formString = '
	    			' . $formArray['javascript'] . '
	    			<form ' . $formArray['attributes'] . '>
	    			' . $formArray['hidden'] . '
	    			<table width = "100%">
		            	<tr><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][0]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][1]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][2]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][3]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][4]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][5]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][6]['html'] . '</td></tr>
		            	<tr><td></td>
		            		<td class = "elementCell">
		            			<img src = "images/16x16/add.png" alt = "' . _ADDFILE . '" title = "' . _ADDFILE . '" onclick = "addUploadBox(this)"/></td></tr>
		            	<tr><td></td>
		            		<td class = "infoCell"><span id="messageError" class = "severeWarning"></span></td></tr>
						<tr><td></td>
		            		<td class = "infoCell">' . _MAXIMUMUPLOADSIZE . ': ' . $this->getUploadMaxSize() . ' ' . _KB . '</td></tr>
		            	<tr><td class = "labelCell">' . _UPLOADFILEFROMURL . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['url_upload']['html'] . '</td></tr>
		            	<tr><td></td>
		            		<td class = "submitCell">
	            				' . $formArray['submit_upload_file']['html'] . '
	            			</td></tr>

	            	</table>
	            	</form>
	            	<img src = "images/others/progress_big.gif" id = "uploading_image" title = "' . _UPLOADING . '" alt = "' . _UPLOADING . '" style = "display:none;margin-left:auto;margin-right:auto;margin-top:30px;vertical-align:middle;"/>';
        return $formString;
    }
开发者ID:kaseya-university,项目名称:efront,代码行数:77,代码来源:filesystem.class.php

示例7: toHTMLQuickForm

    /**
     * Populate the test form
     *
     * This function is used to populate the test form and create the
     * test html code.
     * <br/>Example:
     * <code>
     * $test = new EfrontTest(1);                               //Instantiate test form
     * $form = new HTML_QuickForm("questionForm", "post", "", "", null, true);      //Create the test form
     * echo $test -> toHTMLQuickForm($form);                    //Populates the form and returns the equivalent HTML code
     * echo $test -> toHTMLQuickForm($form, 2);                 //Populates the form and returns the equivalent HTML code, but displays only question with id 2
     * $test -> setDone('jdoe');                                //Get the done test information for user 'jdoe';
     * echo $test -> toHTMLQuickForm($form, false, true);       //Populates the form and returns the equivalent HTML code, but the mode is set to display the done test
     * </code>
     *
     * @param HTML_QuickForm $form The form to populate
     * @param int $questionId If set, it displays only the designated question
     * @param boolean $done If set to true and the test has done information (previously acquired with setDone()), then it displays the done test
     * @param boolean $editHandles Whether to display correction handles, to update questions scores and feedback
     * @param boolean $nocache Whether to skip caching this time
     * @since 3.5.0
     * @access public
     */
    public function toHTMLQuickForm(&$form = false, $questionId = false, $done = false, $editHandles = false, $nocache = false, $isFeedback = false)
    {
        $storeCache = false;
        if (!$questionId && !$done && !$this->options['random_pool'] && !$this->options['shuffle_questions'] && !$this->options['shuffle_answers'] && !$nocache) {
            if ($testString = EfrontCache::getInstance()->getCache('test:' . $this->test['id'])) {
                return $testString;
            } else {
                $storeCache = true;
            }
        }
        $originalTestQuestions = $this->getQuestions();
        //Initialize questions information, it case it isn't
        if (!$form) {
            $form = new HTML_QuickForm("questionForm", "post", "", "", null, true);
            //Create a sample form
        }
        $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
        $allTestQuestions = $this->getQuestions(true);
        //$allTestQuestionsFilter = $allTestQuestions;
        // lines added for redo only wrong questions
        $allTestQuestionsFilter = array();
        $resultCompleted = EfrontCompletedTest::retrieveCompletedTest("completed_tests ct join completed_tests_blob ctb on ct.id=ctb.completed_tests_ID", "ctb.test", "archive=1 AND users_LOGIN='" . $_SESSION['s_login'] . "' AND tests_ID=" . $this->test['id'], "timestamp desc");
        if (!empty($resultCompleted)) {
            $recentlyCompleted = unserialize($resultCompleted[0]['test']);
            if ($recentlyCompleted->redoOnlyWrong == true && !$done) {
                foreach ($recentlyCompleted->questions as $key => $value) {
                    if ($value->score != 100 && isset($originalTestQuestions[$key])) {
                        // && added for the case professor deleted question from test after student clicked to redo only wrong
                        $value->userAnswer = false;
                        $allTestQuestionsFilter[$key] = $value;
                    }
                }
                $allTestQuestions = $allTestQuestionsFilter;
            }
        }
        // If we have a random pool of question then get a random sub-array of the questions
        if ($this->options['random_pool'] > 0 && $this->options['random_pool'] < sizeof($allTestQuestions)) {
            $rand_questions = array_rand($allTestQuestions, $this->options['random_pool']);
            $testQuestions = array();
            foreach ($rand_questions as $question) {
                $testQuestions[$question] = $allTestQuestions[$question];
            }
        } else {
            $testQuestions = $allTestQuestions;
        }
        $questionId && in_array($questionId, array_keys($testQuestions)) ? $testQuestions = $testQuestions[$questionId] : null;
        //If $questionId is specified, keep only this question
        $this->options['display_list'] ? $testString = '<style type = "text/css">span.orderedList{float:left;}</style>' : ($testString = '<style type = "text/css">span.orderedList{display:none;}</style>');
        $count = 1;
        if ($this->test['content_ID']) {
            //Get unit names and ids
            $content = new EfrontContentTree(key($this->getLesson()));
            foreach (new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($content->tree), RecursiveIteratorIterator::SELF_FIRST)) as $key => $value) {
                $units[$key] = $value['name'];
            }
        }
        $currentLesson = $this->getLesson(true);
        foreach ($testQuestions as $id => $question) {
            if ($done) {
                switch ($question->score) {
                    case '':
                    case 0:
                        $image = 'error_delete.png';
                        $alt = _INCORRECTQUESTION;
                        $title = _INCORRECTQUESTION;
                        break;
                    case '100':
                        $image = 'success.png';
                        $alt = _QUESTIONISCORRECT;
                        $title = _QUESTIONISCORRECT;
                        break;
                    default:
                        $image = 'semi_success.png';
                        $alt = _PARTIALLYCORRECTQUESTION;
                        $title = _PARTIALLYCORRECTQUESTION;
                        break;
                }
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:test.class.php


注:本文中的HTML_QuickForm::setMaxFileSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。