Passed
Push — master ( eb013e...37f747 )
by Jonathan
04:35
created

AdminConfigView::renderContent()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 49
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 33
nc 3
nop 0
dl 0
loc 49
rs 9.392
c 0
b 0
f 0
1
<?php
2
/**
3
 * webtrees-lib: MyArtJaub library for webtrees
4
 *
5
 * @package MyArtJaub\Webtrees
6
 * @subpackage Hooks
7
 * @author Jonathan Jaubart <[email protected]>
8
 * @copyright Copyright (c) 2011-2016, Jonathan Jaubart
9
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
10
 */
11
namespace MyArtJaub\Webtrees\Module\Hooks\Views;
12
13
use \MyArtJaub\Webtrees\Mvc\View\AbstractView;
14
use Fisharebest\Webtrees\I18N;
15
use Fisharebest\Webtrees\Filter;
16
use Fisharebest\Webtrees\Functions\FunctionsEdit;
17
use Fisharebest\Webtrees\Module;
18
19
/**
20
 * View for Lineage@index
21
 */
22
class AdminConfigView extends AbstractView {
23
        
24
	/**
25
	 * {@inhericDoc}
26
	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
27
	 */
28
    protected function renderContent() {
29
        
30
        $table_id = $this->data->get('table_id');
31
        
32
        ?>        
33
        <ol class="breadcrumb small">
34
        	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
35
			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
36
			<li class="active"><?php echo $this->data->get('title'); ?></li>
37
		</ol>
38
		
39
		<div align="center">
40
			<div id="tabs">
41
				<form method="post" action="#">
42
					<?php echo Filter::getCsrf(); ?>
43
					<input type="hidden" name="action" value="update">
44
					<table id="<?php echo $table_id; ?>" class="table table-bordered table-condensed table-hover table-site-changes" >
45
						<thead>
46
							<tr>
47
								<th><?php echo I18N::translate('Enabled'); ?></th>
48
								<th>ENABLED_SORT</th>
49
								<th><?php echo I18N::translate('Hook Function'); ?></th>
50
								<th><?php echo I18N::translate('Hook Context'); ?></th>
51
								<th><?php echo I18N::translate('Module Name'); ?></th>
52
								<th><?php echo I18N::translate('Priority (1 is high)'); ?></th>
53
								<th>PRIORITY_SORT</th>
54
							</tr>
55
						</thead>
56
						<tbody> 
57
							<?php  
58
							$hooks = $this->data->get('hook_list');
59
							foreach ($hooks as $hook) { 
60
							?>
61
							<tr>
62
								<td>
63
									<input type="hidden" name="hook-<?php echo $hook->id;?>" value="yes" >
64
									<?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status)=='enabled'); ?>
0 ignored issues
show
Bug introduced by
$hook->status == 'enabled' of type boolean is incompatible with the type integer expected by parameter $is_checked of Fisharebest\Webtrees\Fun...dit::twoStateCheckbox(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

64
									<?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), /** @scrutinizer ignore-type */ ($hook->status)=='enabled'); ?>
Loading history...
65
								</td>
66
								<td><?php echo (($hook->status)=='enabled'); ?></td>
67
								<td><?php echo $hook->hook; ?></td>
68
								<td><?php echo $hook->context; ?></td>
69
								<td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td>
70
								<td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td>
71
								<td><?php echo $hook->priority; ?></td>
72
							</tr>
73
							<?php  } ?>
74
						</tbody>
75
					</table>
76
					<input type="submit" class="btn btn-primary save" value="<?php echo I18N::translate('save'); ?>">
77
				</form>
78
			</div>
79
		</div>	
80
		
81
		<?php        
82
    }
83
    
84
}
85