Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions HideElementsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ public function hookInitialize()
}
}

public function hookConfigForm()
/**
* Shows plugin configuration page.
*/
public function hookConfigForm($args)
{
$view = $args['view'];

$settings = $this->_settings;

$table = get_db()->getTable('Element');
Expand All @@ -76,7 +81,13 @@ public function hookConfigForm()
->order('elements.order');

$elements = $table->fetchObjects($select);
include 'config-form.php';
echo $view->partial(
'plugins/hide-elements-config-form.php',
array(
'view' => $view,
'settings' => $settings,
'elements' => $elements,
));
}

public function hookConfig($args)
Expand Down
41 changes: 23 additions & 18 deletions config-form.php → ...min/plugins/hide-elements-config-form.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
<?php $view = get_view(); ?>
<style type="text/css">
.hide-boxes {
text-align: center;
}
.input-block ul {
list-style: none outside none;
}
</style>
<div class="field">
<div class="two columns alpha">
<label for="collection_tree_parent_collection_id"><?php echo __('Override visibility restrictions by role'); ?></label>
<label for="override-restrictions"><?php echo __('Override visibility restrictions by role'); ?></label>
</div>
<div class="inputs five columns omega">
<?php echo $view->formCheckbox('override[]', 'super', array(
'disableHidden' => true,
'checked' => in_array('super', $settings['override']),
)); ?> <?php echo __('Super'); ?><br>
<?php echo $view->formCheckbox('override[]', 'admin', array(
'disableHidden' => true,
'checked' => in_array('admin', $settings['override']),
)); ?> <?php echo __('Admin'); ?><br>
<?php echo $view->formCheckbox('override[]', 'researcher', array(
'disableHidden' => true,
'checked' => in_array('researcher', $settings['override']),
)); ?> <?php echo __('Researcher'); ?><br>
<?php echo $view->formCheckbox('override[]', 'contributor', array(
'disableHidden' => true,
'checked' => in_array('contributor', $settings['override']),
)); ?> <?php echo __('Contributor'); ?>
<div class="input-block">
<ul>
<?php
$userRoles = get_user_roles();
foreach ($userRoles as $role => $label) {
echo '<li>';
echo $view->formCheckbox('override[]', $role, array(
'disableHidden' => true,
'checked' => in_array($role, $settings['override']),
));
echo ' ' . $label;
echo '</li>';
}
?>
</ul>
</div>
<p class="explanation">
<?php echo __("Note: Full text indexation can't be overridden because the same field is used for all users."); ?>
</p>
</div>
</div>
<table id="hide-elements-table">
Expand Down