Игорь_VasinskyМассив с которым нужно работать...
$reportArr = array(
1 => array(
USER_TYPE_OFFICE => array(
'class' => array( 'no' => array( 9, 10 ), ),
)
),
3 => array(
USER_TYPE_CLASSHEAD | USER_TYPE_SYSADMIN | USER_TYPE_PRINCIPAL |
'class' => array( 'no' => array( ), ),
),
USER_TYPE_TEACHER => array(
'group' => array( 'classNo' => false, ),
),
),
);
У меня на выходе должно быть что-то типо :
С нужными ключами
return array(
1 => array(
USER_TYPE_OFFICE => array(
'class' => array( 'no' => array( 9, 10 ), ),
)
),
3 => array(
USER_TYPE_CLASSHEAD | USER_TYPE_SYSADMIN | USER_TYPE_PRINCIPAL |
'class' => array( 'no' => array( ), ),
),
USER_TYPE_TEACHER => array(
'group' => array( 'classNo' => false, ),
),
),
);
$rules = array(
'report1' => array('1','3','6','7','8','9','10','11','13','14','80','81','82','12','15'
,'4','91','16','17','18','83','84','85'
,'86','87','88','89','90','92','93','95','96','97','98','99','100'),
'report2' => array('6','80','81'),
'report3' => array('1','3','103','7','8','9','10','11','13','14','80'
,'81','82','12','15','4','16','17','18','83','85','17','86','88','92'
,'86','88','92','93','95','96','97','98','99','100','101','102'
),
);
if($markSystem === 1 && $schoolType !== 3 && $this->SchoolId != 1711) {
$page = 'report1';
}
if($markSystem === 3 || $this->SchoolId == 1711) {
$page = 'report2';
}
if($schoolType === 3) {
$page = 'report3';
}
switch($page){
case 'report1' : $rulesKeys = $rules['report1']; break;
case 'report2' : $rulesKeys = $rules['report2']; break;
case 'report3' : $rulesKeys = $rules['report3']; break;
default : $rulesKeys = $rules['report1']; break;
}
foreach($rules as $k=>$rule){
if(in_array($rule, $rulesKeys)){
dump_source(implode(',', $rule));
}
}