Example #1
0
" />
		<input type="hidden" name="formhash" value="<?php 
    echo $formhash;
    ?>
" />
		<li>章节名称:</li>
		<li><input type="text" name="cs_name" value="<?php 
    echo $cs_edit['cs_name'];
    ?>
" style="width:200px" maxlength="50" /></li>
		<li>上级章节:</li>
		<li>
			<select name="pid" id="pid">
				<option value="0">- 根章节 -</option>
				<?php 
    echo get_chapter_section_option($course_id, 0, $cs_edit['parent_id']);
    ?>
			</select>
		</li>
		<li>描述:</li>
		<li><textarea name="description"><?php 
    echo $cs_edit['description'];
    ?>
</textarea></li>
		<li>&nbsp;</li>
		<li><input type="submit" class="btn" value="<?php 
    echo __('btn_submit');
    ?>
" /></li>
		</form>
	</div>
Example #2
0
function get_chapter_section_option($courseId, $pid = 0, $selID = 0, $lv = 0)
{
    global $db, $tpf;
    $q = $db->query("select * from {$tpf}course_chapter_section where course_id = {$courseId}");
    while ($rs = $db->fetch_array($q)) {
        $data[] = $rs;
    }
    $db->free($q);
    unset($rs);
    if (count($data)) {
        $html = '';
        foreach ($data as $v) {
            if ($v['parent_id'] == $pid) {
                $html .= '<option value="' . $v[csid] . '"';
                $html .= $selID ? ifselected($selID, $v[csid]) : '';
                $html .= '>' . str_repeat('&nbsp;', $lv * 2) . $v[cs_name] . '</option>' . LF;
                $lv++;
                $html .= get_chapter_section_option($courseId, $v['csid'], $selID, $lv);
                $lv--;
            }
        }
        return $html;
    } else {
        return '';
    }
}