예제 #1
0
    static function getSqlForRights()
    {
        if (empty(self::$where)) {
            $state = system::$isAdmin && reg::getKey(self::getPrefix() . '/no_view_no_edit') ? '= 2' : '> 0';
            $groups = '';
            $m = user::getGroups();
            while (list($key, $val) = each($m)) {
                $groups .= ' or r_group_id = "' . $key . '"';
            }
            self::$where = ' and r_obj_id = o_id and r_state ' . $state . ' and
	        		  (r_group_id is NULL or r_group_id = "' . user::get('id') . '"' . $groups . ') GROUP BY o_id';
        }
        return self::$where;
    }