remove plain html and use methodes from theme

This commit is contained in:
Uwe Steinmann 2022-09-21 12:33:41 +02:00
parent ec7a8a5bef
commit dbb9e09070

View File

@ -85,13 +85,8 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
<?php
if($workflowmode != 'traditional_only_approval') {
?>
<?php $this->contentSubHeading(getMLText("update_reviewers"));?>
<?php $this->contentContainerStart(); ?>
<div class="cbSelectTitle"><?php printMLText("individuals")?>:</div>
<select class="chzn-select span9" name="indReviewers[]" multiple="multiple" data-placeholder="<?php printMLText('select_ind_reviewers'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
<?php
$this->contentSubHeading(getMLText("update_reviewers"));
$this->contentContainerStart();
if($user->getID() != $owner->getID()) {
$res=$owner->getMandatoryReviewers();
@ -99,37 +94,34 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
$res = array();
} else
$res=$user->getMandatoryReviewers();
$options = [];
foreach ($docAccess["users"] as $usr) {
$mandatory=false;
foreach ($res as $r) if ($r['reviewerUserID']==$usr->getID()) $mandatory=true;
if ($mandatory){
print "<option value=\"".$usr->getID()."\" disabled=\"disabled\">". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())." &lt;".$usr->getEmail()."&gt;</option>";
// print "<input id='revInd".$usr->getID()."' type='hidden' name='indReviewers[]' value='". $usr->getID() ."'>";
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_reviewer'))));
} elseif (isset($reviewIndex["i"][$usr->getID()])) {
switch ($reviewIndex["i"][$usr->getID()]["status"]) {
case 0:
print "<option value='". $usr->getID() ."' selected='selected'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
case S_LOG_WAITING:
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), true);
break;
case -2:
print "<option value='". $usr->getID() ."'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
case S_LOG_USER_REMOVED:
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('data-subtitle', getMLText('user_previously_removed_from_reviewers'))));
break;
default:
print "<option value='". $usr->getID() ."' disabled='disabled'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled')));
break;
}
} else {
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
print "<option value='". $usr->getID() ."'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()));
}
}
?>
</select>
<?php
/* List all mandatory reviewers */
$extraparams = [];
if($res) {
$tmp = array();
foreach ($res as $r) {
@ -139,46 +131,50 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
}
}
if($tmp) {
echo '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> ';
echo implode(', ', $tmp);
echo "</div>\n";
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewers').':</span> '.implode(', ', $tmp)."</div>\n"];
}
}
?>
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
<select class="chzn-select span9" name="grpReviewers[]" multiple="multiple" data-placeholder="<?php printMLText('select_grp_reviewers'); ?>" data-no_results_text="<?php printMLText('unknown_group'); ?>">
<?php
foreach ($docAccess["groups"] as $group) {
$this->formField(
getMLText("individuals"),
array(
'element'=>'select',
'id'=>'indReviewers',
'name'=>'indReviewers[]',
'class'=>'chzn-select',
'multiple'=>true,
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_ind_reviewers')), array('data-no_results_text', getMLText('unknown_user'))),
'options'=>$options,
),
$extraparams
);
$options = [];
foreach ($docAccess["groups"] as $group) {
$grpusers = $group->getUsers();
$mandatory=false;
foreach ($res as $r) if ($r['reviewerGroupID']==$group->getID()) $mandatory=true;
if ($mandatory || !$group->getUsers()){
print "<option value=\"".$group->getID()."\" disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
// print "<input id='revGrp".$group->getID()."' type='hidden' name='grpReviewers[]' value='". $group->getID() ."' />";
if ($mandatory) {
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_reviewer'))));
} elseif (isset($reviewIndex["g"][$group->getID()])) {
switch ($reviewIndex["g"][$group->getID()]["status"]) {
case 0:
print "<option value='". $group->getID() ."' selected='selected'>".htmlspecialchars($group->getName())."</option>";
case S_LOG_WAITING:
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), true);
break;
case -2:
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
case S_LOG_USER_REMOVED:
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('data-subtitle', getMLText('group_previously_removed_from_reviewers'))));
break;
default:
print "<option id='revGrp".$group->getID()."' type='checkbox' name='grpReviewers[]' value='". $group->getID() ."' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled')));
break;
}
} else {
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'));
}
}
?>
</select>
<?php
/* List all mandatory groups of reviewers */
$extraparams = [];
if($res) {
$tmp = array();
foreach ($res as $r) {
@ -188,21 +184,27 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
}
}
if($tmp) {
echo '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> ';
echo implode(', ', $tmp);
echo "</div>\n";
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n"];
}
}
$this->formField(
getMLText("groups"),
array(
'element'=>'select',
'id'=>'grpReviewers',
'name'=>'grpReviewers[]',
'class'=>'chzn-select',
'multiple'=>true,
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_grp_reviewers')), array('data-no_results_text', getMLText('unknown_group'))),
'options'=>$options,
),
$extraparams
);
}
?>
<?php $this->contentContainerEnd(); ?>
<?php $this->contentSubHeading(getMLText("update_approvers"));?>
<?php $this->contentContainerStart(); ?>
<div class="cbSelectTitle cbSelectMargin"><?php printMLText("individuals")?>:</div>
<select class="chzn-select span9" name="indApprovers[]" multiple="multiple" data-placeholder="<?php printMLText('select_ind_approvers'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
<?php
$this->contentContainerEnd();
$this->contentSubHeading(getMLText("update_approvers"));
$this->contentContainerStart();
if($user->getID() != $owner->getID()) {
$res=$owner->getMandatoryApprovers();
@ -210,38 +212,37 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
$res = array();
} else
$res=$user->getMandatoryApprovers();
$options = [];
foreach ($docAccess["users"] as $usr) {
$mandatory=false;
foreach ($res as $r) if ($r['approverUserID']==$usr->getID()) $mandatory=true;
if ($mandatory){
print "<option value='". $usr->getID() ."' disabled='disabled'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())." &lt;".$usr->getEmail()."&gt;</option>";
// print "<input id='appInd".$usr->getID()."' type='hidden' name='indApprovers[]' value='". $usr->getID() ."'>";
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('user_is_mandatory_approver'))));
} elseif (isset($approvalIndex["i"][$usr->getID()])) {
switch ($approvalIndex["i"][$usr->getID()]["status"]) {
case 0:
print "<option value='". $usr->getID() ."' selected='selected'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
case S_LOG_WAITING:
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), true);
break;
case -2:
print "<option value='". $usr->getID() ."'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
case S_LOG_USER_REMOVED:
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('data-subtitle', getMLText('user_previously_removed_from_approvers'))));
break;
default:
print "<option value='". $usr->getID() ."' disabled='disabled'>".htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()), false, array(array('disabled', 'disabled')));
break;
}
}
else {
if (!$enableselfrevapp && $usr->getID()==$user->getID()) continue;
print "<option value='". $usr->getID() ."'>". htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName())."</option>";
$options[] = array($usr->getID(), htmlspecialchars($usr->getLogin() . " - ". $usr->getFullName()));
}
}
?>
</select>
<?php
/* List all mandatory approvers */
$extraparams = [];
if($res) {
$tmp = array();
foreach ($res as $r) {
@ -251,48 +252,52 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
}
}
if($tmp) {
echo '<div class="mandatories"><span>'.getMLText('mandatory_approvers').':</span> ';
echo implode(', ', $tmp);
echo "</div>\n";
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_approvers').':</span> '.implode(', ', $tmp)."</div>\n"];
}
}
?>
<div class="cbSelectTitle"><?php printMLText("groups")?>:</div>
$this->formField(
getMLText("individuals"),
array(
'element'=>'select',
'id'=>'indApprovers',
'name'=>'indApprovers[]',
'class'=>'chzn-select',
'multiple'=>true,
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_ind_approvers')), array('data-no_results_text', getMLText('unknown_user'))),
'options'=>$options,
),
$extraparams
);
<select class="chzn-select span9" name="grpApprovers[]" multiple="multiple" data-placeholder="<?php printMLText('select_grp_approvers'); ?>" data-no_results_text="<?php printMLText('unknown_group'); ?>">
<?php
$options = [];
foreach ($docAccess["groups"] as $group) {
$grpusers = $group->getUsers();
$mandatory=false;
foreach ($res as $r) if ($r['approverGroupID']==$group->getID()) $mandatory=true;
if ($mandatory || !$group->getUsers()){
print "<option type='checkbox' checked='checked' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
// print "<input id='appGrp".$group->getID()."' type='hidden' name='grpApprovers[]' value='". $group->getID() ."'>";
if ($mandatory) {
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled'), array('data-subtitle', getMLText('group_is_mandatory_approver'))));
} elseif (isset($approvalIndex["g"][$group->getID()])) {
switch ($approvalIndex["g"][$group->getID()]["status"]) {
case 0:
print "<option value='". $group->getID() ."' selected='selected'>".htmlspecialchars($group->getName())."</option>";
case S_LOG_WAITING:
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), true);
break;
case -2:
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
case S_LOG_USER_REMOVED:
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('data-subtitle', getMLText('group_previously_removed_from_approvers'))));
break;
default:
print "<option value='". $group->getID() ."' disabled='disabled'>".htmlspecialchars($group->getName())."</option>";
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'), false, array(array('disabled', 'disabled')));
break;
}
}
else {
print "<option value='". $group->getID() ."'>".htmlspecialchars($group->getName())."</option>";
$options[] = array($group->getID(), htmlspecialchars($group->getName().' ('.count($grpusers).')'));
}
}
?>
</select>
<?php
/* List all mandatory groups of approvers */
$extraparams = [];
if($res) {
$tmp = array();
foreach ($res as $r) {
@ -302,11 +307,22 @@ class SeedDMS_View_SetReviewersApprovers extends SeedDMS_Theme_Style {
}
}
if($tmp) {
echo '<div class="mandatories"><span>'.getMLText('mandatory_approvergroups').':</span> ';
echo implode(', ', $tmp);
echo "</div>\n";
$extraparams['field_wrap'] = ['', '<div class="mandatories"><span>'.getMLText('mandatory_reviewergroups').':</span> '.implode(', ', $tmp)."</div>\n"];
}
}
$this->formField(
getMLText("groups"),
array(
'element'=>'select',
'id'=>'grpApprovers',
'name'=>'grpApprovers[]',
'class'=>'chzn-select',
'multiple'=>true,
'attributes'=>array(array('data-allow-clear', 'true'), array('data-placeholder', getMLText('select_grp_approvers')), array('data-no_results_text', getMLText('unknown_group'))),
'options'=>$options,
),
$extraparams
);
$this->contentContainerEnd();
?>
<p>