예제 #1
0
 public function insert_access_array($array, $groupID)
 {
     if (!empty($array)) {
         $publicValues = array();
         if (array_key_exists('public', $array)) {
             $publicValues = $array['public'];
         }
         $adminValues = array();
         if (array_key_exists('admin', $array)) {
             $adminValues = $array['admin'];
         }
         parent::delete_by('group_id', $groupID);
         $modulesArray = array_unique(array_merge($publicValues, $adminValues));
         $dataArray = array();
         foreach ($modulesArray as $moduleID) {
             $ruleArray = array();
             $ruleArray['module_id'] = $moduleID;
             $ruleArray['group_id'] = $groupID;
             if (in_array($moduleID, $publicValues)) {
                 $ruleArray['public_rule'] = 'allow';
             } else {
                 $ruleArray['public_rule'] = 'deny';
             }
             if (in_array($moduleID, $adminValues)) {
                 $ruleArray['admin_rule'] = 'allow';
             } else {
                 $ruleArray['admin_rule'] = 'deny';
             }
             $dataArray[] = $ruleArray;
         }
         $this->db->insert_batch($this->_table, $dataArray);
     }
 }
예제 #2
0
 public function delete_moderators($id)
 {
     $this->_table = 'forum_moderators';
     return parent::delete_by(array('forum' => $id));
 }