mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
"MDL-20125, added configurable setting to section_links block, credit…
…s to Jason Hardin"
- Loading branch information
Dongsheng Cai
committed
Dec 4, 2009
1 parent
44d34e8
commit 0cd77e5
Showing
4 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
$numberofsections = array(); | ||
for ($i = 1; $i < 53; $i++){ | ||
$numberofsections[$i] = $i; | ||
} | ||
|
||
$increments = array(); | ||
|
||
for ($i = 1; $i < 11; $i++){ | ||
$increments[$i] = $i; | ||
} | ||
|
||
if(isset($this->config)){ | ||
$config = $this->config; | ||
} else{ | ||
$config = get_config('blocks/section_links'); | ||
} | ||
|
||
$selected = array(); | ||
if (!empty($config->numsections1)) { | ||
if (!empty($config->incby1)) { | ||
$config->incby1 = 2; | ||
} | ||
$selected[1] = array($config->numsections1, $config->incby1); | ||
} else { | ||
$selected[1] = array(22, 2); | ||
} | ||
|
||
if (!empty($config->numsections2)) { | ||
if (!empty($config->incby1)) { | ||
$config->incby1 = 5; | ||
} | ||
$selected[2] = array($config->numsections2, $config->incby2); | ||
} else { | ||
$selected[2] = array(40, 5); | ||
} | ||
|
||
?> | ||
<table cellpadding="9" cellspacing="0"> | ||
<?php | ||
for($i = 1; $i < 3; $i++){ | ||
?> | ||
<tr valign="top"> | ||
<td align="right"> | ||
<?php print_string('numsections'.$i, 'block_section_links'); ?>: | ||
</td> | ||
<td> | ||
<?php choose_from_menu($numberofsections, 'numsections'.$i, $selected[$i][0]); ?> | ||
</td> | ||
<td> | ||
<?php print_string('numsectionsdesc'.$i, 'block_section_links'); ?> | ||
</td> | ||
</tr> | ||
<tr valign="top"> | ||
<td align="right"> | ||
<?php print_string('incby'.$i, 'block_section_links'); ?>: | ||
</td> | ||
<td> | ||
<?php choose_from_menu($increments, 'incby'.$i, $selected[$i][1]); ?> | ||
</td> | ||
<td> | ||
<?php print_string('incbydesc'.$i, 'block_section_links'); ?> | ||
</td> | ||
</tr> | ||
<?php } | ||
?> | ||
<tr> | ||
<td colspan="3" align="center"> | ||
<input type="hidden" name="sesskey" value="<?php echo sesskey();?>"> | ||
<input type="submit" value="<?php print_string('savechanges') ?>" /> | ||
</td> | ||
</tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
$configs = array(); | ||
|
||
$numberofsections = array(); | ||
|
||
for ($i = 1; $i < 53; $i++){ | ||
$numberofsections[$i] = $i; | ||
} | ||
$increments = array(); | ||
|
||
for ($i = 1; $i < 11; $i++){ | ||
$increments[$i] = $i; | ||
} | ||
|
||
$selected = array(1 => array(22,2), | ||
2 => array(40,5)); | ||
|
||
for($i = 1; $i < 3; $i++){ | ||
$configs[] = new admin_setting_configselect('numsections'.$i, get_string('numsections'.$i, 'block_section_links'), | ||
get_string('numsectionsdesc'.$i, 'block_section_links'), | ||
$selected[$i][0], $numberofsections); | ||
|
||
$configs[] = new admin_setting_configselect('incby'.$i, get_string('incby'.$i, 'block_section_links'), | ||
get_string('incbydesc'.$i, 'block_section_links'), | ||
$selected[$i][1], $increments); | ||
} | ||
|
||
foreach ($configs as $config) { | ||
$config->plugin = 'blocks/section_links'; | ||
$settings->add($config); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters