//reading data from the qx.php $data=require(__dir__. ' /.. /qx.php ');//read the fields in qx.php//qx.php under the Controller directory//The following is the test data /*$result =array (' name ' = ' affairsapproval ', ' desc ' = ' transaction approval ', ' value ' = ' 0 '), Array (' name ' = ' leaveapplyapproval ', ' desc ' = ' leave approval ', ' value ' = ' 0 ');*/ $newresult=Array(); /*foreach ($data as $key + $value) {/* $new =array (' key ' = = $key, ' value ' = = $value, ' Check ' = ' 0 '); $newresult =array_merge_recursive ($new, Array (' key ' = $key, ' value ' = = $value, ' check ' = ' 0 ')); } */ $i=0; $userid=$this->input->get (' userid '); $USERQX=$this->db->get_where (' QX ',Array(' userid ' =$userid)),Result_array (); if(Empty($USERQX[0])){ foreach($data as $key=$value) { $newarray[$i] =Array( ' Value ' =$value, ' key ' =$key, ' checked ' =false ); $i++; } }Else{ foreach($USERQX[0] as $key=$val){ if($key! = ' act ' &&$key! = ' id ' &&$key! = ' UserID '){ $newarray[$i] =Array( ' Value ' =$data[$key], ' key ' =$key, ' checked ' = ($val!=1)?false:true ); $i++; } } } $output->data=$newarray;
Privilege Profile:
$QX=Array();$QX[' Affairsapproval ']= ' Transaction approval ';$QX[' leaveapplyapproval '] = ' leave approval ';$QX[' customprocess ']= ' custom process ';$QX[' Addcustomprocess ']= ' new custom process '; $QX[' Systemadmin ']= ' system administrator '; $QX[' Systemsync ']= ' System Sync data '; $QX[' systemmanagement ']= ' System Management '; $QX[' Checkwork ']= ' administrative attendance '; $QX[' Requestapproval ']= ' Administrative application form '; $QX[' Notice ']= ' company notice ';$QX[' Houtai ']= ' backstage ';return $QX;
Assignment of permission system in PHP and reading of permission profile